mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
avcodec/h264idct_template: Deduplicate h264_{luma,chroma}_dc_dequant_idct
All the high bit depth functions of these types are identical. Reviewed-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -69,14 +69,19 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
|
|||||||
#undef FUNC
|
#undef FUNC
|
||||||
#define FUNC(a, depth) a ## _ ## depth ## _c
|
#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_pixels4_clear = FUNC(ff_h264_add_pixels4, depth);\
|
||||||
c->h264_add_pixels8_clear = FUNC(ff_h264_add_pixels8, depth)
|
c->h264_add_pixels8_clear = FUNC(ff_h264_add_pixels8, depth)
|
||||||
|
|
||||||
if (bit_depth > 8 && bit_depth <= 16) {
|
if (bit_depth > 8 && bit_depth <= 16) {
|
||||||
ADDPX_DSP(16);
|
SET_PIXSIZE_FUNCS(16);
|
||||||
} else {
|
} else {
|
||||||
ADDPX_DSP(8);
|
SET_PIXSIZE_FUNCS(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define H264_DSP(depth) \
|
#define H264_DSP(depth) \
|
||||||
@@ -91,11 +96,6 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
|
|||||||
else\
|
else\
|
||||||
c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\
|
c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\
|
||||||
c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, 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[0]= FUNC(weight_h264_pixels16, depth);\
|
||||||
c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\
|
c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\
|
||||||
|
|||||||
@@ -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_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_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_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( 8)
|
||||||
H264_IDCT( 9)
|
H264_IDCT( 9)
|
||||||
@@ -41,4 +38,12 @@ H264_IDCT(10)
|
|||||||
H264_IDCT(12)
|
H264_IDCT(12)
|
||||||
H264_IDCT(14)
|
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 */
|
#endif /* AVCODEC_H264IDCT_H */
|
||||||
|
|||||||
@@ -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.
|
* IDCT transforms the 16 dc values and dequantizes them.
|
||||||
* @param qmul quantization parameter
|
* @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
|
#define stride 16
|
||||||
int i;
|
int i;
|
||||||
int temp[16];
|
int temp[16];
|
||||||
@@ -283,7 +285,8 @@ void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int
|
|||||||
#undef stride
|
#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 stride= 16*2;
|
||||||
const int xStride= 16;
|
const int xStride= 16;
|
||||||
int i;
|
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 stride= 16*2;
|
||||||
const int xStride= 16;
|
const int xStride= 16;
|
||||||
SUINT a,b,c,d,e;
|
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*0]= (int)((a-c)*qmul) >> 7;
|
||||||
block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7;
|
block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user