Renamed H264BitReader to H26xBitReader.
Change-Id: I960a636541a5cadcce5f41e1a75c3ddfbbfaa803
This commit is contained in:
parent
144cdc5e59
commit
43dc6248a3
|
@ -19,12 +19,12 @@
|
|||
'decoder_configuration.h',
|
||||
'ec3_audio_util.cc',
|
||||
'ec3_audio_util.h',
|
||||
'h264_bit_reader.cc',
|
||||
'h264_bit_reader.h',
|
||||
'h264_byte_to_unit_stream_converter.cc',
|
||||
'h264_byte_to_unit_stream_converter.h',
|
||||
'h264_parser.cc',
|
||||
'h264_parser.h',
|
||||
'h26x_bit_reader.cc',
|
||||
'h26x_bit_reader.h',
|
||||
'hevc_decoder_configuration.cc',
|
||||
'hevc_decoder_configuration.h',
|
||||
'nal_unit_to_byte_stream_converter.cc',
|
||||
|
@ -49,9 +49,9 @@
|
|||
'sources': [
|
||||
'avc_decoder_configuration_unittest.cc',
|
||||
'ec3_audio_util_unittest.cc',
|
||||
'h264_bit_reader_unittest.cc',
|
||||
'h264_byte_to_unit_stream_converter_unittest.cc',
|
||||
'h264_parser_unittest.cc',
|
||||
'h26x_bit_reader_unittest.cc',
|
||||
'hevc_decoder_configuration_unittest.cc',
|
||||
'nal_unit_to_byte_stream_converter_unittest.cc',
|
||||
'nalu_reader_unittest.cc',
|
||||
|
|
|
@ -320,7 +320,7 @@ static void FallbackScalingList8x8(
|
|||
}
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseScalingList(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParseScalingList(H26xBitReader* br,
|
||||
int size,
|
||||
int* scaling_list,
|
||||
bool* use_default) {
|
||||
|
@ -350,7 +350,7 @@ H264Parser::Result H264Parser::ParseScalingList(H264BitReader* br,
|
|||
return kOk;
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseSPSScalingLists(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParseSPSScalingLists(H26xBitReader* br,
|
||||
H264SPS* sps) {
|
||||
// See 7.4.2.1.1.
|
||||
bool seq_scaling_list_present_flag;
|
||||
|
@ -402,7 +402,7 @@ H264Parser::Result H264Parser::ParseSPSScalingLists(H264BitReader* br,
|
|||
return kOk;
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParsePPSScalingLists(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParsePPSScalingLists(H26xBitReader* br,
|
||||
const H264SPS& sps,
|
||||
H264PPS* pps) {
|
||||
// See 7.4.2.2.
|
||||
|
@ -473,7 +473,7 @@ H264Parser::Result H264Parser::ParsePPSScalingLists(H264BitReader* br,
|
|||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseAndIgnoreHRDParameters(
|
||||
H264BitReader* br, bool* hrd_parameters_present) {
|
||||
H26xBitReader* br, bool* hrd_parameters_present) {
|
||||
int data;
|
||||
READ_BOOL_OR_RETURN(&data); // {nal,vcl}_hrd_parameters_present_flag
|
||||
if (!data)
|
||||
|
@ -495,7 +495,7 @@ H264Parser::Result H264Parser::ParseAndIgnoreHRDParameters(
|
|||
return kOk;
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseVUIParameters(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParseVUIParameters(H26xBitReader* br,
|
||||
H264SPS* sps) {
|
||||
bool aspect_ratio_info_present_flag;
|
||||
READ_BOOL_OR_RETURN(&aspect_ratio_info_present_flag);
|
||||
|
@ -590,9 +590,9 @@ H264Parser::Result H264Parser::ParseSPS(const Nalu& nalu, int* sps_id) {
|
|||
// See 7.4.2.1.
|
||||
int data;
|
||||
Result res;
|
||||
H264BitReader reader;
|
||||
H26xBitReader reader;
|
||||
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
|
||||
H264BitReader* br = &reader;
|
||||
H26xBitReader* br = &reader;
|
||||
|
||||
*sps_id = -1;
|
||||
|
||||
|
@ -715,9 +715,9 @@ H264Parser::Result H264Parser::ParsePPS(const Nalu& nalu, int* pps_id) {
|
|||
// See 7.4.2.2.
|
||||
const H264SPS* sps;
|
||||
Result res;
|
||||
H264BitReader reader;
|
||||
H26xBitReader reader;
|
||||
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
|
||||
H264BitReader* br = &reader;
|
||||
H26xBitReader* br = &reader;
|
||||
|
||||
*pps_id = -1;
|
||||
|
||||
|
@ -786,7 +786,7 @@ H264Parser::Result H264Parser::ParsePPS(const Nalu& nalu, int* pps_id) {
|
|||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseRefPicListModification(
|
||||
H264BitReader* br,
|
||||
H26xBitReader* br,
|
||||
int num_ref_idx_active_minus1,
|
||||
H264ModificationOfPicNum* ref_list_mods) {
|
||||
H264ModificationOfPicNum* pic_num_mod;
|
||||
|
@ -830,7 +830,7 @@ H264Parser::Result H264Parser::ParseRefPicListModification(
|
|||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseRefPicListModifications(
|
||||
H264BitReader* br, H264SliceHeader* shdr) {
|
||||
H26xBitReader* br, H264SliceHeader* shdr) {
|
||||
Result res;
|
||||
|
||||
if (!shdr->IsISlice() && !shdr->IsSISlice()) {
|
||||
|
@ -857,7 +857,7 @@ H264Parser::Result H264Parser::ParseRefPicListModifications(
|
|||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseWeightingFactors(
|
||||
H264BitReader* br,
|
||||
H26xBitReader* br,
|
||||
int num_ref_idx_active_minus1,
|
||||
int chroma_array_type,
|
||||
int luma_log2_weight_denom,
|
||||
|
@ -901,7 +901,7 @@ H264Parser::Result H264Parser::ParseWeightingFactors(
|
|||
return kOk;
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParsePredWeightTable(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParsePredWeightTable(H26xBitReader* br,
|
||||
const H264SPS& sps,
|
||||
H264SliceHeader* shdr) {
|
||||
READ_UE_OR_RETURN(&shdr->luma_log2_weight_denom);
|
||||
|
@ -934,7 +934,7 @@ H264Parser::Result H264Parser::ParsePredWeightTable(H264BitReader* br,
|
|||
return kOk;
|
||||
}
|
||||
|
||||
H264Parser::Result H264Parser::ParseDecRefPicMarking(H264BitReader* br,
|
||||
H264Parser::Result H264Parser::ParseDecRefPicMarking(H26xBitReader* br,
|
||||
H264SliceHeader* shdr) {
|
||||
if (shdr->idr_pic_flag) {
|
||||
READ_BOOL_OR_RETURN(&shdr->no_output_of_prior_pics_flag);
|
||||
|
@ -986,9 +986,9 @@ H264Parser::Result H264Parser::ParseSliceHeader(const Nalu& nalu,
|
|||
const H264SPS* sps;
|
||||
const H264PPS* pps;
|
||||
Result res;
|
||||
H264BitReader reader;
|
||||
H26xBitReader reader;
|
||||
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
|
||||
H264BitReader* br = &reader;
|
||||
H26xBitReader* br = &reader;
|
||||
|
||||
memset(shdr, 0, sizeof(*shdr));
|
||||
|
||||
|
@ -1134,9 +1134,9 @@ H264Parser::Result H264Parser::ParseSliceHeader(const Nalu& nalu,
|
|||
H264Parser::Result H264Parser::ParseSEI(const Nalu& nalu,
|
||||
H264SEIMessage* sei_msg) {
|
||||
int byte;
|
||||
H264BitReader reader;
|
||||
H26xBitReader reader;
|
||||
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
|
||||
H264BitReader* br = &reader;
|
||||
H26xBitReader* br = &reader;
|
||||
|
||||
memset(sei_msg, 0, sizeof(*sei_msg));
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include "packager/media/filters/h264_bit_reader.h"
|
||||
#include "packager/media/filters/h26x_bit_reader.h"
|
||||
#include "packager/media/filters/nalu_reader.h"
|
||||
|
||||
namespace edash_packager {
|
||||
|
@ -286,34 +286,34 @@ class H264Parser {
|
|||
|
||||
private:
|
||||
// Parse scaling lists (see spec).
|
||||
Result ParseScalingList(H264BitReader* br,
|
||||
Result ParseScalingList(H26xBitReader* br,
|
||||
int size,
|
||||
int* scaling_list,
|
||||
bool* use_default);
|
||||
Result ParseSPSScalingLists(H264BitReader* br, H264SPS* sps);
|
||||
Result ParsePPSScalingLists(H264BitReader* br,
|
||||
Result ParseSPSScalingLists(H26xBitReader* br, H264SPS* sps);
|
||||
Result ParsePPSScalingLists(H26xBitReader* br,
|
||||
const H264SPS& sps,
|
||||
H264PPS* pps);
|
||||
|
||||
// Parse optional VUI parameters in SPS (see spec).
|
||||
Result ParseVUIParameters(H264BitReader* br, H264SPS* sps);
|
||||
Result ParseVUIParameters(H26xBitReader* br, H264SPS* sps);
|
||||
// Set |hrd_parameters_present| to true only if they are present.
|
||||
Result ParseAndIgnoreHRDParameters(H264BitReader* br,
|
||||
Result ParseAndIgnoreHRDParameters(H26xBitReader* br,
|
||||
bool* hrd_parameters_present);
|
||||
|
||||
// Parse reference picture lists' modifications (see spec).
|
||||
Result ParseRefPicListModifications(H264BitReader* br, H264SliceHeader* shdr);
|
||||
Result ParseRefPicListModification(H264BitReader* br,
|
||||
Result ParseRefPicListModifications(H26xBitReader* br, H264SliceHeader* shdr);
|
||||
Result ParseRefPicListModification(H26xBitReader* br,
|
||||
int num_ref_idx_active_minus1,
|
||||
H264ModificationOfPicNum* ref_list_mods);
|
||||
|
||||
// Parse prediction weight table (see spec).
|
||||
Result ParsePredWeightTable(H264BitReader* br,
|
||||
Result ParsePredWeightTable(H26xBitReader* br,
|
||||
const H264SPS& sps,
|
||||
H264SliceHeader* shdr);
|
||||
|
||||
// Parse weighting factors (see spec).
|
||||
Result ParseWeightingFactors(H264BitReader* br,
|
||||
Result ParseWeightingFactors(H26xBitReader* br,
|
||||
int num_ref_idx_active_minus1,
|
||||
int chroma_array_type,
|
||||
int luma_log2_weight_denom,
|
||||
|
@ -321,7 +321,7 @@ class H264Parser {
|
|||
H264WeightingFactors* w_facts);
|
||||
|
||||
// Parse decoded reference picture marking information (see spec).
|
||||
Result ParseDecRefPicMarking(H264BitReader* br, H264SliceHeader* shdr);
|
||||
Result ParseDecRefPicMarking(H26xBitReader* br, H264SliceHeader* shdr);
|
||||
|
||||
// PPSes and SPSes stored for future reference.
|
||||
typedef std::map<int, H264SPS*> SPSById;
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/media/filters/h264_bit_reader.h"
|
||||
#include "packager/media/filters/h26x_bit_reader.h"
|
||||
|
||||
namespace edash_packager {
|
||||
namespace media {
|
||||
|
||||
H264BitReader::H264BitReader()
|
||||
H26xBitReader::H26xBitReader()
|
||||
: data_(NULL),
|
||||
bytes_left_(0),
|
||||
curr_byte_(0),
|
||||
|
@ -16,9 +16,9 @@ H264BitReader::H264BitReader()
|
|||
prev_two_bytes_(0),
|
||||
emulation_prevention_bytes_(0) {}
|
||||
|
||||
H264BitReader::~H264BitReader() {}
|
||||
H26xBitReader::~H26xBitReader() {}
|
||||
|
||||
bool H264BitReader::Initialize(const uint8_t* data, off_t size) {
|
||||
bool H26xBitReader::Initialize(const uint8_t* data, off_t size) {
|
||||
DCHECK(data);
|
||||
|
||||
if (size < 1)
|
||||
|
@ -34,7 +34,7 @@ bool H264BitReader::Initialize(const uint8_t* data, off_t size) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool H264BitReader::UpdateCurrByte() {
|
||||
bool H26xBitReader::UpdateCurrByte() {
|
||||
if (bytes_left_ < 1)
|
||||
return false;
|
||||
|
||||
|
@ -65,7 +65,7 @@ bool H264BitReader::UpdateCurrByte() {
|
|||
// Read |num_bits| (1 to 31 inclusive) from the stream and return them
|
||||
// in |out|, with first bit in the stream as MSB in |out| at position
|
||||
// (|num_bits| - 1).
|
||||
bool H264BitReader::ReadBits(int num_bits, int* out) {
|
||||
bool H26xBitReader::ReadBits(int num_bits, int* out) {
|
||||
int bits_left = num_bits;
|
||||
*out = 0;
|
||||
DCHECK(num_bits <= 31);
|
||||
|
@ -86,7 +86,7 @@ bool H264BitReader::ReadBits(int num_bits, int* out) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool H264BitReader::ReadUE(int* val) {
|
||||
bool H26xBitReader::ReadUE(int* val) {
|
||||
int num_bits = -1;
|
||||
int bit;
|
||||
int rest;
|
||||
|
@ -113,7 +113,7 @@ bool H264BitReader::ReadUE(int* val) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool H264BitReader::ReadSE(int* val) {
|
||||
bool H26xBitReader::ReadSE(int* val) {
|
||||
int ue;
|
||||
|
||||
// See Chapter 9 in the spec.
|
||||
|
@ -128,11 +128,11 @@ bool H264BitReader::ReadSE(int* val) {
|
|||
return true;
|
||||
}
|
||||
|
||||
off_t H264BitReader::NumBitsLeft() {
|
||||
off_t H26xBitReader::NumBitsLeft() {
|
||||
return (num_remaining_bits_in_curr_byte_ + bytes_left_ * 8);
|
||||
}
|
||||
|
||||
bool H264BitReader::HasMoreRBSPData() {
|
||||
bool H26xBitReader::HasMoreRBSPData() {
|
||||
// Make sure we have more bits, if we are at 0 bits in current byte
|
||||
// and updating current byte fails, we don't have more data anyway.
|
||||
if (num_remaining_bits_in_curr_byte_ == 0 && !UpdateCurrByte())
|
||||
|
@ -149,7 +149,7 @@ bool H264BitReader::HasMoreRBSPData() {
|
|||
((1 << (num_remaining_bits_in_curr_byte_ - 1)) - 1)) != 0;
|
||||
}
|
||||
|
||||
size_t H264BitReader::NumEmulationPreventionBytesRead() {
|
||||
size_t H26xBitReader::NumEmulationPreventionBytesRead() {
|
||||
return emulation_prevention_bytes_;
|
||||
}
|
||||
|
|
@ -19,10 +19,10 @@ namespace media {
|
|||
// This is not a generic bit reader class, as it takes into account
|
||||
// H.264 stream-specific constraints, such as skipping emulation-prevention
|
||||
// bytes and stop bits. See spec for more details.
|
||||
class H264BitReader {
|
||||
class H26xBitReader {
|
||||
public:
|
||||
H264BitReader();
|
||||
~H264BitReader();
|
||||
H26xBitReader();
|
||||
~H26xBitReader();
|
||||
|
||||
// Initialize the reader to start reading at |data|, |size| being size
|
||||
// of |data| in bytes.
|
||||
|
@ -77,7 +77,7 @@ class H264BitReader {
|
|||
// Number of emulation preventation bytes (0x000003) we met.
|
||||
size_t emulation_prevention_bytes_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(H264BitReader);
|
||||
DISALLOW_COPY_AND_ASSIGN(H26xBitReader);
|
||||
};
|
||||
|
||||
} // namespace media
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/media/filters/h264_bit_reader.h"
|
||||
#include "packager/media/filters/h26x_bit_reader.h"
|
||||
|
||||
namespace edash_packager {
|
||||
namespace media {
|
||||
|
||||
TEST(H264BitReaderTest, ReadStreamWithoutEscapeAndTrailingZeroBytes) {
|
||||
H264BitReader reader;
|
||||
TEST(H26xBitReaderTest, ReadStreamWithoutEscapeAndTrailingZeroBytes) {
|
||||
H26xBitReader reader;
|
||||
const unsigned char rbsp[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xa0};
|
||||
int dummy = 0;
|
||||
|
||||
|
@ -42,8 +42,8 @@ TEST(H264BitReaderTest, ReadStreamWithoutEscapeAndTrailingZeroBytes) {
|
|||
EXPECT_FALSE(reader.HasMoreRBSPData());
|
||||
}
|
||||
|
||||
TEST(H264BitReaderTest, SingleByteStream) {
|
||||
H264BitReader reader;
|
||||
TEST(H26xBitReaderTest, SingleByteStream) {
|
||||
H26xBitReader reader;
|
||||
const unsigned char rbsp[] = {0x18};
|
||||
int dummy = 0;
|
||||
|
||||
|
@ -57,8 +57,8 @@ TEST(H264BitReaderTest, SingleByteStream) {
|
|||
EXPECT_FALSE(reader.HasMoreRBSPData());
|
||||
}
|
||||
|
||||
TEST(H264BitReaderTest, StopBitOccupyFullByte) {
|
||||
H264BitReader reader;
|
||||
TEST(H26xBitReaderTest, StopBitOccupyFullByte) {
|
||||
H26xBitReader reader;
|
||||
const unsigned char rbsp[] = {0xab, 0x80};
|
||||
int dummy = 0;
|
||||
|
Loading…
Reference in New Issue