mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Fix extrapolated inter SATD
This commit is contained in:
parent
631ef53d2a
commit
ffac29061f
38
src/image.c
38
src/image.c
|
@ -23,6 +23,7 @@
|
|||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "strategies/strategies-ipol.h"
|
||||
#include "strategies/strategies-picture.h"
|
||||
#include "threads.h"
|
||||
|
||||
|
@ -519,17 +520,36 @@ unsigned kvz_image_calc_satd(const kvz_picture *pic,
|
|||
ref_data,
|
||||
ref->stride) >> (KVZ_BIT_DEPTH - 8);
|
||||
} else {
|
||||
// Call a routine that knows how to interpolate pixels outside the frame.
|
||||
// TODO: write interpolated SATD
|
||||
unsigned sad = image_interpolated_sad(pic,
|
||||
ref,
|
||||
pic_x,
|
||||
// Extrapolate pixels from outside the frame.
|
||||
kvz_extended_block block;
|
||||
kvz_get_extended_block(pic_x,
|
||||
pic_y,
|
||||
ref_x,
|
||||
ref_y,
|
||||
ref_x - pic_x,
|
||||
ref_y - pic_y,
|
||||
0,
|
||||
0,
|
||||
ref->y,
|
||||
ref->width,
|
||||
ref->height,
|
||||
0,
|
||||
block_width,
|
||||
block_height) >> (KVZ_BIT_DEPTH - 8);
|
||||
return 2.4 * sad;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue