Fix extrapolated inter SATD

This commit is contained in:
Arttu Ylä-Outinen 2017-05-19 13:08:36 +03:00
parent 631ef53d2a
commit ffac29061f

View file

@ -23,6 +23,7 @@
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include "strategies/strategies-ipol.h"
#include "strategies/strategies-picture.h" #include "strategies/strategies-picture.h"
#include "threads.h" #include "threads.h"
@ -519,17 +520,36 @@ unsigned kvz_image_calc_satd(const kvz_picture *pic,
ref_data, ref_data,
ref->stride) >> (KVZ_BIT_DEPTH - 8); ref->stride) >> (KVZ_BIT_DEPTH - 8);
} else { } else {
// Call a routine that knows how to interpolate pixels outside the frame. // Extrapolate pixels from outside the frame.
// TODO: write interpolated SATD kvz_extended_block block;
unsigned sad = image_interpolated_sad(pic, kvz_get_extended_block(pic_x,
ref, pic_y,
pic_x, ref_x - pic_x,
pic_y, ref_y - pic_y,
ref_x, 0,
ref_y, 0,
block_width, ref->y,
block_height) >> (KVZ_BIT_DEPTH - 8); ref->width,
return 2.4 * sad; ref->height,
0,
block_width,
block_height,
&block);
const kvz_pixel *pic_data = &pic->y[pic_y * pic->stride + pic_x];
unsigned satd = kvz_satd_any_size(block_width,
block_height,
pic_data,
pic->stride,
block.buffer,
block.stride) >> (KVZ_BIT_DEPTH - 8);
if (block.malloc_used) {
FREE_POINTER(block.buffer);
}
return satd;
} }
} }