mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Fix cclm when tiles are enabled
This commit is contained in:
parent
41c9f5b858
commit
99ddc209fc
|
@ -498,6 +498,7 @@ void kvz_predict_cclm(
|
|||
|
||||
|
||||
kvz_pixel *y_rec = lcu->rec.y + x_scu + y_scu * LCU_WIDTH;
|
||||
const int stride2 = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
||||
|
||||
// Essentially what this does is that it uses 6-tap filtering to downsample
|
||||
// the luma intra references down to match the resolution of the chroma channel.
|
||||
|
@ -513,7 +514,7 @@ void kvz_predict_cclm(
|
|||
}
|
||||
if(y_scu == 0) {
|
||||
if(!state->encoder_control->cfg.wpp) available_above_right = MIN(width / 2, (state->tile->frame->width - x0 - width * 2) / 4);
|
||||
memcpy(sampled_luma_ref.top, &state->tile->frame->cclm_luma_rec_top_line[x0 / 2 + (y0 / 64 - 1) * (stride / 2)], sizeof(kvz_pixel) * (width + available_above_right * 2));
|
||||
memcpy(sampled_luma_ref.top, &state->tile->frame->cclm_luma_rec_top_line[x0 / 2 + (y0 / 64 - 1) * (stride2 / 2)], sizeof(kvz_pixel) * (width + available_above_right * 2));
|
||||
}
|
||||
else {
|
||||
for (int x = 0; x < width * (available_above_right ? 4 : 2); x += 2) {
|
||||
|
@ -538,11 +539,11 @@ void kvz_predict_cclm(
|
|||
if(x_scu == 32 && y_scu == 0 && pu->depth == 0) break;
|
||||
}
|
||||
for(int i = 0; i < height + available_left_below * 2; i++) {
|
||||
sampled_luma_ref.left[i] = state->tile->frame->cclm_luma_rec[(y0/2 + i) * (stride/2) + x0 / 2 - 1];
|
||||
sampled_luma_ref.left[i] = state->tile->frame->cclm_luma_rec[(y0/2 + i) * (stride2/2) + x0 / 2 - 1];
|
||||
}
|
||||
}
|
||||
|
||||
kvz_pixels_blit(&state->tile->frame->cclm_luma_rec[x0 / 2 + (y0 * stride) / 4], sampled_luma, width, height, stride / 2, width);
|
||||
kvz_pixels_blit(&state->tile->frame->cclm_luma_rec[x0 / 2 + (y0 * stride2) / 4], sampled_luma, width, height, stride2 / 2, width);
|
||||
|
||||
int16_t a, b, shift;
|
||||
get_cclm_parameters(state, width, height, mode,x0, y0, available_above_right, available_left_below, &sampled_luma_ref, chroma_ref, &a, &b, &shift);
|
||||
|
@ -1402,7 +1403,7 @@ static void intra_recon_tb_leaf(
|
|||
kvz_intra_build_reference(log2width, color, &luma_px, &pic_px, lcu, &refs, cfg->wpp, extra_refs, multi_ref_index);
|
||||
|
||||
kvz_pixel pred[32 * 32];
|
||||
int stride = state->tile->frame->source->stride;
|
||||
const int stride = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
||||
const bool filter_boundary = color == COLOR_Y && !(cfg->lossless && cfg->implicit_rdpcm);
|
||||
bool use_mip = false;
|
||||
int8_t intra_mode = color == COLOR_Y ? intra_paramas->luma_mode : intra_paramas->chroma_mode;
|
||||
|
|
|
@ -244,7 +244,8 @@ static void downsample_cclm_rec(encoder_state_t *state, int x, int y, int width,
|
|||
int x_scu = SUB_SCU(x);
|
||||
int y_scu = SUB_SCU(y);
|
||||
y_rec += x_scu + y_scu * LCU_WIDTH;
|
||||
int stride = state->tile->frame->source->stride;
|
||||
const int stride = state->tile->frame->rec->stride;
|
||||
const int stride2 = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
||||
|
||||
for (int y_ = 0; y_ < height && y_ * 2 + y < state->encoder_control->cfg.height; y_++) {
|
||||
for (int x_ = 0; x_ < width; x_++) {
|
||||
|
@ -258,13 +259,13 @@ static void downsample_cclm_rec(encoder_state_t *state, int x, int y, int width,
|
|||
s += y_rec[2 * x_ + LCU_WIDTH] * 2;
|
||||
s += y_rec[2 * x_ + 1 + LCU_WIDTH];
|
||||
s += !x_scu && !x_ && x ? state->tile->frame->rec->y[x - 1 + (y + y_ * 2 + 1) * stride] : y_rec[2 * x_ - ((x_ + x) > 0) + LCU_WIDTH];
|
||||
int index = x / 2 + x_ + (y / 2 + y_ )* stride / 2;
|
||||
int index = x / 2 + x_ + (y / 2 + y_ )* stride2 / 2;
|
||||
state->tile->frame->cclm_luma_rec[index] = s >> 3;
|
||||
}
|
||||
y_rec += LCU_WIDTH * 2;
|
||||
}
|
||||
if((y + height * 2) % 64 == 0) {
|
||||
int line = y / 64 * stride / 2;
|
||||
int line = y / 64 * stride2 / 2;
|
||||
y_rec -= LCU_WIDTH;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
int s = 2;
|
||||
|
|
Loading…
Reference in a new issue