2014-04-16 06:09:10 +00:00
|
|
|
#ifndef TABLES_H_
|
|
|
|
#define TABLES_H_
|
|
|
|
/*****************************************************************************
|
2021-11-23 06:46:06 +00:00
|
|
|
* This file is part of uvg266 VVC encoder.
|
2014-04-16 06:09:10 +00:00
|
|
|
*
|
2021-10-07 08:32:59 +00:00
|
|
|
* Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
* are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
* other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
|
|
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
* INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
2014-04-16 06:09:10 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
2015-12-17 11:42:57 +00:00
|
|
|
/**
|
|
|
|
* \ingroup Reconstruction
|
|
|
|
* \file
|
|
|
|
* Various tables.
|
|
|
|
*/
|
|
|
|
|
2016-03-30 09:41:37 +00:00
|
|
|
#include "global.h" // IWYU pragma: keep
|
2014-04-16 06:09:10 +00:00
|
|
|
|
2016-04-01 14:14:23 +00:00
|
|
|
|
2018-08-30 11:24:03 +00:00
|
|
|
static const uint32_t g_go_rice_pars[32] =
|
|
|
|
{
|
2019-07-01 10:00:43 +00:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 1,
|
|
|
|
1, 1, 1, 1, 1, 1, 2, 2,
|
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
|
2, 2, 2, 2, 3, 3, 3, 3
|
2019-05-13 12:30:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const uint32_t g_go_rice_pos0[3][32] =
|
|
|
|
{
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8 },
|
|
|
|
{ 1, 1, 1, 1, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16 },
|
|
|
|
{ 1, 1, 2, 2, 2, 3, 4, 4, 4, 6, 6, 6, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16 }
|
2018-08-30 11:24:03 +00:00
|
|
|
};
|
|
|
|
|
2014-04-16 06:09:10 +00:00
|
|
|
/***
|
|
|
|
* List of indices for 4x4 coefficient groups within 8x8 transform block.
|
|
|
|
* First index: 0 = diagonal, 1 = vertical, 2 horizontal scan pattern.
|
|
|
|
* Second index: (log2 - 2) size of transform block. 4x4 .. 32x32
|
|
|
|
*/
|
|
|
|
static const uint32_t g_sig_last_scan_8x8[3][4] =
|
|
|
|
{ {0, 2, 1, 3},
|
|
|
|
{0, 1, 2, 3},
|
|
|
|
{0, 2, 1, 3}
|
|
|
|
};
|
|
|
|
|
|
|
|
/***
|
|
|
|
* List of indices for 4x4 coefficient groups within 16x16 transform block.
|
|
|
|
*/
|
|
|
|
static const uint32_t g_sig_last_scan_16x16[16] = {
|
|
|
|
0, 4, 1, 8,
|
|
|
|
5, 2, 12, 9,
|
|
|
|
6, 3, 13, 10,
|
|
|
|
7, 14, 11, 15
|
|
|
|
};
|
|
|
|
|
|
|
|
/***
|
|
|
|
* List of indices for 4x4 coefficient groups within 32x32 transform block.
|
|
|
|
*/
|
|
|
|
static const uint32_t g_sig_last_scan_32x32[64] = {
|
|
|
|
0, 8, 1, 16, 9, 2, 24, 17,
|
|
|
|
10, 3, 32, 25, 18, 11, 4, 40,
|
|
|
|
33, 26, 19, 12, 5, 48, 41, 34,
|
|
|
|
27, 20, 13, 6, 56, 49, 42, 35,
|
|
|
|
28, 21, 14, 7, 57, 50, 43, 36,
|
|
|
|
29, 22, 15, 58, 51, 44, 37, 30,
|
|
|
|
23, 59, 52, 45, 38, 31, 60, 53,
|
|
|
|
46, 39, 61, 54, 47, 62, 55, 63
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of pointers to coefficient group mappings.
|
2021-04-14 11:19:31 +00:00
|
|
|
* First index: (log2 - 1) of transform block size
|
2014-04-16 06:09:10 +00:00
|
|
|
* Second index: scan pattern 0 = diagonal, 1 = horizontal, 2 = vertical
|
|
|
|
*/
|
2021-04-14 11:19:31 +00:00
|
|
|
static const uint32_t * const g_sig_last_scan_cg[5][3] = {
|
2014-04-16 06:09:10 +00:00
|
|
|
{ g_sig_last_scan_8x8[0], g_sig_last_scan_8x8[1], g_sig_last_scan_8x8[2] }, // 4x4, only first element is used
|
2021-04-14 11:19:31 +00:00
|
|
|
{ g_sig_last_scan_8x8[0], g_sig_last_scan_8x8[1], g_sig_last_scan_8x8[2] },
|
2014-04-16 06:09:10 +00:00
|
|
|
{ g_sig_last_scan_8x8[0], g_sig_last_scan_8x8[1], g_sig_last_scan_8x8[2] },
|
|
|
|
{ g_sig_last_scan_16x16, 0, 0 },
|
|
|
|
{ g_sig_last_scan_32x32, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-12-03 15:17:06 +00:00
|
|
|
static const uint32_t g_log2_sbb_size[7 + 1][7 + 1][2] =
|
|
|
|
//===== luma/chroma =====
|
|
|
|
{
|
|
|
|
{ { 0,0 },{ 0,1 },{ 0,2 },{ 0,3 },{ 0,4 },{ 0,4 },{ 0,4 },{ 0,4 } },
|
|
|
|
{ { 1,0 },{ 1,1 },{ 1,1 },{ 1,3 },{ 1,3 },{ 1,3 },{ 1,3 },{ 1,3 } },
|
|
|
|
{ { 2,0 },{ 1,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
|
|
|
|
{ { 3,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
|
|
|
|
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
|
|
|
|
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
|
|
|
|
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
|
|
|
|
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-05-12 05:45:54 +00:00
|
|
|
typedef enum
|
2014-04-16 06:09:10 +00:00
|
|
|
{
|
2018-08-27 06:18:15 +00:00
|
|
|
SCAN_DIAG = 0 // up-right diagonal scan
|
|
|
|
//SCAN_HOR, // horizontal first scan
|
|
|
|
//SCAN_VER // vertical first scan
|
2014-05-12 05:45:54 +00:00
|
|
|
} coeff_scan_order_t;
|
2014-04-16 06:09:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of mappings for coefficients within a transform block.
|
|
|
|
* First index: scan pattern 0 = diagonal, 1 = horizontal, 2 = vertical
|
|
|
|
* Second index: (log2 - 1) size of transform block. 2x2 .. 32x32
|
|
|
|
*/
|
2022-04-28 11:18:09 +00:00
|
|
|
extern const uint32_t* const uvg_g_sig_last_scan[3][5];
|
|
|
|
extern const int8_t uvg_g_convert_to_bit[LCU_WIDTH + 1];
|
2022-08-16 12:00:15 +00:00
|
|
|
extern const int8_t uvg_g_convert_to_log2[LCU_WIDTH + 1];
|
2022-04-28 11:18:09 +00:00
|
|
|
extern const uint32_t uvg_g_log2_sbb_size[7 + 1][7 + 1][2];
|
2014-04-16 06:09:10 +00:00
|
|
|
|
2022-08-09 11:02:30 +00:00
|
|
|
#define SCAN_GROUP_TYPES 2
|
|
|
|
#define MAX_LOG2_INDEX 7
|
|
|
|
|
2022-08-10 16:37:09 +00:00
|
|
|
#define SCAN_GROUP_UNGROUPED 0
|
|
|
|
#define SCAN_GROUP_4X4 1
|
2022-08-09 11:02:30 +00:00
|
|
|
|
2022-08-19 12:05:22 +00:00
|
|
|
const uint32_t* const uvg_get_scan_order_table(int scan_group, int scan_type, int log2_w, int log2_h);
|
2022-08-09 11:02:30 +00:00
|
|
|
|
2014-04-16 06:09:10 +00:00
|
|
|
#endif //TABLES_H_
|