1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2021 Advanced Micro Devices, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#ifndef _RADEON_TEMPORAL_H
29bf215546Sopenharmony_ci#define _RADEON_TEMPORAL_H
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#include "radeon_video.h"
32bf215546Sopenharmony_ci#include "radeon_vcn_enc.h"
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#define RENCODE_MAX_TEMPORAL_LAYER_PATTERN_SIZE                                     9
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_citypedef struct rvcn_temporal_layer_pattern_entry_s
37bf215546Sopenharmony_ci{
38bf215546Sopenharmony_ci   unsigned    temporal_id;
39bf215546Sopenharmony_ci   unsigned    reference_index_in_table;
40bf215546Sopenharmony_ci   bool        reference_modification;
41bf215546Sopenharmony_ci   unsigned    frame_num_offset;
42bf215546Sopenharmony_ci   unsigned    poc_offset;
43bf215546Sopenharmony_ci   bool        mark_as_reference;
44bf215546Sopenharmony_ci} rvcn_temporal_layer_pattern_entry_t;
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_citypedef struct rvcn_temporal_layer_pattern_table_s
47bf215546Sopenharmony_ci{
48bf215546Sopenharmony_ci   unsigned    pattern_size;
49bf215546Sopenharmony_ci   rvcn_temporal_layer_pattern_entry_t  pattern_table[RENCODE_MAX_TEMPORAL_LAYER_PATTERN_SIZE];
50bf215546Sopenharmony_ci} rvcn_temporal_layer_pattern_table_t;
51bf215546Sopenharmony_ci
52bf215546Sopenharmony_cistatic const rvcn_temporal_layer_pattern_table_t  rvcn_temporal_layer_pattern_tables[RENCODE_MAX_NUM_TEMPORAL_LAYERS] =
53bf215546Sopenharmony_ci{
54bf215546Sopenharmony_ci   /* 1 temporal layer */
55bf215546Sopenharmony_ci   {
56bf215546Sopenharmony_ci      2,      /* temporal layer pattern size */
57bf215546Sopenharmony_ci      {
58bf215546Sopenharmony_ci         {
59bf215546Sopenharmony_ci            0,
60bf215546Sopenharmony_ci            0,
61bf215546Sopenharmony_ci            false,
62bf215546Sopenharmony_ci            0,
63bf215546Sopenharmony_ci            0,
64bf215546Sopenharmony_ci            true,
65bf215546Sopenharmony_ci         },
66bf215546Sopenharmony_ci         {
67bf215546Sopenharmony_ci            0,
68bf215546Sopenharmony_ci            0,
69bf215546Sopenharmony_ci            false,
70bf215546Sopenharmony_ci            1,
71bf215546Sopenharmony_ci            2,
72bf215546Sopenharmony_ci            true,
73bf215546Sopenharmony_ci         }
74bf215546Sopenharmony_ci      }
75bf215546Sopenharmony_ci   },
76bf215546Sopenharmony_ci   /* 2 temporal layers */
77bf215546Sopenharmony_ci   {
78bf215546Sopenharmony_ci      3,      /* temporal layer pattern size */
79bf215546Sopenharmony_ci      {
80bf215546Sopenharmony_ci         {
81bf215546Sopenharmony_ci            0,
82bf215546Sopenharmony_ci            0,
83bf215546Sopenharmony_ci            false,
84bf215546Sopenharmony_ci            0,
85bf215546Sopenharmony_ci            0,
86bf215546Sopenharmony_ci            true,
87bf215546Sopenharmony_ci         },
88bf215546Sopenharmony_ci         {
89bf215546Sopenharmony_ci            1,
90bf215546Sopenharmony_ci            0,
91bf215546Sopenharmony_ci            false,
92bf215546Sopenharmony_ci            1,
93bf215546Sopenharmony_ci            2,
94bf215546Sopenharmony_ci            false,
95bf215546Sopenharmony_ci         },
96bf215546Sopenharmony_ci         {
97bf215546Sopenharmony_ci            0,
98bf215546Sopenharmony_ci            0,
99bf215546Sopenharmony_ci            false,
100bf215546Sopenharmony_ci            1,
101bf215546Sopenharmony_ci            4,
102bf215546Sopenharmony_ci            true,
103bf215546Sopenharmony_ci         }
104bf215546Sopenharmony_ci      }
105bf215546Sopenharmony_ci   },
106bf215546Sopenharmony_ci   /* 3 temporal layers */
107bf215546Sopenharmony_ci   {
108bf215546Sopenharmony_ci      5,      /* temporal layer pattern size */
109bf215546Sopenharmony_ci      {
110bf215546Sopenharmony_ci         {
111bf215546Sopenharmony_ci            0,
112bf215546Sopenharmony_ci            0,
113bf215546Sopenharmony_ci            false,
114bf215546Sopenharmony_ci            0,
115bf215546Sopenharmony_ci            0,
116bf215546Sopenharmony_ci            true,
117bf215546Sopenharmony_ci         },
118bf215546Sopenharmony_ci         {
119bf215546Sopenharmony_ci            2,
120bf215546Sopenharmony_ci            0,
121bf215546Sopenharmony_ci            false,
122bf215546Sopenharmony_ci            1,
123bf215546Sopenharmony_ci            2,
124bf215546Sopenharmony_ci            false,
125bf215546Sopenharmony_ci         },
126bf215546Sopenharmony_ci         {
127bf215546Sopenharmony_ci            1,
128bf215546Sopenharmony_ci            0,
129bf215546Sopenharmony_ci            false,
130bf215546Sopenharmony_ci            1,
131bf215546Sopenharmony_ci            4,
132bf215546Sopenharmony_ci            true,
133bf215546Sopenharmony_ci         },
134bf215546Sopenharmony_ci         {
135bf215546Sopenharmony_ci            2,
136bf215546Sopenharmony_ci            2,
137bf215546Sopenharmony_ci            false,
138bf215546Sopenharmony_ci            2,
139bf215546Sopenharmony_ci            6,
140bf215546Sopenharmony_ci            false,
141bf215546Sopenharmony_ci         },
142bf215546Sopenharmony_ci         {
143bf215546Sopenharmony_ci            0,
144bf215546Sopenharmony_ci            0,
145bf215546Sopenharmony_ci            true,
146bf215546Sopenharmony_ci            2,
147bf215546Sopenharmony_ci            8,
148bf215546Sopenharmony_ci            true,
149bf215546Sopenharmony_ci         }
150bf215546Sopenharmony_ci      }
151bf215546Sopenharmony_ci   },
152bf215546Sopenharmony_ci   /* 4 temporal layers */
153bf215546Sopenharmony_ci   {
154bf215546Sopenharmony_ci      9,      /* temporal layer pattern size */
155bf215546Sopenharmony_ci      {
156bf215546Sopenharmony_ci         {
157bf215546Sopenharmony_ci            0,
158bf215546Sopenharmony_ci            0,
159bf215546Sopenharmony_ci            false,
160bf215546Sopenharmony_ci            0,
161bf215546Sopenharmony_ci            0,
162bf215546Sopenharmony_ci            true,
163bf215546Sopenharmony_ci         },
164bf215546Sopenharmony_ci         {
165bf215546Sopenharmony_ci            3,
166bf215546Sopenharmony_ci            0,
167bf215546Sopenharmony_ci            false,
168bf215546Sopenharmony_ci            1,
169bf215546Sopenharmony_ci            2,
170bf215546Sopenharmony_ci            false,
171bf215546Sopenharmony_ci         },
172bf215546Sopenharmony_ci         {
173bf215546Sopenharmony_ci            2,
174bf215546Sopenharmony_ci            0,
175bf215546Sopenharmony_ci            false,
176bf215546Sopenharmony_ci            1,
177bf215546Sopenharmony_ci            4,
178bf215546Sopenharmony_ci            true,
179bf215546Sopenharmony_ci         },
180bf215546Sopenharmony_ci         {
181bf215546Sopenharmony_ci            3,
182bf215546Sopenharmony_ci            2,
183bf215546Sopenharmony_ci            false,
184bf215546Sopenharmony_ci            2,
185bf215546Sopenharmony_ci            6,
186bf215546Sopenharmony_ci            false,
187bf215546Sopenharmony_ci         },
188bf215546Sopenharmony_ci         {
189bf215546Sopenharmony_ci            1,
190bf215546Sopenharmony_ci            0,
191bf215546Sopenharmony_ci            true,
192bf215546Sopenharmony_ci            2,
193bf215546Sopenharmony_ci            8,
194bf215546Sopenharmony_ci            true,
195bf215546Sopenharmony_ci         },
196bf215546Sopenharmony_ci         {
197bf215546Sopenharmony_ci            3,
198bf215546Sopenharmony_ci            4,
199bf215546Sopenharmony_ci            false,
200bf215546Sopenharmony_ci            3,
201bf215546Sopenharmony_ci            10,
202bf215546Sopenharmony_ci            false,
203bf215546Sopenharmony_ci         },
204bf215546Sopenharmony_ci         {
205bf215546Sopenharmony_ci            2,
206bf215546Sopenharmony_ci            4,
207bf215546Sopenharmony_ci            false,
208bf215546Sopenharmony_ci            3,
209bf215546Sopenharmony_ci            12,
210bf215546Sopenharmony_ci            true,
211bf215546Sopenharmony_ci         },
212bf215546Sopenharmony_ci         {
213bf215546Sopenharmony_ci            3,
214bf215546Sopenharmony_ci            6,
215bf215546Sopenharmony_ci            false,
216bf215546Sopenharmony_ci            4,
217bf215546Sopenharmony_ci            14,
218bf215546Sopenharmony_ci            false,
219bf215546Sopenharmony_ci         },
220bf215546Sopenharmony_ci         {
221bf215546Sopenharmony_ci            0,
222bf215546Sopenharmony_ci            0,
223bf215546Sopenharmony_ci            true,
224bf215546Sopenharmony_ci            4,
225bf215546Sopenharmony_ci            16,
226bf215546Sopenharmony_ci            true,
227bf215546Sopenharmony_ci         }
228bf215546Sopenharmony_ci      }
229bf215546Sopenharmony_ci   }
230bf215546Sopenharmony_ci};
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_ci#endif // _RADEON_TEMPORAL_H