changeset 35743:68db224c2275

libmpcodec&libvo: avoid use of DCTELEM as it will disappear from ffmpeg. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
author michael
date Wed, 23 Jan 2013 16:43:59 +0000
parents b02e9dea3240
children bfe51acc36fb
files libmpcodecs/vf_fspp.c libmpcodecs/vf_pp7.c libmpcodecs/vf_spp.c libmpcodecs/vf_zrmjpeg.c libvo/jpeg_enc.c
diffstat 5 files changed, 50 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- 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(
--- 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<height; y++){
@@ -310,7 +310,7 @@
         for(x=-8; x<0; x+=4){
             const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset
             uint8_t *src  = p_src + index;
-            DCTELEM *tp= temp+4*x;
+            int16_t *tp= temp+4*x;
 
             dctA_c(tp+4*8, src, stride);
         }
@@ -328,7 +328,7 @@
             for(; x<end; x++){
                 const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset
                 uint8_t *src  = p_src + index;
-                DCTELEM *tp= temp+4*x;
+                int16_t *tp= temp+4*x;
                 int v;
 
                 if((x&3)==0)
--- a/libmpcodecs/vf_spp.c	Wed Jan 23 16:04:33 2013 +0000
+++ b/libmpcodecs/vf_spp.c	Wed Jan 23 16:43:59 2013 +0000
@@ -106,7 +106,7 @@
 
 #define SHIFT 22
 
-static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
+static void hardthresh_c(int16_t dst[64], int16_t src[64], int qp, uint8_t *permutation){
         int i;
         int bias= 0; //FIXME
         unsigned int threshold1, threshold2;
@@ -114,7 +114,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++){
@@ -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<<p->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; y<height; y++){
--- a/libmpcodecs/vf_zrmjpeg.c	Wed Jan 23 16:04:33 2013 +0000
+++ b/libmpcodecs/vf_zrmjpeg.c	Wed Jan 23 16:43:59 2013 +0000
@@ -65,7 +65,7 @@
 		"vf_zrmjpeg: " __VA_ARGS__)
 
 /// The get_pixels() routine to use. The real routine comes from dsputil
-static void (*get_pixels)(DCTELEM *restrict block, const uint8_t *pixels, int line_size);
+static void (*get_pixels)(int16_t *restrict block, const uint8_t *pixels, int line_size);
 
 /* Begin excessive code duplication ************************************/
 /* Code coming from mpegvideo.c and mjpeg.c in ../libavcodec ***********/
@@ -196,7 +196,7 @@
  *
  * This routine is a duplicate of encode_block in mjpeg.c
  */
-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;
 	MJpegContext *m = s->mjpeg_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;
--- 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;