mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-16 07:10:38 +01:00

This reverts commit 3097008de0
.
Reason for revert: suspected crash
Bug: chromium:1230239
TBR=philipel@webrtc.org
Original change's description:
> Rename vp9::FrameInfo to vp9::UncompressedHeader and add more fields.
>
> These fields will be used for bitstream validation in upcoming CLs.
> A new vp9_constants.h file is also added, containing common constants
> defined by the bitstream spec.
>
> Bug: webrtc:12354
> Change-Id: If04256d83409069c8bee43ad41aed41c3707dfd3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226060
> Commit-Queue: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#34476}
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:12354
Change-Id: Ia4d5180d593c66a053d5747e714a579c62ea2a37
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226327
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34496}
92 lines
2.8 KiB
C++
92 lines
2.8 KiB
C++
/*
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
|
|
#define MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "absl/types/optional.h"
|
|
|
|
namespace webrtc {
|
|
|
|
namespace vp9 {
|
|
|
|
// Gets the QP, QP range: [0, 255].
|
|
// Returns true on success, false otherwise.
|
|
bool GetQp(const uint8_t* buf, size_t length, int* qp);
|
|
|
|
// Bit depth per channel. Support varies by profile.
|
|
enum class BitDept : uint8_t {
|
|
k8Bit = 8,
|
|
k10Bit = 10,
|
|
k12Bit = 12,
|
|
};
|
|
|
|
enum class ColorSpace : uint8_t {
|
|
CS_UNKNOWN = 0, // Unknown (in this case the color space must be signaled
|
|
// outside the VP9 bitstream).
|
|
CS_BT_601 = 1, // CS_BT_601 Rec. ITU-R BT.601-7
|
|
CS_BT_709 = 2, // Rec. ITU-R BT.709-6
|
|
CS_SMPTE_170 = 3, // SMPTE-170
|
|
CS_SMPTE_240 = 4, // SMPTE-240
|
|
CS_BT_2020 = 5, // Rec. ITU-R BT.2020-2
|
|
CS_RESERVED = 6, // Reserved
|
|
CS_RGB = 7, // sRGB (IEC 61966-2-1)
|
|
};
|
|
|
|
enum class ColorRange {
|
|
kStudio, // Studio swing:
|
|
// For BitDepth equals 8:
|
|
// Y is between 16 and 235 inclusive.
|
|
// U and V are between 16 and 240 inclusive.
|
|
// For BitDepth equals 10:
|
|
// Y is between 64 and 940 inclusive.
|
|
// U and V are between 64 and 960 inclusive.
|
|
// For BitDepth equals 12:
|
|
// Y is between 256 and 3760.
|
|
// U and V are between 256 and 3840 inclusive.
|
|
kFull // Full swing; no restriction on Y, U, V values.
|
|
};
|
|
|
|
enum class YuvSubsampling {
|
|
k444,
|
|
k440,
|
|
k422,
|
|
k420,
|
|
};
|
|
|
|
struct FrameInfo {
|
|
int profile = 0; // Profile 0-3 are valid.
|
|
absl::optional<uint8_t> show_existing_frame;
|
|
bool is_keyframe = false;
|
|
bool show_frame = false;
|
|
bool error_resilient = false;
|
|
BitDept bit_detph = BitDept::k8Bit;
|
|
ColorSpace color_space = ColorSpace::CS_UNKNOWN;
|
|
ColorRange color_range;
|
|
YuvSubsampling sub_sampling;
|
|
int frame_width = 0;
|
|
int frame_height = 0;
|
|
int render_width = 0;
|
|
int render_height = 0;
|
|
int base_qp = 0;
|
|
};
|
|
|
|
// Parses frame information for a VP9 key-frame or all-intra frame from a
|
|
// bitstream. Returns nullopt on failure or if not a key-frame.
|
|
absl::optional<FrameInfo> ParseIntraFrameInfo(const uint8_t* buf,
|
|
size_t length);
|
|
|
|
} // namespace vp9
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
|