summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/dsputil.c18
-rw-r--r--libavcodec/dsputil.h49
-rw-r--r--libavcodec/dsputil_template.c153
-rw-r--r--libavcodec/hpeldsp.h14
-rw-r--r--libavcodec/vc1dsp.h1
5 files changed, 8 insertions, 227 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 1744f4c25d..708fbd9835 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2723,24 +2723,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->add_pixels8 = add_pixels8_c;
-#define hpel_funcs(prefix, idx, num) \
- c->prefix ## _pixels_tab idx [0] = prefix ## _pixels ## num ## _8_c; \
- c->prefix ## _pixels_tab idx [1] = prefix ## _pixels ## num ## _x2_8_c; \
- c->prefix ## _pixels_tab idx [2] = prefix ## _pixels ## num ## _y2_8_c; \
- c->prefix ## _pixels_tab idx [3] = prefix ## _pixels ## num ## _xy2_8_c
-
- hpel_funcs(put, [0], 16);
- hpel_funcs(put, [1], 8);
- hpel_funcs(put, [2], 4);
- hpel_funcs(put, [3], 2);
- hpel_funcs(put_no_rnd, [0], 16);
- hpel_funcs(put_no_rnd, [1], 8);
- hpel_funcs(avg, [0], 16);
- hpel_funcs(avg, [1], 8);
- hpel_funcs(avg, [2], 4);
- hpel_funcs(avg, [3], 2);
- hpel_funcs(avg_no_rnd,, 16);
-
#undef FUNC
#undef FUNCC
#define FUNC(f, depth) f ## _ ## depth
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 9c4976bc88..105305664e 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -80,7 +80,6 @@ could be reached easily ...
/* add and put pixel (decoding) */
// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller than 4
-typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, ptrdiff_t line_size, int h);
typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h);
typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, ptrdiff_t stride);
@@ -178,54 +177,6 @@ typedef struct DSPContext {
int size);
/**
- * Halfpel motion compensation with rounding (a+b+1)>>1.
- * this is an array[4][4] of motion compensation functions for 4
- * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
- * @param block destination where the result is stored
- * @param pixels source
- * @param line_size number of bytes in a horizontal line of block
- * @param h height
- */
- op_pixels_func put_pixels_tab[4][4];
-
- /**
- * Halfpel motion compensation with rounding (a+b+1)>>1.
- * This is an array[4][4] of motion compensation functions for 4
- * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
- * @param block destination into which the result is averaged (a+b+1)>>1
- * @param pixels source
- * @param line_size number of bytes in a horizontal line of block
- * @param h height
- */
- op_pixels_func avg_pixels_tab[4][4];
-
- /**
- * Halfpel motion compensation with no rounding (a+b)>>1.
- * this is an array[2][4] of motion compensation functions for 2
- * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
- * @param block destination where the result is stored
- * @param pixels source
- * @param line_size number of bytes in a horizontal line of block
- * @param h height
- */
- op_pixels_func put_no_rnd_pixels_tab[2][4];
-
- /**
- * Halfpel motion compensation with no rounding (a+b)>>1.
- * this is an array[4] of motion compensation functions for 1
- * horizontal blocksize (16) and the 4 halfpel positions<br>
- * *pixels_tab[0][ xhalfpel + 2*yhalfpel ]
- * @param block destination into which the result is averaged (a+b)>>1
- * @param pixels source
- * @param line_size number of bytes in a horizontal line of block
- * @param h height
- */
- op_pixels_func avg_no_rnd_pixels_tab[4];
-
- /**
* Thirdpel motion compensation with rounding (a+b+1)>>1.
* this is an array[12] of motion compensation functions for the 9 thirdpe
* positions<br>
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index d232d51489..c876b287eb 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -132,22 +132,6 @@ static inline void FUNC(OPNAME ## _no_rnd_pixels16_l2)(uint8_t *dst, const uint8
FUNC(OPNAME ## _no_rnd_pixels8_l2)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, h);\
}\
\
-static inline void FUNCC(OPNAME ## _no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _no_rnd_pixels8_l2)(block, pixels, pixels+sizeof(pixel), line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels8_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels8_l2)(block, pixels, pixels+sizeof(pixel), line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _no_rnd_pixels8_l2)(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels8_l2)(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
static inline void FUNC(OPNAME ## _pixels8_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
/* FIXME HIGH BIT DEPTH */\
@@ -185,22 +169,6 @@ static inline void FUNC(OPNAME ## _pixels8_l4)(uint8_t *dst, const uint8_t *src1
}\
}\
\
-static inline void FUNCC(OPNAME ## _pixels4_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels4_l2)(block, pixels, pixels+sizeof(pixel), line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels4_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels4_l2)(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels2_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels2_l2)(block, pixels, pixels+sizeof(pixel), line_size, line_size, line_size, h);\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels2_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
- FUNC(OPNAME ## _pixels2_l2)(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
static inline void FUNC(OPNAME ## _no_rnd_pixels8_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
/* FIXME HIGH BIT DEPTH*/\
@@ -248,79 +216,6 @@ static inline void FUNC(OPNAME ## _no_rnd_pixels16_l4)(uint8_t *dst, const uint8
FUNC(OPNAME ## _no_rnd_pixels8_l4)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), src3+8*sizeof(pixel), src4+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
}\
\
-static inline void FUNCC(OPNAME ## _pixels2_xy2)(uint8_t *_block, const uint8_t *_pixels, ptrdiff_t line_size, int h)\
-{\
- int i, a0, b0, a1, b1;\
- pixel *block = (pixel*)_block;\
- const pixel *pixels = (const pixel*)_pixels;\
- line_size /= sizeof(pixel);\
- a0= pixels[0];\
- b0= pixels[1] + 2;\
- a0 += b0;\
- b0 += pixels[2];\
-\
- pixels+=line_size;\
- for(i=0; i<h; i+=2){\
- a1= pixels[0];\
- b1= pixels[1];\
- a1 += b1;\
- b1 += pixels[2];\
-\
- block[0]= (a1+a0)>>2; /* FIXME non put */\
- block[1]= (b1+b0)>>2;\
-\
- pixels+=line_size;\
- block +=line_size;\
-\
- a0= pixels[0];\
- b0= pixels[1] + 2;\
- a0 += b0;\
- b0 += pixels[2];\
-\
- block[0]= (a1+a0)>>2;\
- block[1]= (b1+b0)>>2;\
- pixels+=line_size;\
- block +=line_size;\
- }\
-}\
-\
-static inline void FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\
-{\
- /* FIXME HIGH BIT DEPTH */\
- int i;\
- const uint32_t a= AV_RN32(pixels );\
- const uint32_t b= AV_RN32(pixels+1);\
- uint32_t l0= (a&0x03030303UL)\
- + (b&0x03030303UL)\
- + 0x02020202UL;\
- uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- uint32_t l1,h1;\
-\
- pixels+=line_size;\
- for(i=0; i<h; i+=2){\
- uint32_t a= AV_RN32(pixels );\
- uint32_t b= AV_RN32(pixels+1);\
- l1= (a&0x03030303UL)\
- + (b&0x03030303UL);\
- h1= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
- pixels+=line_size;\
- block +=line_size;\
- a= AV_RN32(pixels );\
- b= AV_RN32(pixels+1);\
- l0= (a&0x03030303UL)\
- + (b&0x03030303UL)\
- + 0x02020202UL;\
- h0= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
- pixels+=line_size;\
- block +=line_size;\
- }\
-}\
-\
static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\
{\
/* FIXME HIGH BIT DEPTH */\
@@ -363,55 +258,7 @@ static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *
}\
}\
\
-static inline void FUNCC(OPNAME ## _no_rnd_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\
-{\
- /* FIXME HIGH BIT DEPTH */\
- int j;\
- for(j=0; j<2; j++){\
- int i;\
- const uint32_t a= AV_RN32(pixels );\
- const uint32_t b= AV_RN32(pixels+1);\
- uint32_t l0= (a&0x03030303UL)\
- + (b&0x03030303UL)\
- + 0x01010101UL;\
- uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- uint32_t l1,h1;\
-\
- pixels+=line_size;\
- for(i=0; i<h; i+=2){\
- uint32_t a= AV_RN32(pixels );\
- uint32_t b= AV_RN32(pixels+1);\
- l1= (a&0x03030303UL)\
- + (b&0x03030303UL);\
- h1= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
- pixels+=line_size;\
- block +=line_size;\
- a= AV_RN32(pixels );\
- b= AV_RN32(pixels+1);\
- l0= (a&0x03030303UL)\
- + (b&0x03030303UL)\
- + 0x01010101UL;\
- h0= ((a&0xFCFCFCFCUL)>>2)\
- + ((b&0xFCFCFCFCUL)>>2);\
- OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
- pixels+=line_size;\
- block +=line_size;\
- }\
- pixels+=4-line_size*(h+1);\
- block +=4-line_size*h;\
- }\
-}\
-\
-CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_x2) , FUNCC(OPNAME ## _pixels8_x2) , 8*sizeof(pixel))\
-CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_y2) , FUNCC(OPNAME ## _pixels8_y2) , 8*sizeof(pixel))\
CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_xy2), FUNCC(OPNAME ## _pixels8_xy2), 8*sizeof(pixel))\
-av_unused CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16) , FUNCC(OPNAME ## _pixels8) , 8*sizeof(pixel))\
-CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_x2) , FUNCC(OPNAME ## _no_rnd_pixels8_x2) , 8*sizeof(pixel))\
-CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_y2) , FUNCC(OPNAME ## _no_rnd_pixels8_y2) , 8*sizeof(pixel))\
-CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_xy2), FUNCC(OPNAME ## _no_rnd_pixels8_xy2), 8*sizeof(pixel))\
#define op_avg(a, b) a = rnd_avg_pixel4(a, b)
#define op_put(a, b) a = b
diff --git a/libavcodec/hpeldsp.h b/libavcodec/hpeldsp.h
index 68190ad8c3..aa58184ed1 100644
--- a/libavcodec/hpeldsp.h
+++ b/libavcodec/hpeldsp.h
@@ -35,9 +35,9 @@
// blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16
// h for hpel_pixels_func is limited to {width/2, width} but never larger
// than 16 and never smaller than 4
-typedef void (*hpel_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
- const uint8_t *pixels /*align 1*/,
- ptrdiff_t line_size, int h);
+typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
+ const uint8_t *pixels /*align 1*/,
+ ptrdiff_t line_size, int h);
/**
* Half-pel DSP context.
@@ -53,7 +53,7 @@ typedef struct HpelDSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- hpel_pixels_func put_pixels_tab[4][4];
+ op_pixels_func put_pixels_tab[4][4];
/**
* Halfpel motion compensation with rounding (a+b+1)>>1.
@@ -65,7 +65,7 @@ typedef struct HpelDSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- hpel_pixels_func avg_pixels_tab[4][4];
+ op_pixels_func avg_pixels_tab[4][4];
/**
* Halfpel motion compensation with no rounding (a+b)>>1.
@@ -77,7 +77,7 @@ typedef struct HpelDSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- hpel_pixels_func put_no_rnd_pixels_tab[2][4];
+ op_pixels_func put_no_rnd_pixels_tab[2][4];
/**
* Halfpel motion compensation with no rounding (a+b)>>1.
@@ -89,7 +89,7 @@ typedef struct HpelDSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- hpel_pixels_func avg_no_rnd_pixels_tab[4];
+ op_pixels_func avg_no_rnd_pixels_tab[4];
} HpelDSPContext;
void ff_hpeldsp_init(HpelDSPContext *c, int flags);
diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h
index 63256e5016..677bc37bbe 100644
--- a/libavcodec/vc1dsp.h
+++ b/libavcodec/vc1dsp.h
@@ -29,6 +29,7 @@
#define AVCODEC_VC1DSP_H
#include "dsputil.h"
+#include "hpeldsp.h"
#include "h264chroma.h"
typedef struct VC1DSPContext {