summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhshi <hshi@chromium.org>2015-09-02 14:45:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-02 21:46:36 +0000
commitf7db687df527e95d3c94dd59597d99f6d1bb10d0 (patch)
tree22bfc34a186c66485babe305215fb3dbd6bb7efd
parent541c8026301dc355d3e16ca98857b9876f0f3ed7 (diff)
downloadchromium_src-f7db687df527e95d3c94dd59597d99f6d1bb10d0.zip
chromium_src-f7db687df527e95d3c94dd59597d99f6d1bb10d0.tar.gz
chromium_src-f7db687df527e95d3c94dd59597d99f6d1bb10d0.tar.bz2
H264 Decoder: move cut off logic from Construct to ModifyRefPicList().
The ConstructRefPicListsP/B() functions are supposed to be slice agnostic. The cut off logic is based on per-slice num_ref_idx_lX_active_minus1 values in the slice header, and therefore it should belong to the ModifyRefPicList() function. BUG=479953 TEST=verify no corruption on xfnity, trybot, vda unit test Review URL: https://codereview.chromium.org/1318283007 Cr-Commit-Position: refs/heads/master@{#346947} (cherry picked from commit 5e19b061b92dd718401660d1899fd56bcd8637f9) TBR=posciak@chromium.org NOTRY=true NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1323143006 Cr-Commit-Position: refs/branch-heads/2490@{#140} Cr-Branched-From: 7790a3535f2a81a03685eca31a32cf69ae0c114f-refs/heads/master@{#344925}
-rw-r--r--content/common/gpu/media/h264_decoder.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/content/common/gpu/media/h264_decoder.cc b/content/common/gpu/media/h264_decoder.cc
index 9953ff2..6f9c918 100644
--- a/content/common/gpu/media/h264_decoder.cc
+++ b/content/common/gpu/media/h264_decoder.cc
@@ -362,9 +362,6 @@ void H264Decoder::ConstructReferencePicListsP(
dpb_.GetLongTermRefPicsAppending(&ref_pic_list_p0_);
std::sort(ref_pic_list_p0_.begin() + num_short_refs, ref_pic_list_p0_.end(),
LongTermPicNumAscCompare());
-
- // Cut off if we have more than requested in slice header.
- ref_pic_list_p0_.resize(slice_hdr->num_ref_idx_l0_active_minus1 + 1);
}
struct POCAscCompare {
@@ -436,12 +433,6 @@ void H264Decoder::ConstructReferencePicListsB(
std::equal(ref_pic_list_b0_.begin(), ref_pic_list_b0_.end(),
ref_pic_list_b1_.begin()))
std::swap(ref_pic_list_b1_[0], ref_pic_list_b1_[1]);
-
- // Per 8.2.4.2 it's possible for num_ref_idx_lX_active_minus1 to indicate
- // there should be more ref pics on list than we constructed.
- // Those superfluous ones should be treated as non-reference.
- ref_pic_list_b0_.resize(slice_hdr->num_ref_idx_l0_active_minus1 + 1);
- ref_pic_list_b1_.resize(slice_hdr->num_ref_idx_l1_active_minus1 + 1);
}
// See 8.2.4
@@ -489,25 +480,36 @@ static void ShiftRightAndInsert(H264Picture::Vector* v,
bool H264Decoder::ModifyReferencePicList(media::H264SliceHeader* slice_hdr,
int list,
H264Picture::Vector* ref_pic_listx) {
+ bool ref_pic_list_modification_flag_lX;
int num_ref_idx_lX_active_minus1;
media::H264ModificationOfPicNum* list_mod;
// This can process either ref_pic_list0 or ref_pic_list1, depending on
// the list argument. Set up pointers to proper list to be processed here.
if (list == 0) {
- if (!slice_hdr->ref_pic_list_modification_flag_l0)
- return true;
-
+ ref_pic_list_modification_flag_lX =
+ slice_hdr->ref_pic_list_modification_flag_l0;
+ num_ref_idx_lX_active_minus1 =
+ slice_hdr->num_ref_idx_l0_active_minus1;
list_mod = slice_hdr->ref_list_l0_modifications;
} else {
- if (!slice_hdr->ref_pic_list_modification_flag_l1)
- return true;
-
+ ref_pic_list_modification_flag_lX =
+ slice_hdr->ref_pic_list_modification_flag_l1;
+ num_ref_idx_lX_active_minus1 =
+ slice_hdr->num_ref_idx_l1_active_minus1;
list_mod = slice_hdr->ref_list_l1_modifications;
}
- num_ref_idx_lX_active_minus1 = ref_pic_listx->size() - 1;
+ // Resize the list to the size requested in the slice header.
+ // Note that per 8.2.4.2 it's possible for num_ref_idx_lX_active_minus1 to
+ // indicate there should be more ref pics on list than we constructed.
+ // Those superfluous ones should be treated as non-reference and will be
+ // initialized to nullptr, which must be handled by clients.
DCHECK_GE(num_ref_idx_lX_active_minus1, 0);
+ ref_pic_listx->resize(num_ref_idx_lX_active_minus1 + 1);
+
+ if (!ref_pic_list_modification_flag_lX)
+ return true;
// Spec 8.2.4.3:
// Reorder pictures on the list in a way specified in the stream.