Commit 0016a804 authored by Oskar Arvidsson's avatar Oskar Arvidsson Committed by Fiona Glaser

Use a 16-bit buffer in hpel_filter regardless of bit depth

This only works up to and including 10-bit (but we don't support anything higher yet).
parent 0a6b2a68
......@@ -333,7 +333,7 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
int scratch_size = 0;
if( !b_lookahead )
{
int buf_hpel = (h->thread[0]->fdec->i_width[0]+48) * sizeof(dctcoef);
int buf_hpel = (h->thread[0]->fdec->i_width[0]+48) * sizeof(int16_t);
int buf_ssim = h->param.analyse.b_ssim * 8 * (h->param.i_width/4+3) * sizeof(int);
int me_range = X264_MIN(h->param.analyse.i_me_range, h->param.analyse.i_mv_range);
int buf_tesa = (h->param.analyse.i_me_method >= X264_ME_ESA) *
......
......@@ -177,18 +177,20 @@ static void mc_copy( pixel *src, int i_src_stride, pixel *dst, int i_dst_stride,
#define TAPFILTER(pix, d) ((pix)[x-2*d] + (pix)[x+3*d] - 5*((pix)[x-d] + (pix)[x+2*d]) + 20*((pix)[x] + (pix)[x+d]))
static void hpel_filter( pixel *dsth, pixel *dstv, pixel *dstc, pixel *src,
int stride, int width, int height, dctcoef *buf )
int stride, int width, int height, int16_t *buf )
{
const int pad = (BIT_DEPTH > 9) ? (-10 * PIXEL_MAX) : 0;
for( int y = 0; y < height; y++ )
{
for( int x = -2; x < width+3; x++ )
{
int v = TAPFILTER(src,stride);
dstv[x] = x264_clip_pixel( (v + 16) >> 5 );
buf[x+2] = v;
/* transform v for storage in a 16-bit integer */
buf[x+2] = v + pad;
}
for( int x = 0; x < width; x++ )
dstc[x] = x264_clip_pixel( (TAPFILTER(buf+2,1) + 512) >> 10 );
dstc[x] = x264_clip_pixel( (TAPFILTER(buf+2,1) - 32*pad + 512) >> 10 );
for( int x = 0; x < width; x++ )
dsth[x] = x264_clip_pixel( (TAPFILTER(src,1) + 16) >> 5 );
dsth += stride;
......
......@@ -98,7 +98,7 @@ typedef struct
pixel *src, int i_src, int w, int h );
void (*hpel_filter)( pixel *dsth, pixel *dstv, pixel *dstc, pixel *src,
int i_stride, int i_width, int i_height, dctcoef *buf );
int i_stride, int i_width, int i_height, int16_t *buf );
/* prefetch the next few macroblocks of fenc or fdec */
void (*prefetch_fenc)( pixel *pix_y, int stride_y,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment