[FFmpeg-cvslog] avcodec/evc_parse: use unsigned types in structs where corresponds

James Almer git at videolan.org
Fri Jun 23 15:32:39 EEST 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Jun 22 19:46:22 2023 -0300| [5b966be5b8a4272d51a7486375072e45bdaa8acf] | committer: James Almer

avcodec/evc_parse: use unsigned types in structs where corresponds

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

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

 libavcodec/evc_parse.c | 12 ++++++------
 libavcodec/evc_parse.h | 42 +++++++++++++++++++++---------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/libavcodec/evc_parse.c b/libavcodec/evc_parse.c
index eff4b7bc38..447f6195c2 100644
--- a/libavcodec/evc_parse.c
+++ b/libavcodec/evc_parse.c
@@ -28,11 +28,11 @@ int ff_evc_parse_slice_header(GetBitContext *gb, EVCParserSliceHeader *sh,
     const EVCParserPPS *pps;
     const EVCParserSPS *sps;
     int num_tiles_in_slice = 0;
-    int slice_pic_parameter_set_id;
+    unsigned slice_pic_parameter_set_id;
 
-    slice_pic_parameter_set_id = get_ue_golomb(gb);
+    slice_pic_parameter_set_id = get_ue_golomb_31(gb);
 
-    if (slice_pic_parameter_set_id < 0 || slice_pic_parameter_set_id >= EVC_MAX_PPS_COUNT)
+    if (slice_pic_parameter_set_id >= EVC_MAX_PPS_COUNT)
         return AVERROR_INVALIDDATA;
 
     pps = ps->pps[slice_pic_parameter_set_id];
@@ -59,14 +59,14 @@ int ff_evc_parse_slice_header(GetBitContext *gb, EVCParserSliceHeader *sh,
         if (!sh->arbitrary_slice_flag)
             sh->last_tile_id = get_bits(gb, pps->tile_id_len_minus1 + 1);
         else {
-            sh->num_remaining_tiles_in_slice_minus1 = get_ue_golomb(gb);
+            sh->num_remaining_tiles_in_slice_minus1 = get_ue_golomb_long(gb);
             num_tiles_in_slice = sh->num_remaining_tiles_in_slice_minus1 + 2;
             for (int i = 0; i < num_tiles_in_slice - 1; ++i)
-                sh->delta_tile_id_minus1[i] = get_ue_golomb(gb);
+                sh->delta_tile_id_minus1[i] = get_ue_golomb_long(gb);
         }
     }
 
-    sh->slice_type = get_ue_golomb(gb);
+    sh->slice_type = get_ue_golomb_31(gb);
 
     if (nalu_type == EVC_IDR_NUT)
         sh->no_output_of_prior_pics_flag = get_bits1(gb);
diff --git a/libavcodec/evc_parse.h b/libavcodec/evc_parse.h
index 0f142976f5..55cdd553ea 100644
--- a/libavcodec/evc_parse.h
+++ b/libavcodec/evc_parse.h
@@ -41,27 +41,27 @@
 // u(n)  - unsigned integer using n bits.
 //         When n is "v" in the syntax table, the number of bits varies in a manner dependent on the value of other syntax elements.
 typedef struct EVCParserSliceHeader {
-    int slice_pic_parameter_set_id;                                     // ue(v)
-    int single_tile_in_slice_flag;                                      // u(1)
-    int first_tile_id;                                                  // u(v)
-    int arbitrary_slice_flag;                                           // u(1)
-    int last_tile_id;                                                   // u(v)
-    int num_remaining_tiles_in_slice_minus1;                            // ue(v)
-    int delta_tile_id_minus1[EVC_MAX_TILE_ROWS * EVC_MAX_TILE_COLUMNS]; // ue(v)
-
-    int slice_type;                                                     // ue(v)
-    int no_output_of_prior_pics_flag;                                   // u(1)
-    int mmvd_group_enable_flag;                                         // u(1)
-    int slice_alf_enabled_flag;                                         // u(1)
-
-    int slice_alf_luma_aps_id;                                          // u(5)
-    int slice_alf_map_flag;                                             // u(1)
-    int slice_alf_chroma_idc;                                           // u(2)
-    int slice_alf_chroma_aps_id;                                        // u(5)
-    int slice_alf_chroma_map_flag;                                      // u(1)
-    int slice_alf_chroma2_aps_id;                                       // u(5)
-    int slice_alf_chroma2_map_flag;                                     // u(1)
-    int slice_pic_order_cnt_lsb;                                        // u(v)
+    uint8_t slice_pic_parameter_set_id;                                      // ue(v)
+    uint8_t single_tile_in_slice_flag;                                       // u(1)
+    uint8_t first_tile_id;                                                   // u(v)
+    uint8_t arbitrary_slice_flag;                                            // u(1)
+    uint8_t last_tile_id;                                                    // u(v)
+    uint32_t num_remaining_tiles_in_slice_minus1;                            // ue(v)
+    uint16_t delta_tile_id_minus1[EVC_MAX_TILE_ROWS * EVC_MAX_TILE_COLUMNS]; // ue(v)
+
+    uint8_t slice_type;                                                      // ue(v)
+    uint8_t no_output_of_prior_pics_flag;                                    // u(1)
+    uint8_t mmvd_group_enable_flag;                                          // u(1)
+    uint8_t slice_alf_enabled_flag;                                          // u(1)
+
+    uint8_t slice_alf_luma_aps_id;                                           // u(5)
+    uint8_t slice_alf_map_flag;                                              // u(1)
+    uint8_t slice_alf_chroma_idc;                                            // u(2)
+    uint8_t slice_alf_chroma_aps_id;                                         // u(5)
+    uint8_t slice_alf_chroma_map_flag;                                       // u(1)
+    uint8_t slice_alf_chroma2_aps_id;                                        // u(5)
+    uint8_t slice_alf_chroma2_map_flag;                                      // u(1)
+    uint16_t slice_pic_order_cnt_lsb;                                        // u(v)
 
     // @note
     // Currently the structure does not reflect the entire Slice Header RBSP layout.



More information about the ffmpeg-cvslog mailing list