[FFmpeg-cvslog] hevc: reuse edge emu buffer for coefficients

Christophe Gisquet git at videolan.org
Wed Oct 1 12:21:21 CEST 2014


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Tue Sep 23 21:36:43 2014 +0000| [9a3653c9ecc4bbbbb502513a70bccd4090ed12b0] | committer: Michael Niedermayer

hevc: reuse edge emu buffer for coefficients

Kind of hackish but...

Reviewed-by: Mickael Raulet <Mickael.Raulet at insa-rennes.fr>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a3653c9ecc4bbbbb502513a70bccd4090ed12b0
---

 libavcodec/hevc.c       |    8 ++++----
 libavcodec/hevc.h       |    1 -
 libavcodec/hevc_cabac.c |    4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 467c36a..adeb66d 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -972,8 +972,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
                         ptrdiff_t stride = s->frame->linesize[1];
                         int hshift = s->sps->hshift[1];
                         int vshift = s->sps->vshift[1];
-                        int16_t *coeffs_y = lc->tu.coeffs[0];
-                        int16_t *coeffs =   lc->tu.coeffs[1];
+                        int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer;
+                        int16_t *coeffs   = (int16_t*)lc->edge_emu_buffer2;
                         int size = 1 << log2_trafo_size_c;
 
                         uint8_t *dst = &s->frame->data[1][(y0 >> vshift) * stride +
@@ -1001,8 +1001,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
                         ptrdiff_t stride = s->frame->linesize[2];
                         int hshift = s->sps->hshift[2];
                         int vshift = s->sps->vshift[2];
-                        int16_t *coeffs_y = lc->tu.coeffs[0];
-                        int16_t *coeffs =   lc->tu.coeffs[1];
+                        int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer;
+                        int16_t *coeffs   = (int16_t*)lc->edge_emu_buffer2;
                         int size = 1 << log2_trafo_size_c;
 
                         uint8_t *dst = &s->frame->data[2][(y0 >> vshift) * stride +
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 87a59fb..7205a78 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -679,7 +679,6 @@ typedef struct PredictionUnit {
 } PredictionUnit;
 
 typedef struct TransformUnit {
-    DECLARE_ALIGNED(32, int16_t, coeffs[2][MAX_TB_SIZE * MAX_TB_SIZE]);
     int cu_qp_delta;
 
     int res_scale_val;
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index e2e5fac..3862df7 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -1079,7 +1079,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
     int vshift = s->sps->vshift[c_idx];
     uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride +
                                           ((x0 >> hshift) << s->sps->pixel_shift)];
-    int16_t *coeffs = lc->tu.coeffs[c_idx > 0];
+    int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer);
     uint8_t significant_coeff_group_flag[8][8] = {{0}};
     int explicit_rdpcm_flag = 0;
     int explicit_rdpcm_dir_flag;
@@ -1552,7 +1552,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
         }
     }
     if (lc->tu.cross_pf) {
-        int16_t *coeffs_y = lc->tu.coeffs[0];
+        int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer;
 
         for (i = 0; i < (trafo_size * trafo_size); i++) {
             coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);



More information about the ffmpeg-cvslog mailing list