diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-11-15 22:31:27 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-11-17 09:25:12 +0100 |
commit | de1f8ead8993512925a3ee6c7491473414419e55 (patch) | |
tree | e3757308ddcd7fa3f8fa28133387040155e60e12 | |
parent | 16c01fb4347312b6d29a6498dad627665b96a20e (diff) | |
download | ffmpeg-de1f8ead8993512925a3ee6c7491473414419e55.tar.gz |
hevcdsp_template: templatize transquant_bypass
-rw-r--r-- | libavcodec/hevcdsp_template.c | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 8dcc83d786..ae7e0217cc 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -40,16 +40,16 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int size, } } -static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, - ptrdiff_t stride) +static av_always_inline void FUNC(transquant_bypass)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride, int size) { int x, y; pixel *dst = (pixel *)_dst; stride /= sizeof(pixel); - for (y = 0; y < 4; y++) { - for (x = 0; x < 4; x++) { + for (y = 0; y < size; y++) { + for (x = 0; x < size; x++) { dst[x] = av_clip_pixel(dst[x] + *coeffs); coeffs++; } @@ -57,55 +57,28 @@ static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, } } -static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, +static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride) { - int x, y; - pixel *dst = (pixel *)_dst; - - stride /= sizeof(pixel); + FUNC(transquant_bypass)(_dst, coeffs, stride, 4); +} - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) { - dst[x] = av_clip_pixel(dst[x] + *coeffs); - coeffs++; - } - dst += stride; - } +static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride) +{ + FUNC(transquant_bypass)(_dst, coeffs, stride, 8); } static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride) { - int x, y; - pixel *dst = (pixel *)_dst; - - stride /= sizeof(pixel); - - for (y = 0; y < 16; y++) { - for (x = 0; x < 16; x++) { - dst[x] = av_clip_pixel(dst[x] + *coeffs); - coeffs++; - } - dst += stride; - } + FUNC(transquant_bypass)(_dst, coeffs, stride, 16); } static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride) { - int x, y; - pixel *dst = (pixel *)_dst; - - stride /= sizeof(pixel); - - for (y = 0; y < 32; y++) { - for (x = 0; x < 32; x++) { - dst[x] = av_clip_pixel(dst[x] + *coeffs); - coeffs++; - } - dst += stride; - } + FUNC(transquant_bypass)(_dst, coeffs, stride, 32); } static void FUNC(transform_skip)(uint8_t *_dst, int16_t *coeffs, |