summaryrefslogtreecommitdiff
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorMickaël Raulet <mraulet@insa-rennes.fr>2016-07-05 18:52:38 +0200
committerLuca Barbato <lu_zero@gentoo.org>2016-07-18 15:27:13 +0200
commitcc16da75c2f99d92f7a6461100f041352deb6d88 (patch)
tree9070fd589edb428c50dc51467d2609e06b2b48c0 /libavcodec/hevc.c
parenta92fd8a06256e71a0be87b03751ec3c2a4a8aa21 (diff)
hevc: Add coefficient limiting to speed up IDCT
Integrated to libav by Josh de Kock <josh@itanimul.li>. Signed-off-by: Alexandra Hájková <alexandra@khirnov.net>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index d8c707b3c6..5d58b5212a 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1218,8 +1218,16 @@ static void hls_residual_coding(HEVCContext *s, int x0, int y0,
int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y);
if (max_xy == 0)
s->hevcdsp.idct_dc[log2_trafo_size - 2](coeffs);
- else
- s->hevcdsp.idct[log2_trafo_size - 2](coeffs);
+ else {
+ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4;
+ if (max_xy < 4)
+ col_limit = FFMIN(4, col_limit);
+ else if (max_xy < 8)
+ col_limit = FFMIN(8, col_limit);
+ else if (max_xy < 12)
+ col_limit = FFMIN(24, col_limit);
+ s->hevcdsp.idct[log2_trafo_size - 2](coeffs, col_limit);
+ }
}
}
s->hevcdsp.add_residual[log2_trafo_size - 2](dst, coeffs, stride);