Commit 9d3793ec authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Chromium LUCI CQ

media/gpu/av1_decoder: Use libgav1::ObuParser::sequence_header_changed()

AV1Decoder checks if there is a new sequence header by basically
finding a new sequence header in parsed OBU headers.
libgav1::ObuParser provides sequence_header_changed() interface.
This CL replaces AV1Decoder's check with a usage of libgav1's interface.

Bug: b:175886969
Test: video.DecodeCompliance.av1_test_vectors
Change-Id: Idb185a043adaedfaf0a36c754459a5017a44bf22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612664
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842852}
parent 541a9ed1
......@@ -98,23 +98,6 @@ AV1Decoder::~AV1Decoder() {
state_.reset();
}
bool AV1Decoder::HasNewSequenceHeader() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(parser_);
const auto& obu_headers = parser_->obu_headers();
const bool has_sequence_header =
std::find_if(obu_headers.begin(), obu_headers.end(),
[](const auto& obu_header) {
return obu_header.type == libgav1::kObuSequenceHeader;
}) != obu_headers.end();
if (!has_sequence_header)
return false;
if (!current_sequence_header_)
return true;
return parser_->sequence_header().ParametersChanged(
*current_sequence_header_);
}
bool AV1Decoder::Flush() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DVLOG(2) << "Decoder flush";
......@@ -208,9 +191,7 @@ AcceleratedVideoDecoder::DecodeResult AV1Decoder::DecodeInternal() {
current_frame_header_ = parser_->frame_header();
// Detects if a new coded video sequence is starting.
// TODO(b/171853869): Replace HasNewSequenceHeader() with whatever
// libgav1::ObuParser provides for more than one sequence headers case.
if (HasNewSequenceHeader()) {
if (parser_->sequence_header_changed()) {
// TODO(b/171853869): Remove this check once libgav1::ObuParser does
// this check.
if (current_frame_header_->frame_type != libgav1::kFrameKey ||
......
......@@ -112,8 +112,6 @@ class MEDIA_GPU_EXPORT AV1Decoder : public AcceleratedVideoDecoder {
size_t GetNumReferenceFrames() const override;
private:
// Returns whether the current stream contains a new OBU sequence header.
bool HasNewSequenceHeader() const;
bool DecodeAndOutputPicture(
scoped_refptr<AV1Picture> pic,
const libgav1::Vector<libgav1::TileBuffer>& tile_buffers);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment