mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
[isp] Remove old_scan tables and related asserts. Fix coefficient group indexing.
This commit is contained in:
parent
fae833c4d2
commit
f0ff249035
|
@ -232,9 +232,7 @@ void uvg_encode_ts_residual(encoder_state_t* const state,
|
|||
const uint32_t log2_block_height = uvg_g_convert_to_log2[height];
|
||||
// TODO: log2_cg_size is wrong if width != height
|
||||
const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_width][0] + uvg_g_log2_sbb_size[log2_block_width][log2_block_width][1];
|
||||
const uint32_t* old_scan = uvg_g_sig_last_scan[scan_mode][log2_block_width - 1];
|
||||
const uint32_t* old_scan_cg = g_sig_last_scan_cg[log2_block_width - 1][scan_mode];
|
||||
|
||||
|
||||
const uint32_t* scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height);
|
||||
const uint32_t* scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height);
|
||||
|
||||
|
@ -251,10 +249,6 @@ void uvg_encode_ts_residual(encoder_state_t* const state,
|
|||
|
||||
for (i = 0; i < width * height; i++) {
|
||||
if (coeff[scan[i]]) {
|
||||
// ISP_DEBUG
|
||||
assert(old_scan[i] == scan[i] && "Old scan_cg differs from the new one.");
|
||||
assert(old_scan_cg[i >> log2_cg_size] == scan_cg[i >> log2_cg_size] && "Old scan_cg differs from the new one.");
|
||||
//scan_pos_last = i;
|
||||
sig_coeffgroup_flag[scan_cg[i >> log2_cg_size]] = 1;
|
||||
}
|
||||
}
|
||||
|
|
10
src/rdo.c
10
src/rdo.c
|
@ -1187,8 +1187,6 @@ int uvg_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
|
|||
|
||||
const coeff_t entropy_coding_maximum = (1 << max_log2_tr_dynamic_range) - 1;
|
||||
|
||||
const uint32_t* old_scan = uvg_g_sig_last_scan[scan_mode][log2_block_width - 1];
|
||||
const uint32_t* old_scan_cg = g_sig_last_scan_cg[log2_block_width - 1][scan_mode];
|
||||
const uint32_t* scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height);
|
||||
const uint32_t* scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height);
|
||||
|
||||
|
@ -1216,9 +1214,6 @@ int uvg_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
|
|||
for (uint32_t sbId = 0; sbId < cg_num; sbId++)
|
||||
{
|
||||
uint32_t cg_blkpos = scan_cg[sbId];
|
||||
// ISP_DEBUG
|
||||
assert(old_scan[sbId] == scan[sbId] && "Old scan_cg differs from the new one.");
|
||||
assert(old_scan_cg[sbId] == scan_cg[sbId] && "Old scan_cg differs from the new one.");
|
||||
|
||||
int no_coeff_coded = 0;
|
||||
base_cost = 0.0;
|
||||
|
@ -1435,9 +1430,6 @@ void uvg_rdoq(
|
|||
const uint32_t cg_width = (MIN((uint8_t)TR_MAX_WIDTH, width) >> log2_cg_width);
|
||||
const uint32_t cg_height = (MIN((uint8_t)TR_MAX_WIDTH, height) >> log2_cg_height);
|
||||
|
||||
const uint32_t *old_scan = uvg_g_sig_last_scan[ scan_mode ][ log2_block_width - 1 ];
|
||||
const uint32_t *old_scan_cg = g_sig_last_scan_cg[log2_block_width - 1][scan_mode];
|
||||
|
||||
const uint32_t *scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height);
|
||||
const uint32_t *scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height);
|
||||
|
||||
|
@ -1487,7 +1479,6 @@ void uvg_rdoq(
|
|||
for (int32_t scanpos_in_cg = (cg_size - 1); scanpos_in_cg >= 0; scanpos_in_cg--)
|
||||
{
|
||||
int32_t scanpos = cg_scanpos*cg_size + scanpos_in_cg;
|
||||
assert(old_scan[scanpos] == scan[scanpos] && "Scan index differs from old system.");
|
||||
|
||||
if (lfnst_idx > 0 && scanpos > max_lfnst_pos) break;
|
||||
uint32_t blkpos = scan[scanpos];
|
||||
|
@ -1523,7 +1514,6 @@ void uvg_rdoq(
|
|||
int32_t last_x_bits[32], last_y_bits[32];
|
||||
|
||||
for (int32_t cg_scanpos = cg_last_scanpos; cg_scanpos >= 0; cg_scanpos--) {
|
||||
assert(old_scan_cg[cg_scanpos] == scan_cg[cg_scanpos] && "Scan cg index differs from old system.");
|
||||
uint32_t cg_blkpos = scan_cg[cg_scanpos];
|
||||
uint32_t cg_pos_y = cg_blkpos / num_blk_side;
|
||||
uint32_t cg_pos_x = cg_blkpos - (cg_pos_y * num_blk_side);
|
||||
|
|
|
@ -204,8 +204,6 @@ static void derive_mts_constraints(cu_info_t *const pred_cu,
|
|||
const uint32_t log2_block_height = uvg_g_convert_to_log2[height];
|
||||
const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_width][0]
|
||||
+ uvg_g_log2_sbb_size[log2_block_width][log2_block_width][1]; // ISP_TODO: height
|
||||
const uint32_t *old_scan = uvg_g_sig_last_scan[scan_idx][log2_block_width - 1];
|
||||
const uint32_t *old_scan_cg = g_sig_last_scan_cg[log2_block_width - 1][scan_idx];
|
||||
const uint32_t *scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_idx, log2_block_width, log2_block_height);
|
||||
const uint32_t *scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_idx, log2_block_width, log2_block_height);
|
||||
|
||||
|
@ -217,9 +215,6 @@ static void derive_mts_constraints(cu_info_t *const pred_cu,
|
|||
// ISP_TODO: height
|
||||
for (int i = 0; i < width * width; i++) {
|
||||
if (coeff[scan[i]]) {
|
||||
// ISP_DEBUG
|
||||
assert(old_scan[i] == scan[i] && "Old scan_cg differs from the new one.");
|
||||
assert(old_scan_cg[i >> log2_cg_size] == scan_cg[i >> log2_cg_size] && "Old scan_cg differs from the new one.");
|
||||
scan_pos_last = i;
|
||||
sig_coeffgroup_flag[scan_cg[i >> log2_cg_size]] = 1;
|
||||
}
|
||||
|
|
|
@ -380,8 +380,6 @@ void uvg_quant_avx2(const encoder_state_t * const state, const coeff_t * __restr
|
|||
int32_t height, color_t color, int8_t scan_idx, int8_t block_type, int8_t transform_skip, uint8_t lfnst_idx)
|
||||
{
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
//const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
//const uint32_t * const old_scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t log2_tr_width = uvg_g_convert_to_log2[width];
|
||||
const uint32_t log2_tr_height = uvg_g_convert_to_log2[height];
|
||||
const uint32_t* const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_idx, log2_tr_width, log2_tr_height);
|
||||
|
|
|
@ -78,9 +78,8 @@ void uvg_encode_coeff_nxn_generic(encoder_state_t * const state,
|
|||
|
||||
const uint32_t log2_block_width = uvg_g_convert_to_log2[width];
|
||||
const uint32_t log2_block_height = uvg_g_convert_to_log2[height];
|
||||
const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_width][0] + uvg_g_log2_sbb_size[log2_block_width][log2_block_width][1];
|
||||
const uint32_t *old_scan = uvg_g_sig_last_scan[scan_mode][log2_block_width - 1];
|
||||
const uint32_t *old_scan_cg = g_sig_last_scan_cg[log2_block_width - 1][scan_mode];
|
||||
|
||||
const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_height][0] + uvg_g_log2_sbb_size[log2_block_width][log2_block_height][1];
|
||||
const uint32_t* scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height);
|
||||
const uint32_t* scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height);
|
||||
|
||||
|
@ -92,11 +91,8 @@ void uvg_encode_coeff_nxn_generic(encoder_state_t * const state,
|
|||
unsigned scan_cg_last = (unsigned)-1;
|
||||
unsigned scan_pos_last = (unsigned)-1;
|
||||
|
||||
for (int i = 0; i < width * width; i++) {
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
if (coeff[scan[i]]) {
|
||||
// ISP_DEBUG
|
||||
assert(old_scan[i] == scan[i] && "Old scan_cg differs from the new one.");
|
||||
assert(old_scan_cg[i >> log2_cg_size] == scan_cg[i >> log2_cg_size] && "Old scan_cg differs from the new one.");
|
||||
scan_pos_last = i;
|
||||
sig_coeffgroup_flag[scan_cg[i >> log2_cg_size]] = 1;
|
||||
}
|
||||
|
@ -144,14 +140,14 @@ void uvg_encode_coeff_nxn_generic(encoder_state_t * const state,
|
|||
for (i = scan_cg_last; i >= 0; i--) {
|
||||
|
||||
//int32_t abs_coeff[64*64];
|
||||
int32_t cg_blk_pos = scan_cg[i];
|
||||
int32_t cg_pos_y = cg_blk_pos / (MIN((uint8_t)32, width) >> (log2_cg_size / 2));
|
||||
int32_t cg_pos_x = cg_blk_pos - (cg_pos_y * (MIN((uint8_t)32, width) >> (log2_cg_size / 2)));
|
||||
|
||||
const uint32_t log2_cg_width = uvg_g_log2_sbb_size[log2_block_width][log2_block_height][0];
|
||||
const uint32_t log2_cg_height = uvg_g_log2_sbb_size[log2_block_width][log2_block_height][1];
|
||||
const uint32_t cg_width = (MIN((uint8_t)TR_MAX_WIDTH, width) >> log2_cg_width);
|
||||
const uint32_t cg_height = (MIN((uint8_t)TR_MAX_WIDTH, height) >> log2_cg_height);
|
||||
int32_t cg_blk_pos = scan_cg[i];
|
||||
int32_t cg_pos_y = cg_blk_pos / (MIN((uint8_t)32, width) >> log2_cg_width);
|
||||
int32_t cg_pos_x = cg_blk_pos - (cg_pos_y * (MIN((uint8_t)32, width) >> log2_cg_width));
|
||||
|
||||
|
||||
// !!! residual_coding_subblock() !!!
|
||||
|
||||
|
|
|
@ -64,8 +64,6 @@ void uvg_quant_generic(
|
|||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
const uint32_t log2_tr_width = uvg_g_convert_to_log2[width];
|
||||
const uint32_t log2_tr_height = uvg_g_convert_to_log2[height];
|
||||
//const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
//const uint32_t * const old_scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t * const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_idx, log2_tr_width, log2_tr_height);
|
||||
|
||||
int32_t qp_scaled = uvg_get_scaled_qp(color, state->qp, (encoder->bitdepth - 8) * 6, encoder->qp_map[0]);
|
||||
|
|
Loading…
Reference in a new issue