aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/av1.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-07-30 11:55:26 -0300
committerJames Almer <jamrial@gmail.com>2019-08-03 12:33:14 -0300
commit9a44ec94100a647df6920c65cccdd605a2e6865b (patch)
treeae572f3eed3021a2eeef10e304a9bbf5acc29a29 /libavformat/av1.c
parent0d597a69bad6e98d088f4c17989abd6a6a34084d (diff)
downloadffmpeg-9a44ec94100a647df6920c65cccdd605a2e6865b.tar.gz
avformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth value
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/av1.c')
-rw-r--r--libavformat/av1.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavformat/av1.c b/libavformat/av1.c
index 43e40453c8..b36c5e44ba 100644
--- a/libavformat/av1.c
+++ b/libavformat/av1.c
@@ -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);