aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-07 23:28:22 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-23 16:44:37 +0100
commit0909b8acf8f76edb5a96d2e9a68b7bb78bc456ed (patch)
treee4c7dda19b34dc12517d50e471c04e2935b9d7c1 /libavcodec/hevc.c
parent2368d08e701acf7942bf6d70a40a3e70186199ea (diff)
downloadandroid_external_ffmpeg-0909b8acf8f76edb5a96d2e9a68b7bb78bc456ed.tar.gz
android_external_ffmpeg-0909b8acf8f76edb5a96d2e9a68b7bb78bc456ed.tar.bz2
android_external_ffmpeg-0909b8acf8f76edb5a96d2e9a68b7bb78bc456ed.zip
avcodec/hevc: Simplify get_qPy_pred()
Fixes use of uninitialized memory Fixes: 93728afd9aa074ba14a09bfd93a632fd-asan_static-oob_124a17d_1445_cov_1021181966_DBLK_D_VIXS_1.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 64278039e55ffc88d231a8d760ecc257a120760a) Conflicts: libavcodec/hevc_filter.c
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index f8438d4bc3..f27eddbdc5 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1549,6 +1549,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
int x_cb = x0 >> log2_min_cb_size;
int y_cb = y0 >> log2_min_cb_size;
int x, y, ret;
+ int qp_block_mask = (1<<(s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth)) - 1;
lc->cu.x = x0;
lc->cu.y = y0;
@@ -1686,6 +1687,11 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
x += min_cb_width;
}
+ if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
+ ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
+ lc->qPy_pred = lc->qp_y;
+ }
+
set_ct_depth(s, x0, y0, log2_cb_size, lc->ct.depth);
return 0;
@@ -1697,6 +1703,7 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,
HEVCLocalContext *lc = s->HEVClc;
const int cb_size = 1 << log2_cb_size;
int ret;
+ int qp_block_mask = (1<<(s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth)) - 1;
lc->ct.depth = cb_depth;
if ((x0 + cb_size <= s->sps->width) &&
@@ -1736,8 +1743,15 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,
}
if (more_data && x1 < s->sps->width &&
y1 < s->sps->height) {
- return hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1);
+ more_data = hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1);
+ if (more_data < 0)
+ return more_data;
}
+
+ if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
+ ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
+ lc->qPy_pred = lc->qp_y;
+
if (more_data)
return ((x1 + cb_size_split) < s->sps->width ||
(y1 + cb_size_split) < s->sps->height);