2014-04-16 06:09:10 +00:00
|
|
|
#ifndef TABLES_H_
|
|
|
|
#define TABLES_H_
|
|
|
|
/*****************************************************************************
|
|
|
|
* This file is part of Kvazaar HEVC encoder.
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
|
2014-04-16 06:09:10 +00:00
|
|
|
* COPYING file).
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License, or (at your
|
|
|
|
* option) any later version.
|
2014-04-16 06:09:10 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
|
* more details.
|
2014-04-16 06:09:10 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
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
|
|
|
};
|
|
|
|
#define MAX_GR_ORDER_RESIDUAL 10
|
|
|
|
#define COEF_REMAIN_BIN_REDUCTION 3 ///< indicates the level at which the VLC transitions from Golomb-Rice to TU+EG(k)
|
|
|
|
static const uint32_t g_go_rice_range[MAX_GR_ORDER_RESIDUAL] =
|
|
|
|
{
|
|
|
|
6, 5, 6, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION, COEF_REMAIN_BIN_REDUCTION
|
|
|
|
};
|
|
|
|
|
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.
|
|
|
|
* First index: (log2 - 2) of transform block size
|
|
|
|
* Second index: scan pattern 0 = diagonal, 1 = horizontal, 2 = vertical
|
|
|
|
*/
|
2014-04-17 08:59:16 +00:00
|
|
|
static const uint32_t * const g_sig_last_scan_cg[4][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
|
|
|
|
{ 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 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2015-08-26 08:50:27 +00:00
|
|
|
extern const uint32_t* const kvz_g_sig_last_scan[3][5];
|
|
|
|
extern const int8_t kvz_g_convert_to_bit[LCU_WIDTH + 1];
|
2014-04-16 06:09:10 +00:00
|
|
|
|
|
|
|
#endif //TABLES_H_
|