Add hi_prec_buf_t for higher precision intermediate values for interpolation filter.

This commit is contained in:
Ari Lemmetti 2015-08-04 15:42:18 +03:00
parent 3e31ff2476
commit a87dafb27a
2 changed files with 33 additions and 0 deletions

View file

@ -172,6 +172,28 @@ void yuv_t_free(yuv_t * yuv)
free(yuv); free(yuv);
} }
hi_prec_buf_t * hi_prec_buf_t_alloc(int luma_size)
{
// Get buffers with separate mallocs in order to take advantage of
// automatic buffer overrun checks.
hi_prec_buf_t *yuv = (hi_prec_buf_t *)malloc(sizeof(*yuv));
yuv->y = (int16_t *)malloc(luma_size * sizeof(*yuv->y));
yuv->u = (int16_t *)malloc(luma_size / 2 * sizeof(*yuv->u));
yuv->v = (int16_t *)malloc(luma_size / 2 * sizeof(*yuv->v));
yuv->size = luma_size;
return yuv;
}
void hi_prec_buf_t_free(hi_prec_buf_t * yuv)
{
free(yuv->y);
free(yuv->u);
free(yuv->v);
free(yuv);
}
/** /**
* \brief Diagonally interpolate SAD outside the frame. * \brief Diagonally interpolate SAD outside the frame.
* *

View file

@ -34,6 +34,13 @@ typedef struct {
kvz_pixel v[LCU_CHROMA_SIZE]; kvz_pixel v[LCU_CHROMA_SIZE];
} lcu_yuv_t; } lcu_yuv_t;
typedef struct {
int size;
int16_t *y;
int16_t *u;
int16_t *v;
} hi_prec_buf_t;
typedef struct { typedef struct {
int size; int size;
kvz_pixel *y; kvz_pixel *y;
@ -57,6 +64,10 @@ kvz_picture *image_make_subimage(kvz_picture *const orig_image,
yuv_t * yuv_t_alloc(int luma_size); yuv_t * yuv_t_alloc(int luma_size);
void yuv_t_free(yuv_t * yuv); void yuv_t_free(yuv_t * yuv);
hi_prec_buf_t * hi_prec_buf_t_alloc(int luma_size);
void hi_prec_buf_t_free(hi_prec_buf_t * yuv);
//Algorithms //Algorithms
unsigned image_calc_sad(const kvz_picture *pic, const kvz_picture *ref, int pic_x, int pic_y, int ref_x, int ref_y, unsigned image_calc_sad(const kvz_picture *pic, const kvz_picture *ref, int pic_x, int pic_y, int ref_x, int ref_y,
int block_width, int block_height, int max_lcu_below); int block_width, int block_height, int max_lcu_below);