Fix for sad_tests. Forced intra mode removed. Define for frame padding added.

This commit is contained in:
Arttu Makinen 2021-01-14 14:30:50 +02:00
parent 381bc329d1
commit 65cbee85d7
4 changed files with 40 additions and 20 deletions

View file

@ -164,6 +164,18 @@ typedef int16_t coeff_t;
#define LCU_LUMA_SIZE (LCU_WIDTH * LCU_WIDTH)
#define LCU_CHROMA_SIZE (LCU_WIDTH * LCU_WIDTH >> 2)
/**
* \brief Number of pixels padded around the frame for each row and column.
*
* Half of the padded pixels for each row are on the left side of the
* frame and the other half on the right side. Half of the padded pixels
* for each column are on top of the frame and the other half below the frame.
* Padding also forms squares size of (<padding>/2)^2 to each corner.
*/
#define FRAME_PADDING_LUMA 8
#define FRAME_PADDING_CHROMA (FRAME_PADDING_LUMA/2)
/**
* \brief Number of Most Probable Modes in Intra coding
*

View file

@ -54,8 +54,7 @@ kvz_picture * kvz_image_alloc(enum kvz_chroma_format chroma_format, const int32_
//Add 4 pixel boundary to each side of luma for ALF
//This results also 2 pixel boundary for chroma
unsigned int luma_size = (width + 8) * (height + 8);
//unsigned int luma_size = width * height;
unsigned int luma_size = (width + FRAME_PADDING_LUMA) * (height + FRAME_PADDING_LUMA);
unsigned chroma_sizes[] = { 0, luma_size / 4, luma_size / 2, luma_size };
unsigned chroma_size = chroma_sizes[chroma_format];
@ -68,17 +67,17 @@ kvz_picture * kvz_image_alloc(enum kvz_chroma_format chroma_format, const int32_
free(im);
return NULL;
}
//im->fulldata = im->fulldata_buf + simd_padding_width / sizeof(kvz_pixel);
//Shift the image to allow ALF filtering
//im->fulldata = &im->fulldata[4 * (width + 8) + 4];
im->fulldata = &im->fulldata_buf[4 * (width + 8) + 4] + simd_padding_width / sizeof(kvz_pixel);
im->base_image = im;
im->refcount = 1; //We give a reference to caller
im->width = width;
im->height = height;
im->stride = width + 8;
im->stride = width + FRAME_PADDING_LUMA;
im->chroma_format = chroma_format;
const int padding_before_first_pixel_luma = (FRAME_PADDING_LUMA / 2) * (im->stride) + FRAME_PADDING_LUMA / 2;
const int padding_before_first_pixel_chroma = (FRAME_PADDING_CHROMA / 2) * (im->stride/2) + FRAME_PADDING_CHROMA / 2;
im->fulldata = &im->fulldata_buf[padding_before_first_pixel_luma] + simd_padding_width / sizeof(kvz_pixel);
im->base_image = im;
im->y = im->data[COLOR_Y] = &im->fulldata[0];
@ -86,8 +85,8 @@ kvz_picture * kvz_image_alloc(enum kvz_chroma_format chroma_format, const int32_
im->u = im->data[COLOR_U] = NULL;
im->v = im->data[COLOR_V] = NULL;
} else {
im->u = im->data[COLOR_U] = &im->fulldata[luma_size - (4 * (width + 8) + 4) + (2 * (im->stride / 2) + 2)];
im->v = im->data[COLOR_V] = &im->fulldata[luma_size - (4 * (width + 8) + 4) + chroma_size + (2 * (im->stride / 2) + 2)];
im->u = im->data[COLOR_U] = &im->fulldata[luma_size - padding_before_first_pixel_luma + padding_before_first_pixel_chroma];
im->v = im->data[COLOR_V] = &im->fulldata[luma_size - padding_before_first_pixel_luma + chroma_size + padding_before_first_pixel_chroma];
}
im->pts = 0;

View file

@ -587,7 +587,6 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
cur_cu->part_size = depth > MAX_DEPTH ? SIZE_NxN : SIZE_2Nx2N;
cur_cu->intra.mode = intra_mode;
}
cur_cu->intra.mode = state->frame->num % 67;
}
// Reconstruct best mode because we need the reconstructed pixels for

View file

@ -77,25 +77,35 @@ static struct sad_test_env_t {
static void setup_tests()
{
g_pic = kvz_image_alloc(KVZ_CSP_420, 8, 8);
for (int i = 0; i < 64; ++i) {
g_pic->y[i] = pic_data[i] + 48;
for (int y = 0; y < 8; ++y) {
for (int x = 0; x < 8; ++x) {
g_pic->y[y*g_pic->stride + x] = pic_data[8*y + x] + 48;
}
}
g_ref = kvz_image_alloc(KVZ_CSP_420, 8, 8);
for (int i = 0; i < 64; ++i) {
g_ref->y[i] = ref_data[i] + 48;
for (int y = 0; y < 8; ++y) {
for (int x = 0; x < 8; ++x) {
g_ref->y[y*g_ref->stride + x] = ref_data[8*y + x] + 48;
}
}
int i = 0;
g_big_pic = kvz_image_alloc(KVZ_CSP_420, 64, 64);
for (int i = 0; i < 64*64; ++i) {
g_big_pic->y[i] = (i*i / 32 + i) % 255;
//g_big_pic->y[i] = i % 255;
for (int y = 0; y < 64; ++y) {
for (int x = 0; x < 64; ++x) {
i = ((64 * y) + x);
g_big_pic->y[y*g_big_pic->stride + x] = (i*i / 32 + i) % 255;
}
}
i = 0;
g_big_ref = kvz_image_alloc(KVZ_CSP_420, 64, 64);
for (int i = 0; i < 64 * 64; ++i) {
g_big_ref->y[i] = (i*i / 16 + i) % 255;
//g_big_ref->y[i] = (i / 2) % 255;
for (int y = 0; y < 64; ++y) {
for (int x = 0; x < 64; ++x) {
i = ((64 * y) + x);
g_big_ref->y[y*g_big_ref->stride + x] = (i*i / 16 + i) % 255;
}
}
g_64x64_zero = kvz_image_alloc(KVZ_CSP_420, 64, 64);