Coverage Report

Created: 2023-09-25 07:43

/src/libhevc/decoder/x86/ihevcd_function_selector.c
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
*
3
* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
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
/**
19
*******************************************************************************
20
* @file
21
*  ihevcd_function_selector.c
22
*
23
* @brief
24
*  Contains functions to initialize function pointers used in hevc
25
*
26
* @author
27
*  Naveen
28
*
29
* @par List of Functions:
30
* @remarks
31
*  None
32
*
33
*******************************************************************************
34
*/
35
/*****************************************************************************/
36
/* File Includes                                                             */
37
/*****************************************************************************/
38
#include <stdio.h>
39
#include <stddef.h>
40
#include <stdlib.h>
41
#include <string.h>
42
43
#include "ihevc_typedefs.h"
44
#include "iv.h"
45
#include "ivd.h"
46
#include "ihevc_defs.h"
47
#include "ihevc_debug.h"
48
#include "ihevc_structs.h"
49
#include "ihevc_macros.h"
50
#include "ihevc_platform_macros.h"
51
#include "ihevc_cabac_tables.h"
52
#include "ihevc_disp_mgr.h"
53
#include "ihevc_buf_mgr.h"
54
#include "ihevc_dpb_mgr.h"
55
#include "ihevc_error.h"
56
57
#include "ihevcd_defs.h"
58
#include "ihevcd_function_selector.h"
59
#include "ihevcd_structs.h"
60
61
void ihevcd_init_function_ptr(void *pv_codec)
62
2.42k
{
63
2.42k
    codec_t *ps_codec = (codec_t *)pv_codec;
64
2.42k
    switch(ps_codec->e_processor_arch)
65
2.42k
    {
66
542
        case ARCH_X86_GENERIC:
67
542
            ihevcd_init_function_ptr_generic(pv_codec);
68
542
            break;
69
19
        case ARCH_X86_SSSE3:
70
19
            ihevcd_init_function_ptr_ssse3(pv_codec);
71
19
            break;
72
1.67k
        case ARCH_X86_SSE42:
73
1.67k
            ihevcd_init_function_ptr_sse42(pv_codec);
74
1.67k
            break;
75
0
        case ARCH_X86_AVX2:
76
#ifndef DISABLE_AVX2
77
            ihevcd_init_function_ptr_avx2(pv_codec);
78
#else
79
0
            ihevcd_init_function_ptr_sse42(pv_codec);
80
0
#endif
81
0
            break;
82
182
        default:
83
182
            ihevcd_init_function_ptr_ssse3(pv_codec);
84
182
            break;
85
2.42k
    }
86
2.42k
}
87
88
void ihevcd_init_arch(void *pv_codec)
89
1.62k
{
90
1.62k
    codec_t *ps_codec = (codec_t *)pv_codec;
91
92
1.62k
#ifdef DEFAULT_ARCH
93
#if DEFAULT_ARCH == D_ARCH_X86_GENERIC
94
    ps_codec->e_processor_arch = ARCH_X86_GENERIC;
95
#elif DEFAULT_ARCH == D_ARCH_X86_SSE42
96
1.62k
    ps_codec->e_processor_arch = ARCH_X86_SSE42;
97
#elif DEFAULT_ARCH == D_ARCH_X86_AVX2
98
    ps_codec->e_processor_arch = ARCH_X86_AVX2;
99
#else
100
    ps_codec->e_processor_arch = ARCH_X86_SSSE3;
101
#endif
102
#else
103
    ps_codec->e_processor_arch = ARCH_X86_SSSE3;
104
#endif
105
1.62k
}