mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
[cclm] Fix heap corruption for non 64 divisible frames
This commit is contained in:
parent
62fabc60dd
commit
7038430646
|
@ -449,7 +449,7 @@ static void downsample_cclm_rec(encoder_state_t *state, int x, int y, int width,
|
||||||
if((y + height * 2) % 64 == 0) {
|
if((y + height * 2) % 64 == 0) {
|
||||||
int line = y / 64 * stride2 / 2;
|
int line = y / 64 * stride2 / 2;
|
||||||
y_rec -= LCU_WIDTH;
|
y_rec -= LCU_WIDTH;
|
||||||
for (int i = 0; i < width; ++i) {
|
for (int i = 0; i < width && i + x < stride2 / 2; ++i) {
|
||||||
int s = 2;
|
int s = 2;
|
||||||
s += y_rec[i * 2] * 2;
|
s += y_rec[i * 2] * 2;
|
||||||
s += y_rec[i * 2 + 1];
|
s += y_rec[i * 2 + 1];
|
||||||
|
|
|
@ -61,7 +61,7 @@ videoframe_t * uvg_videoframe_alloc(int32_t width,
|
||||||
frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu);
|
frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu);
|
||||||
if (cclm) {
|
if (cclm) {
|
||||||
assert(chroma_format == UVG_CSP_420);
|
assert(chroma_format == UVG_CSP_420);
|
||||||
frame->cclm_luma_rec = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) * (((height + 7) & ~7) + FRAME_PADDING_LUMA) / 4);
|
frame->cclm_luma_rec = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) * (((height + 15) & ~7) + FRAME_PADDING_LUMA) / 4);
|
||||||
frame->cclm_luma_rec_top_line = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) / 2 * CEILDIV(height, 64));
|
frame->cclm_luma_rec_top_line = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) / 2 * CEILDIV(height, 64));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue