[fix] Minor fixes

This commit is contained in:
Joose Sainio 2023-04-05 09:33:00 +03:00
parent 6f41929e5a
commit 9120a04e77
2 changed files with 19 additions and 17 deletions

View file

@ -1196,7 +1196,7 @@ static void encoder_state_encode(encoder_state_t * const main_state) {
sub_state->tile->frame->width_in_lcu * LCU_WIDTH,
sub_state->tile->frame->height_in_lcu * LCU_WIDTH
);
if(main_state->encoder_control->cfg.dual_tree){
if(main_state->encoder_control->cfg.dual_tree && main_state->frame->is_irap){
sub_state->tile->frame->chroma_cu_array = uvg_cu_subarray(
main_state->tile->frame->chroma_cu_array,
offset_x,

View file

@ -190,11 +190,28 @@ static void uvg_angular_pred_generic(
if (!vertical_mode) { SWAP(width, height, int) }
if (sample_disp != 0) {
bool use_cubic = true; // Default to cubic filter
static const int uvg_intra_hor_ver_dist_thres[8] = { 24, 24, 24, 14, 2, 0, 0, 0 };
int filter_threshold = uvg_intra_hor_ver_dist_thres[(log2_width + log2_height) >> 1];
int dist_from_vert_or_hor = MIN(abs((int32_t)pred_mode - 50), abs((int32_t)pred_mode - 18));
if (dist_from_vert_or_hor > filter_threshold) {
if ((abs(sample_disp) & 0x1F) != 0)
{
use_cubic = false;
}
}
// Cubic must be used if ref line != 0 or if isp mode is != 0
if (multi_ref_index || isp) {
use_cubic = true;
}
// The mode is not horizontal or vertical, we have to do interpolation.
for (int_fast32_t y = 0, delta_pos = sample_disp * (1 + multi_ref_index); y < height; ++y, delta_pos += sample_disp) {
int_fast32_t delta_int = delta_pos >> 5;
int_fast32_t delta_fract = delta_pos & (32 - 1);
const int16_t filter_coeff[4] = { 16 - (delta_fract >> 1), 32 - (delta_fract >> 1), 16 + (delta_fract >> 1), delta_fract >> 1 };
int16_t const* const f = use_cubic ? cubic_filter[delta_fract] : filter_coeff;
if ((abs(sample_disp) & 0x1F) != 0) {
@ -202,22 +219,7 @@ static void uvg_angular_pred_generic(
if (channel_type == 0) {
int32_t ref_main_index = delta_int;
uvg_pixel p[4];
bool use_cubic = true; // Default to cubic filter
static const int uvg_intra_hor_ver_dist_thres[8] = { 24, 24, 24, 14, 2, 0, 0, 0 };
int filter_threshold = uvg_intra_hor_ver_dist_thres[(log2_width + log2_height) >> 1];
int dist_from_vert_or_hor = MIN(abs((int32_t)pred_mode - 50), abs((int32_t)pred_mode - 18));
if (dist_from_vert_or_hor > filter_threshold) {
if ((abs(sample_disp) & 0x1F) != 0)
{
use_cubic = false;
}
}
// Cubic must be used if ref line != 0 or if isp mode is != 0
if (multi_ref_index || isp) {
use_cubic = true;
}
const int16_t filter_coeff[4] = { 16 - (delta_fract >> 1), 32 - (delta_fract >> 1), 16 + (delta_fract >> 1), delta_fract >> 1 };
int16_t const * const f = use_cubic ? cubic_filter[delta_fract] : filter_coeff;
// Do 4-tap intra interpolation filtering
for (int_fast32_t x = 0; x < width; x++, ref_main_index++) {
p[0] = ref_main[ref_main_index];