]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cbs_av1: always store temporal_id and spatial_id in CodedBitstreamAV1Context
authorJames Almer <jamrial@gmail.com>
Sun, 23 Aug 2020 17:30:23 +0000 (14:30 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 23 Aug 2020 17:34:32 +0000 (14:34 -0300)
Also infer them when not coded in the bitstream.

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/cbs_av1.c
libavcodec/cbs_av1_syntax_template.c

index 75e9cb78dfef29964d568a6f79a5feee3869a570..72ad18151e19905c62e669c7b5f737aabecad74a 100644 (file)
@@ -920,9 +920,6 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
     start_pos = get_bits_count(&gbc);
 
     if (obu->header.obu_extension_flag) {
-        priv->temporal_id = obu->header.temporal_id;
-        priv->spatial_id  = obu->header.spatial_id;
-
         if (obu->header.obu_type != AV1_OBU_SEQUENCE_HEADER &&
             obu->header.obu_type != AV1_OBU_TEMPORAL_DELIMITER &&
             priv->operating_point_idc) {
@@ -934,9 +931,6 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
                 // Decoding will drop this OBU at this operating point.
             }
         }
-    } else {
-        priv->temporal_id = 0;
-        priv->spatial_id  = 0;
     }
 
     switch (obu->header.obu_type) {
index a315e8868a51145252c2ba61d1324378b93c5182..240fa188e4ac168a9bf500f6fed739fc0ccedba4 100644 (file)
@@ -19,6 +19,7 @@
 static int FUNC(obu_header)(CodedBitstreamContext *ctx, RWContext *rw,
                             AV1RawOBUHeader *current)
 {
+    CodedBitstreamAV1Context *priv = ctx->priv_data;
     int err;
 
     HEADER("OBU header");
@@ -35,8 +36,14 @@ static int FUNC(obu_header)(CodedBitstreamContext *ctx, RWContext *rw,
         fb(3, temporal_id);
         fb(2, spatial_id);
         fc(3, extension_header_reserved_3bits, 0, 0);
+    } else {
+        infer(temporal_id, 0);
+        infer(spatial_id, 0);
     }
 
+    priv->temporal_id = current->temporal_id;
+    priv->spatial_id  = current->spatial_id;
+
     return 0;
 }