TUT HEVC Encoder
Loading...
Searching...
No Matches
strategyselector.h
Go to the documentation of this file.
1#ifndef STRATEGYSELECTOR_H_
2#define STRATEGYSELECTOR_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
41#include "global.h" // IWYU pragma: keep
42
43#if defined(KVZ_DEBUG) && !defined(DEBUG_STRATEGYSELECTOR)
44# define DEBUG_STRATEGYSELECTOR
45#endif
46
47typedef struct {
48 const char *type; //Type of the function, usually its name
49 const char *strategy_name; //Name of the strategy (e.g. sse2)
50 unsigned int priority; //Priority. 0 = lowest (default strategy)
51 void *fptr; //Pointer to the function
53
54typedef struct {
55 unsigned int count;
56 unsigned int allocated;//How much memory is allocated
59
60#define STRATEGY_LIST_ALLOC_SIZE 16
61
62typedef struct {
63 const char *strategy_type;
64 void **fptr;
66
67typedef struct {
68 struct {
69 int mmx;
70 int sse;
71 int sse2;
72 int sse3;
73 int ssse3;
74 int sse41;
75 int sse42;
76 int avx;
77 int avx2;
78
80 } intel_flags;
81
82 struct {
84 } powerpc_flags;
85
86 struct {
87 int neon;
88 } arm_flags;
89
93
97
98int kvz_strategyselector_init(int32_t cpuid, uint8_t bitdepth, uint8_t enable_logging_output);
99int kvz_strategyselector_register(void *opaque, const char *type, const char *strategy_name, int priority, void *fptr);
100
101
102//Strategy to include
111
123
124#endif //STRATEGYSELECTOR_H_
Header that is included in every other header.
#define MAX_TILES_PER_DIM
Definition global.h:232
Interface for transform functions.
#define STRATEGIES_DCT_EXPORTS
Definition strategies-dct.h:69
Interface for quantization functions.
#define STRATEGIES_ENCODE_EXPORTS
Definition strategies-encode.h:64
Interface for intra prediction functions.
#define STRATEGIES_INTRA_EXPORTS
Definition strategies-intra.h:72
Interface for subpixel interpolation functions.
#define STRATEGIES_IPOL_EXPORTS
Definition strategies-ipol.h:141
Interface for hash functions.
#define STRATEGIES_NAL_EXPORTS
Definition strategies-nal.h:65
Interface for distortion metric functions.
#define STRATEGIES_PICTURE_EXPORTS
Definition strategies-picture.h:197
Interface for quantization functions.
#define STRATEGIES_QUANT_EXPORTS
Definition strategies-quant.h:78
Interface for sao functions.
#define STRATEGIES_SAO_EXPORTS
Definition strategies-sao.h:77
hardware_flags_t kvz_g_strategies_available
Definition strategyselector.c:47
hardware_flags_t kvz_g_strategies_in_use
Definition strategyselector.c:46
int kvz_strategyselector_register(void *opaque, const char *type, const char *strategy_name, int priority, void *fptr)
Definition strategyselector.c:233
static const strategy_to_select_t strategies_to_select[]
Definition strategyselector.h:112
hardware_flags_t kvz_g_hardware_flags
Definition strategyselector.c:45
int kvz_strategyselector_init(int32_t cpuid, uint8_t bitdepth, uint8_t enable_logging_output)
Definition strategyselector.c:55
Definition strategyselector.h:67
int sse
Definition strategyselector.h:70
int sse2
Definition strategyselector.h:71
int ssse3
Definition strategyselector.h:73
int sse3
Definition strategyselector.h:72
int avx2
Definition strategyselector.h:77
int avx
Definition strategyselector.h:76
int mmx
Definition strategyselector.h:69
int sse42
Definition strategyselector.h:75
int physical_cpu_count
Definition strategyselector.h:91
int neon
Definition strategyselector.h:87
int sse41
Definition strategyselector.h:74
int altivec
Definition strategyselector.h:83
int logical_cpu_count
Definition strategyselector.h:90
bool hyper_threading
Definition strategyselector.h:79
Definition strategyselector.h:54
unsigned int count
Definition strategyselector.h:55
strategy_t * strategies
Definition strategyselector.h:57
unsigned int allocated
Definition strategyselector.h:56
Definition strategyselector.h:47
unsigned int priority
Definition strategyselector.h:50
const char * type
Definition strategyselector.h:48
void * fptr
Definition strategyselector.h:51
const char * strategy_name
Definition strategyselector.h:49
Definition strategyselector.h:62
void ** fptr
Definition strategyselector.h:64
const char * strategy_type
Definition strategyselector.h:63