diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c index 1ba936be1c..8a6a3f5325 100644 --- a/libavcodec/h264dsp.c +++ b/libavcodec/h264dsp.c @@ -69,14 +69,19 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, #undef FUNC #define FUNC(a, depth) a ## _ ## depth ## _c -#define ADDPX_DSP(depth) \ +#define SET_PIXSIZE_FUNCS(depth) \ + c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ + if (chroma_format_idc <= 1)\ + c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ + else\ + c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\ c->h264_add_pixels4_clear = FUNC(ff_h264_add_pixels4, depth);\ c->h264_add_pixels8_clear = FUNC(ff_h264_add_pixels8, depth) if (bit_depth > 8 && bit_depth <= 16) { - ADDPX_DSP(16); + SET_PIXSIZE_FUNCS(16); } else { - ADDPX_DSP(8); + SET_PIXSIZE_FUNCS(8); } #define H264_DSP(depth) \ @@ -91,11 +96,6 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, else\ c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\ c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\ - c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ - if (chroma_format_idc <= 1)\ - c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ - else\ - c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\ \ c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\ c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\ diff --git a/libavcodec/h264idct.h b/libavcodec/h264idct.h index 6f18df9e5f..42e93ed17a 100644 --- a/libavcodec/h264idct.h +++ b/libavcodec/h264idct.h @@ -31,9 +31,6 @@ void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffse void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\ void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\ void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\ -void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(int16_t *output, int16_t *input, int qmul);\ -void ff_h264_chroma422_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul);\ -void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul); H264_IDCT( 8) H264_IDCT( 9) @@ -41,4 +38,12 @@ H264_IDCT(10) H264_IDCT(12) H264_IDCT(14) +#define H264_IDCT2(pixsize) \ +void ff_h264_luma_dc_dequant_idct_ ## pixsize ## _c(int16_t *output, int16_t *input, int qmul);\ +void ff_h264_chroma422_dc_dequant_idct_ ## pixsize ## _c(int16_t *block, int qmul);\ +void ff_h264_chroma_dc_dequant_idct_ ## pixsize ## _c(int16_t *block, int qmul); + +H264_IDCT2( 8) +H264_IDCT2(16) + #endif /* AVCODEC_H264IDCT_H */ diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index db19b5f9fb..64f5faddca 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -244,11 +244,13 @@ void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, int16 } } +#if BIT_DEPTH == 8 || BIT_DEPTH == 9 /** * IDCT transforms the 16 dc values and dequantizes them. * @param qmul quantization parameter */ -void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul){ +void FUNCC2(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul) +{ #define stride 16 int i; int temp[16]; @@ -283,7 +285,8 @@ void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int #undef stride } -void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){ +void FUNCC2(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul) +{ const int stride= 16*2; const int xStride= 16; int i; @@ -310,7 +313,8 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){ } } -void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ +void FUNCC2(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul) +{ const int stride= 16*2; const int xStride= 16; SUINT a,b,c,d,e; @@ -331,3 +335,4 @@ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ block[stride*1 + xStride*0]= (int)((a-c)*qmul) >> 7; block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7; } +#endif