[FFmpeg-cvslog] avformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth value

James Almer git at videolan.org
Sat Aug 3 18:43:29 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Jul 30 11:55:26 2019 -0300| [9a44ec94100a647df6920c65cccdd605a2e6865b] | committer: James Almer

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

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a44ec94100a647df6920c65cccdd605a2e6865b
---

 libavformat/av1.c | 15 +++++++++------
 libavformat/av1.h |  3 +--
 2 files changed, 10 insertions(+), 8 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);
diff --git a/libavformat/av1.h b/libavformat/av1.h
index c07fb740e9..9354889afe 100644
--- a/libavformat/av1.h
+++ b/libavformat/av1.h
@@ -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;



More information about the ffmpeg-cvslog mailing list