mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Change sad functions to accept negative block widths.
This makes boundary checking clearer.
This commit is contained in:
parent
235b1ec0bc
commit
0df974cb0d
|
@ -560,10 +560,10 @@ uint32_t sad4x4(int16_t *block1, uint32_t stride1,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned cor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
unsigned cor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
unsigned block_width, unsigned block_height, unsigned width)
|
int block_width, int block_height, unsigned width)
|
||||||
{
|
{
|
||||||
unsigned char ref = *ref_data;
|
unsigned char ref = *ref_data;
|
||||||
unsigned x, y;
|
int x, y;
|
||||||
unsigned sad = 0;
|
unsigned sad = 0;
|
||||||
|
|
||||||
for (y = 0; y < block_height; ++y) {
|
for (y = 0; y < block_height; ++y) {
|
||||||
|
@ -576,9 +576,9 @@ unsigned cor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ver_sad(unsigned char* pic_data, unsigned char* ref_data,
|
unsigned ver_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
unsigned block_width, unsigned block_height, unsigned width)
|
int block_width, int block_height, unsigned width)
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
int x, y;
|
||||||
unsigned sad = 0;
|
unsigned sad = 0;
|
||||||
|
|
||||||
for (y = 0; y < block_height; ++y) {
|
for (y = 0; y < block_height; ++y) {
|
||||||
|
@ -591,9 +591,9 @@ unsigned ver_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned hor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
unsigned hor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
unsigned block_width, unsigned block_height, unsigned width)
|
int block_width, int block_height, unsigned width)
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
int x, y;
|
||||||
unsigned sad = 0;
|
unsigned sad = 0;
|
||||||
|
|
||||||
for (y = 0; y < block_height; ++y) {
|
for (y = 0; y < block_height; ++y) {
|
||||||
|
@ -619,10 +619,10 @@ unsigned hor_sad(unsigned char* pic_data, unsigned char* ref_data,
|
||||||
*
|
*
|
||||||
* \returns Sum of Absolute Differences
|
* \returns Sum of Absolute Differences
|
||||||
*/
|
*/
|
||||||
uint32_t reg_sad(uint8_t *data1, uint8_t *data2,
|
unsigned reg_sad(uint8_t *data1, uint8_t *data2,
|
||||||
unsigned width, unsigned height, unsigned stride)
|
int width, int height, unsigned stride)
|
||||||
{
|
{
|
||||||
unsigned y, x;
|
int y, x;
|
||||||
unsigned sad = 0;
|
unsigned sad = 0;
|
||||||
|
|
||||||
for (y = 0; y < height; ++y) {
|
for (y = 0; y < height; ++y) {
|
||||||
|
|
|
@ -121,14 +121,14 @@ uint32_t sad8x8(int16_t *block1, uint32_t stride1,
|
||||||
uint32_t sad4x4(int16_t *block1, uint32_t stride1,
|
uint32_t sad4x4(int16_t *block1, uint32_t stride1,
|
||||||
int16_t* block2, uint32_t stride2);
|
int16_t* block2, uint32_t stride2);
|
||||||
|
|
||||||
uint32_t cor_sad(uint8_t *data1, uint8_t *data2,
|
unsigned cor_sad(uint8_t *data1, uint8_t *data2,
|
||||||
unsigned width, unsigned height, unsigned stride);
|
int width, int height, unsigned stride);
|
||||||
uint32_t ver_sad(uint8_t *data1, uint8_t *data2,
|
unsigned ver_sad(uint8_t *data1, uint8_t *data2,
|
||||||
unsigned width, unsigned height, unsigned stride);
|
int width, int height, unsigned stride);
|
||||||
uint32_t hor_sad(uint8_t *data1, uint8_t *data2,
|
unsigned hor_sad(uint8_t *data1, uint8_t *data2,
|
||||||
unsigned width, unsigned height, unsigned stride);
|
int width, int height, unsigned stride);
|
||||||
uint32_t reg_sad(uint8_t *data1, uint8_t *data2,
|
unsigned reg_sad(uint8_t *data1, uint8_t *data2,
|
||||||
unsigned width, unsigned height, unsigned stride);
|
int width, int height, unsigned stride);
|
||||||
|
|
||||||
double image_psnr(uint8_t *frame1, uint8_t *frame2, int32_t x, int32_t y);
|
double image_psnr(uint8_t *frame1, uint8_t *frame2, int32_t x, int32_t y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue