mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
[refwrap] Fix the MV wrapping by only wrapping the x-axis and rename some variables
This commit is contained in:
parent
505d0f8c16
commit
96c6dee6ab
|
@ -371,7 +371,7 @@ static void inter_cp_with_ext_border(const uvg_pixel *ref_buf, int ref_stride,
|
||||||
for (int x = mv_in_frame->x; x < mv_in_frame->x + width; ++x) {
|
for (int x = mv_in_frame->x; x < mv_in_frame->x + width; ++x) {
|
||||||
vector2d_t in_frame = {
|
vector2d_t in_frame = {
|
||||||
mv_wrap?((x<0)?x+ref_width:x%ref_width):CLIP(0, ref_width - 1, x),
|
mv_wrap?((x<0)?x+ref_width:x%ref_width):CLIP(0, ref_width - 1, x),
|
||||||
mv_wrap?((y<0)?y+ref_height:y%ref_height):CLIP(0, ref_height - 1, y),
|
CLIP(0, ref_height - 1, y),
|
||||||
};
|
};
|
||||||
vector2d_t in_pu = {
|
vector2d_t in_pu = {
|
||||||
x - mv_in_frame->x,
|
x - mv_in_frame->x,
|
||||||
|
|
|
@ -828,26 +828,25 @@ void uvg_get_extended_block_wraparound_generic(uvg_epol_args *args)
|
||||||
*args->ext_origin = args->buf + args->pad_t * (*args->ext_s) + args->pad_l;
|
*args->ext_origin = args->buf + args->pad_t * (*args->ext_s) + args->pad_l;
|
||||||
|
|
||||||
// Note that stride equals width here.
|
// Note that stride equals width here.
|
||||||
int cnt_l = CLIP(0, *args->ext_s, -min_x);
|
int count_left = CLIP(0, *args->ext_s, -min_x);
|
||||||
int cnt_r = CLIP(0, *args->ext_s, max_x - (args->src_w - 1));
|
int count_right = CLIP(0, *args->ext_s, max_x - (args->src_w - 1));
|
||||||
int cnt_m = CLIP(0, *args->ext_s, *args->ext_s - cnt_l - cnt_r);
|
int count_middle = CLIP(0, *args->ext_s, *args->ext_s - count_left - count_right);
|
||||||
|
|
||||||
// For each row including real padding.
|
// For each row including real padding.
|
||||||
// Don't read "don't care" values (SIMD padding). Zero them out.
|
// Don't read "don't care" values (SIMD padding). Zero them out.
|
||||||
int y;
|
int y;
|
||||||
for (y = -args->pad_t; y < args->blk_h + args->pad_b; ++y) {
|
for (y = -args->pad_t; y < args->blk_h + args->pad_b; ++y) {
|
||||||
int absolute_y = args->blk_y + y;
|
int clipped_y = CLIP(0, args->src_h - 1, args->blk_y + y);
|
||||||
int wrapped_y = absolute_y<0?args->src_h+absolute_y:((absolute_y > args->src_h - 1)?absolute_y-args->src_h:absolute_y);
|
uvg_pixel *sample_l = args->src + clipped_y * args->src_s;
|
||||||
uvg_pixel *sample_l = args->src + wrapped_y * args->src_s;
|
|
||||||
uvg_pixel *sample_r =
|
uvg_pixel *sample_r =
|
||||||
args->src + wrapped_y * args->src_s + args->src_w - 1;
|
args->src + clipped_y * args->src_s + args->src_w - 1;
|
||||||
uvg_pixel *src_m = args->src + wrapped_y * args->src_s + MAX(min_x, 0);
|
uvg_pixel *src_m = args->src + clipped_y * args->src_s + MAX(min_x, 0);
|
||||||
uvg_pixel *dst_l = args->buf + (y + args->pad_t) * (*args->ext_s);
|
uvg_pixel *dst_l = args->buf + (y + args->pad_t) * (*args->ext_s);
|
||||||
uvg_pixel *dst_m = dst_l + cnt_l;
|
uvg_pixel *dst_m = dst_l + count_left;
|
||||||
uvg_pixel *dst_r = dst_m + cnt_m;
|
uvg_pixel *dst_r = dst_m + count_middle;
|
||||||
for (int i = 0; i < cnt_l; ++i) *(dst_l + i) = *(sample_r - (cnt_l-i));
|
for (int i = 0; i < count_left; ++i) *(dst_l + i) = *((sample_r - (count_left-1)) + i);
|
||||||
for (int i = 0; i < cnt_m; ++i) *(dst_m + i) = *(src_m + i);
|
for (int i = 0; i < count_middle; ++i) *(dst_m + i) = *(src_m + i);
|
||||||
for (int i = 0; i < cnt_r; ++i) *(dst_r + i) = *(sample_l + i);
|
for (int i = 0; i < count_right; ++i) *(dst_r + i) = *(sample_l + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y_simd = 0; y_simd < args->pad_b_simd; ++y_simd) {
|
for (int y_simd = 0; y_simd < args->pad_b_simd; ++y_simd) {
|
||||||
|
|
Loading…
Reference in a new issue