#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/parsers/h264_parser.h"
#include <cstring>
#include <limits>
#include <memory>
#include "base/logging.h"
#include "base/notreached.h"
#include "base/numerics/safe_math.h"
#include "media/base/subsample_entry.h"
#include "media/parsers/bit_reader_macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
namespace media {
bool H264SliceHeader::IsPSlice() const { … }
bool H264SliceHeader::IsBSlice() const { … }
bool H264SliceHeader::IsISlice() const { … }
bool H264SliceHeader::IsSPSlice() const { … }
bool H264SliceHeader::IsSISlice() const { … }
H264NALU::H264NALU() = default;
void H264SPS::GetLevelConfigFromProfileLevel(VideoCodecProfile profile,
uint8_t level,
int* level_idc,
bool* constraint_set3_flag) { … }
H264SPS::H264SPS() { … }
H264SPS& H264SPS::operator=(const H264SPS&) = default;
H264SPS::H264SPS(H264SPS&&) noexcept = default;
std::optional<gfx::Size> H264SPS::GetCodedSize() const { … }
std::optional<gfx::Rect> H264SPS::GetVisibleRect() const { … }
VideoColorSpace H264SPS::GetColorSpace() const { … }
VideoChromaSampling H264SPS::GetChromaSampling() const { … }
uint8_t H264SPS::GetIndicatedLevel() const { … }
bool H264SPS::CheckIndicatedLevelWithinTarget(uint8_t target_level) const { … }
H264PPS::H264PPS() { … }
H264PPS::H264PPS(H264PPS&&) noexcept = default;
H264SliceHeader::H264SliceHeader() { … }
H264SliceHeader::H264SliceHeader(const H264SliceHeader& t) = default;
H264SliceHeader& H264SliceHeader::operator=(const H264SliceHeader& t) = default;
H264SEIMessage::H264SEIMessage() { … }
gfx::HdrMetadataCta861_3 H264SEIContentLightLevelInfo::ToGfx() const { … }
gfx::HdrMetadataSmpteSt2086 H264SEIMasteringDisplayInfo::ToGfx() const { … }
H264SEI::H264SEI() = default;
H264SEI::~H264SEI() = default;
static const int kTableSarWidth[] = …;
static const int kTableSarHeight[] = …;
static_assert …;
H264Parser::H264Parser() { … }
H264Parser::~H264Parser() = default;
void H264Parser::Reset() { … }
void H264Parser::SetStream(const uint8_t* stream, off_t stream_size) { … }
void H264Parser::SetEncryptedStream(
const uint8_t* stream,
off_t stream_size,
const std::vector<SubsampleEntry>& subsamples) { … }
const H264PPS* H264Parser::GetPPS(int pps_id) const { … }
const H264SPS* H264Parser::GetSPS(int sps_id) const { … }
static inline bool IsStartCode(const uint8_t* data) { … }
bool H264Parser::FindStartCode(const uint8_t* data,
off_t data_size,
off_t* offset,
off_t* start_code_size) { … }
bool H264Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) { … }
bool H264Parser::FindStartCodeInClearRanges(
const uint8_t* data,
off_t data_size,
const Ranges<const uint8_t*>& encrypted_ranges,
off_t* offset,
off_t* start_code_size) { … }
VideoCodecProfile H264Parser::ProfileIDCToVideoCodecProfile(int profile_idc) { … }
bool H264Parser::ParseNALUs(const uint8_t* stream,
size_t stream_size,
std::vector<H264NALU>* nalus) { … }
H264Parser::Result H264Parser::AdvanceToNextNALU(H264NALU* nalu) { … }
static const uint8_t kDefault4x4Intra[kH264ScalingList4x4Length] = …;
static const uint8_t kDefault4x4Inter[kH264ScalingList4x4Length] = …;
static const uint8_t kDefault8x8Intra[kH264ScalingList8x8Length] = …;
static const uint8_t kDefault8x8Inter[kH264ScalingList8x8Length] = …;
static inline void DefaultScalingList4x4(
int i,
uint8_t scaling_list4x4[][kH264ScalingList4x4Length]) { … }
static inline void DefaultScalingList8x8(
int i,
uint8_t scaling_list8x8[][kH264ScalingList8x8Length]) { … }
static void FallbackScalingList4x4(
int i,
const uint8_t default_scaling_list_intra[],
const uint8_t default_scaling_list_inter[],
uint8_t scaling_list4x4[][kH264ScalingList4x4Length]) { … }
static void FallbackScalingList8x8(
int i,
const uint8_t default_scaling_list_intra[],
const uint8_t default_scaling_list_inter[],
uint8_t scaling_list8x8[][kH264ScalingList8x8Length]) { … }
H264Parser::Result H264Parser::ParseScalingList(int size,
uint8_t* scaling_list,
bool* use_default) { … }
H264Parser::Result H264Parser::ParseSPSScalingLists(H264SPS* sps) { … }
H264Parser::Result H264Parser::ParsePPSScalingLists(const H264SPS& sps,
H264PPS* pps) { … }
H264Parser::Result H264Parser::ParseAndIgnoreHRDParameters(
bool* hrd_parameters_present) { … }
H264Parser::Result H264Parser::ParseVUIParameters(H264SPS* sps) { … }
static void FillDefaultSeqScalingLists(H264SPS* sps) { … }
H264Parser::Result H264Parser::ParseSPS(int* sps_id) { … }
H264Parser::Result H264Parser::ParsePPS(int* pps_id) { … }
H264Parser::Result H264Parser::ParseSPSExt(int* sps_id) { … }
H264Parser::Result H264Parser::ParseRefPicListModification(
int num_ref_idx_active_minus1,
H264ModificationOfPicNum* ref_list_mods) { … }
H264Parser::Result H264Parser::ParseRefPicListModifications(
H264SliceHeader* shdr) { … }
H264Parser::Result H264Parser::ParseWeightingFactors(
int num_ref_idx_active_minus1,
int chroma_array_type,
int luma_log2_weight_denom,
int chroma_log2_weight_denom,
H264WeightingFactors* w_facts) { … }
H264Parser::Result H264Parser::ParsePredWeightTable(const H264SPS& sps,
H264SliceHeader* shdr) { … }
H264Parser::Result H264Parser::ParseDecRefPicMarking(H264SliceHeader* shdr) { … }
H264Parser::Result H264Parser::ParseSliceHeader(const H264NALU& nalu,
H264SliceHeader* shdr) { … }
H264Parser::Result H264Parser::ParseSEI(H264SEI* sei) { … }
std::vector<SubsampleEntry> H264Parser::GetCurrentSubsamples() { … }
}