Coverage Report

Created: 2025-08-26 06:38

/src/libavc/encoder/svc/isvce_cabac_utils.h
Line
Count
Source (jump to first uncovered line)
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
*******************************************************************************
23
* @file
24
*  isvce_cabac_utils.h
25
*
26
* @brief
27
*  Contains function declarations for function declared in
28
*  isvce_svc_cabac_utils.c
29
*
30
* @author
31
*  ittiam
32
*
33
* @remarks
34
*  None
35
*
36
*******************************************************************************
37
*/
38
39
#ifndef _ISVCE_CABAC_UTILS_H_
40
#define _ISVCE_CABAC_UTILS_H_
41
42
#include "ih264_typedefs.h"
43
#include "isvc_macros.h"
44
#include "isvc_defs.h"
45
#include "isvc_cabac_tables.h"
46
#include "isvce_cabac_structs.h"
47
#include "isvce_cabac.h"
48
49
static FORCEINLINE void isvce_cabac_enc_base_mode_flag(isvce_cabac_ctxt_t *ps_cabac_ctxt,
50
                                                       UWORD8 u1_base_mode_flag)
51
3.43M
{
52
3.43M
    UWORD8 u1_ctx_inc;
53
3.43M
    UWORD8 u1_a, u1_b;
54
55
3.43M
    const UWORD32 u4_ctxidx_offset = BASE_MODE_FLAG;
56
57
3.43M
    u1_a = !ps_cabac_ctxt->ps_left_ctxt_mb_info->u1_base_mode_flag;
58
3.43M
    u1_b = !ps_cabac_ctxt->ps_top_ctxt_mb_info->u1_base_mode_flag;
59
60
3.43M
    u1_ctx_inc = u1_a + u1_b;
61
62
3.43M
    isvce_cabac_encode_bin(ps_cabac_ctxt, u1_base_mode_flag,
63
3.43M
                           ps_cabac_ctxt->au1_cabac_ctxt_table + u4_ctxidx_offset + u1_ctx_inc);
64
3.43M
}
65
66
static FORCEINLINE void isvce_cabac_enc_residual_prediction_flag(isvce_cabac_ctxt_t *ps_cabac_ctxt,
67
                                                                 UWORD8 u1_base_mode_flag,
68
                                                                 UWORD8 u1_residual_prediction_flag)
69
128k
{
70
128k
    const UWORD32 u4_ctxidx_offset = RESIDUAL_PREDICTION_FLAG;
71
128k
    UWORD8 u1_ctx_inc = !u1_base_mode_flag;
72
73
128k
    isvce_cabac_encode_bin(ps_cabac_ctxt, u1_residual_prediction_flag,
74
128k
                           ps_cabac_ctxt->au1_cabac_ctxt_table + u4_ctxidx_offset + u1_ctx_inc);
75
128k
}
76
77
static FORCEINLINE void isvce_cabac_enc_motion_prediction_flag(isvce_cabac_ctxt_t *ps_cabac_ctxt,
78
                                                               UWORD8 u1_motion_prediction_flag,
79
                                                               UWORD8 u1_is_l0_mvp)
80
93.8k
{
81
93.8k
    const UWORD32 u4_ctxidx_offset =
82
93.8k
        u1_is_l0_mvp ? MOTION_PREDICTION_FLAG_L0 : MOTION_PREDICTION_FLAG_L1;
83
84
93.8k
    isvce_cabac_encode_bin(ps_cabac_ctxt, u1_motion_prediction_flag,
85
93.8k
                           ps_cabac_ctxt->au1_cabac_ctxt_table + u4_ctxidx_offset);
86
93.8k
}
87
88
#endif