aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-09-29 16:25:14 +0000
committerAnton Khirnov <anton@khirnov.net>2014-10-07 07:13:01 +0000
commitd208d1eba3799c58fd6d3602d31de3e686f14aec (patch)
tree9c71d398733dc3fafcc7104afef401c3ffa0c5ec /libavcodec
parent79a60c8e779242b5ba4c531b2c706c871e8e6420 (diff)
downloadffmpeg-d208d1eba3799c58fd6d3602d31de3e686f14aec.tar.gz
hevc_mvs: make sure to always initialize the temporal MV fully
The spec requires this. Fixes uninitialized reads on some samples. Remove now unnecessary initialization of the whole merge candidate list.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc_mvs.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index 8b172a268d..721eb3af41 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -481,14 +481,10 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
mergecandlist[nb_merge_cand].is_intra = 0;
mergecandlist[nb_merge_cand].pred_flag[0] = available_l0;
mergecandlist[nb_merge_cand].pred_flag[1] = available_l1;
- if (available_l0) {
- mergecandlist[nb_merge_cand].mv[0] = mv_l0_col;
- mergecandlist[nb_merge_cand].ref_idx[0] = 0;
- }
- if (available_l1) {
- mergecandlist[nb_merge_cand].mv[1] = mv_l1_col;
- mergecandlist[nb_merge_cand].ref_idx[1] = 0;
- }
+ AV_ZERO16(mergecandlist[nb_merge_cand].ref_idx);
+ mergecandlist[nb_merge_cand].mv[0] = mv_l0_col;
+ mergecandlist[nb_merge_cand].mv[1] = mv_l1_col;
+
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
@@ -558,8 +554,6 @@ void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW,
int nPbH2 = nPbH;
HEVCLocalContext *lc = &s->HEVClc;
- memset(mergecand_list, 0, MRG_MAX_NUM_CANDS * sizeof(*mergecand_list));
-
if (s->pps->log2_parallel_merge_level > 2 && nCS == 8) {
singleMCLFlag = 1;
x0 = lc->cu.x;