# HG changeset patch # User michael # Date 1358959439 0 # Node ID 68db224c2275f70821209cfc0bd059f819142271 # Parent b02e9dea3240466f4c150a10a99e9d1b3d4e401d libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg. Signed-off-by: Michael Niedermayer diff -r b02e9dea3240 -r 68db224c2275 libmpcodecs/vf_fspp.c --- a/libmpcodecs/vf_fspp.c Wed Jan 23 16:04:33 2013 +0000 +++ b/libmpcodecs/vf_fspp.c Wed Jan 23 16:43:59 2013 +0000 @@ -165,10 +165,10 @@ ((short*)p->threshold_mtx)[a]=q * ((short*)p->threshold_mtx_noq)[a];//ints faster in C } -static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt); -static void row_idct_c(DCTELEM* workspace, +static void column_fidct_c(int16_t* thr_adr, int16_t *data, int16_t *output, int cnt); +static void row_idct_c(int16_t* workspace, int16_t* output_adr, int output_stride, int cnt); -static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt); +static void row_fdct_c(int16_t *data, const uint8_t *pixels, int line_size, int cnt); //this is rather ugly, but there is no need for function pointers #define store_slice_s store_slice_c @@ -394,10 +394,10 @@ ); } -static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt); -static void row_idct_mmx(DCTELEM* workspace, +static void column_fidct_mmx(int16_t* thr_adr, int16_t *data, int16_t *output, int cnt); +static void row_idct_mmx(int16_t* workspace, int16_t* output_adr, int output_stride, int cnt); -static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt); +static void row_fdct_mmx(int16_t *data, const uint8_t *pixels, int line_size, int cnt); #define store_slice_s store_slice_mmx #define store_slice2_s store_slice2_mmx @@ -417,8 +417,8 @@ const int step=6-p->log2_count; const int qps= 3 + is_luma; int32_t __attribute__((aligned(32))) block_align[4*8*BLOCKSZ+ 4*8*BLOCKSZ]; - DCTELEM *block= (DCTELEM *)block_align; - DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ); + int16_t *block= (int16_t *)block_align; + int16_t *block3=(int16_t *)(block_align+4*8*BLOCKSZ); memset(block3, 0, 4*8*BLOCKSZ); @@ -461,8 +461,8 @@ column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+x*8, block3+x*8, 8); //yes, this is a HOTSPOT } row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, 2*(BLOCKSZ-1)); - memmove(block, block+(BLOCKSZ-1)*64, 8*8*sizeof(DCTELEM)); //cycling - memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(DCTELEM)); + memmove(block, block+(BLOCKSZ-1)*64, 8*8*sizeof(int16_t)); //cycling + memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(int16_t)); } // es=width+8-x0; // 8, ... @@ -695,7 +695,7 @@ //#define MANGLE(a) #a -//typedef int16_t DCTELEM; //! only int16_t +//typedef int16_t int16_t; //! only int16_t #define DCTSIZE 8 #define DCTSIZE_S "8" @@ -746,15 +746,15 @@ #if !HAVE_MMX -static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) +static void column_fidct_c(int16_t* thr_adr, int16_t *data, int16_t *output, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; int_simd16_t z1,z2,z3,z4,z5, z10, z11, z12, z13; int_simd16_t d0, d1, d2, d3, d4, d5, d6, d7; - DCTELEM* dataptr; - DCTELEM* wsptr; + int16_t* dataptr; + int16_t* wsptr; int16_t *threshold; int ctr; @@ -871,7 +871,7 @@ #else /* HAVE_MMX */ -static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt) +static void column_fidct_mmx(int16_t* thr_adr, int16_t *data, int16_t *output, int cnt) { uint64_t __attribute__((aligned(8))) temps[4]; __asm__ volatile( @@ -1606,14 +1606,14 @@ #if !HAVE_MMX -static void row_idct_c(DCTELEM* workspace, +static void row_idct_c(int16_t* workspace, int16_t* output_adr, int output_stride, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; int_simd16_t z5, z10, z11, z12, z13; int16_t* outptr; - DCTELEM* wsptr; + int16_t* wsptr; cnt*=4; wsptr = workspace; @@ -1671,7 +1671,7 @@ #else /* HAVE_MMX */ -static void row_idct_mmx (DCTELEM* workspace, +static void row_idct_mmx (int16_t* workspace, int16_t* output_adr, int output_stride, int cnt) { uint64_t __attribute__((aligned(8))) temps[4]; @@ -1875,12 +1875,12 @@ #if !HAVE_MMX -static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) +static void row_fdct_c(int16_t *data, const uint8_t *pixels, int line_size, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; int_simd16_t z1, z2, z3, z4, z5, z11, z13; - DCTELEM *dataptr; + int16_t *dataptr; cnt*=4; // Pass 1: process rows. @@ -1938,7 +1938,7 @@ #else /* HAVE_MMX */ -static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt) +static void row_fdct_mmx(int16_t *data, const uint8_t *pixels, int line_size, int cnt) { uint64_t __attribute__((aligned(8))) temps[4]; __asm__ volatile( diff -r b02e9dea3240 -r 68db224c2275 libmpcodecs/vf_pp7.c --- a/libmpcodecs/vf_pp7.c Wed Jan 23 16:04:33 2013 +0000 +++ b/libmpcodecs/vf_pp7.c Wed Jan 23 16:43:59 2013 +0000 @@ -44,7 +44,7 @@ #define XMIN(a,b) ((a) < (b) ? (a) : (b)) #define XMAX(a,b) ((a) > (b) ? (a) : (b)) -typedef short DCTELEM; +typedef short int16_t; //===========================================================================// static const uint8_t __attribute__((aligned(8))) dither[8][8]={ @@ -66,7 +66,7 @@ uint8_t *src; }; #if 0 -static inline void dct7_c(DCTELEM *dst, int s0, int s1, int s2, int s3, int step){ +static inline void dct7_c(int16_t *dst, int s0, int s1, int s2, int s3, int step){ int s, d; int dst2[64]; //#define S0 (1024/0.37796447300922719759) @@ -113,7 +113,7 @@ } #endif -static inline void dctA_c(DCTELEM *dst, uint8_t *src, int stride){ +static inline void dctA_c(int16_t *dst, uint8_t *src, int stride){ int i; for(i=0; i<4; i++){ @@ -135,7 +135,7 @@ } } -static void dctB_c(DCTELEM *dst, DCTELEM *src){ +static void dctB_c(int16_t *dst, int16_t *src){ int i; for(i=0; i<4; i++){ @@ -158,7 +158,7 @@ } #if HAVE_MMX -static void dctB_mmx(DCTELEM *dst, DCTELEM *src){ +static void dctB_mmx(int16_t *dst, int16_t *src){ __asm__ volatile ( "movq (%0), %%mm0 \n\t" "movq 1*4*2(%0), %%mm1 \n\t" @@ -191,7 +191,7 @@ } #endif -static void (*dctB)(DCTELEM *dst, DCTELEM *src)= dctB_c; +static void (*dctB)(int16_t *dst, int16_t *src)= dctB_c; #define N0 4 #define N1 5 @@ -228,7 +228,7 @@ } } -static int hardthresh_c(DCTELEM *src, int qp){ +static int hardthresh_c(int16_t *src, int qp){ int i; int a; @@ -244,7 +244,7 @@ return (a + (1<<11))>>12; } -static int mediumthresh_c(DCTELEM *src, int qp){ +static int mediumthresh_c(int16_t *src, int qp){ int i; int a; @@ -265,7 +265,7 @@ return (a + (1<<11))>>12; } -static int softthresh_c(DCTELEM *src, int qp){ +static int softthresh_c(int16_t *src, int qp){ int i; int a; @@ -282,14 +282,14 @@ return (a + (1<<11))>>12; } -static int (*requantize)(DCTELEM *src, int qp)= hardthresh_c; +static int (*requantize)(int16_t *src, int qp)= hardthresh_c; static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ int x, y; const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); uint8_t *p_src= p->src + 8*stride; - DCTELEM *block= (DCTELEM *)p->src; - DCTELEM *temp= (DCTELEM *)(p->src + 32); + int16_t *block= (int16_t *)p->src; + int16_t *temp= (int16_t *)(p->src + 32); if (!src || !dst) return; // HACK avoid crash for Y8 colourspace for(y=0; y>3; for(i=1; i<64; i++){ @@ -126,7 +126,7 @@ } } -static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ +static void softthresh_c(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ int i; int bias= 0; //FIXME unsigned int threshold1, threshold2; @@ -134,7 +134,7 @@ threshold1= qp*((1<<4) - bias) - 1; threshold2= (threshold1<<1); - memset(dst, 0, 64*sizeof(DCTELEM)); + memset(dst, 0, 64*sizeof(int16_t)); dst[0]= (src[0] + 4)>>3; for(i=1; i<64; i++){ @@ -150,7 +150,7 @@ } #if HAVE_MMX -static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ +static void hardthresh_mmx(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ int bias= 0; //FIXME unsigned int threshold1; @@ -218,7 +218,7 @@ dst[0]= (src[0] + 4)>>3; } -static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ +static void softthresh_mmx(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){ int bias= 0; //FIXME unsigned int threshold1; @@ -295,7 +295,7 @@ } #endif -static inline void add_block(int16_t *dst, int stride, DCTELEM block[64]){ +static inline void add_block(int16_t *dst, int stride, int16_t block[64]){ int y; for(y=0; y<8; y++){ @@ -373,15 +373,15 @@ static void (*store_slice)(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)= store_slice_c; -static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= hardthresh_c; +static void (*requantize)(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation)= hardthresh_c; static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ int x, y, i; const int count= 1<log2_count; const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); uint64_t __attribute__((aligned(16))) block_align[32]; - DCTELEM *block = (DCTELEM *)block_align; - DCTELEM *block2= (DCTELEM *)(block_align+16); + int16_t *block = (int16_t *)block_align; + int16_t *block2= (int16_t *)(block_align+16); if (!src || !dst) return; // HACK avoid crash for Y8 colourspace for(y=0; ymjpeg_ctx; @@ -267,7 +267,7 @@ * The max and min level, which are clipped to, are stored in * s->min_qcoeff and s->max_qcoeff respectively. */ -static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, +static inline void clip_coeffs(MpegEncContext *s, int16_t *block, int last_index) { int i; const int maxlevel= s->max_qcoeff; diff -r b02e9dea3240 -r 68db224c2275 libvo/jpeg_enc.c --- a/libvo/jpeg_enc.c Wed Jan 23 16:04:33 2013 +0000 +++ b/libvo/jpeg_enc.c Wed Jan 23 16:43:59 2013 +0000 @@ -137,7 +137,7 @@ } } -static void encode_block(MpegEncContext *s, DCTELEM *block, int n) +static void encode_block(MpegEncContext *s, int16_t *block, int n) { int mant, nbits, code, i, j; int component, dc, run, last_index, val; @@ -200,7 +200,7 @@ put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]); } -static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index) +static inline void clip_coeffs(MpegEncContext *s, int16_t *block, int last_index) { int i; const int maxlevel= s->max_qcoeff;