mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Fix kvz_get_extended_block functions.
The buffers allocated in functions kvz_get_extended_block_avx2 and kvz_get_extended_block_generic were too small when the width of the block was less than its height. Fixed to allocate correctly sized buffers.
This commit is contained in:
parent
bdd8b1c0aa
commit
4402e251ae
|
@ -502,7 +502,7 @@ void kvz_get_extended_block_avx2(int xpos, int ypos, int mv_x, int mv_y, int off
|
|||
int sample_out_of_bounds = out_of_bounds_y || out_of_bounds_x;
|
||||
|
||||
if (sample_out_of_bounds){
|
||||
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (width + filter_size));
|
||||
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (height + filter_size));
|
||||
if (!out->buffer){
|
||||
fprintf(stderr, "Memory allocation failed!\n");
|
||||
assert(0);
|
||||
|
@ -521,7 +521,7 @@ void kvz_get_extended_block_avx2(int xpos, int ypos, int mv_x, int mv_y, int off
|
|||
coord_y *= ref_width;
|
||||
|
||||
if (!out_of_bounds_x){
|
||||
memcpy(&out->buffer[dst_y*(width + filter_size) + 0], &ref[coord_y + min_x], (width + filter_size) * sizeof(kvz_pixel));
|
||||
memcpy(&out->buffer[dst_y * out->stride + 0], &ref[coord_y + min_x], out->stride * sizeof(kvz_pixel));
|
||||
} else {
|
||||
for (dst_x = 0, x = (xpos)-half_filter_size; x < ((xpos + width)) + half_filter_size; dst_x++, x++) {
|
||||
|
||||
|
@ -529,7 +529,7 @@ void kvz_get_extended_block_avx2(int xpos, int ypos, int mv_x, int mv_y, int off
|
|||
coord_x = CLIP(0, (ref_width)-1, coord_x);
|
||||
|
||||
// Store source block data (with extended borders)
|
||||
out->buffer[dst_y*(width + filter_size) + dst_x] = ref[coord_y + coord_x];
|
||||
out->buffer[dst_y * out->stride + dst_x] = ref[coord_y + coord_x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ void kvz_get_extended_block_generic(int xpos, int ypos, int mv_x, int mv_y, int
|
|||
int sample_out_of_bounds = out_of_bounds_y || out_of_bounds_x;
|
||||
|
||||
if (sample_out_of_bounds){
|
||||
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (width + filter_size));
|
||||
out->buffer = MALLOC(kvz_pixel, (width + filter_size) * (height + filter_size));
|
||||
if (!out->buffer){
|
||||
fprintf(stderr, "Memory allocation failed!\n");
|
||||
assert(0);
|
||||
|
@ -522,7 +522,7 @@ void kvz_get_extended_block_generic(int xpos, int ypos, int mv_x, int mv_y, int
|
|||
coord_y *= ref_width;
|
||||
|
||||
if (!out_of_bounds_x){
|
||||
memcpy(&out->buffer[dst_y*(width + filter_size) + 0], &ref[coord_y + min_x], (width + filter_size) * sizeof(kvz_pixel));
|
||||
memcpy(&out->buffer[dst_y * out->stride + 0], &ref[coord_y + min_x], out->stride * sizeof(kvz_pixel));
|
||||
} else {
|
||||
for (dst_x = 0, x = (xpos)-half_filter_size; x < ((xpos + width)) + half_filter_size; dst_x++, x++) {
|
||||
|
||||
|
@ -530,7 +530,7 @@ void kvz_get_extended_block_generic(int xpos, int ypos, int mv_x, int mv_y, int
|
|||
coord_x = CLIP(0, (ref_width)-1, coord_x);
|
||||
|
||||
// Store source block data (with extended borders)
|
||||
out->buffer[dst_y*(width + filter_size) + dst_x] = ref[coord_y + coord_x];
|
||||
out->buffer[dst_y * out->stride + dst_x] = ref[coord_y + coord_x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue