summaryrefslogtreecommitdiff
path: root/libavcodec/hevcdsp_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-17 11:41:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-17 11:41:35 +0100
commit30156eab6d816878bb404fb1565d026aad0d2d9e (patch)
treec8c44afc883f465a80b37020276edb0a95b99c33 /libavcodec/hevcdsp_template.c
parentc192be196839ae28a55b37a01209bc052b8fdbe3 (diff)
parentde1f8ead8993512925a3ee6c7491473414419e55 (diff)
downloadffmpeg-30156eab6d816878bb404fb1565d026aad0d2d9e.tar.gz
Merge commit 'de1f8ead8993512925a3ee6c7491473414419e55'
* commit 'de1f8ead8993512925a3ee6c7491473414419e55': hevcdsp_template: templatize transquant_bypass Conflicts: libavcodec/hevcdsp_template.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevcdsp_template.c')
-rw-r--r--libavcodec/hevcdsp_template.c53
1 files changed, 13 insertions, 40 deletions
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 8a843f54d7..360a509374 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -42,16 +42,16 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int width, int height
}
}
-static void FUNC(transform_add4x4)(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++;
}
@@ -59,55 +59,28 @@ static void FUNC(transform_add4x4)(uint8_t *_dst, int16_t *coeffs,
}
}
-static void FUNC(transform_add8x8)(uint8_t *_dst, int16_t *coeffs,
+static void FUNC(transform_add4x4)(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(transform_add8x8)(uint8_t *_dst, int16_t *coeffs,
+ ptrdiff_t stride)
+{
+ FUNC(transquant_bypass)(_dst, coeffs, stride, 8);
}
static void FUNC(transform_add16x16)(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(transform_add32x32)(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);
}