avformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth value

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-07-30 11:55:26 -03:00
parent 0d597a69ba
commit 9a44ec9410
2 changed files with 10 additions and 8 deletions

View File

@ -94,9 +94,12 @@ static inline void uvlc(GetBitContext *gb)
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
{
seq_params->high_bitdepth = get_bits1(gb);
if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && seq_params->high_bitdepth)
seq_params->twelve_bit = get_bits1(gb);
int twelve_bit = 0;
int high_bitdepth = get_bits1(gb);
if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && high_bitdepth)
twelve_bit = get_bits1(gb);
seq_params->bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
if (seq_params->profile == FF_PROFILE_AV1_HIGH)
seq_params->monochrome = 0;
@ -135,7 +138,7 @@ static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *
seq_params->chroma_subsampling_x = 0;
seq_params->chroma_subsampling_y = 0;
} else {
if (seq_params->twelve_bit) {
if (twelve_bit) {
seq_params->chroma_subsampling_x = get_bits1(gb);
if (seq_params->chroma_subsampling_x)
seq_params->chroma_subsampling_y = get_bits1(gb);
@ -383,8 +386,8 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
put_bits(&pbc, 3, seq_params.profile);
put_bits(&pbc, 5, seq_params.level);
put_bits(&pbc, 1, seq_params.tier);
put_bits(&pbc, 1, seq_params.high_bitdepth);
put_bits(&pbc, 1, seq_params.twelve_bit);
put_bits(&pbc, 1, seq_params.bitdepth > 8);
put_bits(&pbc, 1, seq_params.bitdepth == 12);
put_bits(&pbc, 1, seq_params.monochrome);
put_bits(&pbc, 1, seq_params.chroma_subsampling_x);
put_bits(&pbc, 1, seq_params.chroma_subsampling_y);

View File

@ -29,8 +29,7 @@ typedef struct AV1SequenceParameters {
uint8_t profile;
uint8_t level;
uint8_t tier;
uint8_t high_bitdepth;
uint8_t twelve_bit;
uint8_t bitdepth;
uint8_t monochrome;
uint8_t chroma_subsampling_x;
uint8_t chroma_subsampling_y;