[FFmpeg-devel] [PATCH 4/9] hevc: reduce cu depth allocation
Christophe Gisquet
christophe.gisquet at gmail.com
Thu Jul 10 08:47:51 CEST 2014
---
libavcodec/hevc.c | 4 ++--
libavcodec/hevc_cabac.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 2b37f53..4d3513a 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -100,7 +100,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
goto fail;
s->skip_flag = av_malloc(16*s->sps->min_cb_width);
- s->tab_ct_depth = av_malloc_array(sps->min_cb_height, sps->min_cb_width);
+ s->tab_ct_depth = av_malloc(16*sps->min_cb_width);
if (!s->skip_flag || !s->tab_ct_depth)
goto fail;
@@ -1682,7 +1682,7 @@ static av_always_inline void set_ct_depth(HEVCContext *s, int x0, int y0,
int y;
for (y = 0; y < length; y++)
- memset(&s->tab_ct_depth[(y_cb + y) * s->sps->min_cb_width + x_cb],
+ memset(&s->tab_ct_depth[((y_cb + y)&15) * s->sps->min_cb_width + x_cb],
ct_depth, length);
}
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index 40f5ce1..0923c13 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -708,9 +708,9 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0,
int y_cb = y0 >> s->sps->log2_min_cb_size;
if (s->HEVClc->ctb_left_flag || x0b)
- depth_left = s->tab_ct_depth[(y_cb) * s->sps->min_cb_width + x_cb - 1];
+ depth_left = s->tab_ct_depth[(y_cb&15) * s->sps->min_cb_width + x_cb - 1];
if (s->HEVClc->ctb_up_flag || y0b)
- depth_top = s->tab_ct_depth[(y_cb - 1) * s->sps->min_cb_width + x_cb];
+ depth_top = s->tab_ct_depth[((y_cb - 1)&15) * s->sps->min_cb_width + x_cb];
inc += (depth_left > ct_depth);
inc += (depth_top > ct_depth);
--
1.9.2.msysgit.0
More information about the ffmpeg-devel
mailing list