diff options
author | James Zern <jzern@google.com> | 2021-05-12 19:31:53 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2021-05-12 19:33:15 -0700 |
commit | 3614ca655e56ca7406fd013967e6f6181b1c01e1 (patch) | |
tree | 3e69b59a9e1892dd7ca72458c08945f83cd03d19 | |
parent | 82a1d2330e113a14e545d806eb5419f09374255f (diff) | |
download | libwebm-upstream-master.tar.gz |
webm_info: output vp9 display width/heightupstream-master
if it is different than the encoded width and height
Change-Id: I58e59c390bb9c1ac86a1e2e82c1967facb932853
-rw-r--r-- | common/vp9_header_parser.cc | 11 | ||||
-rw-r--r-- | common/vp9_header_parser.h | 4 | ||||
-rw-r--r-- | webm_info.cc | 11 |
3 files changed, 20 insertions, 6 deletions
diff --git a/common/vp9_header_parser.cc b/common/vp9_header_parser.cc index 604a050..c017d7f 100644 --- a/common/vp9_header_parser.cc +++ b/common/vp9_header_parser.cc @@ -169,13 +169,16 @@ void Vp9HeaderParser::ParseColorSpace() { void Vp9HeaderParser::ParseFrameResolution() { width_ = VpxReadLiteral(16) + 1; height_ = VpxReadLiteral(16) + 1; + if (ReadBit()) { + display_width_ = VpxReadLiteral(16) + 1; + display_height_ = VpxReadLiteral(16) + 1; + } else { + display_width_ = width_; + display_height_ = height_; + } } void Vp9HeaderParser::ParseFrameParallelMode() { - if (ReadBit()) { - VpxReadLiteral(16); // display width - VpxReadLiteral(16); // display height - } if (!error_resilient_mode_) { ReadBit(); // Consume refresh frame context frame_parallel_mode_ = ReadBit(); diff --git a/common/vp9_header_parser.h b/common/vp9_header_parser.h index 06bd656..3e57514 100644 --- a/common/vp9_header_parser.h +++ b/common/vp9_header_parser.h @@ -64,6 +64,8 @@ class Vp9HeaderParser { int color_space() const { return color_space_; } int width() const { return width_; } int height() const { return height_; } + int display_width() const { return display_width_; } + int display_height() const { return display_height_; } int refresh_frame_flags() const { return refresh_frame_flags_; } int row_tiles() const { return row_tiles_; } int column_tiles() const { return column_tiles_; } @@ -115,6 +117,8 @@ class Vp9HeaderParser { int refresh_frame_flags_; int width_; int height_; + int display_width_; + int display_height_; int row_tiles_; int column_tiles_; int frame_parallel_mode_; diff --git a/webm_info.cc b/webm_info.cc index fdf4759..7cc7272 100644 --- a/webm_info.cc +++ b/webm_info.cc @@ -761,8 +761,15 @@ void PrintVP9Info(const uint8_t* data, int size, FILE* o, int64_t time_ns, version, altref_frame, error_resilient_mode, row_tiles, column_tiles, frame_parallel_mode); - if (key && size > 4) { - fprintf(o, " cs:%d", parser->color_space()); + if (key) { + if (size > 4) { + fprintf(o, " cs:%d", parser->color_space()); + } + if (parser->display_width() != parser->width() || + parser->display_height() != parser->height()) { + fprintf(o, " dw:%d dh:%d", parser->display_width(), + parser->display_height()); + } } if (count > 0) { |