Coverage Report

Created: 2025-07-23 06:18

/src/libavc/decoder/svc/isvcd_vui.c
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2022 The Android Open Source Project
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at:
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 *****************************************************************************
18
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19
 */
20
/**
21
 *******************************************************************************
22
 * @file
23
 *  isvcd_vui.c
24
 *
25
 * @brief
26
 *  This file contains routines to parse VUI NAL's
27
 *
28
 * @author
29
 *  Kishore
30
 *
31
 * @remarks
32
 *  None
33
 *
34
 *******************************************************************************
35
 */
36
37
#include "ih264_typedefs.h"
38
#include "ih264_macros.h"
39
#include "ih264_platform_macros.h"
40
#include "ih264d_vui.h"
41
#include "ih264d_bitstrm.h"
42
#include "ih264d_parse_cavlc.h"
43
#include "isvcd_structs.h"
44
#include "ih264d_error_handler.h"
45
46
/*****************************************************************************/
47
/*                                                                           */
48
/*  Function Name : isvcd_parse_vui_ext_parametres                           */
49
/*                                                                           */
50
/*  Description   : This function parses VUI NALs.                           */
51
/*  Inputs        : ps_vu4          pointer to VUI params                    */
52
/*                  ps_bitstrm   Bitstream                                   */
53
/*  Globals       : None                                                     */
54
/*  Processing    : Parses VUI NAL's units and stores the info               */
55
/*  Outputs       : None                                                     */
56
/*  Returns       : None                                                     */
57
/*                                                                           */
58
/*  Issues        : None                                                     */
59
/*                                                                           */
60
/*  Revision History:                                                        */
61
/*                                                                           */
62
/*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
63
/*         06 05 2002   Kishore             Draft                            */
64
/*                                                                           */
65
/*****************************************************************************/
66
67
WORD32 isvcd_parse_vui_ext_parametres(svc_vui_ext_t *ps_svc_vui_ext, dec_bit_stream_t *ps_bitstrm)
68
988
{
69
988
    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
70
988
    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
71
988
    WORD32 ret;
72
988
    UWORD32 u4_i;
73
74
988
    ps_svc_vui_ext->u4_vui_ext_num_entries_minus1 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
75
988
    if(ps_svc_vui_ext->u4_vui_ext_num_entries_minus1 > 1023)
76
89
    {
77
89
        return ERROR_INV_SPS_PPS_T;
78
89
    }
79
80
29.8k
    for(u4_i = 0; u4_i <= ps_svc_vui_ext->u4_vui_ext_num_entries_minus1; u4_i++)
81
29.0k
    {
82
29.0k
        ps_svc_vui_ext->u1_vui_ext_dependency_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 3);
83
29.0k
        ps_svc_vui_ext->u1_vui_ext_quality_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 4);
84
29.0k
        ps_svc_vui_ext->u1_vui_ext_temporal_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 3);
85
29.0k
        ps_svc_vui_ext->u1_vui_ext_timing_info_present_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
86
87
29.0k
        if(1 == ps_svc_vui_ext->u1_vui_ext_timing_info_present_flag[u4_i])
88
2.67k
        {
89
2.67k
            ps_svc_vui_ext->u4_vui_ext_num_units_in_tick[u4_i] =
90
2.67k
                ih264d_get_bits_h264(ps_bitstrm, 32);
91
2.67k
            ps_svc_vui_ext->u4_vui_ext_time_scale[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 32);
92
2.67k
            ps_svc_vui_ext->u1_vui_ext_fixed_frame_rate_flag[u4_i] =
93
2.67k
                ih264d_get_bit_h264(ps_bitstrm);
94
2.67k
        }
95
96
29.0k
        ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i] =
97
29.0k
            ih264d_get_bit_h264(ps_bitstrm);
98
29.0k
        if(ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i])
99
2.70k
        {
100
2.70k
            ret = ih264d_parse_hrd_parametres(&ps_svc_vui_ext->s_nal_hrd[u4_i], ps_bitstrm);
101
2.70k
            if(ret != OK) return ret;
102
2.70k
        }
103
29.0k
        ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i] =
104
29.0k
            ih264d_get_bit_h264(ps_bitstrm);
105
29.0k
        if(ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i])
106
2.59k
        {
107
2.59k
            ret = ih264d_parse_hrd_parametres(&ps_svc_vui_ext->s_vcl_hrd[u4_i], ps_bitstrm);
108
2.59k
            if(ret != OK) return ret;
109
2.59k
        }
110
28.9k
        if(ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i] ||
111
28.9k
           ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i])
112
2.96k
        {
113
2.96k
            ps_svc_vui_ext->u1_vui_ext_low_delay_hrd_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
114
2.96k
        }
115
28.9k
        ps_svc_vui_ext->u1_vui_ext_pic_struct_present_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
116
28.9k
    }
117
761
    return OK;
118
899
}