void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
\
-static void (* x264_mc##func##_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int ) =\
+static void (* mc##func##_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int ) =\
{\
x264_mc_weight_w4##func##_neon,\
x264_mc_weight_w4##func##_neon,\
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
-static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w )
+static void weight_cache_neon( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
if( w->i_offset < 0 )
{
- w->weightfn = x264_mc_offsetsub_wtab_neon;
+ w->weightfn = mc_offsetsub_wtab_neon;
w->cachea[0] = -w->i_offset;
}
else
{
- w->weightfn = x264_mc_offsetadd_wtab_neon;
+ w->weightfn = mc_offsetadd_wtab_neon;
w->cachea[0] = w->i_offset;
}
}
else if( !w->i_denom )
- w->weightfn = x264_mc_nodenom_wtab_neon;
+ w->weightfn = mc_nodenom_wtab_neon;
else
- w->weightfn = x264_mc_wtab_neon;
+ w->weightfn = mc_wtab_neon;
}
-static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
+static void (* const pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
{
NULL,
x264_pixel_avg2_w4_neon,
x264_pixel_avg2_w20_neon,
};
-static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
+static void (* const mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
{
NULL,
x264_mc_copy_w4_neon,
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
else if( weight->weightfn )
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );
else
- x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
}
static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride,
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, *i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon;
pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon;
- pf->plane_copy = x264_plane_copy_neon;
- pf->plane_copy_swap = x264_plane_copy_swap_neon;
+ pf->plane_copy = plane_copy_neon;
+ pf->plane_copy_swap = plane_copy_swap_neon;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon;
- pf->plane_copy_interleave = x264_plane_copy_interleave_neon;
+ pf->plane_copy_interleave = plane_copy_interleave_neon;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_neon;
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon;
- pf->weight = x264_mc_wtab_neon;
- pf->offsetadd = x264_mc_offsetadd_wtab_neon;
- pf->offsetsub = x264_mc_offsetsub_wtab_neon;
- pf->weight_cache = x264_weight_cache_neon;
+ pf->weight = mc_wtab_neon;
+ pf->offsetadd = mc_offsetadd_wtab_neon;
+ pf->offsetsub = mc_offsetsub_wtab_neon;
+ pf->weight_cache = weight_cache_neon;
pf->mc_chroma = x264_mc_chroma_neon;
pf->mc_luma = mc_luma_neon;
pf->integral_init8v = x264_integral_init8v_neon;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon;
+ pf->mbtree_propagate_list = mbtree_propagate_list_neon;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon;
void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
\
-static weight_fn_t x264_mc##func##_wtab_neon[6] =\
+static weight_fn_t mc##func##_wtab_neon[6] =\
{\
x264_mc_weight_w4##func##_neon,\
x264_mc_weight_w4##func##_neon,\
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
-static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w )
+static void weight_cache_neon( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
if( w->i_offset < 0 )
{
- w->weightfn = x264_mc_offsetsub_wtab_neon;
+ w->weightfn = mc_offsetsub_wtab_neon;
w->cachea[0] = -w->i_offset;
}
else
{
- w->weightfn = x264_mc_offsetadd_wtab_neon;
+ w->weightfn = mc_offsetadd_wtab_neon;
w->cachea[0] = w->i_offset;
}
}
else if( !w->i_denom )
- w->weightfn = x264_mc_nodenom_wtab_neon;
+ w->weightfn = mc_nodenom_wtab_neon;
else
- w->weightfn = x264_mc_wtab_neon;
+ w->weightfn = mc_wtab_neon;
}
-static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
+static void (* const pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
{
NULL,
x264_pixel_avg2_w4_neon,
x264_pixel_avg2_w20_neon,
};
-static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
+static void (* const mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
{
NULL,
x264_mc_copy_w4_neon,
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
else if( weight->weightfn )
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );
else
- x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
}
static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride,
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, *i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon;
pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon;
- pf->plane_copy = x264_plane_copy_neon;
+ pf->plane_copy = plane_copy_neon;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon;
- pf->plane_copy_interleave = x264_plane_copy_interleave_neon;
- pf->plane_copy_swap = x264_plane_copy_swap_neon;
+ pf->plane_copy_interleave = plane_copy_interleave_neon;
+ pf->plane_copy_swap = plane_copy_swap_neon;
pf->store_interleave_chroma = x264_store_interleave_chroma_neon;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon;
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon;
- pf->weight = x264_mc_wtab_neon;
- pf->offsetadd = x264_mc_offsetadd_wtab_neon;
- pf->offsetsub = x264_mc_offsetsub_wtab_neon;
- pf->weight_cache = x264_weight_cache_neon;
+ pf->weight = mc_wtab_neon;
+ pf->offsetadd = mc_offsetadd_wtab_neon;
+ pf->offsetsub = mc_offsetsub_wtab_neon;
+ pf->weight_cache = weight_cache_neon;
pf->mc_chroma = x264_mc_chroma_neon;
pf->mc_luma = mc_luma_neon;
pf->integral_init8v = x264_integral_init8v_neon;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon;
+ pf->mbtree_propagate_list = mbtree_propagate_list_neon;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon;
#endif // !HIGH_BIT_DEPTH
#include "common.h"
-static uint8_t *x264_nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end )
+static uint8_t *nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end )
{
if( src < end ) *dst++ = *src++;
if( src < end ) *dst++ = *src++;
{
memset( pf, 0, sizeof(*pf) );
- pf->nal_escape = x264_nal_escape_c;
+ pf->nal_escape = nal_escape_c;
#if HAVE_MMX
#if ARCH_X86_64 && !defined( __MACH__ )
pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_sse2;
cb->p_end = p_end;
}
-static inline void x264_cabac_putbyte( x264_cabac_t *cb )
+static inline void cabac_putbyte( x264_cabac_t *cb )
{
if( cb->i_queue >= 0 )
{
}
}
-static inline void x264_cabac_encode_renorm( x264_cabac_t *cb )
+static inline void cabac_encode_renorm( x264_cabac_t *cb )
{
int shift = x264_cabac_renorm_shift[cb->i_range>>3];
cb->i_range <<= shift;
cb->i_low <<= shift;
cb->i_queue += shift;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
}
/* Making custom versions of this function, even in asm, for the cases where
cb->i_range = i_range_lps;
}
cb->state[i_ctx] = x264_cabac_transition[i_state][b];
- x264_cabac_encode_renorm( cb );
+ cabac_encode_renorm( cb );
}
/* Note: b is negated for this function */
cb->i_low <<= 1;
cb->i_low += b & cb->i_range;
cb->i_queue += 1;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
}
static const int bypass_lut[16] =
cb->i_low <<= i;
cb->i_low += ((x>>k)&0xff) * cb->i_range;
cb->i_queue += i;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
i = 8;
} while( k > 0 );
}
void x264_cabac_encode_terminal_c( x264_cabac_t *cb )
{
cb->i_range -= 2;
- x264_cabac_encode_renorm( cb );
+ cabac_encode_renorm( cb );
}
void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb )
cb->i_low |= 1;
cb->i_low <<= 9;
cb->i_queue += 9;
- x264_cabac_putbyte( cb );
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
+ cabac_putbyte( cb );
cb->i_low <<= -cb->i_queue;
cb->i_low |= (0x35a4e4f5 >> (h->i_frame & 31) & 1) << 10;
cb->i_queue = 0;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
while( cb->i_bytes_outstanding > 0 )
{
const int x264_chroma_format = X264_CHROMA_FORMAT;
-static void x264_log_default( void *, int, const char *, va_list );
+static void log_default( void *, int, const char *, va_list );
/****************************************************************************
* x264_param_default:
param->rc.b_mb_tree = 1;
/* Log */
- param->pf_log = x264_log_default;
+ param->pf_log = log_default;
param->p_log_private = NULL;
param->i_log_level = X264_LOG_INFO;
param->psz_clbin_file = NULL;
}
-static int x264_param_apply_preset( x264_param_t *param, const char *preset )
+static int param_apply_preset( x264_param_t *param, const char *preset )
{
char *end;
int i = strtol( preset, &end, 10 );
return 0;
}
-static int x264_param_apply_tune( x264_param_t *param, const char *tune )
+static int param_apply_tune( x264_param_t *param, const char *tune )
{
char *tmp = x264_malloc( strlen( tune ) + 1 );
if( !tmp )
{
x264_param_default( param );
- if( preset && x264_param_apply_preset( param, preset ) < 0 )
+ if( preset && param_apply_preset( param, preset ) < 0 )
return -1;
- if( tune && x264_param_apply_tune( param, tune ) < 0 )
+ if( tune && param_apply_tune( param, tune ) < 0 )
return -1;
return 0;
}
return (i == length) ? 0 : -1;
}
-static int x264_atobool( const char *str, int *b_error )
+static int atobool_internal( const char *str, int *b_error )
{
if( !strcmp(str, "1") ||
!strcasecmp(str, "true") ||
return 0;
}
-static int x264_atoi( const char *str, int *b_error )
+static int atoi_internal( const char *str, int *b_error )
{
char *end;
int v = strtol( str, &end, 0 );
return v;
}
-static double x264_atof( const char *str, int *b_error )
+static double atof_internal( const char *str, int *b_error )
{
char *end;
double v = strtod( str, &end );
return v;
}
-#define atobool(str) ( name_was_bool = 1, x264_atobool( str, &b_error ) )
+#define atobool(str) ( name_was_bool = 1, atobool_internal( str, &b_error ) )
#undef atoi
#undef atof
-#define atoi(str) x264_atoi( str, &b_error )
-#define atof(str) x264_atof( str, &b_error )
+#define atoi(str) atoi_internal( str, &b_error )
+#define atof(str) atof_internal( str, &b_error )
int x264_param_parse( x264_param_t *p, const char *name, const char *value )
{
va_list arg;
va_start( arg, psz_fmt );
if( !h )
- x264_log_default( NULL, i_level, psz_fmt, arg );
+ log_default( NULL, i_level, psz_fmt, arg );
else
h->param.pf_log( h->param.p_log_private, i_level, psz_fmt, arg );
va_end( arg );
}
}
-static void x264_log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg )
+static void log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg )
{
char *psz_prefix;
switch( i_level )
int height_fix8[3];
} x264_csp_tab_t;
- static const x264_csp_tab_t x264_csp_tab[] =
+ static const x264_csp_tab_t csp_tab[] =
{
[X264_CSP_I420] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
[X264_CSP_YV12] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
return -1;
x264_picture_init( pic );
pic->img.i_csp = i_csp;
- pic->img.i_plane = x264_csp_tab[csp].planes;
+ pic->img.i_plane = csp_tab[csp].planes;
int depth_factor = i_csp & X264_CSP_HIGH_DEPTH ? 2 : 1;
int plane_offset[3] = {0};
int frame_size = 0;
for( int i = 0; i < pic->img.i_plane; i++ )
{
- int stride = (((int64_t)i_width * x264_csp_tab[csp].width_fix8[i]) >> 8) * depth_factor;
- int plane_size = (((int64_t)i_height * x264_csp_tab[csp].height_fix8[i]) >> 8) * stride;
+ int stride = (((int64_t)i_width * csp_tab[csp].width_fix8[i]) >> 8) * depth_factor;
+ int plane_size = (((int64_t)i_height * csp_tab[csp].height_fix8[i]) >> 8) * stride;
pic->img.i_stride[i] = stride;
plane_offset[i] = frame_size;
frame_size += plane_size;
pf_intra( pix, i_stride, alpha, beta );
}
-static ALWAYS_INLINE void x264_macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
+static ALWAYS_INLINE void macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
{
int deblock_on_slice_edges = h->sh.i_disable_deblocking_filter_idc != 2;
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
{
x264_prefetch_fenc( h, h->fdec, mb_x, mb_y );
- x264_macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
+ macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
int mb_xy = h->mb.i_mb_xy;
int transform_8x8 = h->mb.mb_transform_size[mb_xy];
return x;
}
-static int x264_frame_internal_csp( int external_csp )
+static int frame_internal_csp( int external_csp )
{
switch( external_csp & X264_CSP_MASK )
{
}
}
-static x264_frame_t *x264_frame_new( x264_t *h, int b_fdec )
+static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
x264_frame_t *frame;
- int i_csp = x264_frame_internal_csp( h->param.i_csp );
+ int i_csp = frame_internal_csp( h->param.i_csp );
int i_mb_count = h->mb.i_mb_count;
int i_stride, i_width, i_lines, luma_plane_count;
int i_padv = PADV << PARAM_INTERLACED;
int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
{
int i_csp = src->img.i_csp & X264_CSP_MASK;
- if( dst->i_csp != x264_frame_internal_csp( i_csp ) )
+ if( dst->i_csp != frame_internal_csp( i_csp ) )
{
x264_log( h, X264_LOG_ERROR, "Invalid input colorspace\n" );
return -1;
if( h->frames.unused[b_fdec][0] )
frame = x264_frame_pop( h->frames.unused[b_fdec] );
else
- frame = x264_frame_new( h, b_fdec );
+ frame = frame_new( h, b_fdec );
if( !frame )
return NULL;
frame->b_last_minigop_bframe = 0;
mvx, mvy, 4*width, 4*height, \
list ? x264_weight_none : &h->sh.weight[i_ref][p] );
-static NOINLINE void x264_mb_mc_0xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_0xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref = h->mb.cache.ref[0][i8];
&h->sh.weight[i_ref][2], height );
}
}
-static NOINLINE void x264_mb_mc_1xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_1xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref = h->mb.cache.ref[1][i8];
h->mc.avg[i_mode]( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \
src0, i_stride0, src1, i_stride1, weight );
-static NOINLINE void x264_mb_mc_01xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_01xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref0 = h->mb.cache.ref[0][i8];
switch( h->mb.i_sub_partition[i8] )
{
case D_L0_8x8:
- x264_mb_mc_0xywh( h, x, y, 2, 2 );
+ mb_mc_0xywh( h, x, y, 2, 2 );
break;
case D_L0_8x4:
- x264_mb_mc_0xywh( h, x, y+0, 2, 1 );
- x264_mb_mc_0xywh( h, x, y+1, 2, 1 );
+ mb_mc_0xywh( h, x, y+0, 2, 1 );
+ mb_mc_0xywh( h, x, y+1, 2, 1 );
break;
case D_L0_4x8:
- x264_mb_mc_0xywh( h, x+0, y, 1, 2 );
- x264_mb_mc_0xywh( h, x+1, y, 1, 2 );
+ mb_mc_0xywh( h, x+0, y, 1, 2 );
+ mb_mc_0xywh( h, x+1, y, 1, 2 );
break;
case D_L0_4x4:
- x264_mb_mc_0xywh( h, x+0, y+0, 1, 1 );
- x264_mb_mc_0xywh( h, x+1, y+0, 1, 1 );
- x264_mb_mc_0xywh( h, x+0, y+1, 1, 1 );
- x264_mb_mc_0xywh( h, x+1, y+1, 1, 1 );
+ mb_mc_0xywh( h, x+0, y+0, 1, 1 );
+ mb_mc_0xywh( h, x+1, y+0, 1, 1 );
+ mb_mc_0xywh( h, x+0, y+1, 1, 1 );
+ mb_mc_0xywh( h, x+1, y+1, 1, 1 );
break;
}
}
if( h->mb.cache.ref[0][scan8] >= 0 )
if( h->mb.cache.ref[1][scan8] >= 0 )
- x264_mb_mc_01xywh( h, x, y, 2, 2 );
+ mb_mc_01xywh( h, x, y, 2, 2 );
else
- x264_mb_mc_0xywh( h, x, y, 2, 2 );
+ mb_mc_0xywh( h, x, y, 2, 2 );
else
- x264_mb_mc_1xywh( h, x, y, 2, 2 );
+ mb_mc_1xywh( h, x, y, 2, 2 );
}
}
if( h->mb.i_partition == D_16x16 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 4 );
- else x264_mb_mc_0xywh ( h, 0, 0, 4, 4 );
- else x264_mb_mc_1xywh ( h, 0, 0, 4, 4 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 4, 4 );
+ else mb_mc_0xywh ( h, 0, 0, 4, 4 );
+ else mb_mc_1xywh ( h, 0, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 2 );
- else x264_mb_mc_0xywh ( h, 0, 0, 4, 2 );
- else x264_mb_mc_1xywh ( h, 0, 0, 4, 2 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 4, 2 );
+ else mb_mc_0xywh ( h, 0, 0, 4, 2 );
+ else mb_mc_1xywh ( h, 0, 0, 4, 2 );
if( ref0b >= 0 )
- if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 0, 2, 4, 2 );
- else x264_mb_mc_0xywh ( h, 0, 2, 4, 2 );
- else x264_mb_mc_1xywh ( h, 0, 2, 4, 2 );
+ if( ref1b >= 0 ) mb_mc_01xywh( h, 0, 2, 4, 2 );
+ else mb_mc_0xywh ( h, 0, 2, 4, 2 );
+ else mb_mc_1xywh ( h, 0, 2, 4, 2 );
}
else if( h->mb.i_partition == D_8x16 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 2, 4 );
- else x264_mb_mc_0xywh ( h, 0, 0, 2, 4 );
- else x264_mb_mc_1xywh ( h, 0, 0, 2, 4 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 2, 4 );
+ else mb_mc_0xywh ( h, 0, 0, 2, 4 );
+ else mb_mc_1xywh ( h, 0, 0, 2, 4 );
if( ref0b >= 0 )
- if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 2, 0, 2, 4 );
- else x264_mb_mc_0xywh ( h, 2, 0, 2, 4 );
- else x264_mb_mc_1xywh ( h, 2, 0, 2, 4 );
+ if( ref1b >= 0 ) mb_mc_01xywh( h, 2, 0, 2, 4 );
+ else mb_mc_0xywh ( h, 2, 0, 2, 4 );
+ else mb_mc_1xywh ( h, 2, 0, 2, 4 );
}
}
}
dst[i*FDEC_STRIDE] = src[i*FDEC_STRIDE];
}
-static void ALWAYS_INLINE x264_macroblock_load_pic_pointers( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
+static void ALWAYS_INLINE macroblock_load_pic_pointers( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
{
int mb_interlaced = b_mbaff && MB_INTERLACED;
int height = b_chroma ? 16 >> CHROMA_V_SHIFT : 16;
{{ 4, 5, 6, 3}, { 3, 7, 11, 15}, {16+1, 16+5, 32+1, 32+5}, {0, 1, 2, 3}, {0, 0, 1, 1}}
};
-static void ALWAYS_INLINE x264_macroblock_cache_load_neighbours( x264_t *h, int mb_x, int mb_y, int b_interlaced )
+static void ALWAYS_INLINE macroblock_cache_load_neighbours( x264_t *h, int mb_x, int mb_y, int b_interlaced )
{
const int mb_interlaced = b_interlaced && MB_INTERLACED;
int top_y = mb_y - (1 << mb_interlaced);
# define LBOT 0
#endif
-static void ALWAYS_INLINE x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y, int b_mbaff )
+static void ALWAYS_INLINE macroblock_cache_load( x264_t *h, int mb_x, int mb_y, int b_mbaff )
{
- x264_macroblock_cache_load_neighbours( h, mb_x, mb_y, b_mbaff );
+ macroblock_cache_load_neighbours( h, mb_x, mb_y, b_mbaff );
int *left = h->mb.i_mb_left_xy;
int top = h->mb.i_mb_top_xy;
{
x264_copy_column8( h->mb.pic.p_fdec[0]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[0]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+12*FDEC_STRIDE );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 0 );
if( CHROMA444 )
{
x264_copy_column8( h->mb.pic.p_fdec[1]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+12*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+12*FDEC_STRIDE );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 0 );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 0 );
}
else
{
x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+ 7+12*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+ 7+12*FDEC_STRIDE );
}
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 0 );
}
}
else
{
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 1 );
if( CHROMA444 )
{
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 1 );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 1 );
}
else
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 1 );
}
if( h->fdec->integral )
void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y )
{
- x264_macroblock_cache_load( h, mb_x, mb_y, 0 );
+ macroblock_cache_load( h, mb_x, mb_y, 0 );
}
void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y )
{
- x264_macroblock_cache_load( h, mb_x, mb_y, 1 );
+ macroblock_cache_load( h, mb_x, mb_y, 1 );
}
-static void x264_macroblock_deblock_strength_mbaff( x264_t *h, uint8_t (*bs)[8][4] )
+static void macroblock_deblock_strength_mbaff( x264_t *h, uint8_t (*bs)[8][4] )
{
if( (h->mb.i_neighbour & MB_LEFT) && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED )
{
bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B );
if( SLICE_MBAFF )
- x264_macroblock_deblock_strength_mbaff( h, bs );
+ macroblock_deblock_strength_mbaff( h, bs );
}
-static void ALWAYS_INLINE x264_macroblock_store_pic( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
+static void ALWAYS_INLINE macroblock_store_pic( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
{
int height = b_chroma ? 16>>CHROMA_V_SHIFT : 16;
int i_stride = h->fdec->i_stride[i];
h->mc.copy[PIXEL_16x16]( &h->fdec->plane[i][i_pix_offset], i_stride2, h->mb.pic.p_fdec[i], FDEC_STRIDE, 16 );
}
-static void ALWAYS_INLINE x264_macroblock_backup_intra( x264_t *h, int mb_x, int mb_y, int b_mbaff )
+static void ALWAYS_INLINE macroblock_backup_intra( x264_t *h, int mb_x, int mb_y, int b_mbaff )
{
/* In MBAFF we store the last two rows in intra_border_backup[0] and [1].
* For progressive mbs this is the bottom two rows, and for interlaced the
if( SLICE_MBAFF )
{
- x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 1 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 1 );
+ macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 1 );
if( CHROMA444 )
{
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 1 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 1 );
}
else
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 1 );
}
else
{
- x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 0 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 0 );
+ macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 0 );
if( CHROMA444 )
{
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 0 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 0 );
}
else
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 0 );
}
x264_prefetch_fenc( h, h->fdec, h->mb.i_mb_x, h->mb.i_mb_y );
PIXEL_AVG_C( pixel_avg_2x4, 2, 4 )
PIXEL_AVG_C( pixel_avg_2x2, 2, 2 )
-static void x264_weight_cache( x264_t *h, x264_weight_t *w )
+static void weight_cache( x264_t *h, x264_weight_t *w )
{
w->weightfn = h->mc.weight;
}
}
#define MC_WEIGHT_C( name, width ) \
- static void name( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, const x264_weight_t *weight, int height ) \
+static void name( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, const x264_weight_t *weight, int height ) \
{ \
mc_weight( dst, i_dst_stride, src, i_src_stride, weight, width, height );\
}
MC_WEIGHT_C( mc_weight_w4, 4 )
MC_WEIGHT_C( mc_weight_w2, 2 )
-static weight_fn_t x264_mc_weight_wtab[6] =
+static weight_fn_t mc_weight_wtab[6] =
{
mc_weight_w2,
mc_weight_w4,
}
}
-static void x264_plane_copy_deinterleave_rgb_c( pixel *dsta, intptr_t i_dsta,
- pixel *dstb, intptr_t i_dstb,
- pixel *dstc, intptr_t i_dstc,
- pixel *src, intptr_t i_src, int pw, int w, int h )
+static void plane_copy_deinterleave_rgb_c( pixel *dsta, intptr_t i_dsta,
+ pixel *dstb, intptr_t i_dstb,
+ pixel *dstc, intptr_t i_dstc,
+ pixel *src, intptr_t i_src, int pw, int w, int h )
{
for( int y=0; y<h; y++, dsta+=i_dsta, dstb+=i_dstb, dstc+=i_dstc, src+=i_src )
{
#define v210_endian_fix32(x) (x)
#endif
-static void x264_plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
- pixel *dstc, intptr_t i_dstc,
- uint32_t *src, intptr_t i_src, int w, int h )
+static void plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
+ pixel *dstc, intptr_t i_dstc,
+ uint32_t *src, intptr_t i_src, int w, int h )
{
for( int l = 0; l < h; l++ )
{
pf->avg[PIXEL_2x4] = pixel_avg_2x4;
pf->avg[PIXEL_2x2] = pixel_avg_2x2;
- pf->weight = x264_mc_weight_wtab;
- pf->offsetadd = x264_mc_weight_wtab;
- pf->offsetsub = x264_mc_weight_wtab;
- pf->weight_cache = x264_weight_cache;
+ pf->weight = mc_weight_wtab;
+ pf->offsetadd = mc_weight_wtab;
+ pf->offsetsub = mc_weight_wtab;
+ pf->weight_cache = weight_cache;
pf->copy_16x16_unaligned = mc_copy_w16;
pf->copy[PIXEL_16x16] = mc_copy_w16;
pf->plane_copy = x264_plane_copy_c;
pf->plane_copy_swap = x264_plane_copy_swap_c;
pf->plane_copy_interleave = x264_plane_copy_interleave_c;
+
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_c;
pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_c;
- pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_c;
- pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_c;
+ pf->plane_copy_deinterleave_rgb = plane_copy_deinterleave_rgb_c;
+ pf->plane_copy_deinterleave_v210 = plane_copy_deinterleave_v210_c;
pf->hpel_filter = hpel_filter;
uint16_t *lowres_costs, int16_t *output,\
int bipred_weight, int mb_y, int len );\
\
-static void x264_mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],\
- int16_t *propagate_amount, uint16_t *lowres_costs,\
- int bipred_weight, int mb_y, int len, int list )\
+static void mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],\
+ int16_t *propagate_amount, uint16_t *lowres_costs,\
+ int bipred_weight, int mb_y, int len, int list )\
{\
int16_t *current = h->scratch_buffer2;\
\
void x264_plane_copy_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY(align, cpu)\
-static void x264_plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
{\
int c_w = (align) / sizeof(pixel) - 1;\
if( w < 256 ) /* tiny resolutions don't want non-temporal hints. dunno the exact threshold. */\
void x264_plane_copy_swap_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY_SWAP(align, cpu)\
-static void x264_plane_copy_swap_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_swap_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
{\
int c_w = (align>>1) / sizeof(pixel) - 1;\
if( !(w&c_w) )\
/* We can utilize existing plane_copy_deinterleave() functions for YUYV/UYUV
* input with the additional constraint that we cannot overread src. */
#define PLANE_COPY_YUYV(align, cpu)\
-static void x264_plane_copy_deinterleave_yuyv_##cpu( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,\
- pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_deinterleave_yuyv_##cpu( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,\
+ pixel *src, intptr_t i_src, int w, int h )\
{\
int c_w = (align>>1) / sizeof(pixel) - 1;\
if( !(w&c_w) )\
pixel *srcv, intptr_t i_srcv, int w, int h );
#define PLANE_INTERLEAVE(cpu) \
-static void x264_plane_copy_interleave_##cpu( pixel *dst, intptr_t i_dst,\
- pixel *srcu, intptr_t i_srcu,\
- pixel *srcv, intptr_t i_srcv, int w, int h )\
+static void plane_copy_interleave_##cpu( pixel *dst, intptr_t i_dst,\
+ pixel *srcu, intptr_t i_srcu,\
+ pixel *srcv, intptr_t i_srcv, int w, int h )\
{\
int c_w = 16 / sizeof(pixel) - 1;\
if( !(w&c_w) )\
0, 1, 1, 2, 16, 17, 17, 18, 16, 17, 17, 18, 18, 19, 19, 20
};
-void x264_mc_copy_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t i_height );
-void x264_mc_copy_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t i_height );
-void x264_mc_copy_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride, uint8_t *p_src,
- intptr_t i_src_stride, int32_t i_height );
-void x264_memzero_aligned_msa( void *p_dst, size_t n );
-
-void x264_pixel_avg_16x16_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_16x8_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_8x16_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_8x8_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_8x4_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_4x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_4x8_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_4x4_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-void x264_pixel_avg_4x2_msa( uint8_t *p_pix1, intptr_t i_pix1_stride,
- uint8_t *p_pix2, intptr_t i_pix2_stride,
- uint8_t *p_pix3, intptr_t i_pix3_stride,
- int32_t i_weight );
-
-void x264_mc_weight_w20_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height );
-void x264_mc_weight_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height );
-void x264_mc_weight_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height );
-void x264_mc_weight_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height );
-
-weight_fn_t x264_mc_weight_wtab_msa[6] =
-{
- x264_mc_weight_w4_msa,
- x264_mc_weight_w4_msa,
- x264_mc_weight_w8_msa,
- x264_mc_weight_w16_msa,
- x264_mc_weight_w16_msa,
- x264_mc_weight_w20_msa,
-};
-
-void x264_mc_luma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src[4], intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height,
- const x264_weight_t *pWeight );
-uint8_t *x264_get_ref_msa( uint8_t *p_dst, intptr_t *p_dst_stride,
- uint8_t *p_src[4], intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height,
- const x264_weight_t *pWeight );
-void x264_mc_chroma_msa( uint8_t *p_dst_u, uint8_t *p_dst_v,
- intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height );
-void x264_hpel_filter_msa( uint8_t *p_dsth, uint8_t *p_dst_v,
- uint8_t *p_dstc, uint8_t *p_src,
- intptr_t i_stride, int32_t i_width,
- int32_t i_height, int16_t *p_buf );
-
-void x264_plane_copy_interleave_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src0, intptr_t i_src_stride0,
- uint8_t *p_src1, intptr_t i_src_stride1,
- int32_t i_width, int32_t i_height );
-void x264_plane_copy_deinterleave_msa( uint8_t *p_dst0, intptr_t i_dst_stride0,
- uint8_t *p_dst1, intptr_t i_dst_stride1,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t i_width, int32_t i_height );
-void x264_plane_copy_deinterleave_rgb_msa( uint8_t *p_dst0,
- intptr_t i_dst_stride0,
- uint8_t *p_dst1,
- intptr_t i_dst_stride1,
- uint8_t *p_dst2,
- intptr_t i_dst_stride2,
- uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_src_width, int32_t i_width,
- int32_t i_height );
-void x264_store_interleave_chroma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src0, uint8_t *p_src1,
- int32_t i_height );
-void x264_load_deinterleave_chroma_fenc_msa( uint8_t *p_dst, uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_height );
-void x264_load_deinterleave_chroma_fdec_msa( uint8_t *p_dst, uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_height );
-void x264_frame_init_lowres_core_msa( uint8_t *p_src, uint8_t *p_dst0,
- uint8_t *p_dst1, uint8_t *p_dst2,
- uint8_t *p_dst3, intptr_t i_src_stride,
- intptr_t i_dst_stride, int32_t i_width,
- int32_t i_height );
-
static void avc_luma_hz_16w_msa( uint8_t *p_src, int32_t i_src_stride,
uint8_t *p_dst, int32_t i_dst_stride,
int32_t i_height )
}
}
-static void plane_copy_interleave_msa( uint8_t *p_src0, int32_t i_src0_stride,
- uint8_t *p_src1, int32_t i_src1_stride,
- uint8_t *p_dst, int32_t i_dst_stride,
- int32_t i_width, int32_t i_height )
+static void core_plane_copy_interleave_msa( uint8_t *p_src0, int32_t i_src0_stride,
+ uint8_t *p_src1, int32_t i_src1_stride,
+ uint8_t *p_dst, int32_t i_dst_stride,
+ int32_t i_width, int32_t i_height )
{
int32_t i_loop_width, i_loop_height, i_w_mul8, i_h4w;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
}
}
-static void plane_copy_deinterleave_msa( uint8_t *p_src, int32_t i_src_stride,
- uint8_t *p_dst0, int32_t dst0_stride,
- uint8_t *p_dst1, int32_t dst1_stride,
- int32_t i_width, int32_t i_height )
+static void core_plane_copy_deinterleave_msa( uint8_t *p_src, int32_t i_src_stride,
+ uint8_t *p_dst0, int32_t dst0_stride,
+ uint8_t *p_dst1, int32_t dst1_stride,
+ int32_t i_width, int32_t i_height )
{
int32_t i_loop_width, i_loop_height, i_w_mul4, i_w_mul8, i_h4w;
uint32_t u_res_w0, u_res_w1;
}
-static void plane_copy_deinterleave_rgb_msa( uint8_t *p_src,
- int32_t i_src_stride,
- uint8_t *p_dst0,
- int32_t i_dst0_stride,
- uint8_t *p_dst1,
- int32_t i_dst1_stride,
- uint8_t *p_dst2,
- int32_t i_dst2_stride,
- int32_t i_width,
- int32_t i_height )
+static void core_plane_copy_deinterleave_rgb_msa( uint8_t *p_src,
+ int32_t i_src_stride,
+ uint8_t *p_dst0,
+ int32_t i_dst0_stride,
+ uint8_t *p_dst1,
+ int32_t i_dst1_stride,
+ uint8_t *p_dst2,
+ int32_t i_dst2_stride,
+ int32_t i_width,
+ int32_t i_height )
{
uint8_t *p_src_orig = p_src;
uint8_t *p_dst0_orig = p_dst0;
}
}
-static void plane_copy_deinterleave_rgba_msa( uint8_t *p_src,
- int32_t i_src_stride,
- uint8_t *p_dst0,
- int32_t i_dst0_stride,
- uint8_t *p_dst1,
- int32_t i_dst1_stride,
- uint8_t *p_dst2,
- int32_t i_dst2_stride,
- int32_t i_width,
- int32_t i_height )
+static void core_plane_copy_deinterleave_rgba_msa( uint8_t *p_src,
+ int32_t i_src_stride,
+ uint8_t *p_dst0,
+ int32_t i_dst0_stride,
+ uint8_t *p_dst1,
+ int32_t i_dst1_stride,
+ uint8_t *p_dst2,
+ int32_t i_dst2_stride,
+ int32_t i_width,
+ int32_t i_height )
{
uint8_t *p_src_orig = p_src;
uint8_t *p_dst0_orig = p_dst0;
}
}
-static void store_interleave_chroma_msa( uint8_t *p_src0, int32_t i_src0_stride,
- uint8_t *p_src1, int32_t i_src1_stride,
- uint8_t *p_dst, int32_t i_dst_stride,
- int32_t i_height )
+static void core_store_interleave_chroma_msa( uint8_t *p_src0, int32_t i_src0_stride,
+ uint8_t *p_src1, int32_t i_src1_stride,
+ uint8_t *p_dst, int32_t i_dst_stride,
+ int32_t i_height )
{
int32_t i_loop_height, i_h4w;
v16u8 in0, in1, in2, in3, in4, in5, in6, in7;
}
}
-static void frame_init_lowres_core_msa( uint8_t *p_src, int32_t i_src_stride,
- uint8_t *p_dst0, int32_t dst0_stride,
- uint8_t *p_dst1, int32_t dst1_stride,
- uint8_t *p_dst2, int32_t dst2_stride,
- uint8_t *p_dst3, int32_t dst3_stride,
- int32_t i_width, int32_t i_height )
+static void core_frame_init_lowres_core_msa( uint8_t *p_src, int32_t i_src_stride,
+ uint8_t *p_dst0, int32_t dst0_stride,
+ uint8_t *p_dst1, int32_t dst1_stride,
+ uint8_t *p_dst2, int32_t dst2_stride,
+ uint8_t *p_dst3, int32_t dst3_stride,
+ int32_t i_width, int32_t i_height )
{
int32_t i_loop_width, i_loop_height, i_w16_mul;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
}
}
-void x264_mc_copy_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t i_height )
+static void mc_copy_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ int32_t i_height )
{
copy_width16_msa( p_src, i_src_stride, p_dst, i_dst_stride, i_height );
}
-void x264_mc_copy_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride, uint8_t *p_src,
- intptr_t i_src_stride, int32_t i_height )
+static void mc_copy_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride, uint8_t *p_src,
+ intptr_t i_src_stride, int32_t i_height )
{
copy_width8_msa( p_src, i_src_stride, p_dst, i_dst_stride, i_height );
}
-void x264_mc_copy_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride, uint8_t *p_src,
- intptr_t i_src_stride, int32_t i_height )
+static void mc_copy_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride, uint8_t *p_src,
+ intptr_t i_src_stride, int32_t i_height )
{
copy_width4_msa( p_src, i_src_stride, p_dst, i_dst_stride, i_height );
}
-void x264_pixel_avg_16x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_16x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_16x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_16x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_8x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_8x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_8x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_8x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_8x4_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_8x4_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_4x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_4x16_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_4x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_4x8_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_4x4_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_4x4_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
}
-void x264_pixel_avg_4x2_msa( uint8_t *p_pix1, intptr_t pix1_stride,
- uint8_t *p_pix2, intptr_t pix2_stride,
- uint8_t *p_pix3, intptr_t pix3_stride,
- int32_t i_weight )
+static void pixel_avg_4x2_msa( uint8_t *p_pix1, intptr_t pix1_stride,
+ uint8_t *p_pix2, intptr_t pix2_stride,
+ uint8_t *p_pix3, intptr_t pix3_stride,
+ int32_t i_weight )
{
if( 32 == i_weight )
{
}
-void x264_memzero_aligned_msa( void *p_dst, size_t n )
+static void memzero_aligned_msa( void *p_dst, size_t n )
{
uint32_t u_tot32_mul_lines = n >> 5;
uint32_t u_remaining = n - ( u_tot32_mul_lines << 5 );
}
}
-void x264_mc_weight_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height )
+static void mc_weight_w4_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ const x264_weight_t *pWeight, int32_t i_height )
{
int32_t i_log2_denom = pWeight->i_denom;
int32_t i_offset = pWeight->i_offset;
i_height, i_log2_denom, i_weight, i_offset );
}
-void x264_mc_weight_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height )
+static void mc_weight_w8_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ const x264_weight_t *pWeight, int32_t i_height )
{
int32_t i_log2_denom = pWeight->i_denom;
int32_t i_offset = pWeight->i_offset;
i_height, i_log2_denom, i_weight, i_offset );
}
-void x264_mc_weight_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height )
+static void mc_weight_w16_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ const x264_weight_t *pWeight, int32_t i_height )
{
int32_t i_log2_denom = pWeight->i_denom;
int32_t i_offset = pWeight->i_offset;
i_height, i_log2_denom, i_weight, i_offset );
}
-void x264_mc_weight_w20_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- const x264_weight_t *pWeight, int32_t i_height )
+static void mc_weight_w20_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ const x264_weight_t *pWeight, int32_t i_height )
{
- x264_mc_weight_w16_msa( p_dst, i_dst_stride, p_src, i_src_stride,
- pWeight, i_height );
- x264_mc_weight_w4_msa( p_dst + 16, i_dst_stride, p_src + 16, i_src_stride,
- pWeight, i_height );
+ mc_weight_w16_msa( p_dst, i_dst_stride, p_src, i_src_stride,
+ pWeight, i_height );
+ mc_weight_w4_msa( p_dst + 16, i_dst_stride, p_src + 16, i_src_stride,
+ pWeight, i_height );
}
-void x264_mc_luma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src[4], intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height,
- const x264_weight_t *pWeight )
+static void mc_luma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src[4], intptr_t i_src_stride,
+ int32_t m_vx, int32_t m_vy,
+ int32_t i_width, int32_t i_height,
+ const x264_weight_t *pWeight )
{
int32_t i_qpel_idx;
int32_t i_offset;
{
if( 16 == i_width )
{
- x264_mc_weight_w16_msa( p_dst, i_dst_stride,
- p_dst, i_dst_stride,
- pWeight, i_height );
+ mc_weight_w16_msa( p_dst, i_dst_stride,
+ p_dst, i_dst_stride,
+ pWeight, i_height );
}
else if( 8 == i_width )
{
- x264_mc_weight_w8_msa( p_dst, i_dst_stride, p_dst, i_dst_stride,
- pWeight, i_height );
+ mc_weight_w8_msa( p_dst, i_dst_stride, p_dst, i_dst_stride,
+ pWeight, i_height );
}
else if( 4 == i_width )
{
- x264_mc_weight_w4_msa( p_dst, i_dst_stride, p_dst, i_dst_stride,
- pWeight, i_height );
+ mc_weight_w4_msa( p_dst, i_dst_stride, p_dst, i_dst_stride,
+ pWeight, i_height );
}
}
}
{
if( 16 == i_width )
{
- x264_mc_weight_w16_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
- pWeight, i_height );
+ mc_weight_w16_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
+ pWeight, i_height );
}
else if( 8 == i_width )
{
- x264_mc_weight_w8_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
- pWeight, i_height );
+ mc_weight_w8_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
+ pWeight, i_height );
}
else if( 4 == i_width )
{
- x264_mc_weight_w4_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
- pWeight, i_height );
+ mc_weight_w4_msa( p_dst, i_dst_stride, p_src1, i_src_stride,
+ pWeight, i_height );
}
}
else
}
}
-void x264_mc_chroma_msa( uint8_t *p_dst_u, uint8_t *p_dst_v,
- intptr_t i_dst_stride,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height )
+static void mc_chroma_msa( uint8_t *p_dst_u, uint8_t *p_dst_v,
+ intptr_t i_dst_stride,
+ uint8_t *p_src, intptr_t i_src_stride,
+ int32_t m_vx, int32_t m_vy,
+ int32_t i_width, int32_t i_height )
{
int32_t i_d8x = m_vx & 0x07;
int32_t i_d8y = m_vy & 0x07;
}
}
-void x264_hpel_filter_msa( uint8_t *p_dsth, uint8_t *p_dst_v,
- uint8_t *p_dstc, uint8_t *p_src,
- intptr_t i_stride, int32_t i_width,
- int32_t i_height, int16_t *p_buf )
+static void hpel_filter_msa( uint8_t *p_dsth, uint8_t *p_dst_v,
+ uint8_t *p_dstc, uint8_t *p_src,
+ intptr_t i_stride, int32_t i_width,
+ int32_t i_height, int16_t *p_buf )
{
for( int32_t i = 0; i < ( i_width / 16 ); i++ )
{
}
}
-void x264_plane_copy_interleave_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src0, intptr_t i_src_stride0,
- uint8_t *p_src1, intptr_t i_src_stride1,
- int32_t i_width, int32_t i_height )
+static void plane_copy_interleave_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src0, intptr_t i_src_stride0,
+ uint8_t *p_src1, intptr_t i_src_stride1,
+ int32_t i_width, int32_t i_height )
{
- plane_copy_interleave_msa( p_src0, i_src_stride0, p_src1, i_src_stride1,
- p_dst, i_dst_stride, i_width, i_height );
+ core_plane_copy_interleave_msa( p_src0, i_src_stride0, p_src1, i_src_stride1,
+ p_dst, i_dst_stride, i_width, i_height );
}
-void x264_plane_copy_deinterleave_msa( uint8_t *p_dst0, intptr_t i_dst_stride0,
- uint8_t *p_dst1, intptr_t i_dst_stride1,
- uint8_t *p_src, intptr_t i_src_stride,
- int32_t i_width, int32_t i_height )
+static void plane_copy_deinterleave_msa( uint8_t *p_dst0, intptr_t i_dst_stride0,
+ uint8_t *p_dst1, intptr_t i_dst_stride1,
+ uint8_t *p_src, intptr_t i_src_stride,
+ int32_t i_width, int32_t i_height )
{
- plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst0, i_dst_stride0,
- p_dst1, i_dst_stride1, i_width, i_height );
+ core_plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst0, i_dst_stride0,
+ p_dst1, i_dst_stride1, i_width, i_height );
}
-void x264_plane_copy_deinterleave_rgb_msa( uint8_t *p_dst0,
- intptr_t i_dst_stride0,
- uint8_t *p_dst1,
- intptr_t i_dst_stride1,
- uint8_t *p_dst2,
- intptr_t i_dst_stride2,
- uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_src_width,
- int32_t i_width,
- int32_t i_height )
+static void plane_copy_deinterleave_rgb_msa( uint8_t *p_dst0,
+ intptr_t i_dst_stride0,
+ uint8_t *p_dst1,
+ intptr_t i_dst_stride1,
+ uint8_t *p_dst2,
+ intptr_t i_dst_stride2,
+ uint8_t *p_src,
+ intptr_t i_src_stride,
+ int32_t i_src_width,
+ int32_t i_width,
+ int32_t i_height )
{
if( 3 == i_src_width )
{
- plane_copy_deinterleave_rgb_msa( p_src, i_src_stride,
- p_dst0, i_dst_stride0,
- p_dst1, i_dst_stride1,
- p_dst2, i_dst_stride2,
- i_width, i_height );
+ core_plane_copy_deinterleave_rgb_msa( p_src, i_src_stride,
+ p_dst0, i_dst_stride0,
+ p_dst1, i_dst_stride1,
+ p_dst2, i_dst_stride2,
+ i_width, i_height );
}
else if( 4 == i_src_width )
{
- plane_copy_deinterleave_rgba_msa( p_src, i_src_stride,
- p_dst0, i_dst_stride0,
- p_dst1, i_dst_stride1,
- p_dst2, i_dst_stride2,
- i_width, i_height );
+ core_plane_copy_deinterleave_rgba_msa( p_src, i_src_stride,
+ p_dst0, i_dst_stride0,
+ p_dst1, i_dst_stride1,
+ p_dst2, i_dst_stride2,
+ i_width, i_height );
}
}
-void x264_store_interleave_chroma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
- uint8_t *p_src0, uint8_t *p_src1,
- int32_t i_height )
+static void store_interleave_chroma_msa( uint8_t *p_dst, intptr_t i_dst_stride,
+ uint8_t *p_src0, uint8_t *p_src1,
+ int32_t i_height )
{
- store_interleave_chroma_msa( p_src0, FDEC_STRIDE, p_src1, FDEC_STRIDE,
- p_dst, i_dst_stride, i_height );
+ core_store_interleave_chroma_msa( p_src0, FDEC_STRIDE, p_src1, FDEC_STRIDE,
+ p_dst, i_dst_stride, i_height );
}
-void x264_load_deinterleave_chroma_fenc_msa( uint8_t *p_dst, uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_height )
+static void load_deinterleave_chroma_fenc_msa( uint8_t *p_dst, uint8_t *p_src,
+ intptr_t i_src_stride,
+ int32_t i_height )
{
- plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst, FENC_STRIDE,
- ( p_dst + ( FENC_STRIDE / 2 ) ), FENC_STRIDE,
- 8, i_height );
+ core_plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst, FENC_STRIDE,
+ ( p_dst + ( FENC_STRIDE / 2 ) ), FENC_STRIDE,
+ 8, i_height );
}
-void x264_load_deinterleave_chroma_fdec_msa( uint8_t *p_dst, uint8_t *p_src,
- intptr_t i_src_stride,
- int32_t i_height )
+static void load_deinterleave_chroma_fdec_msa( uint8_t *p_dst, uint8_t *p_src,
+ intptr_t i_src_stride,
+ int32_t i_height )
{
- plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst, FDEC_STRIDE,
- ( p_dst + ( FDEC_STRIDE / 2 ) ), FDEC_STRIDE,
- 8, i_height );
+ core_plane_copy_deinterleave_msa( p_src, i_src_stride, p_dst, FDEC_STRIDE,
+ ( p_dst + ( FDEC_STRIDE / 2 ) ), FDEC_STRIDE,
+ 8, i_height );
}
-void x264_frame_init_lowres_core_msa( uint8_t *p_src, uint8_t *p_dst0,
- uint8_t *p_dst1, uint8_t *p_dst2,
- uint8_t *p_dst3, intptr_t i_src_stride,
- intptr_t i_dst_stride, int32_t i_width,
- int32_t i_height )
+static void frame_init_lowres_core_msa( uint8_t *p_src, uint8_t *p_dst0,
+ uint8_t *p_dst1, uint8_t *p_dst2,
+ uint8_t *p_dst3, intptr_t i_src_stride,
+ intptr_t i_dst_stride, int32_t i_width,
+ int32_t i_height )
{
- frame_init_lowres_core_msa( p_src, i_src_stride, p_dst0, i_dst_stride,
- p_dst1, i_dst_stride, p_dst2, i_dst_stride,
- p_dst3, i_dst_stride, i_width, i_height );
+ core_frame_init_lowres_core_msa( p_src, i_src_stride, p_dst0, i_dst_stride,
+ p_dst1, i_dst_stride, p_dst2, i_dst_stride,
+ p_dst3, i_dst_stride, i_width, i_height );
}
-uint8_t *x264_get_ref_msa( uint8_t *p_dst, intptr_t *p_dst_stride,
- uint8_t *p_src[4], intptr_t i_src_stride,
- int32_t m_vx, int32_t m_vy,
- int32_t i_width, int32_t i_height,
- const x264_weight_t *pWeight )
+static uint8_t *get_ref_msa( uint8_t *p_dst, intptr_t *p_dst_stride,
+ uint8_t *p_src[4], intptr_t i_src_stride,
+ int32_t m_vx, int32_t m_vy,
+ int32_t i_width, int32_t i_height,
+ const x264_weight_t *pWeight )
{
int32_t i_qpel_idx, i_cnt, i_h4w;
int32_t i_offset;
if( 16 == i_width || 12 == i_width )
{
- x264_mc_weight_w16_msa( p_dst, *p_dst_stride,
- p_dst, *p_dst_stride,
- pWeight, i_h4w );
+ mc_weight_w16_msa( p_dst, *p_dst_stride,
+ p_dst, *p_dst_stride,
+ pWeight, i_h4w );
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
v16i8 zero = {0};
}
else if( 20 == i_width )
{
- x264_mc_weight_w20_msa( p_dst, *p_dst_stride,
- p_dst, *p_dst_stride,
- pWeight, i_h4w );
+ mc_weight_w20_msa( p_dst, *p_dst_stride,
+ p_dst, *p_dst_stride,
+ pWeight, i_h4w );
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint32_t temp0;
}
else if( 8 == i_width )
{
- x264_mc_weight_w8_msa( p_dst, *p_dst_stride,
- p_dst, *p_dst_stride,
- pWeight, i_h4w );
+ mc_weight_w8_msa( p_dst, *p_dst_stride,
+ p_dst, *p_dst_stride,
+ pWeight, i_h4w );
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint64_t temp0;
}
else if( 4 == i_width )
{
- x264_mc_weight_w4_msa( p_dst, *p_dst_stride,
- p_dst, *p_dst_stride,
- pWeight, i_h4w );
+ mc_weight_w4_msa( p_dst, *p_dst_stride,
+ p_dst, *p_dst_stride,
+ pWeight, i_h4w );
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint32_t temp0;
if( 16 == i_width || 12 == i_width )
{
- x264_mc_weight_w16_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
- pWeight, i_h4w );
+ mc_weight_w16_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
+ pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
}
else if( 20 == i_width )
{
- x264_mc_weight_w20_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
- pWeight, i_h4w );
+ mc_weight_w20_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
+ pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
}
else if( 8 == i_width )
{
- x264_mc_weight_w8_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
- pWeight, i_h4w );
+ mc_weight_w8_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
+ pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
}
else if( 4 == i_width )
{
- x264_mc_weight_w4_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
- pWeight, i_h4w );
+ mc_weight_w4_msa( p_dst, *p_dst_stride, p_src1, i_src_stride,
+ pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
return p_src1;
}
}
+
+static weight_fn_t mc_weight_wtab_msa[6] =
+{
+ mc_weight_w4_msa,
+ mc_weight_w4_msa,
+ mc_weight_w8_msa,
+ mc_weight_w16_msa,
+ mc_weight_w16_msa,
+ mc_weight_w20_msa,
+};
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_mips( int32_t cpu, x264_mc_functions_t *pf )
#if !HIGH_BIT_DEPTH
if( cpu & X264_CPU_MSA )
{
- pf->mc_luma = x264_mc_luma_msa;
- pf->mc_chroma = x264_mc_chroma_msa;
- pf->get_ref = x264_get_ref_msa;
+ pf->mc_luma = mc_luma_msa;
+ pf->mc_chroma = mc_chroma_msa;
+ pf->get_ref = get_ref_msa;
- pf->avg[PIXEL_16x16]= x264_pixel_avg_16x16_msa;
- pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_msa;
- pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_msa;
- pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_msa;
- pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_msa;
- pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_msa;
- pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_msa;
- pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_msa;
- pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_msa;
+ pf->avg[PIXEL_16x16]= pixel_avg_16x16_msa;
+ pf->avg[PIXEL_16x8] = pixel_avg_16x8_msa;
+ pf->avg[PIXEL_8x16] = pixel_avg_8x16_msa;
+ pf->avg[PIXEL_8x8] = pixel_avg_8x8_msa;
+ pf->avg[PIXEL_8x4] = pixel_avg_8x4_msa;
+ pf->avg[PIXEL_4x16] = pixel_avg_4x16_msa;
+ pf->avg[PIXEL_4x8] = pixel_avg_4x8_msa;
+ pf->avg[PIXEL_4x4] = pixel_avg_4x4_msa;
+ pf->avg[PIXEL_4x2] = pixel_avg_4x2_msa;
- pf->weight = x264_mc_weight_wtab_msa;
- pf->offsetadd = x264_mc_weight_wtab_msa;
- pf->offsetsub = x264_mc_weight_wtab_msa;
+ pf->weight = mc_weight_wtab_msa;
+ pf->offsetadd = mc_weight_wtab_msa;
+ pf->offsetsub = mc_weight_wtab_msa;
- pf->copy_16x16_unaligned = x264_mc_copy_w16_msa;
- pf->copy[PIXEL_16x16] = x264_mc_copy_w16_msa;
- pf->copy[PIXEL_8x8] = x264_mc_copy_w8_msa;
- pf->copy[PIXEL_4x4] = x264_mc_copy_w4_msa;
+ pf->copy_16x16_unaligned = mc_copy_w16_msa;
+ pf->copy[PIXEL_16x16] = mc_copy_w16_msa;
+ pf->copy[PIXEL_8x8] = mc_copy_w8_msa;
+ pf->copy[PIXEL_4x4] = mc_copy_w4_msa;
- pf->store_interleave_chroma = x264_store_interleave_chroma_msa;
- pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_msa;
- pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_msa;
+ pf->store_interleave_chroma = store_interleave_chroma_msa;
+ pf->load_deinterleave_chroma_fenc = load_deinterleave_chroma_fenc_msa;
+ pf->load_deinterleave_chroma_fdec = load_deinterleave_chroma_fdec_msa;
- pf->plane_copy_interleave = x264_plane_copy_interleave_msa;
- pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_msa;
- pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_msa;
+ pf->plane_copy_interleave = plane_copy_interleave_msa;
+ pf->plane_copy_deinterleave = plane_copy_deinterleave_msa;
+ pf->plane_copy_deinterleave_rgb = plane_copy_deinterleave_rgb_msa;
- pf->hpel_filter = x264_hpel_filter_msa;
+ pf->hpel_filter = hpel_filter_msa;
pf->memcpy_aligned = memcpy;
- pf->memzero_aligned = x264_memzero_aligned_msa;
- pf->frame_init_lowres_core = x264_frame_init_lowres_core_msa;
+ pf->memzero_aligned = memzero_aligned_msa;
+ pf->frame_init_lowres_core = frame_init_lowres_core_msa;
}
#endif // !HIGH_BIT_DEPTH
}
x264_mb_predict_mv_16x16( h, 0, 0, mv );
}
-static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
+static int mb_predict_mv_direct16x16_temporal( x264_t *h )
{
int mb_x = h->mb.i_mb_x;
int mb_y = h->mb.i_mb_y;
return 1;
}
-static ALWAYS_INLINE int x264_mb_predict_mv_direct16x16_spatial( x264_t *h, int b_interlaced )
+static ALWAYS_INLINE int mb_predict_mv_direct16x16_spatial( x264_t *h, int b_interlaced )
{
int8_t ref[2];
ALIGNED_ARRAY_8( int16_t, mv,[2],[2] );
}
-static int x264_mb_predict_mv_direct16x16_spatial_interlaced( x264_t *h )
+static int mb_predict_mv_direct16x16_spatial_interlaced( x264_t *h )
{
- return x264_mb_predict_mv_direct16x16_spatial( h, 1 );
+ return mb_predict_mv_direct16x16_spatial( h, 1 );
}
-static int x264_mb_predict_mv_direct16x16_spatial_progressive( x264_t *h )
+static int mb_predict_mv_direct16x16_spatial_progressive( x264_t *h )
{
- return x264_mb_predict_mv_direct16x16_spatial( h, 0 );
+ return mb_predict_mv_direct16x16_spatial( h, 0 );
}
int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed )
else if( h->sh.b_direct_spatial_mv_pred )
{
if( SLICE_MBAFF )
- b_available = x264_mb_predict_mv_direct16x16_spatial_interlaced( h );
+ b_available = mb_predict_mv_direct16x16_spatial_interlaced( h );
else
- b_available = x264_mb_predict_mv_direct16x16_spatial_progressive( h );
+ b_available = mb_predict_mv_direct16x16_spatial_progressive( h );
}
else
- b_available = x264_mb_predict_mv_direct16x16_temporal( h );
+ b_available = mb_predict_mv_direct16x16_temporal( h );
if( b_changed != NULL && b_available )
{
/* Requires full include path in case of out-of-tree builds */
#include "common/oclobj.h"
-static int x264_detect_switchable_graphics( void );
+static int detect_switchable_graphics( void );
/* Try to load the cached compiled program binary, verify the device context is
* still valid before reuse */
-static cl_program x264_opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version )
+static cl_program opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version )
{
/* try to load cached program binary */
FILE *fp = x264_fopen( h->param.psz_clbin_file, "rb" );
/* Save the compiled program binary to a file for later reuse. Device context
* is also saved in the cache file so we do not reuse stale binaries */
-static void x264_opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version )
+static void opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version )
{
FILE *fp = x264_fopen( h->param.psz_clbin_file, "wb" );
if( !fp )
* the Makefile. It defines a x264_opencl_source byte array which we will pass
* to clCreateProgramWithSource(). We also attempt to use a cache file for the
* compiled binary, stored in the current working folder. */
-static cl_program x264_opencl_compile( x264_t *h )
+static cl_program opencl_compile( x264_t *h )
{
x264_opencl_function_t *ocl = h->opencl.ocl;
cl_program program = NULL;
if( vectorize )
{
/* Disable OpenCL on Intel/AMD switchable graphics devices */
- if( x264_detect_switchable_graphics() )
+ if( detect_switchable_graphics() )
{
x264_log( h, X264_LOG_INFO, "OpenCL acceleration disabled, switchable graphics detected\n" );
return NULL;
x264_log( h, X264_LOG_INFO, "OpenCL acceleration enabled with %s %s %s\n", dev_vendor, dev_name, h->opencl.b_device_AMD_SI ? "(SI)" : "" );
- program = x264_opencl_cache_load( h, dev_name, dev_vendor, driver_version );
+ program = opencl_cache_load( h, dev_name, dev_vendor, driver_version );
if( !program )
{
/* clCreateProgramWithSource() requires a pointer variable, you cannot just use &x264_opencl_source */
status = ocl->clBuildProgram( program, 1, &h->opencl.device, buildopts, NULL, NULL );
if( status == CL_SUCCESS )
{
- x264_opencl_cache_save( h, program, dev_name, dev_vendor, driver_version );
+ opencl_cache_save( h, program, dev_name, dev_vendor, driver_version );
return program;
}
return NULL;
}
-static int x264_opencl_lookahead_alloc( x264_t *h )
+static int opencl_lookahead_alloc( x264_t *h )
{
if( !h->param.rc.i_lookahead )
return -1;
x264_opencl_function_t *ocl = h->opencl.ocl;
cl_int status;
- h->opencl.lookahead_program = x264_opencl_compile( h );
+ h->opencl.lookahead_program = opencl_compile( h );
if( !h->opencl.lookahead_program )
goto fail;
return -1;
}
-static void CL_CALLBACK x264_opencl_error_notify( const char *errinfo, const void *private_info, size_t cb, void *user_data )
+static void CL_CALLBACK opencl_error_notify( const char *errinfo, const void *private_info, size_t cb, void *user_data )
{
/* Any error notification can be assumed to be fatal to the OpenCL context.
* We need to stop using it immediately to prevent further damage. */
if( context )
ocl->clReleaseContext( context );
- context = ocl->clCreateContext( NULL, 1, &h->opencl.device, (void*)x264_opencl_error_notify, (void*)h, &status );
+ context = ocl->clCreateContext( NULL, 1, &h->opencl.device, (void*)opencl_error_notify, (void*)h, &status );
if( status != CL_SUCCESS || !context )
continue;
if( ret )
x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to find a compatible device\n" );
else
- ret = x264_opencl_lookahead_alloc( h );
+ ret = opencl_lookahead_alloc( h );
fail:
if( context )
return ret;
}
-static void x264_opencl_lookahead_free( x264_t *h )
+static void opencl_lookahead_free( x264_t *h )
{
x264_opencl_function_t *ocl = h->opencl.ocl;
if( h->opencl.queue )
ocl->clFinish( h->opencl.queue );
- x264_opencl_lookahead_free( h );
+ opencl_lookahead_free( h );
if( h->opencl.queue )
{
return x264_malloc( iSize );
}
-static int x264_detect_switchable_graphics( void )
+static int detect_switchable_graphics( void )
{
void *hDLL;
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
#if HAVE_WIN32THREAD || PTW32_STATIC_LIB
/* state of the threading library being initialized */
-static volatile LONG x264_threading_is_init = 0;
+static volatile LONG threading_is_init = 0;
-static void x264_threading_destroy( void )
+static void threading_destroy( void )
{
#if PTW32_STATIC_LIB
pthread_win32_thread_detach_np();
int x264_threading_init( void )
{
/* if already init, then do nothing */
- if( InterlockedCompareExchange( &x264_threading_is_init, 1, 0 ) )
+ if( InterlockedCompareExchange( &threading_is_init, 1, 0 ) )
return 0;
#if PTW32_STATIC_LIB
/* if static pthread-win32 is already initialized, then do nothing */
return -1;
#endif
/* register cleanup to run at process termination */
- atexit( x264_threading_destroy );
+ atexit( threading_destroy );
return 0;
}
return sum + ((uint64_t)sqr << 32); \
}
-PIXEL_VAR_C( x264_pixel_var_16x16, 16, 16 )
-PIXEL_VAR_C( x264_pixel_var_8x16, 8, 16 )
-PIXEL_VAR_C( x264_pixel_var_8x8, 8, 8 )
+PIXEL_VAR_C( pixel_var_16x16, 16, 16 )
+PIXEL_VAR_C( pixel_var_8x16, 8, 16 )
+PIXEL_VAR_C( pixel_var_8x8, 8, 8 )
/****************************************************************************
* pixel_var2_wxh
sqr_v - ((int64_t)sum_v * sum_v >> shift); \
}
-PIXEL_VAR2_C( x264_pixel_var2_8x16, 16, 7 )
-PIXEL_VAR2_C( x264_pixel_var2_8x8, 8, 6 )
+PIXEL_VAR2_C( pixel_var2_8x16, 16, 7 )
+PIXEL_VAR2_C( pixel_var2_8x8, 8, 6 )
#if BIT_DEPTH > 8
typedef uint32_t sum_t;
#endif // !HIGH_BIT_DEPTH
#define INTRA_MBCMP_8x8( mbcmp, cpu, cpu2 )\
-void x264_intra_##mbcmp##_x3_8x8##cpu( pixel *fenc, pixel edge[36], int res[3] )\
+static void intra_##mbcmp##_x3_8x8##cpu( pixel *fenc, pixel edge[36], int res[3] )\
{\
ALIGNED_ARRAY_16( pixel, pix, [8*FDEC_STRIDE] );\
x264_predict_8x8_v##cpu2( pix, edge );\
#endif
#define INTRA_MBCMP( mbcmp, size, pred1, pred2, pred3, chroma, cpu, cpu2 )\
-void x264_intra_##mbcmp##_x3_##size##chroma##cpu( pixel *fenc, pixel *fdec, int res[3] )\
+static void intra_##mbcmp##_x3_##size##chroma##cpu( pixel *fenc, pixel *fdec, int res[3] )\
{\
x264_predict_##size##chroma##_##pred1##cpu2( fdec );\
res[0] = x264_pixel_##mbcmp##_##size##cpu( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\
#endif
// No C implementation of intra_satd_x9. See checkasm for its behavior,
-// or see x264_mb_analyse_intra for the entirely different algorithm we
+// or see mb_analyse_intra for the entirely different algorithm we
// use when lacking an asm implementation of it.
pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8;
- pixf->var[PIXEL_16x16] = x264_pixel_var_16x16;
- pixf->var[PIXEL_8x16] = x264_pixel_var_8x16;
- pixf->var[PIXEL_8x8] = x264_pixel_var_8x8;
- pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16;
- pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8;
+ pixf->var[PIXEL_16x16] = pixel_var_16x16;
+ pixf->var[PIXEL_8x16] = pixel_var_8x16;
+ pixf->var[PIXEL_8x8] = pixel_var_8x8;
+ pixf->var2[PIXEL_8x16] = pixel_var2_8x16;
+ pixf->var2[PIXEL_8x8] = pixel_var2_8x8;
pixf->ssd_nv12_core = pixel_ssd_nv12_core;
pixf->ssim_4x4x2_core = ssim_4x4x2_core;
pixf->vsad = pixel_vsad;
pixf->asd8 = pixel_asd8;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16;
#if HIGH_BIT_DEPTH
#if HAVE_MMX
INIT8( ssd, _mmx2 );
INIT_ADS( _mmx2 );
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_mmx2;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_mmx2;
pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_mmx2;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_mmx2;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_mmx2;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_mmx2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_mmx2;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_mmx2;
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2;
}
if( cpu&X264_CPU_SSE2 )
INIT6( satd, _sse2 );
pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_sse2;
- pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2;
- pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2;
-#if ARCH_X86_64
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_sse2;
- pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2;
-#endif
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_sse2;
- pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2;
+ pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_sse2;
pixf->ssim_end4 = x264_pixel_ssim_end4_sse2;
pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_sse2;
pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2;
pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_sse2;
pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_sse2;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
+
+ pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2;
+ pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2;
+#if ARCH_X86_64
+ pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2;
+#endif
+ pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_sse2;
+ pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_sse2;
}
if( (cpu&X264_CPU_SSE2) && !(cpu&X264_CPU_SSE2_IS_SLOW) )
{
pixf->vsad = x264_pixel_vsad_sse2;
pixf->asd8 = x264_pixel_asd8_sse2;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_sse2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_sse2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_sse2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse2;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_sse2;
}
if( cpu&X264_CPU_SSE2_IS_FAST )
{
}
pixf->vsad = x264_pixel_vsad_ssse3;
pixf->asd8 = x264_pixel_asd8_ssse3;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3;
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_ssse3;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_ssse3;
#if ARCH_X86_64
#endif
pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_ssse3;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_ssse3;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_ssse3;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_ssse3;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_ssse3;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_ssse3;
}
if( cpu&X264_CPU_SSE4 )
{
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4;
#endif
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse4;
}
if( cpu&X264_CPU_AVX )
{
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_avx;
#endif
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_avx;
}
if( cpu&X264_CPU_XOP )
{
#endif
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2;
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_mmx2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_mmx2;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2;
pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2;
pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2;
pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_sse2;
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_sse2;
if( cpu&X264_CPU_CACHELINE_64 )
{
INIT2( ssd, _sse2); /* faster for width 16 on p4 */
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_ssse3;
if( !(cpu&X264_CPU_SLOW_PSHUFB) )
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_ssse3;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_ssse3;
pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3;
pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_ssse3;
}
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_sse4;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse4;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse4;
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4;
#endif
INIT5( ssd, _avx );
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_avx;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_avx;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx;
pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx;
pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx;
INIT5( ssd, _xop );
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_xop;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_xop;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_xop;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_xop;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_xop;
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_xop;
pixf->vsad = x264_pixel_vsad_neon;
pixf->asd8 = x264_pixel_asd8_neon;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_neon;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4_neon;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_neon;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_neon;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_neon;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c_neon;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_neon;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_neon;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_neon;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16_neon;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon;
pixf->vsad = x264_pixel_vsad_neon;
pixf->asd8 = x264_pixel_asd8_neon;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_neon;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4_neon;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_neon;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_neon;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_neon;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c_neon;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_neon;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_neon;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_neon;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16_neon;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon;
typedef void (*pf_mc_t)( uint8_t *src, intptr_t i_src,
uint8_t *dst, intptr_t i_dst, int i_height );
-static inline void x264_pixel_avg2_w4_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src1, intptr_t i_src1,
- uint8_t *src2, int i_height )
+static inline void pixel_avg2_w4_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src1, intptr_t i_src1,
+ uint8_t *src2, int i_height )
{
for( int y = 0; y < i_height; y++ )
{
}
}
-static inline void x264_pixel_avg2_w8_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src1, intptr_t i_src1,
- uint8_t *src2, int i_height )
+static inline void pixel_avg2_w8_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src1, intptr_t i_src1,
+ uint8_t *src2, int i_height )
{
vec_u8_t src1v, src2v;
PREP_STORE8;
}
}
-static inline void x264_pixel_avg2_w16_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src1, intptr_t i_src1,
- uint8_t *src2, int i_height )
+static inline void pixel_avg2_w16_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src1, intptr_t i_src1,
+ uint8_t *src2, int i_height )
{
vec_u8_t src1v, src2v;
}
}
-static inline void x264_pixel_avg2_w20_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src1, intptr_t i_src1,
- uint8_t *src2, int i_height )
+static inline void pixel_avg2_w20_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src1, intptr_t i_src1,
+ uint8_t *src2, int i_height )
{
- x264_pixel_avg2_w16_altivec(dst, i_dst, src1, i_src1, src2, i_height);
- x264_pixel_avg2_w4_altivec(dst+16, i_dst, src1+16, i_src1, src2+16, i_height);
+ pixel_avg2_w16_altivec(dst, i_dst, src1, i_src1, src2, i_height);
+ pixel_avg2_w4_altivec(dst+16, i_dst, src1+16, i_src1, src2+16, i_height);
}
/* mc_copy: plain c */
dst += i_dst; \
} \
}
-MC_COPY( x264_mc_copy_w4_altivec, 4 )
-MC_COPY( x264_mc_copy_w8_altivec, 8 )
+MC_COPY( mc_copy_w4_altivec, 4 )
+MC_COPY( mc_copy_w8_altivec, 8 )
-static void x264_mc_copy_w16_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src, intptr_t i_src, int i_height )
+static void mc_copy_w16_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src, intptr_t i_src, int i_height )
{
vec_u8_t cpyV;
}
-static void x264_mc_copy_w16_aligned_altivec( uint8_t *dst, intptr_t i_dst,
- uint8_t *src, intptr_t i_src, int i_height )
+static void mc_copy_w16_aligned_altivec( uint8_t *dst, intptr_t i_dst,
+ uint8_t *src, intptr_t i_src, int i_height )
{
for( int y = 0; y < i_height; ++y )
{
switch( i_width )
{
case 4:
- x264_pixel_avg2_w4_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w4_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
break;
case 8:
- x264_pixel_avg2_w8_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w8_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
break;
case 16:
default:
- x264_pixel_avg2_w16_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w16_altivec( dst, i_dst_stride, src1, i_src_stride, src2, i_height );
}
if( weight->weightfn )
weight->weightfn[i_width>>2]( dst, i_dst_stride, dst, i_dst_stride, weight, i_height );
switch( i_width )
{
case 4:
- x264_mc_copy_w4_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_w4_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
break;
case 8:
- x264_mc_copy_w8_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_w8_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
break;
case 16:
- x264_mc_copy_w16_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_w16_altivec( dst, i_dst_stride, src1, i_src_stride, i_height );
break;
}
}
switch( i_width )
{
case 4:
- x264_pixel_avg2_w4_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w4_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
break;
case 8:
- x264_pixel_avg2_w8_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w8_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
break;
case 12:
case 16:
default:
- x264_pixel_avg2_w16_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w16_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
break;
case 20:
- x264_pixel_avg2_w20_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
+ pixel_avg2_w20_altivec( dst, *i_dst_stride, src1, i_src_stride, src2, i_height );
break;
}
if( weight->weightfn )
}
}
-static weight_fn_t x264_mc_weight_wtab_altivec[6] =
+static weight_fn_t mc_weight_wtab_altivec[6] =
{
mc_weight_w2_altivec,
mc_weight_w4_altivec,
pf->get_ref = get_ref_altivec;
pf->mc_chroma = mc_chroma_altivec;
- pf->copy_16x16_unaligned = x264_mc_copy_w16_altivec;
- pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_altivec;
+ pf->copy_16x16_unaligned = mc_copy_w16_altivec;
+ pf->copy[PIXEL_16x16] = mc_copy_w16_aligned_altivec;
pf->hpel_filter = x264_hpel_filter_altivec;
pf->frame_init_lowres_core = frame_init_lowres_core_altivec;
- pf->weight = x264_mc_weight_wtab_altivec;
+ pf->weight = mc_weight_wtab_altivec;
- pf->plane_copy_swap = x264_plane_copy_swap_altivec;
- pf->plane_copy_interleave = x264_plane_copy_interleave_altivec;
+ pf->plane_copy_swap = plane_copy_swap_altivec;
+ pf->plane_copy_interleave = plane_copy_interleave_altivec;
pf->store_interleave_chroma = x264_store_interleave_chroma_altivec;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_altivec;
#if HAVE_VSX
/****************************************************************************
* variance
****************************************************************************/
-static uint64_t x264_pixel_var_16x16_altivec( uint8_t *pix, intptr_t i_stride )
+static uint64_t pixel_var_16x16_altivec( uint8_t *pix, intptr_t i_stride )
{
ALIGNED_16(uint32_t sum_tab[4]);
ALIGNED_16(uint32_t sqr_tab[4]);
return sum + ((uint64_t)sqr<<32);
}
-static uint64_t x264_pixel_var_8x8_altivec( uint8_t *pix, intptr_t i_stride )
+static uint64_t pixel_var_8x8_altivec( uint8_t *pix, intptr_t i_stride )
{
ALIGNED_16(uint32_t sum_tab[4]);
ALIGNED_16(uint32_t sqr_tab[4]);
0x1C,0x0C,0x1D,0x0D, 0x1E,0x0E,0x1F,0x0F )
};
-static uint64_t x264_pixel_hadamard_ac_16x16_altivec( uint8_t *pix, intptr_t stride )
+static uint64_t pixel_hadamard_ac_16x16_altivec( uint8_t *pix, intptr_t stride )
{
int idx = ((uintptr_t)pix & 8) >> 3;
vec_u8_t permh = hadamard_permtab[idx];
return ((sum>>34)<<32) + ((uint32_t)sum>>1);
}
-static uint64_t x264_pixel_hadamard_ac_16x8_altivec( uint8_t *pix, intptr_t stride )
+static uint64_t pixel_hadamard_ac_16x8_altivec( uint8_t *pix, intptr_t stride )
{
int idx = ((uintptr_t)pix & 8) >> 3;
vec_u8_t permh = hadamard_permtab[idx];
return ((sum>>34)<<32) + ((uint32_t)sum>>1);
}
-static uint64_t x264_pixel_hadamard_ac_8x16_altivec( uint8_t *pix, intptr_t stride )
+static uint64_t pixel_hadamard_ac_8x16_altivec( uint8_t *pix, intptr_t stride )
{
vec_u8_t perm = hadamard_permtab[ (((uintptr_t)pix & 8) >> 3) ];
uint64_t sum = pixel_hadamard_ac_altivec( pix, stride, perm );
return ((sum>>34)<<32) + ((uint32_t)sum>>1);
}
-static uint64_t x264_pixel_hadamard_ac_8x8_altivec( uint8_t *pix, intptr_t stride )
+static uint64_t pixel_hadamard_ac_8x8_altivec( uint8_t *pix, intptr_t stride )
{
vec_u8_t perm = hadamard_permtab[ (((uintptr_t)pix & 8) >> 3) ];
uint64_t sum = pixel_hadamard_ac_altivec( pix, stride, perm );
#define INTRA_MBCMP_8x8( mbcmp )\
-void intra_##mbcmp##_x3_8x8_altivec( uint8_t *fenc, uint8_t edge[36], int res[3] )\
+static void intra_##mbcmp##_x3_8x8_altivec( uint8_t *fenc, uint8_t edge[36], int res[3] )\
{\
ALIGNED_8( uint8_t pix[8*FDEC_STRIDE] );\
x264_predict_8x8_v_c( pix, edge );\
INTRA_MBCMP_8x8(sa8d)
#define INTRA_MBCMP( mbcmp, size, pred1, pred2, pred3, chroma )\
-void intra_##mbcmp##_x3_##size##x##size##chroma##_altivec( uint8_t *fenc, uint8_t *fdec, int res[3] )\
+static void intra_##mbcmp##_x3_##size##x##size##chroma##_altivec( uint8_t *fenc, uint8_t *fdec, int res[3] )\
{\
x264_predict_##size##x##size##chroma##_##pred1##_c( fdec );\
res[0] = pixel_##mbcmp##_##size##x##size##_altivec( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\
pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_altivec;
- pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_altivec;
- pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_altivec;
+ pixf->var[PIXEL_16x16] = pixel_var_16x16_altivec;
+ pixf->var[PIXEL_8x8] = pixel_var_8x8_altivec;
- pixf->hadamard_ac[PIXEL_16x16] = x264_pixel_hadamard_ac_16x16_altivec;
- pixf->hadamard_ac[PIXEL_16x8] = x264_pixel_hadamard_ac_16x8_altivec;
- pixf->hadamard_ac[PIXEL_8x16] = x264_pixel_hadamard_ac_8x16_altivec;
- pixf->hadamard_ac[PIXEL_8x8] = x264_pixel_hadamard_ac_8x8_altivec;
+ pixf->hadamard_ac[PIXEL_16x16] = pixel_hadamard_ac_16x16_altivec;
+ pixf->hadamard_ac[PIXEL_16x8] = pixel_hadamard_ac_16x8_altivec;
+ pixf->hadamard_ac[PIXEL_8x16] = pixel_hadamard_ac_8x16_altivec;
+ pixf->hadamard_ac[PIXEL_8x8] = pixel_hadamard_ac_8x8_altivec;
pixf->ssim_4x4x2_core = ssim_4x4x2_core_altivec;
#endif // !HIGH_BIT_DEPTH
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_left_c( pixel *src )
+static void predict_16x16_dc_left_c( pixel *src )
{
int dc = 0;
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_top_c( pixel *src )
+static void predict_16x16_dc_top_c( pixel *src )
{
int dc = 0;
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_128_c( pixel *src )
+static void predict_16x16_dc_128_c( pixel *src )
{
PREDICT_16x16_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
* 8x8 prediction for intra chroma block (4:2:0)
****************************************************************************/
-static void x264_predict_8x8c_dc_128_c( pixel *src )
+static void predict_8x8c_dc_128_c( pixel *src )
{
for( int y = 0; y < 8; y++ )
{
src += FDEC_STRIDE;
}
}
-static void x264_predict_8x8c_dc_left_c( pixel *src )
+static void predict_8x8c_dc_left_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
}
}
-static void x264_predict_8x8c_dc_top_c( pixel *src )
+static void predict_8x8c_dc_top_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
* 8x16 prediction for intra chroma block (4:2:2)
****************************************************************************/
-static void x264_predict_8x16c_dc_128_c( pixel *src )
+static void predict_8x16c_dc_128_c( pixel *src )
{
for( int y = 0; y < 16; y++ )
{
src += FDEC_STRIDE;
}
}
-static void x264_predict_8x16c_dc_left_c( pixel *src )
+static void predict_8x16c_dc_left_c( pixel *src )
{
for( int i = 0; i < 4; i++ )
{
}
}
}
-static void x264_predict_8x16c_dc_top_c( pixel *src )
+static void predict_8x16c_dc_top_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
#define PREDICT_4x4_DC(v)\
SRC_X4(0,0) = SRC_X4(0,1) = SRC_X4(0,2) = SRC_X4(0,3) = v;
-static void x264_predict_4x4_dc_128_c( pixel *src )
+static void predict_4x4_dc_128_c( pixel *src )
{
PREDICT_4x4_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
-static void x264_predict_4x4_dc_left_c( pixel *src )
+static void predict_4x4_dc_left_c( pixel *src )
{
pixel4 dc = PIXEL_SPLAT_X4( (SRC(-1,0) + SRC(-1,1) + SRC(-1,2) + SRC(-1,3) + 2) >> 2 );
PREDICT_4x4_DC( dc );
}
-static void x264_predict_4x4_dc_top_c( pixel *src )
+static void predict_4x4_dc_top_c( pixel *src )
{
pixel4 dc = PIXEL_SPLAT_X4( (SRC(0,-1) + SRC(1,-1) + SRC(2,-1) + SRC(3,-1) + 2) >> 2 );
PREDICT_4x4_DC( dc );
#define F1(a,b) (((a)+(b)+1)>>1)
#define F2(a,b,c) (((a)+2*(b)+(c)+2)>>2)
-static void x264_predict_4x4_ddl_c( pixel *src )
+static void predict_4x4_ddl_c( pixel *src )
{
PREDICT_4x4_LOAD_TOP
PREDICT_4x4_LOAD_TOP_RIGHT
SRC(3,2)=SRC(2,3)= F2(t5,t6,t7);
SRC(3,3)= F2(t6,t7,t7);
}
-static void x264_predict_4x4_ddr_c( pixel *src )
+static void predict_4x4_ddr_c( pixel *src )
{
int lt = SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
SRC(0,3)= F2(l1,l2,l3);
}
-static void x264_predict_4x4_vr_c( pixel *src )
+static void predict_4x4_vr_c( pixel *src )
{
int lt = SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
SRC(3,0)= F1(t2,t3);
}
-static void x264_predict_4x4_hd_c( pixel *src )
+static void predict_4x4_hd_c( pixel *src )
{
int lt= SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
SRC(3,0)= F2(t2,t1,t0);
}
-static void x264_predict_4x4_vl_c( pixel *src )
+static void predict_4x4_vl_c( pixel *src )
{
PREDICT_4x4_LOAD_TOP
PREDICT_4x4_LOAD_TOP_RIGHT
SRC(3,3)= F2(t4,t5,t6);
}
-static void x264_predict_4x4_hu_c( pixel *src )
+static void predict_4x4_hu_c( pixel *src )
{
PREDICT_4x4_LOAD_LEFT
SRC(0,0)= F1(l0,l1);
#define PT(x) \
edge[16+x] = F2(SRC(x-1,-1), SRC(x,-1), SRC(x+1,-1));
-static void x264_predict_8x8_filter_c( pixel *src, pixel edge[36], int i_neighbor, int i_filters )
+static void predict_8x8_filter_c( pixel *src, pixel edge[36], int i_neighbor, int i_filters )
{
/* edge[7..14] = l7..l0
* edge[15] = lt
src += FDEC_STRIDE; \
}
-static void x264_predict_8x8_dc_128_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_128_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
-static void x264_predict_8x8_dc_left_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_left_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_LEFT
pixel4 dc = PIXEL_SPLAT_X4( (l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3 );
PREDICT_8x8_DC( dc );
}
-static void x264_predict_8x8_dc_top_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_top_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
pixel4 dc = PIXEL_SPLAT_X4( (t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3 );
MPIXEL_X4( src+y*FDEC_STRIDE+4 ) = top[1];
}
}
-static void x264_predict_8x8_ddl_c( pixel *src, pixel edge[36] )
+static void predict_8x8_ddl_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_TOPRIGHT
SRC(6,7)=SRC(7,6)= F2(t13,t14,t15);
SRC(7,7)= F2(t14,t15,t15);
}
-static void x264_predict_8x8_ddr_c( pixel *src, pixel edge[36] )
+static void predict_8x8_ddr_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
SRC(7,0)= F2(t5,t6,t7);
}
-static void x264_predict_8x8_vr_c( pixel *src, pixel edge[36] )
+static void predict_8x8_vr_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
SRC(7,1)= F2(t5,t6,t7);
SRC(7,0)= F1(t6,t7);
}
-static void x264_predict_8x8_hd_c( pixel *src, pixel edge[36] )
+static void predict_8x8_hd_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
SRC_X4(4,1)= pack_pixel_2to4(p9,p10);
SRC_X4(4,0)= pack_pixel_2to4(p10,p11);
}
-static void x264_predict_8x8_vl_c( pixel *src, pixel edge[36] )
+static void predict_8x8_vl_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_TOPRIGHT
SRC(7,6)= F1(t10,t11);
SRC(7,7)= F2(t10,t11,t12);
}
-static void x264_predict_8x8_hu_c( pixel *src, pixel edge[36] )
+static void predict_8x8_hu_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_LEFT
int p1 = pack_pixel_1to2(F1(l0,l1), F2(l0,l1,l2));
pf[I_PRED_16x16_H ] = x264_predict_16x16_h_c;
pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_c;
pf[I_PRED_16x16_P ] = x264_predict_16x16_p_c;
- pf[I_PRED_16x16_DC_LEFT]= x264_predict_16x16_dc_left_c;
- pf[I_PRED_16x16_DC_TOP ]= x264_predict_16x16_dc_top_c;
- pf[I_PRED_16x16_DC_128 ]= x264_predict_16x16_dc_128_c;
+ pf[I_PRED_16x16_DC_LEFT]= predict_16x16_dc_left_c;
+ pf[I_PRED_16x16_DC_TOP ]= predict_16x16_dc_top_c;
+ pf[I_PRED_16x16_DC_128 ]= predict_16x16_dc_128_c;
#if HAVE_MMX
x264_predict_16x16_init_mmx( cpu, pf );
pf[I_PRED_CHROMA_H ] = x264_predict_8x8c_h_c;
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_c;
pf[I_PRED_CHROMA_P ] = x264_predict_8x8c_p_c;
- pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x8c_dc_left_c;
- pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x8c_dc_top_c;
- pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x8c_dc_128_c;
+ pf[I_PRED_CHROMA_DC_LEFT]= predict_8x8c_dc_left_c;
+ pf[I_PRED_CHROMA_DC_TOP ]= predict_8x8c_dc_top_c;
+ pf[I_PRED_CHROMA_DC_128 ]= predict_8x8c_dc_128_c;
#if HAVE_MMX
x264_predict_8x8c_init_mmx( cpu, pf );
pf[I_PRED_CHROMA_H ] = x264_predict_8x16c_h_c;
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_c;
pf[I_PRED_CHROMA_P ] = x264_predict_8x16c_p_c;
- pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x16c_dc_left_c;
- pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x16c_dc_top_c;
- pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x16c_dc_128_c;
+ pf[I_PRED_CHROMA_DC_LEFT]= predict_8x16c_dc_left_c;
+ pf[I_PRED_CHROMA_DC_TOP ]= predict_8x16c_dc_top_c;
+ pf[I_PRED_CHROMA_DC_128 ]= predict_8x16c_dc_128_c;
#if HAVE_MMX
x264_predict_8x16c_init_mmx( cpu, pf );
pf[I_PRED_8x8_V] = x264_predict_8x8_v_c;
pf[I_PRED_8x8_H] = x264_predict_8x8_h_c;
pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_c;
- pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_c;
- pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_c;
- pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_c;
- pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_c;
- pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_c;
- pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_c;
- pf[I_PRED_8x8_DC_LEFT]= x264_predict_8x8_dc_left_c;
- pf[I_PRED_8x8_DC_TOP] = x264_predict_8x8_dc_top_c;
- pf[I_PRED_8x8_DC_128] = x264_predict_8x8_dc_128_c;
- *predict_filter = x264_predict_8x8_filter_c;
+ pf[I_PRED_8x8_DDL] = predict_8x8_ddl_c;
+ pf[I_PRED_8x8_DDR] = predict_8x8_ddr_c;
+ pf[I_PRED_8x8_VR] = predict_8x8_vr_c;
+ pf[I_PRED_8x8_HD] = predict_8x8_hd_c;
+ pf[I_PRED_8x8_VL] = predict_8x8_vl_c;
+ pf[I_PRED_8x8_HU] = predict_8x8_hu_c;
+ pf[I_PRED_8x8_DC_LEFT]= predict_8x8_dc_left_c;
+ pf[I_PRED_8x8_DC_TOP] = predict_8x8_dc_top_c;
+ pf[I_PRED_8x8_DC_128] = predict_8x8_dc_128_c;
+ *predict_filter = predict_8x8_filter_c;
#if HAVE_MMX
x264_predict_8x8_init_mmx( cpu, pf, predict_filter );
pf[I_PRED_4x4_V] = x264_predict_4x4_v_c;
pf[I_PRED_4x4_H] = x264_predict_4x4_h_c;
pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_c;
- pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_c;
- pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_c;
- pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_c;
- pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_c;
- pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_c;
- pf[I_PRED_4x4_HU] = x264_predict_4x4_hu_c;
- pf[I_PRED_4x4_DC_LEFT]= x264_predict_4x4_dc_left_c;
- pf[I_PRED_4x4_DC_TOP] = x264_predict_4x4_dc_top_c;
- pf[I_PRED_4x4_DC_128] = x264_predict_4x4_dc_128_c;
+ pf[I_PRED_4x4_DDL] = predict_4x4_ddl_c;
+ pf[I_PRED_4x4_DDR] = predict_4x4_ddr_c;
+ pf[I_PRED_4x4_VR] = predict_4x4_vr_c;
+ pf[I_PRED_4x4_HD] = predict_4x4_hd_c;
+ pf[I_PRED_4x4_VL] = predict_4x4_vl_c;
+ pf[I_PRED_4x4_HU] = predict_4x4_hu_c;
+ pf[I_PRED_4x4_DC_LEFT]= predict_4x4_dc_left_c;
+ pf[I_PRED_4x4_DC_TOP] = predict_4x4_dc_top_c;
+ pf[I_PRED_4x4_DC_128] = predict_4x4_dc_128_c;
#if HAVE_MMX
x264_predict_4x4_init_mmx( cpu, pf );
return optimize_chroma_dc_internal( dct, dequant_mf, 1 );
}
-static void x264_denoise_dct( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size )
+static void denoise_dct( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size )
{
for( int i = 0; i < size; i++ )
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
-static int ALWAYS_INLINE x264_decimate_score_internal( dctcoef *dct, int i_max )
+static int ALWAYS_INLINE decimate_score_internal( dctcoef *dct, int i_max )
{
const uint8_t *ds_table = (i_max == 64) ? x264_decimate_table8 : x264_decimate_table4;
int i_score = 0;
return i_score;
}
-static int x264_decimate_score15( dctcoef *dct )
+static int decimate_score15( dctcoef *dct )
{
- return x264_decimate_score_internal( dct+1, 15 );
+ return decimate_score_internal( dct+1, 15 );
}
-static int x264_decimate_score16( dctcoef *dct )
+static int decimate_score16( dctcoef *dct )
{
- return x264_decimate_score_internal( dct, 16 );
+ return decimate_score_internal( dct, 16 );
}
-static int x264_decimate_score64( dctcoef *dct )
+static int decimate_score64( dctcoef *dct )
{
- return x264_decimate_score_internal( dct, 64 );
+ return decimate_score_internal( dct, 64 );
}
#define last(num)\
-static int x264_coeff_last##num( dctcoef *l )\
+static int coeff_last##num( dctcoef *l )\
{\
int i_last = num-1;\
while( i_last >= 0 && l[i_last] == 0 )\
last(64)
#define level_run(num)\
-static int x264_coeff_level_run##num( dctcoef *dct, x264_run_level_t *runlevel )\
+static int coeff_level_run##num( dctcoef *dct, x264_run_level_t *runlevel )\
{\
- int i_last = runlevel->last = x264_coeff_last##num(dct);\
+ int i_last = runlevel->last = coeff_last##num(dct);\
int i_total = 0;\
int mask = 0;\
do\
pf->optimize_chroma_2x2_dc = optimize_chroma_2x2_dc;
pf->optimize_chroma_2x4_dc = optimize_chroma_2x4_dc;
- pf->denoise_dct = x264_denoise_dct;
- pf->decimate_score15 = x264_decimate_score15;
- pf->decimate_score16 = x264_decimate_score16;
- pf->decimate_score64 = x264_decimate_score64;
-
- pf->coeff_last4 = x264_coeff_last4;
- pf->coeff_last8 = x264_coeff_last8;
- pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15;
- pf->coeff_last[ DCT_LUMA_4x4] = x264_coeff_last16;
- pf->coeff_last[ DCT_LUMA_8x8] = x264_coeff_last64;
- pf->coeff_level_run4 = x264_coeff_level_run4;
- pf->coeff_level_run8 = x264_coeff_level_run8;
- pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15;
- pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16;
+ pf->denoise_dct = denoise_dct;
+ pf->decimate_score15 = decimate_score15;
+ pf->decimate_score16 = decimate_score16;
+ pf->decimate_score64 = decimate_score64;
+
+ pf->coeff_last4 = coeff_last4;
+ pf->coeff_last8 = coeff_last8;
+ pf->coeff_last[ DCT_LUMA_AC] = coeff_last15;
+ pf->coeff_last[ DCT_LUMA_4x4] = coeff_last16;
+ pf->coeff_last[ DCT_LUMA_8x8] = coeff_last64;
+ pf->coeff_level_run4 = coeff_level_run4;
+ pf->coeff_level_run8 = coeff_level_run8;
+ pf->coeff_level_run[ DCT_LUMA_AC] = coeff_level_run15;
+ pf->coeff_level_run[ DCT_LUMA_4x4] = coeff_level_run16;
#if HIGH_BIT_DEPTH
#if HAVE_MMX
#include "common.h"
#define CACHE_FUNC(name,size,width,height)\
-static void x264_macroblock_cache_##name##_##width##_##height( void *target, uint32_t val )\
+static void macroblock_cache_##name##_##width##_##height( void *target, uint32_t val )\
{\
x264_macroblock_cache_rect( target, width*size, height, size, val );\
}
CACHE_FUNC(name,size,1,1)\
void (*x264_cache_##name##_func_table[10])(void *, uint32_t) =\
{\
- x264_macroblock_cache_##name##_1_1,\
- x264_macroblock_cache_##name##_2_1,\
- x264_macroblock_cache_##name##_1_2,\
- x264_macroblock_cache_##name##_2_2,\
+ macroblock_cache_##name##_1_1,\
+ macroblock_cache_##name##_2_1,\
+ macroblock_cache_##name##_1_2,\
+ macroblock_cache_##name##_2_2,\
NULL,\
- x264_macroblock_cache_##name##_4_2,\
+ macroblock_cache_##name##_4_2,\
NULL,\
- x264_macroblock_cache_##name##_2_4,\
+ macroblock_cache_##name##_2_4,\
NULL,\
- x264_macroblock_cache_##name##_4_4\
+ macroblock_cache_##name##_4_4\
};\
CACHE_FUNCS(mv, 4)
x264_free( h->nr_offset_emergency );
}
-static int x264_cqm_parse_jmlist( x264_t *h, const char *buf, const char *name,
+static int cqm_parse_jmlist( x264_t *h, const char *buf, const char *name,
uint8_t *cqm, const uint8_t *jvt, int length )
{
int i;
while( (p = strchr( buf, '#' )) != NULL )
memset( p, ' ', strcspn( p, "\n" ) );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_LUMA", h->param.cqm_4iy, x264_cqm_jvt4i, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_LUMA", h->param.cqm_4py, x264_cqm_jvt4p, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_CHROMA", h->param.cqm_4ic, x264_cqm_jvt4i, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_CHROMA", h->param.cqm_4pc, x264_cqm_jvt4p, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_LUMA", h->param.cqm_8iy, x264_cqm_jvt8i, 64 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_LUMA", h->param.cqm_8py, x264_cqm_jvt8p, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA4X4_LUMA", h->param.cqm_4iy, x264_cqm_jvt4i, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER4X4_LUMA", h->param.cqm_4py, x264_cqm_jvt4p, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA4X4_CHROMA", h->param.cqm_4ic, x264_cqm_jvt4i, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER4X4_CHROMA", h->param.cqm_4pc, x264_cqm_jvt4p, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA8X8_LUMA", h->param.cqm_8iy, x264_cqm_jvt8i, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER8X8_LUMA", h->param.cqm_8py, x264_cqm_jvt8p, 64 );
if( CHROMA444 )
{
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_CHROMA", h->param.cqm_8ic, x264_cqm_jvt8i, 64 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_CHROMA", h->param.cqm_8pc, x264_cqm_jvt8p, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA8X8_CHROMA", h->param.cqm_8ic, x264_cqm_jvt8i, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER8X8_CHROMA", h->param.cqm_8pc, x264_cqm_jvt8p, 64 );
}
x264_free( buf );
x264_sync_frame_list_t done; /* list of jobs that have finished processing */
};
-static void *x264_threadpool_thread( x264_threadpool_t *pool )
+static void *threadpool_thread( x264_threadpool_t *pool )
{
if( pool->init_func )
pool->init_func( pool->init_arg );
x264_sync_frame_list_push( &pool->uninit, (void*)job );
}
for( int i = 0; i < pool->threads; i++ )
- if( x264_pthread_create( pool->thread_handle+i, NULL, (void*)x264_threadpool_thread, pool ) )
+ if( x264_pthread_create( pool->thread_handle+i, NULL, (void*)threadpool_thread, pool ) )
goto fail;
return 0;
}
}
-static void x264_threadpool_list_delete( x264_sync_frame_list_t *slist )
+static void threadpool_list_delete( x264_sync_frame_list_t *slist )
{
for( int i = 0; slist->list[i]; i++ )
{
for( int i = 0; i < pool->threads; i++ )
x264_pthread_join( pool->thread_handle[i], NULL );
- x264_threadpool_list_delete( &pool->uninit );
- x264_threadpool_list_delete( &pool->run );
- x264_threadpool_list_delete( &pool->done );
+ threadpool_list_delete( &pool->uninit );
+ threadpool_list_delete( &pool->run );
+ threadpool_list_delete( &pool->done );
x264_free( pool->thread_handle );
x264_free( pool );
}
static x264_pthread_mutex_t static_mutex;
/* _beginthreadex requires that the start routine is __stdcall */
-static unsigned __stdcall x264_win32thread_worker( void *arg )
+static unsigned __stdcall win32thread_worker( void *arg )
{
x264_pthread_t *h = arg;
*h->p_ret = h->func( h->arg );
thread->arg = arg;
thread->p_ret = &thread->ret;
thread->ret = NULL;
- thread->handle = (void*)_beginthreadex( NULL, 0, x264_win32thread_worker, thread, 0, NULL );
+ thread->handle = (void*)_beginthreadex( NULL, 0, win32thread_worker, thread, 0, NULL );
return !thread->handle;
}
PIXEL_AVG_WALL(avx2)
#define PIXEL_AVG_WTAB(instr, name1, name2, name3, name4, name5)\
-static void (* const x264_pixel_avg_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ) =\
+static void (* const pixel_avg_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ) =\
{\
NULL,\
x264_pixel_avg2_w4_##name1,\
#endif // HIGH_BIT_DEPTH
#define MC_COPY_WTAB(instr, name1, name2, name3)\
-static void (* const x264_mc_copy_wtab_##instr[5])( pixel *, intptr_t, pixel *, intptr_t, int ) =\
+static void (* const mc_copy_wtab_##instr[5])( pixel *, intptr_t, pixel *, intptr_t, int ) =\
{\
NULL,\
x264_mc_copy_w4_##name1,\
#endif
#define MC_WEIGHT_WTAB(function, instr, name1, name2, w12version)\
- static void (* x264_mc_##function##_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ) =\
+static void (* mc_##function##_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ) =\
{\
x264_mc_##function##_w4_##name1,\
x264_mc_##function##_w4_##name1,\
MC_WEIGHT_WTAB(offsetadd,sse2,mmx2,sse2,16)
MC_WEIGHT_WTAB(offsetsub,sse2,mmx2,sse2,16)
-static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w )
+static void weight_cache_mmx2( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
MC_WEIGHT_WTAB(weight,ssse3,ssse3,ssse3,16)
MC_WEIGHT_WTAB(weight,avx2,ssse3,avx2,16)
-static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w )
+static void weight_cache_mmx2( x264_t *h, x264_weight_t *w )
{
int i;
int16_t den1;
}
}
-static void x264_weight_cache_ssse3( x264_t *h, x264_weight_t *w )
+static void weight_cache_ssse3( x264_t *h, x264_weight_t *w )
{
int i, den1;
if( w->i_scale == 1<<w->i_denom )
if( qpel_idx & 5 ) /* qpel interpolation needed */\
{\
pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\
- x264_pixel_avg_wtab_##instr1[i_width>>2](\
+ pixel_avg_wtab_##instr1[i_width>>2](\
dst, i_dst_stride, src1, i_src_stride,\
src2, i_height );\
if( weight->weightfn )\
else if( weight->weightfn )\
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );\
else\
- x264_mc_copy_wtab_##instr2[i_width>>2](dst, i_dst_stride, src1, i_src_stride, i_height );\
+ mc_copy_wtab_##instr2[i_width>>2](dst, i_dst_stride, src1, i_src_stride, i_height );\
}
MC_LUMA(mmx2,mmx2,mmx)
if( qpel_idx & 5 ) /* qpel interpolation needed */\
{\
pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\
- x264_pixel_avg_wtab_##name[i_width>>2](\
+ pixel_avg_wtab_##name[i_width>>2](\
dst, *i_dst_stride, src1, i_src_stride,\
src2, i_height );\
if( weight->weightfn )\
uint16_t *lowres_costs, int bipred_weight, int mb_y,
int width, int height, int stride, int list_mask );
-static void x264_mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],
- int16_t *propagate_amount, uint16_t *lowres_costs,
- int bipred_weight, int mb_y, int len, int list )
+static void mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],
+ int16_t *propagate_amount, uint16_t *lowres_costs,
+ int bipred_weight, int mb_y, int len, int list )
{
x264_mbtree_propagate_list_internal_avx512( len, ref_costs, mvs, propagate_amount, lowres_costs, bipred_weight << 9,
mb_y << 16, h->mb.i_mb_width, h->mb.i_mb_height, h->mb.i_mb_stride,
pf->prefetch_fenc_422 = x264_prefetch_fenc_422_mmx2;
pf->prefetch_ref = x264_prefetch_ref_mmx2;
- pf->plane_copy_interleave = x264_plane_copy_interleave_mmx2;
+ pf->plane_copy_interleave = plane_copy_interleave_mmx2;
pf->store_interleave_chroma = x264_store_interleave_chroma_mmx2;
pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_mmx2;
pf->get_ref = get_ref_mmx2;
pf->mc_chroma = x264_mc_chroma_mmx2;
pf->hpel_filter = x264_hpel_filter_mmx2;
- pf->weight = x264_mc_weight_wtab_mmx2;
- pf->weight_cache = x264_weight_cache_mmx2;
- pf->offsetadd = x264_mc_offsetadd_wtab_mmx2;
- pf->offsetsub = x264_mc_offsetsub_wtab_mmx2;
+ pf->weight = mc_weight_wtab_mmx2;
+ pf->weight_cache = weight_cache_mmx2;
+ pf->offsetadd = mc_offsetadd_wtab_mmx2;
+ pf->offsetsub = mc_offsetsub_wtab_mmx2;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_mmx2;
{
pf->memcpy_aligned = x264_memcpy_aligned_sse;
pf->memzero_aligned = x264_memzero_aligned_sse;
- pf->plane_copy = x264_plane_copy_sse;
+ pf->plane_copy = plane_copy_sse;
}
#if HIGH_BIT_DEPTH
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2;
- pf->plane_copy_interleave = x264_plane_copy_interleave_sse2;
+ pf->plane_copy_interleave = plane_copy_interleave_sse2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_sse2;
if( cpu&X264_CPU_SSE2_IS_FAST )
{
pf->integral_init8v = x264_integral_init8v_sse2;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2;
pf->store_interleave_chroma = x264_store_interleave_chroma_sse2;
- pf->offsetadd = x264_mc_offsetadd_wtab_sse2;
- pf->offsetsub = x264_mc_offsetsub_wtab_sse2;
+ pf->offsetadd = mc_offsetadd_wtab_sse2;
+ pf->offsetsub = mc_offsetsub_wtab_sse2;
if( cpu&X264_CPU_SSE2_IS_SLOW )
return;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_sse2;
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse;
- pf->weight = x264_mc_weight_wtab_sse2;
+ pf->weight = mc_weight_wtab_sse2;
if( !(cpu&X264_CPU_STACK_MOD4) )
pf->mc_chroma = x264_mc_chroma_sse2;
return;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_ssse3;
- pf->plane_copy_swap = x264_plane_copy_swap_ssse3;
+ pf->plane_copy_swap = plane_copy_swap_ssse3;
pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_ssse3;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3;
+ pf->mbtree_propagate_list = mbtree_propagate_list_ssse3;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx;
- pf->plane_copy_interleave = x264_plane_copy_interleave_avx;
+ pf->plane_copy_interleave = plane_copy_interleave_avx;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_avx;
pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx;
pf->store_interleave_chroma = x264_store_interleave_chroma_avx;
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_avx;
pf->hpel_filter = x264_hpel_filter_sse2_amd;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_sse2;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_sse2;
if( !(cpu&X264_CPU_SSE2_IS_SLOW) )
{
- pf->weight = x264_mc_weight_wtab_sse2;
+ pf->weight = mc_weight_wtab_sse2;
if( !(cpu&X264_CPU_SLOW_ATOM) )
{
- pf->offsetadd = x264_mc_offsetadd_wtab_sse2;
- pf->offsetsub = x264_mc_offsetsub_wtab_sse2;
+ pf->offsetadd = mc_offsetadd_wtab_sse2;
+ pf->offsetsub = mc_offsetsub_wtab_sse2;
}
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse;
if( cpu&X264_CPU_SSE2_IS_FAST )
{
pf->store_interleave_chroma = x264_store_interleave_chroma_sse2; // FIXME sse2fast? sse2medium?
- pf->plane_copy_interleave = x264_plane_copy_interleave_sse2;
+ pf->plane_copy_interleave = plane_copy_interleave_sse2;
pf->mc_luma = mc_luma_sse2;
pf->get_ref = get_ref_sse2;
if( cpu&X264_CPU_CACHELINE_64 )
pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_ssse3;
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_ssse3;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_ssse3;
- pf->plane_copy_swap = x264_plane_copy_swap_ssse3;
+ pf->plane_copy_swap = plane_copy_swap_ssse3;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_ssse3;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3;
+ pf->mbtree_propagate_list = mbtree_propagate_list_ssse3;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_ssse3;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_ssse3;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_ssse3;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_ssse3;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_ssse3;
}
if( !(cpu&X264_CPU_SLOW_PALIGNR) )
}
}
- pf->weight_cache = x264_weight_cache_ssse3;
- pf->weight = x264_mc_weight_wtab_ssse3;
+ pf->weight_cache = weight_cache_ssse3;
+ pf->weight = mc_weight_wtab_ssse3;
if( !(cpu&(X264_CPU_SLOW_SHUFFLE|X264_CPU_SLOW_ATOM|X264_CPU_SLOW_PALIGNR)) )
pf->integral_init4v = x264_integral_init4v_ssse3;
{
pf->hpel_filter = x264_hpel_filter_avx2;
pf->mc_chroma = x264_mc_chroma_avx2;
- pf->weight = x264_mc_weight_wtab_avx2;
+ pf->weight = mc_weight_wtab_avx2;
pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_avx2;
pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_avx2;
pf->integral_init8v = x264_integral_init8v_avx2;
return;
pf->memcpy_aligned = x264_memcpy_aligned_avx;
pf->memzero_aligned = x264_memzero_aligned_avx;
- pf->plane_copy = x264_plane_copy_avx;
+ pf->plane_copy = plane_copy_avx;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx;
if( cpu&X264_CPU_FMA4 )
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_fma4;
if( !(cpu&X264_CPU_AVX2) )
return;
- pf->plane_copy_swap = x264_plane_copy_swap_avx2;
+ pf->plane_copy_swap = plane_copy_swap_avx2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_avx2;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx2;
pf->get_ref = get_ref_avx2;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx2;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx2;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx2;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_avx2;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_avx2;
pf->memzero_aligned = x264_memzero_aligned_avx512;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx512;
#if ARCH_X86_64
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx512;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx512;
#endif
}
x264_predict_16x16_p_core_##name( src, i00, b, c );
#define PREDICT_16x16_P(name, name2)\
-static void x264_predict_16x16_p_##name( pixel *src )\
+static void predict_16x16_p_##name( pixel *src )\
{\
PREDICT_16x16_P_CORE\
PREDICT_16x16_P_END(name2)\
+ 1 * ( src[ 8*FDEC_STRIDE-1] - src[ 6*FDEC_STRIDE-1] );
#define PREDICT_16x16_P_INLINE(name, name2)\
-static void x264_predict_16x16_p_##name( pixel *src )\
+static void predict_16x16_p_##name( pixel *src )\
{\
PREDICT_16x16_P_CORE_INLINE\
PREDICT_16x16_P_END(name2)\
#endif // HIGH_BIT_DEPTH
#define PREDICT_8x16C_P(name)\
-static void x264_predict_8x16c_p_##name( pixel *src )\
+static void predict_8x16c_p_##name( pixel *src )\
{\
PREDICT_8x16C_P_CORE\
PREDICT_8x16C_P_END(name)\
#endif // HIGH_BIT_DEPTH
#define PREDICT_8x8C_P(name, name2)\
-static void x264_predict_8x8c_p_##name( pixel *src )\
+static void predict_8x8c_p_##name( pixel *src )\
{\
PREDICT_8x8C_P_CORE\
PREDICT_8x8C_P_END(name2)\
H += -4 * src[-1*FDEC_STRIDE -1];
#define PREDICT_8x8C_P_INLINE(name, name2)\
-static void x264_predict_8x8c_p_##name( pixel *src )\
+static void predict_8x8c_p_##name( pixel *src )\
{\
PREDICT_8x8C_P_CORE_INLINE\
PREDICT_8x8C_P_END(name2)\
PREDICT_8x8C_P_INLINE( avx2, avx2 )
#if ARCH_X86_64 && !HIGH_BIT_DEPTH
-static void x264_predict_8x8c_dc_left( uint8_t *src )
+static void predict_8x8c_dc_left( uint8_t *src )
{
int y;
uint32_t s0 = 0, s1 = 0;
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2;
pf[I_PRED_16x16_H] = x264_predict_16x16_h_sse2;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
pf[I_PRED_16x16_V] = x264_predict_16x16_v_avx;
pf[I_PRED_16x16_H] = x264_predict_16x16_h_avx2;
#else
#if !ARCH_X86_64
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_mmx2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_mmx2;
#endif
if( !(cpu&X264_CPU_SSE) )
return;
return;
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
if( !(cpu&X264_CPU_SLOW_PSHUFB) )
pf[I_PRED_16x16_H] = x264_predict_16x16_h_ssse3;
#if HAVE_X86_INLINE_ASM
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_ssse3;
+ pf[I_PRED_16x16_P] = predict_16x16_p_ssse3;
#endif
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx;
+ pf[I_PRED_16x16_P] = predict_16x16_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_avx2;
pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_avx2;
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_avx2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_avx2;
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_sse2;
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_sse2;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_sse2;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx;
if( !(cpu&X264_CPU_AVX2) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_avx2;
#else
#if ARCH_X86_64
- pf[I_PRED_CHROMA_DC_LEFT] = x264_predict_8x8c_dc_left;
+ pf[I_PRED_CHROMA_DC_LEFT] = predict_8x8c_dc_left;
#endif
pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_mmx;
if( !(cpu&X264_CPU_MMX2) )
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_mmx2;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_mmx2;
#if !ARCH_X86_64
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_mmx2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_mmx2;
#endif
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_mmx2;
if( !(cpu&X264_CPU_SSE2) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_ssse3;
#if HAVE_X86_INLINE_ASM
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_ssse3;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_ssse3;
#endif
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx2;
}
}
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x16c_dc_top_sse2;
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_sse2;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_sse2;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx;
if( !(cpu&X264_CPU_AVX2) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_avx2;
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_mmx2;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_mmx2;
#if !ARCH_X86_64
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_mmx2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_mmx2;
#endif
if( !(cpu&X264_CPU_SSE2) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_ssse3;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx2;
}
}
5, 3, 3, 1
};
-static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a );
+static void analyse_update_cache( x264_t *h, x264_mb_analysis_t *a );
static uint16_t x264_cost_ref[QP_MAX+1][3][33];
static UNUSED x264_pthread_mutex_t cost_ref_mutex = X264_PTHREAD_MUTEX_INITIALIZER;
}
/* initialize an array of lambda*nbits for all possible mvs */
-static void x264_mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a )
{
a->p_cost_mv = h->cost_mv[a->i_qp];
a->p_cost_ref[0] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l0_active-1,0,2)];
a->p_cost_ref[1] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l1_active-1,0,2)];
}
-static void x264_mb_analyse_init_qp( x264_t *h, x264_mb_analysis_t *a, int qp )
+static void mb_analyse_init_qp( x264_t *h, x264_mb_analysis_t *a, int qp )
{
int effective_chroma_qp = h->chroma_qp_table[SPEC_QP(qp)] + X264_MAX( qp - QP_MAX_SPEC, 0 );
a->i_lambda = x264_lambda_tab[qp];
h->mb.i_chroma_qp = h->chroma_qp_table[qp];
}
-static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
+static void mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
{
int subme = h->param.analyse.i_subpel_refine - (h->sh.i_type == SLICE_TYPE_B);
h->mb.b_deblock_rdo = h->param.analyse.i_subpel_refine >= 9 && h->sh.i_disable_deblocking_filter_idc != 1;
a->b_early_terminate = h->param.analyse.i_subpel_refine < 11;
- x264_mb_analyse_init_qp( h, a, qp );
+ mb_analyse_init_qp( h, a, qp );
h->mb.b_transform_8x8 = 0;
}
/* For trellis=2, we need to do this for both sizes of DCT, for trellis=1 we only need to use it on the chosen mode. */
-static void inline x264_psy_trellis_init( x264_t *h, int do_both_dct )
+static void inline psy_trellis_init( x264_t *h, int do_both_dct )
{
ALIGNED_16( static pixel zero[16*FDEC_STRIDE] ) = {0};
}
/* Reset fenc satd scores cache for psy RD */
-static inline void x264_mb_init_fenc_cache( x264_t *h, int b_satd )
+static inline void mb_init_fenc_cache( x264_t *h, int b_satd )
{
if( h->param.analyse.i_trellis == 2 && h->mb.i_psy_trellis )
- x264_psy_trellis_init( h, h->param.analyse.b_transform_8x8 );
+ psy_trellis_init( h, h->param.analyse.b_transform_8x8 );
if( !h->mb.i_psy_rd )
return;
h->mc.memzero_aligned( h->mb.pic.fenc_satd_cache, sizeof(h->mb.pic.fenc_satd_cache) );
}
-static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
{
if( a->i_satd_chroma < COST_MAX )
return;
}
/* FIXME: should we do any sort of merged chroma analysis with 4:4:4? */
-static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
+static void mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
{
const unsigned int flags = h->sh.i_type == SLICE_TYPE_I ? h->param.analyse.intra : h->param.analyse.inter;
pixel *p_src = h->mb.pic.p_fenc[0];
}
}
-static void x264_intra_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_thresh )
+static void intra_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_thresh )
{
if( !a->b_early_terminate )
i_satd_thresh = COST_MAX;
if( a->i_satd_i16x16 < i_satd_thresh )
{
h->mb.i_type = I_16x16;
- x264_analyse_update_cache( h, a );
- a->i_satd_i16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i16x16 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->i_satd_i16x16 = COST_MAX;
if( a->i_satd_i4x4 < i_satd_thresh )
{
h->mb.i_type = I_4x4;
- x264_analyse_update_cache( h, a );
- a->i_satd_i4x4 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i4x4 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->i_satd_i4x4 = COST_MAX;
if( a->i_satd_i8x8 < i_satd_thresh )
{
h->mb.i_type = I_8x8;
- x264_analyse_update_cache( h, a );
- a->i_satd_i8x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i8x8 = rd_cost_mb( h, a->i_lambda2 );
a->i_cbp_i8x8_luma = h->mb.i_cbp_luma;
}
else
a->i_satd_i8x8 = COST_MAX;
}
-static void x264_intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
+static void intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
{
uint64_t i_satd, i_best;
int plane_count = CHROMA444 ? 3 : 1;
if( i_mode == old_pred_mode || a->i_satd_i16x16_dir[i_mode] > i_thresh )
continue;
h->mb.i_intra16x16_pred_mode = i_mode;
- i_satd = x264_rd_cost_mb( h, a->i_lambda2 );
+ i_satd = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( i_best, i_satd, a->i_predict16x16, i_mode );
}
}
{
int i_cbp_chroma_best = h->mb.i_cbp_chroma;
int i_chroma_lambda = x264_lambda2_tab[h->mb.i_chroma_qp];
- /* the previous thing encoded was x264_intra_rd(), so the pixels and
+ /* the previous thing encoded was intra_rd(), so the pixels and
* coefs for the current chroma mode are still around, so we only
* have to recount the bits. */
- i_best = x264_rd_cost_chroma( h, i_chroma_lambda, a->i_predict8x8chroma, 0 );
+ i_best = rd_cost_chroma( h, i_chroma_lambda, a->i_predict8x8chroma, 0 );
for( int i = 0; i < i_max; i++ )
{
int i_mode = predict_mode_sorted[i];
/* if we've already found a mode that needs no residual, then
* probably any mode with a residual will be worse.
* so avoid dct on the remaining modes to improve speed. */
- i_satd = x264_rd_cost_chroma( h, i_chroma_lambda, i_mode, h->mb.i_cbp_chroma != 0x00 );
+ i_satd = rd_cost_chroma( h, i_chroma_lambda, i_mode, h->mb.i_cbp_chroma != 0x00 );
COPY3_IF_LT( i_best, i_satd, a->i_predict8x8chroma, i_mode, i_cbp_chroma_best, h->mb.i_cbp_chroma );
}
h->mb.i_chroma_pred_mode = a->i_predict8x8chroma;
for( ; *predict_mode >= 0; predict_mode++ )
{
int i_mode = *predict_mode;
- i_satd = x264_rd_cost_i4x4( h, a->i_lambda2, idx, i_mode );
+ i_satd = rd_cost_i4x4( h, a->i_lambda2, idx, i_mode );
if( i_best > i_satd )
{
continue;
h->mb.i_cbp_luma = a->i_cbp_i8x8_luma;
- i_satd = x264_rd_cost_i8x8( h, a->i_lambda2, idx, i_mode, edge );
+ i_satd = rd_cost_i8x8( h, a->i_lambda2, idx, i_mode, edge );
if( i_best > i_satd )
{
#define REF_COST(list, ref) \
(a->p_cost_ref[list][ref])
-static void x264_mb_analyse_inter_p16x16( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p16x16( x264_t *h, x264_mb_analysis_t *a )
{
x264_me_t m;
int i_mvc;
&& x264_macroblock_probe_pskip( h ) )
{
h->mb.i_type = P_SKIP;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
assert( h->mb.cache.pskip_mv[1] <= h->mb.mv_max_spel[1] || h->i_thread_frames == 1 );
return;
}
h->mb.i_type = P_L0;
if( a->i_mbrd )
{
- x264_mb_init_fenc_cache( h, a->i_mbrd >= 2 || h->param.analyse.inter & X264_ANALYSE_PSUB8x8 );
+ mb_init_fenc_cache( h, a->i_mbrd >= 2 || h->param.analyse.inter & X264_ANALYSE_PSUB8x8 );
if( a->l0.me16x16.i_ref == 0 && M32( a->l0.me16x16.mv ) == M32( h->mb.cache.pskip_mv ) && !a->b_force_intra )
{
h->mb.i_partition = D_16x16;
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
if( !(h->mb.i_cbp_luma|h->mb.i_cbp_chroma) )
h->mb.i_type = P_SKIP;
}
}
}
-static void x264_mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101;
}
-static void x264_mb_analyse_inter_p8x8( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p8x8( x264_t *h, x264_mb_analysis_t *a )
{
/* Duplicate refs are rarely useful in p8x8 due to the high cost of the
* reference frame flags. Thus, if we're not doing mixedrefs, just
M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101;
}
-static void x264_mb_analyse_inter_p16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_p16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
a->l0.i_cost16x8 = a->l0.me16x8[0].cost + a->l0.me16x8[1].cost;
}
-static void x264_mb_analyse_inter_p8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_p8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
a->l0.i_cost8x16 = a->l0.me8x16[0].cost + a->l0.me8x16[1].cost;
}
-static ALWAYS_INLINE int x264_mb_analyse_inter_p4x4_chroma_internal( x264_t *h, x264_mb_analysis_t *a,
- pixel **p_fref, int i8x8, int size, int chroma )
+static ALWAYS_INLINE int mb_analyse_inter_p4x4_chroma_internal( x264_t *h, x264_mb_analysis_t *a,
+ pixel **p_fref, int i8x8, int size, int chroma )
{
ALIGNED_ARRAY_32( pixel, pix1,[16*16] );
pixel *pix2 = pix1+8;
+ h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[2][oe], FENC_STRIDE, pix2, 16 );
}
-static int x264_mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, pixel **p_fref, int i8x8, int size )
+static int mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, pixel **p_fref, int i8x8, int size )
{
if( CHROMA_FORMAT == CHROMA_444 )
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_444 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_444 );
else if( CHROMA_FORMAT == CHROMA_422 )
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_422 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_422 );
else
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_420 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_420 );
}
-static void x264_mb_analyse_inter_p4x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p4x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x4];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost4x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x4 );
+ a->l0.i_cost4x4[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x4 );
}
-static void x264_mb_analyse_inter_p8x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p8x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_8x4];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost8x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_8x4 );
+ a->l0.i_cost8x4[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_8x4 );
}
-static void x264_mb_analyse_inter_p4x8( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p4x8( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x8];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost4x8[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x8 );
+ a->l0.i_cost4x8[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x8 );
}
-static ALWAYS_INLINE int x264_analyse_bi_chroma( x264_t *h, x264_mb_analysis_t *a, int idx, int i_pixel )
+static ALWAYS_INLINE int analyse_bi_chroma( x264_t *h, x264_mb_analysis_t *a, int idx, int i_pixel )
{
ALIGNED_ARRAY_32( pixel, pix, [4],[16*16] );
ALIGNED_ARRAY_32( pixel, bi, [2],[16*16] );
return i_chroma_cost;
}
-static void x264_mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a )
{
/* Assumes that fdec still contains the results of
* x264_mb_predict_mv_direct16x16 and x264_mb_mc */
}
}
-static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
{
ALIGNED_ARRAY_32( pixel, pix0,[16*16] );
ALIGNED_ARRAY_32( pixel, pix1,[16*16] );
{
/* We already tested skip */
h->mb.i_type = B_SKIP;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
return;
}
}
+ a->l1.bi16x16.cost_mv;
if( h->mb.b_chroma_me )
- a->i_cost16x16bi += x264_analyse_bi_chroma( h, a, 0, PIXEL_16x16 );
+ a->i_cost16x16bi += analyse_bi_chroma( h, a, 0, PIXEL_16x16 );
/* Always try the 0,0,0,0 vector; helps avoid errant motion vectors in fades */
if( M32( a->l0.bi16x16.mv ) | M32( a->l1.bi16x16.mv ) )
a->l1.me16x16.cost += a->i_lambda * i_mb_b_cost_table[B_L1_L1];
}
-static inline void x264_mb_cache_mv_p8x8( x264_t *h, x264_mb_analysis_t *a, int i )
+static inline void mb_cache_mv_p8x8( x264_t *h, x264_mb_analysis_t *a, int i )
{
int x = 2*(i&1);
int y = i&2;
}
}
-static void x264_mb_load_mv_direct8x8( x264_t *h, int idx )
+static void mb_load_mv_direct8x8( x264_t *h, int idx )
{
int x = 2*(idx&1);
int y = idx&2;
x264_macroblock_cache_mvd( h, x,y,dx,dy, 1, 0 ); \
}
-static inline void x264_mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
int x = 2*(i&1);
int y = i&2;
if( h->mb.i_sub_partition[i] == D_DIRECT_8x8 )
{
- x264_mb_load_mv_direct8x8( h, i );
+ mb_load_mv_direct8x8( h, i );
if( b_mvd )
{
x264_macroblock_cache_mvd( h, x, y, 2, 2, 0, 0 );
CACHE_MV_BI( x, y, 2, 2, a->l0.me8x8[i], a->l1.me8x8[i], h->mb.i_sub_partition[i] );
}
}
-static inline void x264_mb_cache_mv_b16x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b16x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
CACHE_MV_BI( 0, 2*i, 4, 2, a->l0.me16x8[i], a->l1.me16x8[i], a->i_mb_partition16x8[i] );
}
-static inline void x264_mb_cache_mv_b8x16( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b8x16( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
CACHE_MV_BI( 2*i, 0, 2, 4, a->l0.me8x16[i], a->l1.me8x16[i], a->i_mb_partition8x16[i] );
}
#undef CACHE_MV_BI
-static void x264_mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
{
ALIGNED_ARRAY_16( pixel, pix,[2],[8*8] );
int i_maxref[2] = {h->mb.pic.i_fref[0]-1, h->mb.pic.i_fref[1]-1};
if( h->mb.b_chroma_me )
{
- int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 );
+ int i_chroma_cost = analyse_bi_chroma( h, a, i, PIXEL_8x8 );
i_part_cost_bi += i_chroma_cost;
a->i_satd8x8[2][i] += i_chroma_cost;
}
a->i_cost8x8bi += i_part_cost;
/* XXX Needed for x264_mb_predict_mv */
- x264_mb_cache_mv_b8x8( h, a, i, 0 );
+ mb_cache_mv_b8x8( h, a, i, 0 );
}
/* mb type cost */
a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8];
}
-static void x264_mb_analyse_inter_b8x8( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b8x8( x264_t *h, x264_mb_analysis_t *a )
{
pixel **p_fref[2] =
{ h->mb.pic.p_fref[0][a->l0.me16x16.i_ref],
if( h->mb.b_chroma_me )
{
- int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 );
+ int i_chroma_cost = analyse_bi_chroma( h, a, i, PIXEL_8x8 );
i_part_cost_bi += i_chroma_cost;
a->i_satd8x8[2][i] += i_chroma_cost;
}
a->i_cost8x8bi += i_part_cost;
/* XXX Needed for x264_mb_predict_mv */
- x264_mb_cache_mv_b8x8( h, a, i, 0 );
+ mb_cache_mv_b8x8( h, a, i, 0 );
}
/* mb type cost */
a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8];
}
-static void x264_mb_analyse_inter_b16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_b16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
ALIGNED_ARRAY_32( pixel, pix,[2],[16*8] );
ALIGNED_4( int16_t mvc[3][2] );
+ a->l1.me16x8[i].i_ref_cost;
if( h->mb.b_chroma_me )
- i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_16x8 );
+ i_part_cost_bi += analyse_bi_chroma( h, a, i, PIXEL_16x8 );
i_part_cost = a->l0.me16x8[i].cost;
a->i_mb_partition16x8[i] = D_L0_8x8; /* not actually 8x8, only the L0 matters */
return;
}
- x264_mb_cache_mv_b16x8( h, a, i, 0 );
+ mb_cache_mv_b16x8( h, a, i, 0 );
}
/* mb type cost */
a->i_cost16x8bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type16x8];
}
-static void x264_mb_analyse_inter_b8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_b8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
ALIGNED_ARRAY_16( pixel, pix,[2],[8*16] );
ALIGNED_4( int16_t mvc[3][2] );
+ a->l1.me8x16[i].i_ref_cost;
if( h->mb.b_chroma_me )
- i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_8x16 );
+ i_part_cost_bi += analyse_bi_chroma( h, a, i, PIXEL_8x16 );
i_part_cost = a->l0.me8x16[i].cost;
a->i_mb_partition8x16[i] = D_L0_8x8;
return;
}
- x264_mb_cache_mv_b8x16( h, a, i, 0 );
+ mb_cache_mv_b8x16( h, a, i, 0 );
}
/* mb type cost */
a->i_cost8x16bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type8x16];
}
-static void x264_mb_analyse_p_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd )
+static void mb_analyse_p_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd )
{
int thresh = a->b_early_terminate ? i_satd * 5/4 + 1 : COST_MAX;
if( a->l0.i_rd16x16 == COST_MAX && (!a->b_early_terminate || a->l0.me16x16.cost <= i_satd * 3/2) )
{
h->mb.i_partition = D_16x16;
- x264_analyse_update_cache( h, a );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
if( a->l0.i_cost16x8 < thresh )
{
h->mb.i_partition = D_16x8;
- x264_analyse_update_cache( h, a );
- a->l0.i_cost16x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost16x8 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost16x8 = COST_MAX;
if( a->l0.i_cost8x16 < thresh )
{
h->mb.i_partition = D_8x16;
- x264_analyse_update_cache( h, a );
- a->l0.i_cost8x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost8x16 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost8x16 = COST_MAX;
if( costs[subtype] > sub8x8_thresh )
continue;
h->mb.i_sub_partition[i] = subtype;
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
if( subtype == btype )
continue;
cost = x264_rd_cost_part( h, a->i_lambda2, i<<2, PIXEL_8x8 );
if( h->mb.i_sub_partition[i] != btype )
{
h->mb.i_sub_partition[i] = btype;
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
}
}
}
else
- x264_analyse_update_cache( h, a );
- a->l0.i_cost8x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost8x8 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost8x8 = COST_MAX;
}
-static void x264_mb_analyse_b_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
+static void mb_analyse_b_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
{
int thresh = a->b_early_terminate ? i_satd_inter * (17 + (!!h->mb.i_psy_rd))/16 + 1 : COST_MAX;
/* Assumes direct/skip MC is still in fdec */
/* Requires b-rdo to be done before intra analysis */
h->mb.b_skip_mc = 1;
- x264_analyse_update_cache( h, a );
- a->i_rd16x16direct = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x16direct = rd_cost_mb( h, a->i_lambda2 );
h->mb.b_skip_mc = 0;
}
if( a->l0.me16x16.cost < thresh && a->l0.i_rd16x16 == COST_MAX )
{
h->mb.i_type = B_L0_L0;
- x264_analyse_update_cache( h, a );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
/* L1 */
if( a->l1.me16x16.cost < thresh && a->l1.i_rd16x16 == COST_MAX )
{
h->mb.i_type = B_L1_L1;
- x264_analyse_update_cache( h, a );
- a->l1.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l1.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
/* BI */
if( a->i_cost16x16bi < thresh && a->i_rd16x16bi == COST_MAX )
{
h->mb.i_type = B_BI_BI;
- x264_analyse_update_cache( h, a );
- a->i_rd16x16bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x16bi = rd_cost_mb( h, a->i_lambda2 );
}
/* 8x8 */
{
h->mb.i_type = B_8x8;
h->mb.i_partition = D_8x8;
- x264_analyse_update_cache( h, a );
- a->i_rd8x8bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd8x8bi = rd_cost_mb( h, a->i_lambda2 );
x264_macroblock_cache_skip( h, 0, 0, 4, 4, 0 );
}
{
h->mb.i_type = a->i_mb_type16x8;
h->mb.i_partition = D_16x8;
- x264_analyse_update_cache( h, a );
- a->i_rd16x8bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x8bi = rd_cost_mb( h, a->i_lambda2 );
}
/* 8x16 */
{
h->mb.i_type = a->i_mb_type8x16;
h->mb.i_partition = D_8x16;
- x264_analyse_update_cache( h, a );
- a->i_rd8x16bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd8x16bi = rd_cost_mb( h, a->i_lambda2 );
}
}
-static void x264_refine_bidir( x264_t *h, x264_mb_analysis_t *a )
+static void refine_bidir( x264_t *h, x264_mb_analysis_t *a )
{
int i_biweight;
}
}
-static inline void x264_mb_analyse_transform( x264_t *h )
+static inline void mb_analyse_transform( x264_t *h )
{
if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 && !h->mb.b_lossless )
{
}
}
-static inline void x264_mb_analyse_transform_rd( x264_t *h, x264_mb_analysis_t *a, int *i_satd, int *i_rd )
+static inline void mb_analyse_transform_rd( x264_t *h, x264_mb_analysis_t *a, int *i_satd, int *i_rd )
{
if( h->param.analyse.b_transform_8x8 && h->pps->b_transform_8x8_mode )
{
else if( !x264_transform_allowed[h->mb.i_type] )
return;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
h->mb.b_transform_8x8 ^= 1;
/* FIXME only luma is needed for 4:2:0, but the score for comparison already includes chroma */
- int i_rd8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ int i_rd8 = rd_cost_mb( h, a->i_lambda2 );
if( *i_rd >= i_rd8 )
{
* There must be a more efficient way to get that portion of the benefit
* without doing full QP-RD, but RD-decimation doesn't seem to do the
* trick. */
-static inline void x264_mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
+static inline void mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
{
int bcost, cost, failures, prevcost, origcost;
int orig_qp = h->mb.i_qp, bqp = h->mb.i_qp;
int last_qp_tried = 0;
- origcost = bcost = x264_rd_cost_mb( h, a->i_lambda2 );
+ origcost = bcost = rd_cost_mb( h, a->i_lambda2 );
int origcbp = h->mb.cbp[h->mb.i_mb_xy];
/* If CBP is already zero, don't raise the quantizer any higher. */
{
h->mb.i_qp = X264_MAX( h->mb.i_qp - threshold - 1, SPEC_QP( h->param.rc.i_qp_min ) );
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- already_checked_cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ already_checked_cost = rd_cost_mb( h, a->i_lambda2 );
if( !h->mb.cbp[h->mb.i_mb_xy] )
{
/* If our empty-CBP block is lower QP than the last QP,
else
{
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp );
}
{
h->mb.i_qp = h->mb.i_last_qp;
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp );
}
x264_mb_transform_8x8_allowed( h ) )
{
h->mb.b_transform_8x8 ^= 1;
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
if( cost > bcost )
h->mb.b_transform_8x8 ^= 1;
}
if( h->param.analyse.b_mb_info )
h->fdec->effective_qp[h->mb.i_mb_xy] = h->mb.i_qp; /* Store the real analysis QP. */
- x264_mb_analyse_init( h, &analysis, h->mb.i_qp );
+ mb_analyse_init( h, &analysis, h->mb.i_qp );
/*--------------------------- Do the analysis ---------------------------*/
if( h->sh.i_type == SLICE_TYPE_I )
{
intra_analysis:
if( analysis.i_mbrd )
- x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
- x264_mb_analyse_intra( h, &analysis, COST_MAX );
+ mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
+ mb_analyse_intra( h, &analysis, COST_MAX );
if( analysis.i_mbrd )
- x264_intra_rd( h, &analysis, COST_MAX );
+ intra_rd( h, &analysis, COST_MAX );
i_cost = analysis.i_satd_i16x16;
h->mb.i_type = I_16x16;
h->mb.i_type = I_PCM;
else if( analysis.i_mbrd >= 2 )
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
}
else if( h->sh.i_type == SLICE_TYPE_P )
{
{
if( !h->param.analyse.b_psy )
{
- x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
+ mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
goto intra_analysis;
}
}
int i_partition;
int i_satd_inter, i_satd_intra;
- x264_mb_analyse_load_costs( h, &analysis );
+ mb_analyse_load_costs( h, &analysis );
- x264_mb_analyse_inter_p16x16( h, &analysis );
+ mb_analyse_inter_p16x16( h, &analysis );
if( h->mb.i_type == P_SKIP )
{
if( flags & X264_ANALYSE_PSUB16x16 )
{
if( h->param.analyse.b_mixed_references )
- x264_mb_analyse_inter_p8x8_mixed_ref( h, &analysis );
+ mb_analyse_inter_p8x8_mixed_ref( h, &analysis );
else
- x264_mb_analyse_inter_p8x8( h, &analysis );
+ mb_analyse_inter_p8x8( h, &analysis );
}
/* Select best inter mode */
{
for( int i = 0; i < 4; i++ )
{
- x264_mb_analyse_inter_p4x4( h, &analysis, i );
+ mb_analyse_inter_p4x4( h, &analysis, i );
int i_thresh8x4 = analysis.l0.me4x4[i][1].cost_mv + analysis.l0.me4x4[i][2].cost_mv;
if( !analysis.b_early_terminate || analysis.l0.i_cost4x4[i] < analysis.l0.me8x8[i].cost + i_thresh8x4 )
{
int i_cost8x8 = analysis.l0.i_cost4x4[i];
h->mb.i_sub_partition[i] = D_L0_4x4;
- x264_mb_analyse_inter_p8x4( h, &analysis, i );
+ mb_analyse_inter_p8x4( h, &analysis, i );
COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost8x4[i],
h->mb.i_sub_partition[i], D_L0_8x4 );
- x264_mb_analyse_inter_p4x8( h, &analysis, i );
+ mb_analyse_inter_p4x8( h, &analysis, i );
COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost4x8[i],
h->mb.i_sub_partition[i], D_L0_4x8 );
i_cost += i_cost8x8 - analysis.l0.me8x8[i].cost;
}
- x264_mb_cache_mv_p8x8( h, &analysis, i );
+ mb_cache_mv_p8x8( h, &analysis, i );
}
analysis.l0.i_cost8x8 = i_cost;
}
+ analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1;
analysis.i_cost_est16x8[1] = analysis.i_satd8x8[0][2] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost;
- x264_mb_analyse_inter_p16x8( h, &analysis, i_cost );
+ mb_analyse_inter_p16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.l0.i_cost16x8, i_type, P_L0, i_partition, D_16x8 );
i_avg_mv_ref_cost = (analysis.l0.me8x8[1].cost_mv + analysis.l0.me8x8[1].i_ref_cost
+ analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1;
analysis.i_cost_est8x16[1] = analysis.i_satd8x8[0][1] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost;
- x264_mb_analyse_inter_p8x16( h, &analysis, i_cost );
+ mb_analyse_inter_p8x16( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.l0.i_cost8x16, i_type, P_L0, i_partition, D_8x16 );
}
{
if( CHROMA444 )
{
- x264_mb_analyse_intra( h, &analysis, i_cost );
- x264_mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_cost );
+ mb_analyse_intra_chroma( h, &analysis );
}
else
{
- x264_mb_analyse_intra_chroma( h, &analysis );
- x264_mb_analyse_intra( h, &analysis, i_cost - analysis.i_satd_chroma );
+ mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_cost - analysis.i_satd_chroma );
}
analysis.i_satd_i16x16 += analysis.i_satd_chroma;
analysis.i_satd_i8x8 += analysis.i_satd_chroma;
analysis.i_satd_i4x4 += analysis.i_satd_chroma;
}
else
- x264_mb_analyse_intra( h, &analysis, i_cost );
+ mb_analyse_intra( h, &analysis, i_cost );
i_satd_inter = i_cost;
i_satd_intra = X264_MIN3( analysis.i_satd_i16x16,
if( analysis.i_mbrd )
{
- x264_mb_analyse_p_rd( h, &analysis, X264_MIN(i_satd_inter, i_satd_intra) );
+ mb_analyse_p_rd( h, &analysis, X264_MIN(i_satd_inter, i_satd_intra) );
i_type = P_L0;
i_partition = D_16x16;
i_cost = analysis.l0.i_rd16x16;
h->mb.i_type = i_type;
h->mb.i_partition = i_partition;
if( i_cost < COST_MAX )
- x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
- x264_intra_rd( h, &analysis, i_satd_inter * 5/4 + 1 );
+ mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
+ intra_rd( h, &analysis, i_satd_inter * 5/4 + 1 );
}
COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 );
{
/* Intra masking: copy fdec to fenc and re-encode the block as intra in order to make it appear as if
* it was an inter block. */
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
x264_macroblock_encode( h );
for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ )
h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, h->mb.pic.p_fdec[p], FDEC_STRIDE, 16 );
h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE, height );
h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE, height );
}
- x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
+ mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
goto intra_analysis;
}
{
if( IS_INTRA( h->mb.i_type ) )
{
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
}
else if( i_partition == D_16x16 )
{
}
else if( i_partition == D_8x8 )
{
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
for( int i8x8 = 0; i8x8 < 4; i8x8++ )
{
if( h->mb.i_sub_partition[i8x8] == D_L0_8x8 )
int b_skip = 0;
if( analysis.i_mbrd )
- x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
+ mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
h->mb.i_type = B_SKIP;
if( h->mb.b_direct_auto_write )
h->mb.b_skip_mc = 0;
h->mb.i_type = B_DIRECT;
- x264_mb_analyse_load_costs( h, &analysis );
+ mb_analyse_load_costs( h, &analysis );
/* select best inter mode */
/* direct must be first */
if( analysis.b_direct_available )
- x264_mb_analyse_inter_direct( h, &analysis );
+ mb_analyse_inter_direct( h, &analysis );
- x264_mb_analyse_inter_b16x16( h, &analysis );
+ mb_analyse_inter_b16x16( h, &analysis );
if( h->mb.i_type == B_SKIP )
{
if( analysis.i_mbrd && analysis.b_early_terminate && analysis.i_cost16x16direct <= i_cost * 33/32 )
{
- x264_mb_analyse_b_rd( h, &analysis, i_cost );
+ mb_analyse_b_rd( h, &analysis, i_cost );
if( i_bskip_cost < analysis.i_rd16x16direct &&
i_bskip_cost < analysis.i_rd16x16bi &&
i_bskip_cost < analysis.l0.i_rd16x16 &&
i_bskip_cost < analysis.l1.i_rd16x16 )
{
h->mb.i_type = B_SKIP;
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
return;
}
}
if( flags & X264_ANALYSE_BSUB16x16 )
{
if( h->param.analyse.b_mixed_references )
- x264_mb_analyse_inter_b8x8_mixed_ref( h, &analysis );
+ mb_analyse_inter_b8x8_mixed_ref( h, &analysis );
else
- x264_mb_analyse_inter_b8x8( h, &analysis );
+ mb_analyse_inter_b8x8( h, &analysis );
COPY3_IF_LT( i_cost, analysis.i_cost8x8bi, i_type, B_8x8, i_partition, D_8x8 );
int try_16x8_first = i_cost_est16x8bi_total < i_cost_est8x16bi_total;
if( try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) )
{
- x264_mb_analyse_inter_b16x8( h, &analysis, i_cost );
+ mb_analyse_inter_b16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 );
}
if( !analysis.b_early_terminate || i_cost_est8x16bi_total < i_cost )
{
- x264_mb_analyse_inter_b8x16( h, &analysis, i_cost );
+ mb_analyse_inter_b8x16( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost8x16bi, i_type, analysis.i_mb_type8x16, i_partition, D_8x16 );
}
if( !try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) )
{
- x264_mb_analyse_inter_b16x8( h, &analysis, i_cost );
+ mb_analyse_inter_b16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 );
}
}
if( analysis.i_mbrd )
{
- x264_mb_analyse_b_rd( h, &analysis, i_satd_inter );
+ mb_analyse_b_rd( h, &analysis, i_satd_inter );
i_type = B_SKIP;
i_cost = i_bskip_cost;
i_partition = D_16x16;
{
if( CHROMA444 )
{
- x264_mb_analyse_intra( h, &analysis, i_satd_inter );
- x264_mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_satd_inter );
+ mb_analyse_intra_chroma( h, &analysis );
}
else
{
- x264_mb_analyse_intra_chroma( h, &analysis );
- x264_mb_analyse_intra( h, &analysis, i_satd_inter - analysis.i_satd_chroma );
+ mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_satd_inter - analysis.i_satd_chroma );
}
analysis.i_satd_i16x16 += analysis.i_satd_chroma;
analysis.i_satd_i8x8 += analysis.i_satd_chroma;
analysis.i_satd_i4x4 += analysis.i_satd_chroma;
}
else
- x264_mb_analyse_intra( h, &analysis, i_satd_inter );
+ mb_analyse_intra( h, &analysis, i_satd_inter );
if( analysis.i_mbrd )
{
- x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
- x264_intra_rd( h, &analysis, i_satd_inter * 17/16 + 1 );
+ mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
+ intra_rd( h, &analysis, i_satd_inter * 17/16 + 1 );
}
COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 );
h->mb.i_partition = i_partition;
if( analysis.i_mbrd >= 2 && IS_INTRA( i_type ) && i_type != I_PCM )
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
if( h->mb.i_subpel_refine >= 5 )
- x264_refine_bidir( h, &analysis );
+ refine_bidir( h, &analysis );
if( analysis.i_mbrd >= 2 && i_type > B_DIRECT && i_type < B_SKIP )
{
int i_biweight;
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
if( i_partition == D_16x16 )
{
}
}
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
/* In rare cases we can end up qpel-RDing our way back to a larger partition size
* without realizing it. Check for this and account for it if necessary. */
}
if( !analysis.i_mbrd )
- x264_mb_analyse_transform( h );
+ mb_analyse_transform( h );
if( analysis.i_mbrd == 3 && !IS_SKIP(h->mb.i_type) )
- x264_mb_analyse_qp_rd( h, &analysis );
+ mb_analyse_qp_rd( h, &analysis );
h->mb.b_trellis = h->param.analyse.i_trellis;
h->mb.b_noise_reduction = h->mb.b_noise_reduction || (!!h->param.analyse.i_noise_reduction && !IS_INTRA( h->mb.i_type ));
if( !IS_SKIP(h->mb.i_type) && h->mb.i_psy_trellis && h->param.analyse.i_trellis == 1 )
- x264_psy_trellis_init( h, 0 );
+ psy_trellis_init( h, 0 );
if( h->mb.b_trellis == 1 || h->mb.b_noise_reduction )
h->mb.i_skip_intra = 0;
}
/*-------------------- Update MB from the analysis ----------------------*/
-static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a )
+static void analyse_update_cache( x264_t *h, x264_mb_analysis_t *a )
{
switch( h->mb.i_type )
{
for( int i = 0; i < 16; i++ )
h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] = a->i_predict4x4[i];
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_8x8:
for( int i = 0; i < 4; i++ )
x264_macroblock_cache_intra8x8_pred( h, 2*(i&1), 2*(i>>1), a->i_predict8x8[i] );
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_16x16:
h->mb.i_intra16x16_pred_mode = a->i_predict16x16;
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_PCM:
x264_macroblock_cache_ref( h, 0, 2, 2, 2, 0, a->l0.me8x8[2].i_ref );
x264_macroblock_cache_ref( h, 2, 2, 2, 2, 0, a->l0.me8x8[3].i_ref );
for( int i = 0; i < 4; i++ )
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
break;
case P_SKIP:
case B_SKIP:
case B_DIRECT:
h->mb.i_partition = h->mb.cache.direct_partition;
- x264_mb_load_mv_direct8x8( h, 0 );
- x264_mb_load_mv_direct8x8( h, 1 );
- x264_mb_load_mv_direct8x8( h, 2 );
- x264_mb_load_mv_direct8x8( h, 3 );
+ mb_load_mv_direct8x8( h, 0 );
+ mb_load_mv_direct8x8( h, 1 );
+ mb_load_mv_direct8x8( h, 2 );
+ mb_load_mv_direct8x8( h, 3 );
break;
case B_8x8:
/* optimize: cache might not need to be rewritten */
for( int i = 0; i < 4; i++ )
- x264_mb_cache_mv_b8x8( h, a, i, 1 );
+ mb_cache_mv_b8x8( h, a, i, 1 );
break;
default: /* the rest of the B types */
}
break;
case D_16x8:
- x264_mb_cache_mv_b16x8( h, a, 0, 1 );
- x264_mb_cache_mv_b16x8( h, a, 1, 1 );
+ mb_cache_mv_b16x8( h, a, 0, 1 );
+ mb_cache_mv_b16x8( h, a, 1, 1 );
break;
case D_8x16:
- x264_mb_cache_mv_b8x16( h, a, 0, 1 );
- x264_mb_cache_mv_b8x16( h, a, 1, 1 );
+ mb_cache_mv_b8x16( h, a, 0, 1 );
+ mb_cache_mv_b8x16( h, a, 1, 1 );
break;
default:
x264_log( h, X264_LOG_ERROR, "internal error (invalid MB type)\n" );
x264_log( h, X264_LOG_DEBUG, "mb_xy: %d,%d \n", h->mb.i_mb_x, h->mb.i_mb_y);
x264_log( h, X264_LOG_DEBUG, "completed: %d \n", completed );
x264_log( h, X264_LOG_WARNING, "recovering by using intra mode\n");
- x264_mb_analyse_intra( h, a, COST_MAX );
+ mb_analyse_intra( h, a, COST_MAX );
h->mb.i_type = I_16x16;
h->mb.i_intra16x16_pred_mode = a->i_predict16x16;
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
}
}
}
#define RDO_SKIP_BS 0
#endif
-static inline void x264_cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type,
+static inline void cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type,
int ctx0, int ctx1, int ctx2, int ctx3, int ctx4, int ctx5 )
{
if( i_mb_type == I_4x4 || i_mb_type == I_8x8 )
}
#if !RDO_SKIP_BS
-static void x264_cabac_field_decoding_flag( x264_t *h, x264_cabac_t *cb )
+static void cabac_field_decoding_flag( x264_t *h, x264_cabac_t *cb )
{
int ctx = 0;
ctx += h->mb.field_decoding_flag & !!h->mb.i_mb_x;
}
#endif
-static void x264_cabac_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode )
+static void cabac_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode )
{
if( i_pred == i_mode )
x264_cabac_encode_decision( cb, 68, 1 );
}
}
-static void x264_cabac_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb )
+static void cabac_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb )
{
int i_mode = x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode];
int ctx = 0;
}
}
-static void x264_cabac_cbp_luma( x264_t *h, x264_cabac_t *cb )
+static void cabac_cbp_luma( x264_t *h, x264_cabac_t *cb )
{
int cbp = h->mb.i_cbp_luma;
int cbp_l = h->mb.cache.i_cbp_left;
x264_cabac_encode_decision_noup( cb, 76 - ((cbp >> 2) & 1) - ((cbp >> 0) & 2), (cbp >> 3) & 1 );
}
-static void x264_cabac_cbp_chroma( x264_t *h, x264_cabac_t *cb )
+static void cabac_cbp_chroma( x264_t *h, x264_cabac_t *cb )
{
int cbp_a = h->mb.cache.i_cbp_left & 0x30;
int cbp_b = h->mb.cache.i_cbp_top & 0x30;
}
}
-static void x264_cabac_qp_delta( x264_t *h, x264_cabac_t *cb )
+static void cabac_qp_delta( x264_t *h, x264_cabac_t *cb )
{
int i_dqp = h->mb.i_qp - h->mb.i_last_qp;
int ctx;
}
#endif
-static inline void x264_cabac_subpartition_p( x264_cabac_t *cb, int i_sub )
+static inline void cabac_subpartition_p( x264_cabac_t *cb, int i_sub )
{
if( i_sub == D_L0_8x8 )
{
}
}
-static ALWAYS_INLINE void x264_cabac_subpartition_b( x264_cabac_t *cb, int i_sub )
+static ALWAYS_INLINE void cabac_subpartition_b( x264_cabac_t *cb, int i_sub )
{
if( i_sub == D_DIRECT_8x8 )
{
x264_cabac_encode_decision( cb, 39, i_sub == D_L1_8x8 );
}
-static ALWAYS_INLINE void x264_cabac_transform_size( x264_t *h, x264_cabac_t *cb )
+static ALWAYS_INLINE void cabac_transform_size( x264_t *h, x264_cabac_t *cb )
{
int ctx = 399 + h->mb.cache.i_neighbour_transform_size;
x264_cabac_encode_decision_noup( cb, ctx, h->mb.b_transform_8x8 );
}
-static ALWAYS_INLINE void x264_cabac_ref_internal( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int bframe )
+static ALWAYS_INLINE void cabac_ref_internal( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int bframe )
{
const int i8 = x264_scan8[idx];
const int i_refa = h->mb.cache.ref[i_list][i8 - 1];
x264_cabac_encode_decision( cb, 54 + ctx, 0 );
}
-static NOINLINE void x264_cabac_ref_p( x264_t *h, x264_cabac_t *cb, int idx )
+static NOINLINE void cabac_ref_p( x264_t *h, x264_cabac_t *cb, int idx )
{
- x264_cabac_ref_internal( h, cb, 0, idx, 0 );
+ cabac_ref_internal( h, cb, 0, idx, 0 );
}
-static NOINLINE void x264_cabac_ref_b( x264_t *h, x264_cabac_t *cb, int i_list, int idx )
+static NOINLINE void cabac_ref_b( x264_t *h, x264_cabac_t *cb, int i_list, int idx )
{
- x264_cabac_ref_internal( h, cb, i_list, idx, 1 );
+ cabac_ref_internal( h, cb, i_list, idx, 1 );
}
-static ALWAYS_INLINE int x264_cabac_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
+static ALWAYS_INLINE int cabac_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
{
int ctxbase = l ? 47 : 40;
return X264_MIN( i_abs, 66 );
}
-static NOINLINE uint16_t x264_cabac_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width )
+static NOINLINE uint16_t cabac_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width )
{
ALIGNED_4( int16_t mvp[2] );
int mdx, mdy;
h->mb.cache.mvd[i_list][x264_scan8[idx] - 8]);
/* encode */
- mdx = x264_cabac_mvd_cpn( h, cb, i_list, idx, 0, mdx, amvd&0xFF );
- mdy = x264_cabac_mvd_cpn( h, cb, i_list, idx, 1, mdy, amvd>>8 );
+ mdx = cabac_mvd_cpn( h, cb, i_list, idx, 0, mdx, amvd&0xFF );
+ mdy = cabac_mvd_cpn( h, cb, i_list, idx, 1, mdy, amvd>>8 );
return pack8to16(mdx,mdy);
}
-#define x264_cabac_mvd(h,cb,i_list,idx,width,height)\
+#define cabac_mvd(h,cb,i_list,idx,width,height)\
do\
{\
- uint16_t mvd = x264_cabac_mvd(h,cb,i_list,idx,width);\
+ uint16_t mvd = cabac_mvd(h,cb,i_list,idx,width);\
x264_macroblock_cache_mvd( h, block_idx_x[idx], block_idx_y[idx], width, height, i_list, mvd );\
} while( 0 )
-static inline void x264_cabac_8x8_mvd( x264_t *h, x264_cabac_t *cb, int i )
+static inline void cabac_8x8_mvd( x264_t *h, x264_cabac_t *cb, int i )
{
switch( h->mb.i_sub_partition[i] )
{
case D_L0_8x8:
- x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i, 2, 2 );
break;
case D_L0_8x4:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 2, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+2, 2, 1 );
+ cabac_mvd( h, cb, 0, 4*i+0, 2, 1 );
+ cabac_mvd( h, cb, 0, 4*i+2, 2, 1 );
break;
case D_L0_4x8:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 2 );
- x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 2 );
+ cabac_mvd( h, cb, 0, 4*i+0, 1, 2 );
+ cabac_mvd( h, cb, 0, 4*i+1, 1, 2 );
break;
case D_L0_4x4:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+2, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+3, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+0, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+1, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+2, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+3, 1, 1 );
break;
default:
assert(0);
}
}
-static ALWAYS_INLINE void x264_cabac_mb_header_i( x264_t *h, x264_cabac_t *cb, int i_mb_type, int slice_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_i( x264_t *h, x264_cabac_t *cb, int i_mb_type, int slice_type, int chroma )
{
if( slice_type == SLICE_TYPE_I )
{
if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != I_4x4 )
ctx++;
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 );
}
else if( slice_type == SLICE_TYPE_P )
{
x264_cabac_encode_decision_noup( cb, 14, 1 );
/* suffix */
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 );
}
else if( slice_type == SLICE_TYPE_B )
{
x264_cabac_encode_decision( cb, 27+5, 1 );
/* suffix */
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 );
}
if( i_mb_type == I_PCM )
if( i_mb_type != I_16x16 )
{
if( h->pps->b_transform_8x8_mode )
- x264_cabac_transform_size( h, cb );
+ cabac_transform_size( h, cb );
int di = h->mb.b_transform_8x8 ? 4 : 1;
for( int i = 0; i < 16; i += di )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, i );
const int i_mode = x264_mb_pred_mode4x4_fix( h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
}
}
if( chroma )
- x264_cabac_intra_chroma_pred_mode( h, cb );
+ cabac_intra_chroma_pred_mode( h, cb );
}
-static ALWAYS_INLINE void x264_cabac_mb_header_p( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_p( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
{
if( i_mb_type == P_L0 )
{
x264_cabac_encode_decision_noup( cb, 15, 0 );
x264_cabac_encode_decision_noup( cb, 16, 0 );
if( h->mb.pic.i_fref[0] > 1 )
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_mvd( h, cb, 0, 0, 4, 4 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_mvd( h, cb, 0, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
x264_cabac_encode_decision_noup( cb, 17, 1 );
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 8 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 8 );
}
- x264_cabac_mvd( h, cb, 0, 0, 4, 2 );
- x264_cabac_mvd( h, cb, 0, 8, 4, 2 );
+ cabac_mvd( h, cb, 0, 0, 4, 2 );
+ cabac_mvd( h, cb, 0, 8, 4, 2 );
}
else //if( h->mb.i_partition == D_8x16 )
{
x264_cabac_encode_decision_noup( cb, 17, 0 );
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 4 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 4 );
}
- x264_cabac_mvd( h, cb, 0, 0, 2, 4 );
- x264_cabac_mvd( h, cb, 0, 4, 2, 4 );
+ cabac_mvd( h, cb, 0, 0, 2, 4 );
+ cabac_mvd( h, cb, 0, 4, 2, 4 );
}
}
else if( i_mb_type == P_8x8 )
/* sub mb type */
for( int i = 0; i < 4; i++ )
- x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i] );
+ cabac_subpartition_p( cb, h->mb.i_sub_partition[i] );
/* ref 0 */
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 4 );
- x264_cabac_ref_p( h, cb, 8 );
- x264_cabac_ref_p( h, cb, 12 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 4 );
+ cabac_ref_p( h, cb, 8 );
+ cabac_ref_p( h, cb, 12 );
}
for( int i = 0; i < 4; i++ )
- x264_cabac_8x8_mvd( h, cb, i );
+ cabac_8x8_mvd( h, cb, i );
}
else /* intra */
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_P, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_P, chroma );
}
-static ALWAYS_INLINE void x264_cabac_mb_header_b( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_b( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
{
int ctx = 0;
if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != B_SKIP && h->mb.i_mb_type_left[0] != B_DIRECT )
/* sub mb type */
for( int i = 0; i < 4; i++ )
- x264_cabac_subpartition_b( cb, h->mb.i_sub_partition[i] );
+ cabac_subpartition_b( cb, h->mb.i_sub_partition[i] );
/* ref */
if( h->mb.pic.i_fref[0] > 1 )
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cabac_ref_b( h, cb, 0, 4*i );
+ cabac_ref_b( h, cb, 0, 4*i );
if( h->mb.pic.i_fref[1] > 1 )
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cabac_ref_b( h, cb, 1, 4*i );
+ cabac_ref_b( h, cb, 1, 4*i );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i, 2, 2 );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cabac_mvd( h, cb, 1, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 1, 4*i, 2, 2 );
}
else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI )
{
if( h->mb.pic.i_fref[0] > 1 )
{
if( b_list[0][0] )
- x264_cabac_ref_b( h, cb, 0, 0 );
+ cabac_ref_b( h, cb, 0, 0 );
if( b_list[0][1] && h->mb.i_partition != D_16x16 )
- x264_cabac_ref_b( h, cb, 0, 8 >> (h->mb.i_partition == D_8x16) );
+ cabac_ref_b( h, cb, 0, 8 >> (h->mb.i_partition == D_8x16) );
}
if( h->mb.pic.i_fref[1] > 1 )
{
if( b_list[1][0] )
- x264_cabac_ref_b( h, cb, 1, 0 );
+ cabac_ref_b( h, cb, 1, 0 );
if( b_list[1][1] && h->mb.i_partition != D_16x16 )
- x264_cabac_ref_b( h, cb, 1, 8 >> (h->mb.i_partition == D_8x16) );
+ cabac_ref_b( h, cb, 1, 8 >> (h->mb.i_partition == D_8x16) );
}
for( int i_list = 0; i_list < 2; i_list++ )
{
if( h->mb.i_partition == D_16x16 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 4 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 2 );
- if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 8, 4, 2 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 4, 2 );
+ if( b_list[i_list][1] ) cabac_mvd( h, cb, i_list, 8, 4, 2 );
}
else //if( h->mb.i_partition == D_8x16 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 2, 4 );
- if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 4, 2, 4 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 2, 4 );
+ if( b_list[i_list][1] ) cabac_mvd( h, cb, i_list, 4, 2, 4 );
}
}
}
else /* intra */
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_B, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_B, chroma );
}
-static int ALWAYS_INLINE x264_cabac_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx, int b_intra, int b_dc )
+static int ALWAYS_INLINE cabac_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx, int b_intra, int b_dc )
{
static const uint16_t base_ctx[14] = {85,89,93,97,101,1012,460,464,468,1016,472,476,480,1020};
};
#if !RDO_SKIP_BS
-static ALWAYS_INLINE void x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int chroma422dc )
+static ALWAYS_INLINE void cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int chroma422dc )
{
int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
int ctx_last = x264_last_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0 );
}
-static void ALWAYS_INLINE x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static void ALWAYS_INLINE cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_internal( l, MB_INTERLACED, ctx_block_cat, cb );
x264_cabac_block_residual_c( h, cb, ctx_block_cat, l );
#endif
}
-static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static void cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
/* Template a version specifically for chroma 4:2:2 DC in order to avoid
* slowing down everything else due to the added complexity. */
- x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 1 );
+ cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 1 );
}
-#define x264_cabac_block_residual_8x8( h, cb, cat, l ) x264_cabac_block_residual( h, cb, cat, l )
+#define cabac_block_residual_8x8( h, cb, cat, l ) cabac_block_residual( h, cb, cat, l )
#else
/* Faster RDO by merging sigmap and level coding. Note that for 8x8dct and chroma 4:2:2 dc this is
* slightly incorrect because the sigmap is not reversible (contexts are repeated). However, there
* is nearly no quality penalty for this (~0.001db) and the speed boost (~30%) is worth it. */
-static void ALWAYS_INLINE x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int b_8x8, int chroma422dc )
+static void ALWAYS_INLINE cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int b_8x8, int chroma422dc )
{
const uint8_t *sig_offset = x264_significant_coeff_flag_offset_8x8[MB_INTERLACED];
int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 1, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 1, 0 );
}
void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0, 0 );
}
-static ALWAYS_INLINE void x264_cabac_block_residual_8x8( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static ALWAYS_INLINE void cabac_block_residual_8x8( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_8x8_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb );
x264_cabac_block_residual_8x8_rd_c( h, cb, ctx_block_cat, l );
#endif
}
-static ALWAYS_INLINE void x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static ALWAYS_INLINE void cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb );
#endif
}
-static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static void cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 0, 1 );
+ cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 0, 1 );
}
#endif
-#define x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, b_dc, name )\
+#define cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, b_dc, name )\
do\
{\
- int ctxidxinc = x264_cabac_cbf_ctxidxinc( h, ctx_block_cat, i_idx, b_intra, b_dc );\
+ int ctxidxinc = cabac_cbf_ctxidxinc( h, ctx_block_cat, i_idx, b_intra, b_dc );\
if( h->mb.cache.non_zero_count[x264_scan8[i_idx]] )\
{\
x264_cabac_encode_decision( cb, ctxidxinc, 1 );\
- x264_cabac_block_residual##name( h, cb, ctx_block_cat, l );\
+ cabac_block_residual##name( h, cb, ctx_block_cat, l );\
}\
else\
x264_cabac_encode_decision( cb, ctxidxinc, 0 );\
} while( 0 )
-#define x264_cabac_block_residual_dc_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 1, )
+#define cabac_block_residual_dc_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 1, )
-#define x264_cabac_block_residual_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, )
+#define cabac_block_residual_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, )
-#define x264_cabac_block_residual_8x8_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, _8x8 )
+#define cabac_block_residual_8x8_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, _8x8 )
-#define x264_cabac_block_residual_422_dc_cbf( h, cb, ch, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, DCT_CHROMA_DC, CHROMA_DC+(ch), h->dct.chroma_dc[ch], b_intra, 1, _422_dc )
+#define cabac_block_residual_422_dc_cbf( h, cb, ch, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, DCT_CHROMA_DC, CHROMA_DC+(ch), h->dct.chroma_dc[ch], b_intra, 1, _422_dc )
-static ALWAYS_INLINE void x264_macroblock_write_cabac_internal( x264_t *h, x264_cabac_t *cb, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_write_cabac_internal( x264_t *h, x264_cabac_t *cb, int plane_count, int chroma )
{
const int i_mb_type = h->mb.i_type;
if( SLICE_MBAFF &&
(!(h->mb.i_mb_y & 1) || IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride])) )
{
- x264_cabac_field_decoding_flag( h, cb );
+ cabac_field_decoding_flag( h, cb );
}
#endif
if( h->sh.i_type == SLICE_TYPE_P )
- x264_cabac_mb_header_p( h, cb, i_mb_type, chroma );
+ cabac_mb_header_p( h, cb, i_mb_type, chroma );
else if( h->sh.i_type == SLICE_TYPE_B )
- x264_cabac_mb_header_b( h, cb, i_mb_type, chroma );
+ cabac_mb_header_b( h, cb, i_mb_type, chroma );
else //if( h->sh.i_type == SLICE_TYPE_I )
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_I, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_I, chroma );
#if !RDO_SKIP_BS
i_mb_pos_tex = x264_cabac_pos( cb );
if( i_mb_type != I_16x16 )
{
- x264_cabac_cbp_luma( h, cb );
+ cabac_cbp_luma( h, cb );
if( chroma )
- x264_cabac_cbp_chroma( h, cb );
+ cabac_cbp_chroma( h, cb );
}
if( x264_mb_transform_8x8_allowed( h ) && h->mb.i_cbp_luma )
{
- x264_cabac_transform_size( h, cb );
+ cabac_transform_size( h, cb );
}
if( h->mb.i_cbp_luma || (chroma && h->mb.i_cbp_chroma) || i_mb_type == I_16x16 )
{
const int b_intra = IS_INTRA( i_mb_type );
- x264_cabac_qp_delta( h, cb );
+ cabac_qp_delta( h, cb );
/* write residual */
if( i_mb_type == I_16x16 )
/* DC Luma */
for( int p = 0; p < plane_count; p++ )
{
- x264_cabac_block_residual_dc_cbf( h, cb, ctx_cat_plane[DCT_LUMA_DC][p], LUMA_DC+p, h->dct.luma16x16_dc[p], 1 );
+ cabac_block_residual_dc_cbf( h, cb, ctx_cat_plane[DCT_LUMA_DC][p], LUMA_DC+p, h->dct.luma16x16_dc[p], 1 );
/* AC Luma */
if( h->mb.i_cbp_luma )
for( int i = p*16; i < p*16+16; i++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_AC][p], i, h->dct.luma4x4[i]+1, 1 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_AC][p], i, h->dct.luma4x4[i]+1, 1 );
}
}
else if( h->mb.b_transform_8x8 )
for( int p = 0; p < 3; p++ )
FOREACH_BIT( i, 0, h->mb.i_cbp_luma )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i*4+p*16, h->dct.luma8x8[i+p*4], b_intra );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i*4+p*16, h->dct.luma8x8[i+p*4], b_intra );
MUNGE_8x8_NNZ( RESTORE )
}
else
{
FOREACH_BIT( i, 0, h->mb.i_cbp_luma )
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i] );
}
}
else
for( int p = 0; p < plane_count; p++ )
FOREACH_BIT( i8x8, 0, h->mb.i_cbp_luma )
for( int i = 0; i < 4; i++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i+i8x8*4+p*16, h->dct.luma4x4[i+i8x8*4+p*16], b_intra );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i+i8x8*4+p*16, h->dct.luma4x4[i+i8x8*4+p*16], b_intra );
}
if( chroma && h->mb.i_cbp_chroma ) /* Chroma DC residual present */
{
if( CHROMA_FORMAT == CHROMA_422 )
{
- x264_cabac_block_residual_422_dc_cbf( h, cb, 0, b_intra );
- x264_cabac_block_residual_422_dc_cbf( h, cb, 1, b_intra );
+ cabac_block_residual_422_dc_cbf( h, cb, 0, b_intra );
+ cabac_block_residual_422_dc_cbf( h, cb, 1, b_intra );
}
else
{
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], b_intra );
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], b_intra );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], b_intra );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], b_intra );
}
if( h->mb.i_cbp_chroma == 2 ) /* Chroma AC residual present */
int step = 8 << CHROMA_V_SHIFT;
for( int i = 16; i < 3*16; i += step )
for( int j = i; j < i+4; j++ )
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra );
}
}
}
void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
{
if( CHROMA444 )
- x264_macroblock_write_cabac_internal( h, cb, 3, 0 );
+ macroblock_write_cabac_internal( h, cb, 3, 0 );
else
- x264_macroblock_write_cabac_internal( h, cb, 1, 1 );
+ macroblock_write_cabac_internal( h, cb, 1, 1 );
}
#if RDO_SKIP_BS
* only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
* works on all partition sizes except 16x16
*****************************************************************************/
-static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel )
+static void partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel )
{
const int i_mb_type = h->mb.i_type;
int b_8x16 = h->mb.i_partition == D_8x16;
if( i_mb_type == P_8x8 )
{
- x264_cabac_8x8_mvd( h, cb, i8 );
- x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i8] );
+ cabac_8x8_mvd( h, cb, i8 );
+ cabac_subpartition_p( cb, h->mb.i_sub_partition[i8] );
}
else if( i_mb_type == P_L0 )
- x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
else if( i_mb_type > B_DIRECT && i_mb_type < B_8x8 )
{
- if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
- if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) x264_cabac_mvd( h, cb, 1, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) cabac_mvd( h, cb, 1, 4*i8, 4>>b_8x16, 2<<b_8x16 );
}
else //if( i_mb_type == B_8x8 )
{
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] )
- x264_cabac_mvd( h, cb, 0, 4*i8, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i8, 2, 2 );
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] )
- x264_cabac_mvd( h, cb, 1, 4*i8, 2, 2 );
+ cabac_mvd( h, cb, 1, 4*i8, 2, 2 );
}
for( int j = (i_pixel < PIXEL_8x8); j >= 0; j-- )
{
if( CHROMA444 )
for( int p = 0; p < 3; p++ )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 0 );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 0 );
else
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
}
else
for( int p = 0; p < plane_count; p++ )
for( int i4 = 0; i4 < 4; i4++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16], 0 );
}
if( h->mb.i_cbp_chroma )
if( CHROMA_FORMAT == CHROMA_422 )
{
int offset = (5*i8) & 0x09;
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1, 0 );
}
else
{
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1, 0 );
}
}
}
}
-static void x264_subpartition_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_pixel )
+static void subpartition_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_pixel )
{
int b_8x4 = i_pixel == PIXEL_8x4;
int plane_count = CHROMA444 ? 3 : 1;
if( i_pixel == PIXEL_4x4 )
- x264_cabac_mvd( h, cb, 0, i4, 1, 1 );
+ cabac_mvd( h, cb, 0, i4, 1, 1 );
else
- x264_cabac_mvd( h, cb, 0, i4, 1+b_8x4, 2-b_8x4 );
+ cabac_mvd( h, cb, 0, i4, 1+b_8x4, 2-b_8x4 );
for( int p = 0; p < plane_count; p++ )
{
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4, h->dct.luma4x4[p*16+i4], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4, h->dct.luma4x4[p*16+i4], 0 );
if( i_pixel != PIXEL_4x4 )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4], 0 );
}
}
-static void x264_partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode )
+static void partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, 4*i8 );
i_mode = x264_mb_pred_mode4x4_fix( i_mode );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
- x264_cabac_cbp_luma( h, cb );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_cbp_luma( h, cb );
if( h->mb.i_cbp_luma & (1 << i8) )
{
if( CHROMA444 )
for( int p = 0; p < 3; p++ )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 1 );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 1 );
else
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
}
}
-static void x264_partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode )
+static void partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, i4 );
int plane_count = CHROMA444 ? 3 : 1;
i_mode = x264_mb_pred_mode4x4_fix( i_mode );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
for( int p = 0; p < plane_count; p++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+p*16, h->dct.luma4x4[i4+p*16], 1 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+p*16, h->dct.luma4x4[i4+p*16], 1 );
}
-static void x264_chroma_size_cabac( x264_t *h, x264_cabac_t *cb )
+static void chroma_size_cabac( x264_t *h, x264_cabac_t *cb )
{
- x264_cabac_intra_chroma_pred_mode( h, cb );
- x264_cabac_cbp_chroma( h, cb );
+ cabac_intra_chroma_pred_mode( h, cb );
+ cabac_cbp_chroma( h, cb );
if( h->mb.i_cbp_chroma )
{
if( CHROMA_FORMAT == CHROMA_422 )
{
- x264_cabac_block_residual_422_dc_cbf( h, cb, 0, 1 );
- x264_cabac_block_residual_422_dc_cbf( h, cb, 1, 1 );
+ cabac_block_residual_422_dc_cbf( h, cb, 0, 1 );
+ cabac_block_residual_422_dc_cbf( h, cb, 1, 1 );
}
else
{
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], 1 );
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], 1 );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], 1 );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], 1 );
}
if( h->mb.i_cbp_chroma == 2 )
int step = 8 << CHROMA_V_SHIFT;
for( int i = 16; i < 3*16; i += step )
for( int j = i; j < i+4; j++ )
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 );
}
}
}
/****************************************************************************
* x264_cavlc_block_residual:
****************************************************************************/
-static inline int x264_cavlc_block_residual_escape( x264_t *h, int i_suffix_length, int level )
+static inline int cavlc_block_residual_escape( x264_t *h, int i_suffix_length, int level )
{
bs_t *s = &h->out.bs;
static const uint16_t next_suffix[7] = { 0, 3, 6, 12, 24, 48, 0xffff };
return i_suffix_length;
}
-static int x264_cavlc_block_residual_internal( x264_t *h, int ctx_block_cat, dctcoef *l, int nC )
+static int cavlc_block_residual_internal( x264_t *h, int ctx_block_cat, dctcoef *l, int nC )
{
bs_t *s = &h->out.bs;
static const uint8_t ctz_index[8] = {3,0,1,0,2,0,1,0};
i_suffix_length = x264_level_token[i_suffix_length][val_original].i_next;
}
else
- i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
+ i_suffix_length = cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
for( int i = i_trailing+1; i < i_total; i++ )
{
val = runlevel.level[i] + LEVEL_TABLE_SIZE/2;
i_suffix_length = x264_level_token[i_suffix_length][val].i_next;
}
else
- i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
+ i_suffix_length = cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
}
}
if( !*nnz )\
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );\
else\
- *nnz = x264_cavlc_block_residual_internal(h,cat,l,nC);\
+ *nnz = cavlc_block_residual_internal(h,cat,l,nC);\
}
-static void x264_cavlc_qp_delta( x264_t *h )
+static void cavlc_qp_delta( x264_t *h )
{
bs_t *s = &h->out.bs;
int i_dqp = h->mb.i_qp - h->mb.i_last_qp;
bs_write_se( s, i_dqp );
}
-static void x264_cavlc_mvd( x264_t *h, int i_list, int idx, int width )
+static void cavlc_mvd( x264_t *h, int i_list, int idx, int width )
{
bs_t *s = &h->out.bs;
ALIGNED_4( int16_t mvp[2] );
bs_write_se( s, h->mb.cache.mv[i_list][x264_scan8[idx]][1] - mvp[1] );
}
-static inline void x264_cavlc_8x8_mvd( x264_t *h, int i )
+static inline void cavlc_8x8_mvd( x264_t *h, int i )
{
switch( h->mb.i_sub_partition[i] )
{
case D_L0_8x8:
- x264_cavlc_mvd( h, 0, 4*i, 2 );
+ cavlc_mvd( h, 0, 4*i, 2 );
break;
case D_L0_8x4:
- x264_cavlc_mvd( h, 0, 4*i+0, 2 );
- x264_cavlc_mvd( h, 0, 4*i+2, 2 );
+ cavlc_mvd( h, 0, 4*i+0, 2 );
+ cavlc_mvd( h, 0, 4*i+2, 2 );
break;
case D_L0_4x8:
- x264_cavlc_mvd( h, 0, 4*i+0, 1 );
- x264_cavlc_mvd( h, 0, 4*i+1, 1 );
+ cavlc_mvd( h, 0, 4*i+0, 1 );
+ cavlc_mvd( h, 0, 4*i+1, 1 );
break;
case D_L0_4x4:
- x264_cavlc_mvd( h, 0, 4*i+0, 1 );
- x264_cavlc_mvd( h, 0, 4*i+1, 1 );
- x264_cavlc_mvd( h, 0, 4*i+2, 1 );
- x264_cavlc_mvd( h, 0, 4*i+3, 1 );
+ cavlc_mvd( h, 0, 4*i+0, 1 );
+ cavlc_mvd( h, 0, 4*i+1, 1 );
+ cavlc_mvd( h, 0, 4*i+2, 1 );
+ cavlc_mvd( h, 0, 4*i+3, 1 );
break;
}
}
-static ALWAYS_INLINE void x264_cavlc_macroblock_luma_residual( x264_t *h, int plane_count )
+static ALWAYS_INLINE void cavlc_macroblock_luma_residual( x264_t *h, int plane_count )
{
if( h->mb.b_transform_8x8 )
{
}
#if RDO_SKIP_BS
-static ALWAYS_INLINE void x264_cavlc_partition_luma_residual( x264_t *h, int i8, int p )
+static ALWAYS_INLINE void cavlc_partition_luma_residual( x264_t *h, int i8, int p )
{
if( h->mb.b_transform_8x8 && h->mb.cache.non_zero_count[x264_scan8[i8*4]] )
h->zigzagf.interleave_8x8_cavlc( h->dct.luma4x4[i8*4+p*16], h->dct.luma8x8[i8+p*4],
}
#endif
-static void x264_cavlc_mb_header_i( x264_t *h, int i_mb_type, int i_mb_i_offset, int chroma )
+static void cavlc_mb_header_i( x264_t *h, int i_mb_type, int i_mb_i_offset, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == I_16x16 )
bs_write_ue( s, x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] );
}
-static ALWAYS_INLINE void x264_cavlc_mb_header_p( x264_t *h, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cavlc_mb_header_p( x264_t *h, int i_mb_type, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == P_L0 )
if( h->mb.pic.i_fref[0] > 1 )
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
- x264_cavlc_mvd( h, 0, 0, 4 );
+ cavlc_mvd( h, 0, 0, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[8]] );
}
- x264_cavlc_mvd( h, 0, 0, 4 );
- x264_cavlc_mvd( h, 0, 8, 4 );
+ cavlc_mvd( h, 0, 0, 4 );
+ cavlc_mvd( h, 0, 8, 4 );
}
else if( h->mb.i_partition == D_8x16 )
{
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[4]] );
}
- x264_cavlc_mvd( h, 0, 0, 2 );
- x264_cavlc_mvd( h, 0, 4, 2 );
+ cavlc_mvd( h, 0, 0, 2 );
+ cavlc_mvd( h, 0, 4, 2 );
}
}
else if( i_mb_type == P_8x8 )
}
for( int i = 0; i < 4; i++ )
- x264_cavlc_8x8_mvd( h, i );
+ cavlc_8x8_mvd( h, i );
}
else //if( IS_INTRA( i_mb_type ) )
- x264_cavlc_mb_header_i( h, i_mb_type, 5, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 5, chroma );
}
-static ALWAYS_INLINE void x264_cavlc_mb_header_b( x264_t *h, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cavlc_mb_header_b( x264_t *h, int i_mb_type, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == B_8x8 )
/* mvd */
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cavlc_mvd( h, 0, 4*i, 2 );
+ cavlc_mvd( h, 0, 4*i, 2 );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cavlc_mvd( h, 1, 4*i, 2 );
+ cavlc_mvd( h, 1, 4*i, 2 );
}
else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI )
{
{
if( i_ref0_max && b_list[0][0] ) bs_write_te( s, i_ref0_max, h->mb.cache.ref[0][x264_scan8[0]] );
if( i_ref1_max && b_list[1][0] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[0]] );
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 4 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 4 );
}
else
{
if( i_ref1_max && b_list[1][1] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[12]] );
if( h->mb.i_partition == D_16x8 )
{
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 );
- if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 8, 4 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 );
- if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 8, 4 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 4 );
+ if( b_list[0][1] ) cavlc_mvd( h, 0, 8, 4 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 4 );
+ if( b_list[1][1] ) cavlc_mvd( h, 1, 8, 4 );
}
else //if( h->mb.i_partition == D_8x16 )
{
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 2 );
- if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 4, 2 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 2 );
- if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 4, 2 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 2 );
+ if( b_list[0][1] ) cavlc_mvd( h, 0, 4, 2 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 2 );
+ if( b_list[1][1] ) cavlc_mvd( h, 1, 4, 2 );
}
}
}
else if( i_mb_type == B_DIRECT )
bs_write1( s, 1 );
else //if( IS_INTRA( i_mb_type ) )
- x264_cavlc_mb_header_i( h, i_mb_type, 23, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 23, chroma );
}
/*****************************************************************************
#endif
if( h->sh.i_type == SLICE_TYPE_P )
- x264_cavlc_mb_header_p( h, i_mb_type, chroma );
+ cavlc_mb_header_p( h, i_mb_type, chroma );
else if( h->sh.i_type == SLICE_TYPE_B )
- x264_cavlc_mb_header_b( h, i_mb_type, chroma );
+ cavlc_mb_header_b( h, i_mb_type, chroma );
else //if( h->sh.i_type == SLICE_TYPE_I )
- x264_cavlc_mb_header_i( h, i_mb_type, 0, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 0, chroma );
#if !RDO_SKIP_BS
i_mb_pos_tex = bs_pos( s );
if( i_mb_type == I_16x16 )
{
- x264_cavlc_qp_delta( h );
+ cavlc_qp_delta( h );
/* DC Luma */
for( int p = 0; p < plane_count; p++ )
}
else if( h->mb.i_cbp_luma | h->mb.i_cbp_chroma )
{
- x264_cavlc_qp_delta( h );
- x264_cavlc_macroblock_luma_residual( h, plane_count );
+ cavlc_qp_delta( h );
+ cavlc_macroblock_luma_residual( h, plane_count );
}
if( h->mb.i_cbp_chroma )
{
* only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
* works on all partition sizes except 16x16
*****************************************************************************/
-static int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel )
+static int partition_size_cavlc( x264_t *h, int i8, int i_pixel )
{
bs_t *s = &h->out.bs;
const int i_mb_type = h->mb.i_type;
if( i_mb_type == P_8x8 )
{
- x264_cavlc_8x8_mvd( h, i8 );
+ cavlc_8x8_mvd( h, i8 );
bs_write_ue( s, subpartition_p_to_golomb[ h->mb.i_sub_partition[i8] ] );
}
else if( i_mb_type == P_L0 )
- x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
+ cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
else if( i_mb_type > B_DIRECT && i_mb_type < B_8x8 )
{
- if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
- if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) x264_cavlc_mvd( h, 1, 4*i8, 4>>b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) cavlc_mvd( h, 1, 4*i8, 4>>b_8x16 );
}
else //if( i_mb_type == B_8x8 )
{
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] )
- x264_cavlc_mvd( h, 0, 4*i8, 2 );
+ cavlc_mvd( h, 0, 4*i8, 2 );
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] )
- x264_cavlc_mvd( h, 1, 4*i8, 2 );
+ cavlc_mvd( h, 1, 4*i8, 2 );
}
for( j = (i_pixel < PIXEL_8x8); j >= 0; j-- )
{
for( int p = 0; p < plane_count; p++ )
- x264_cavlc_partition_luma_residual( h, i8, p );
+ cavlc_partition_luma_residual( h, i8, p );
if( h->mb.i_cbp_chroma )
{
if( CHROMA_FORMAT == CHROMA_422 )
return h->out.bs.i_bits_encoded;
}
-static int x264_subpartition_size_cavlc( x264_t *h, int i4, int i_pixel )
+static int subpartition_size_cavlc( x264_t *h, int i4, int i_pixel )
{
int plane_count = CHROMA444 ? 3 : 1;
int b_8x4 = i_pixel == PIXEL_8x4;
h->out.bs.i_bits_encoded = 0;
- x264_cavlc_mvd( h, 0, i4, 1+b_8x4 );
+ cavlc_mvd( h, 0, i4, 1+b_8x4 );
for( int p = 0; p < plane_count; p++ )
{
x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] );
return h->out.bs.i_bits_encoded;
}
-static int x264_cavlc_intra4x4_pred_size( x264_t *h, int i4, int i_mode )
+static int cavlc_intra4x4_pred_size( x264_t *h, int i4, int i_mode )
{
if( x264_mb_predict_intra4x4_mode( h, i4 ) == x264_mb_pred_mode4x4_fix( i_mode ) )
return 1;
return 4;
}
-static int x264_partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
+static int partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
{
int plane_count = CHROMA444 ? 3 : 1;
- h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, 4*i8, i_mode );
+ h->out.bs.i_bits_encoded = cavlc_intra4x4_pred_size( h, 4*i8, i_mode );
bs_write_ue( &h->out.bs, cbp_to_golomb[!CHROMA444][1][(h->mb.i_cbp_chroma << 4)|h->mb.i_cbp_luma] );
for( int p = 0; p < plane_count; p++ )
- x264_cavlc_partition_luma_residual( h, i8, p );
+ cavlc_partition_luma_residual( h, i8, p );
return h->out.bs.i_bits_encoded;
}
-static int x264_partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode )
+static int partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode )
{
int plane_count = CHROMA444 ? 3 : 1;
- h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, i4, i_mode );
+ h->out.bs.i_bits_encoded = cavlc_intra4x4_pred_size( h, i4, i_mode );
for( int p = 0; p < plane_count; p++ )
x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] );
return h->out.bs.i_bits_encoded;
}
-static int x264_chroma_size_cavlc( x264_t *h )
+static int chroma_size_cavlc( x264_t *h )
{
h->out.bs.i_bits_encoded = bs_size_ue( x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] );
if( h->mb.i_cbp_chroma )
#define bs_write_ue bs_write_ue_big
-static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
- x264_nal_t **pp_nal, int *pi_nal,
- x264_picture_t *pic_out );
+static int encoder_frame_end( x264_t *h, x264_t *thread_current,
+ x264_nal_t **pp_nal, int *pi_nal,
+ x264_picture_t *pic_out );
/****************************************************************************
*
******************************* x264 libs **********************************
*
****************************************************************************/
-static double x264_psnr( double sqe, double size )
+static double calc_psnr( double sqe, double size )
{
double mse = sqe / (PIXEL_MAX*PIXEL_MAX * size);
if( mse <= 0.0000000001 ) /* Max 100dB */
return -10.0 * log10( mse );
}
-static double x264_ssim( double ssim )
+static double calc_ssim_db( double ssim )
{
double inv_ssim = 1 - ssim;
if( inv_ssim <= 0.0000000001 ) /* Max 100dB */
return -10.0 * log10( inv_ssim );
}
-static int x264_threadpool_wait_all( x264_t *h )
+static int threadpool_wait_all( x264_t *h )
{
for( int i = 0; i < h->param.i_threads; i++ )
if( h->thread[i]->b_thread_active )
return 0;
}
-static void x264_frame_dump( x264_t *h )
+static void frame_dump( x264_t *h )
{
FILE *f = x264_fopen( h->param.psz_dump_yuv, "r+b" );
if( !f )
/* Wait for the threads to finish deblocking */
if( h->param.b_sliced_threads )
- x264_threadpool_wait_all( h );
+ threadpool_wait_all( h );
/* Write the frame in display order */
int frame_size = FRAME_SIZE( h->param.i_height * h->param.i_width * sizeof(pixel) );
}
/* Fill "default" values */
-static void x264_slice_header_init( x264_t *h, x264_slice_header_t *sh,
- x264_sps_t *sps, x264_pps_t *pps,
- int i_idr_pic_id, int i_frame, int i_qp )
+static void slice_header_init( x264_t *h, x264_slice_header_t *sh,
+ x264_sps_t *sps, x264_pps_t *pps,
+ int i_idr_pic_id, int i_frame, int i_qp )
{
x264_param_t *param = &h->param;
sh->i_beta_offset = param->i_deblocking_filter_beta << 1;
}
-static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal_ref_idc )
+static void slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal_ref_idc )
{
if( sh->b_mbaff )
{
/* If we are within a reasonable distance of the end of the memory allocated for the bitstream, */
/* reallocate, adding an arbitrary amount of space. */
-static int x264_bitstream_check_buffer_internal( x264_t *h, int size, int b_cabac, int i_nal )
+static int bitstream_check_buffer_internal( x264_t *h, int size, int b_cabac, int i_nal )
{
if( (b_cabac && (h->cabac.p_end - h->cabac.p < size)) ||
(h->out.bs.p_end - h->out.bs.p < size) )
return 0;
}
-static int x264_bitstream_check_buffer( x264_t *h )
+static int bitstream_check_buffer( x264_t *h )
{
int max_row_size = (2500 << SLICE_MBAFF) * h->mb.i_mb_width;
- return x264_bitstream_check_buffer_internal( h, max_row_size, h->param.b_cabac, h->out.i_nal );
+ return bitstream_check_buffer_internal( h, max_row_size, h->param.b_cabac, h->out.i_nal );
}
-static int x264_bitstream_check_buffer_filler( x264_t *h, int filler )
+static int bitstream_check_buffer_filler( x264_t *h, int filler )
{
filler += 32; // add padding for safety
- return x264_bitstream_check_buffer_internal( h, filler, 0, -1 );
+ return bitstream_check_buffer_internal( h, filler, 0, -1 );
}
#if HAVE_THREAD
-static void x264_encoder_thread_init( x264_t *h )
+static void encoder_thread_init( x264_t *h )
{
if( h->param.i_sync_lookahead )
x264_lower_thread_priority( 10 );
*
****************************************************************************/
-static int x264_validate_parameters( x264_t *h, int b_open )
+static int validate_parameters( x264_t *h, int b_open )
{
if( !h->param.pf_log )
{
}
}
-static void x264_set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
+static void set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
{
/* VUI */
if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 )
goto fail;
}
- if( x264_validate_parameters( h, 1 ) < 0 )
+ if( validate_parameters( h, 1 ) < 0 )
goto fail;
if( h->param.psz_cqm_file )
goto fail;
}
- x264_set_aspect_ratio( h, &h->param, 1 );
+ set_aspect_ratio( h, &h->param, 1 );
x264_sps_init( h->sps, h->param.i_sps_id, &h->param );
x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps );
CHECKED_MALLOC( h->reconfig_h, sizeof(x264_t) );
if( h->param.i_threads > 1 &&
- x264_threadpool_init( &h->threadpool, h->param.i_threads, (void*)x264_encoder_thread_init, h ) )
+ x264_threadpool_init( &h->threadpool, h->param.i_threads, (void*)encoder_thread_init, h ) )
goto fail;
if( h->param.i_lookahead_threads > 1 &&
x264_threadpool_init( &h->lookaheadpool, h->param.i_lookahead_threads, NULL, NULL ) )
}
/****************************************************************************/
-static int x264_encoder_try_reconfig( x264_t *h, x264_param_t *param, int *rc_reconfig )
+static int encoder_try_reconfig( x264_t *h, x264_param_t *param, int *rc_reconfig )
{
*rc_reconfig = 0;
- x264_set_aspect_ratio( h, param, 0 );
+ set_aspect_ratio( h, param, 0 );
#define COPY(var) h->param.var = param->var
COPY( i_frame_reference ); // but never uses more refs than initially specified
COPY( i_bframe_bias );
COPY( rc.f_rf_constant_max );
#undef COPY
- return x264_validate_parameters( h, 0 );
+ return validate_parameters( h, 0 );
}
int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param )
{
int rc_reconfig;
- int ret = x264_encoder_try_reconfig( h, param, &rc_reconfig );
+ int ret = encoder_try_reconfig( h, param, &rc_reconfig );
mbcmp_init( h );
if( !ret )
h->reconfig_h->param = h->param;
int rc_reconfig;
- int ret = x264_encoder_try_reconfig( h->reconfig_h, param, &rc_reconfig );
+ int ret = encoder_try_reconfig( h->reconfig_h, param, &rc_reconfig );
if( !ret )
h->reconfig = 1;
else
}
/* internal usage */
-static void x264_nal_start( x264_t *h, int i_type, int i_ref_idc )
+static void nal_start( x264_t *h, int i_type, int i_ref_idc )
{
x264_nal_t *nal = &h->out.nal[h->out.i_nal];
}
/* if number of allocated nals is not enough, re-allocate a larger one. */
-static int x264_nal_check_buffer( x264_t *h )
+static int nal_check_buffer( x264_t *h )
{
if( h->out.i_nal >= h->out.i_nals_allocated )
{
return 0;
}
-static int x264_nal_end( x264_t *h )
+static int nal_end( x264_t *h )
{
x264_nal_t *nal = &h->out.nal[h->out.i_nal];
uint8_t *end = &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8];
h->param.nalu_process( h, nal, h->fenc->opaque );
h->out.i_nal++;
- return x264_nal_check_buffer( h );
+ return nal_check_buffer( h );
}
-static int x264_check_encapsulated_buffer( x264_t *h, x264_t *h0, int start,
- int previous_nal_size, int necessary_size )
+static int check_encapsulated_buffer( x264_t *h, x264_t *h0, int start,
+ int previous_nal_size, int necessary_size )
{
if( h0->nal_buffer_size < necessary_size )
{
return 0;
}
-static int x264_encoder_encapsulate_nals( x264_t *h, int start )
+static int encoder_encapsulate_nals( x264_t *h, int start )
{
x264_t *h0 = h->thread[0];
int nal_size = 0, previous_nal_size = 0;
int necessary_size = previous_nal_size + nal_size * 3/2 + h->out.i_nal * 4 + 4 + 64;
for( int i = start; i < h->out.i_nal; i++ )
necessary_size += h->out.nal[i].i_padding;
- if( x264_check_encapsulated_buffer( h, h0, start, previous_nal_size, necessary_size ) )
+ if( check_encapsulated_buffer( h, h0, start, previous_nal_size, necessary_size ) )
return -1;
uint8_t *nal_buffer = h0->nal_buffer + previous_nal_size;
/* Write SEI, SPS and PPS. */
/* generate sequence parameters */
- x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* generate picture parameters */
- x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
x264_pps_write( &h->out.bs, h->sps, h->pps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* identify ourselves */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_version_write( h, &h->out.bs ) )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
- frame_size = x264_encoder_encapsulate_nals( h, 0 );
+ frame_size = encoder_encapsulate_nals( h, 0 );
if( frame_size < 0 )
return -1;
/* Check to see whether we have chosen a reference list ordering different
* from the standard's default. */
-static inline void x264_reference_check_reorder( x264_t *h )
+static inline void reference_check_reorder( x264_t *h )
{
/* The reorder check doesn't check for missing frames, so just
* force a reorder if one of the reference list is corrupt. */
}
/* return -1 on failure, else return the index of the new reference frame */
-static int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w )
+static int weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w )
{
int i = h->i_ref[0];
int j = 1;
return j;
}
-static void x264_weighted_pred_init( x264_t *h )
+static void weighted_pred_init( x264_t *h )
{
/* for now no analysis and set all weights to nothing */
for( int i_ref = 0; i_ref < h->i_ref[0]; i_ref++ )
h->sh.weight[0][2].i_denom = h->sh.weight[0][1].i_denom;
}
-static inline int x264_reference_distance( x264_t *h, x264_frame_t *frame )
+static inline int reference_distance( x264_t *h, x264_frame_t *frame )
{
if( h->param.i_frame_packing == 5 )
return abs((h->fenc->i_frame&~1) - (frame->i_frame&~1)) +
return abs(h->fenc->i_frame - frame->i_frame);
}
-static inline void x264_reference_build_list( x264_t *h, int i_poc )
+static inline void reference_build_list( x264_t *h, int i_poc )
{
int b_ok;
if( list ? h->fref[list][i+1]->i_poc < h->fref_nearest[list]->i_poc
: h->fref[list][i+1]->i_poc > h->fref_nearest[list]->i_poc )
h->fref_nearest[list] = h->fref[list][i+1];
- if( x264_reference_distance( h, h->fref[list][i] ) > x264_reference_distance( h, h->fref[list][i+1] ) )
+ if( reference_distance( h, h->fref[list][i] ) > reference_distance( h, h->fref[list][i+1] ) )
{
XCHG( x264_frame_t*, h->fref[list][i], h->fref[list][i+1] );
b_ok = 0;
} while( !b_ok );
}
- x264_reference_check_reorder( h );
+ reference_check_reorder( h );
h->i_ref[1] = X264_MIN( h->i_ref[1], h->frames.i_max_ref1 );
h->i_ref[0] = X264_MIN( h->i_ref[0], h->frames.i_max_ref0 );
{
h->fenc->weight[0][0].i_denom = 0;
SET_WEIGHT( w[0], 1, 1, 0, -1 );
- idx = x264_weighted_reference_duplicate( h, 0, w );
+ idx = weighted_reference_duplicate( h, 0, w );
}
else
{
{
SET_WEIGHT( h->fenc->weight[0][0], 1, 1, 0, h->fenc->weight[0][0].i_offset );
}
- x264_weighted_reference_duplicate( h, 0, x264_weight_none );
+ weighted_reference_duplicate( h, 0, x264_weight_none );
if( h->fenc->weight[0][0].i_offset > -128 )
{
w[0] = h->fenc->weight[0][0];
w[0].i_offset--;
h->mc.weight_cache( h, &w[0] );
- idx = x264_weighted_reference_duplicate( h, 0, w );
+ idx = weighted_reference_duplicate( h, 0, w );
}
}
}
h->mb.pic.i_fref[1] = h->i_ref[1];
}
-static void x264_fdec_filter_row( x264_t *h, int mb_y, int pass )
+static void fdec_filter_row( x264_t *h, int mb_y, int pass )
{
/* mb_y is the mb to be encoded next, not the mb to be filtered here */
int b_hpel = h->fdec->b_kept_as_ref;
}
}
-static inline int x264_reference_update( x264_t *h )
+static inline int reference_update( x264_t *h )
{
if( !h->fdec->b_kept_as_ref )
{
return 0;
}
-static inline void x264_reference_reset( x264_t *h )
+static inline void reference_reset( x264_t *h )
{
while( h->frames.reference[0] )
x264_frame_push_unused( h, x264_frame_pop( h->frames.reference ) );
h->fenc->i_poc = 0;
}
-static inline void x264_reference_hierarchy_reset( x264_t *h )
+static inline void reference_hierarchy_reset( x264_t *h )
{
int ref;
int b_hasdelayframe = 0;
h->sh.i_mmco_remove_from_end = X264_MAX( ref + 2 - h->frames.i_max_dpb, 0 );
}
-static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_global_qp )
+static inline void slice_init( x264_t *h, int i_nal_type, int i_global_qp )
{
/* ------------------------ Create slice header ----------------------- */
if( i_nal_type == NAL_SLICE_IDR )
{
- x264_slice_header_init( h, &h->sh, h->sps, h->pps, h->i_idr_pic_id, h->i_frame_num, i_global_qp );
+ slice_header_init( h, &h->sh, h->sps, h->pps, h->i_idr_pic_id, h->i_frame_num, i_global_qp );
/* alternate id */
if( h->param.i_avcintra_class )
}
else
{
- x264_slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp );
+ slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp );
h->sh.i_num_ref_idx_l0_active = h->i_ref[0] <= 0 ? 1 : h->i_ref[0];
h->sh.i_num_ref_idx_l1_active = h->i_ref[1] <= 0 ? 1 : h->i_ref[1];
int field_decoding_flag;
} x264_bs_bak_t;
-static ALWAYS_INLINE void x264_bitstream_backup( x264_t *h, x264_bs_bak_t *bak, int i_skip, int full )
+static ALWAYS_INLINE void bitstream_backup( x264_t *h, x264_bs_bak_t *bak, int i_skip, int full )
{
if( full )
{
}
}
-static ALWAYS_INLINE void x264_bitstream_restore( x264_t *h, x264_bs_bak_t *bak, int *skip, int full )
+static ALWAYS_INLINE void bitstream_restore( x264_t *h, x264_bs_bak_t *bak, int *skip, int full )
{
if( full )
{
}
}
-static intptr_t x264_slice_write( x264_t *h )
+static intptr_t slice_write( x264_t *h )
{
int i_skip;
int mb_xy, i_mb_x, i_mb_y;
bs_realign( &h->out.bs );
/* Slice */
- x264_nal_start( h, h->i_nal_type, h->i_nal_ref_idc );
+ nal_start( h, h->i_nal_type, h->i_nal_ref_idc );
h->out.nal[h->out.i_nal].i_first_mb = h->sh.i_first_mb;
/* Slice header */
h->sh.i_qp = SPEC_QP( h->sh.i_qp );
h->sh.i_qp_delta = h->sh.i_qp - h->pps->i_pic_init_qp;
- x264_slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );
+ slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );
if( h->param.b_cabac )
{
/* alignment needed */
if( i_mb_x == 0 )
{
- if( x264_bitstream_check_buffer( h ) )
+ if( bitstream_check_buffer( h ) )
return -1;
if( !(i_mb_y & SLICE_MBAFF) && h->param.rc.i_vbv_buffer_size )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_ROW_VBV], i_skip, 1 );
+ bitstream_backup( h, &bs_bak[BS_BAK_ROW_VBV], i_skip, 1 );
if( !h->mb.b_reencode_mb )
- x264_fdec_filter_row( h, i_mb_y, 0 );
+ fdec_filter_row( h, i_mb_y, 0 );
}
if( back_up_bitstream )
{
if( back_up_bitstream_cavlc )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], i_skip, 0 );
if( slice_max_size && !(i_mb_y & SLICE_MBAFF) )
{
- x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], i_skip, 0 );
if( (thread_last_mb+1-mb_xy) == h->param.i_slice_min_mbs )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], i_skip, 0 );
}
}
h->mb.i_skip_intra = 0;
h->mb.b_skip_mc = 0;
h->mb.b_overflow = 0;
- x264_bitstream_restore( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], &i_skip, 0 );
goto reencode;
}
}
slice_max_size = 0;
goto cont;
}
- x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], &i_skip, 0 );
h->mb.b_reencode_mb = 1;
h->sh.i_last_mb = thread_last_mb-h->param.i_slice_min_mbs;
break;
}
if( mb_xy-SLICE_MBAFF*h->mb.i_mb_stride != h->sh.i_first_mb )
{
- x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], &i_skip, 0 );
h->mb.b_reencode_mb = 1;
if( SLICE_MBAFF )
{
if( x264_ratecontrol_mb( h, mb_size ) < 0 )
{
- x264_bitstream_restore( h, &bs_bak[BS_BAK_ROW_VBV], &i_skip, 1 );
+ bitstream_restore( h, &bs_bak[BS_BAK_ROW_VBV], &i_skip, 1 );
h->mb.b_reencode_mb = 1;
i_mb_x = 0;
i_mb_y = i_mb_y - SLICE_MBAFF;
bs_rbsp_trailing( &h->out.bs );
bs_flush( &h->out.bs );
}
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
if( h->sh.i_last_mb == (h->i_threadslice_end * h->mb.i_mb_width - 1) )
+ (h->out.i_nal*NALU_OVERHEAD * 8)
- h->stat.frame.i_tex_bits
- h->stat.frame.i_mv_bits;
- x264_fdec_filter_row( h, h->i_threadslice_end, 0 );
+ fdec_filter_row( h, h->i_threadslice_end, 0 );
if( h->param.b_sliced_threads )
{
x264_threadslice_cond_broadcast( h, 1 );
/* Do hpel now */
for( int mb_y = h->i_threadslice_start; mb_y <= h->i_threadslice_end; mb_y++ )
- x264_fdec_filter_row( h, mb_y, 1 );
+ fdec_filter_row( h, mb_y, 1 );
x264_threadslice_cond_broadcast( h, 2 );
/* Do the first row of hpel, now that the previous slice is done */
if( h->i_thread_idx > 0 )
{
x264_threadslice_cond_wait( h->thread[h->i_thread_idx-1], 2 );
- x264_fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 );
+ fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 );
}
}
return 0;
}
-static void x264_thread_sync_context( x264_t *dst, x264_t *src )
+static void thread_sync_context( x264_t *dst, x264_t *src )
{
if( dst == src )
return;
dst->reconfig = src->reconfig;
}
-static void x264_thread_sync_stat( x264_t *dst, x264_t *src )
+static void thread_sync_stat( x264_t *dst, x264_t *src )
{
if( dst != src )
memcpy( &dst->stat, &src->stat, offsetof(x264_t, stat.frame) - offsetof(x264_t, stat) );
}
-static void *x264_slices_write( x264_t *h )
+static void *slices_write( x264_t *h )
{
int i_slice_num = 0;
int last_thread_mb = h->sh.i_last_mb;
}
}
h->sh.i_last_mb = X264_MIN( h->sh.i_last_mb, last_thread_mb );
- if( x264_stack_align( x264_slice_write, h ) )
+ if( x264_stack_align( slice_write, h ) )
goto fail;
h->sh.i_first_mb = h->sh.i_last_mb + 1;
// if i_first_mb is not the last mb in a row then go to the next mb in MBAFF order
return (void *)-1;
}
-static int x264_threaded_slices_write( x264_t *h )
+static int threaded_slices_write( x264_t *h )
{
/* set first/last mb and sync contexts */
for( int i = 0; i < h->param.i_threads; i++ )
}
/* dispatch */
for( int i = 0; i < h->param.i_threads; i++ )
- x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h->thread[i] );
+ x264_threadpool_run( h->threadpool, (void*)slices_write, h->thread[i] );
/* wait */
for( int i = 0; i < h->param.i_threads; i++ )
x264_threadslice_cond_wait( h->thread[i], 1 );
{
h->out.nal[h->out.i_nal] = t->out.nal[j];
h->out.i_nal++;
- x264_nal_check_buffer( h );
+ nal_check_buffer( h );
}
/* All entries in stat.frame are ints except for ssd/ssim. */
for( int j = 0; j < (offsetof(x264_t,stat.frame.i_ssd) - offsetof(x264_t,stat.frame.i_mv_bits)) / sizeof(int); j++ )
h->i_thread_phase = (h->i_thread_phase + 1) % h->i_thread_frames;
thread_current = h->thread[ h->i_thread_phase ];
thread_oldest = h->thread[ (h->i_thread_phase + 1) % h->i_thread_frames ];
- x264_thread_sync_context( thread_current, thread_prev );
+ thread_sync_context( thread_current, thread_prev );
x264_thread_sync_ratecontrol( thread_current, thread_prev, thread_oldest );
h = thread_current;
}
x264_lookahead_get_frames( h );
if( !h->frames.current[0] && x264_lookahead_is_empty( h ) )
- return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
+ return encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
/* ------------------- Get frame to be encoded ------------------------- */
/* 4: get picture to encode */
/* If applicable, wait for previous frame reconstruction to finish */
if( h->param.b_sliced_threads )
- if( x264_threadpool_wait_all( h ) < 0 )
+ if( threadpool_wait_all( h ) < 0 )
return -1;
if( h->i_frame == 0 )
x264_ratecontrol_zone_init( h );
// ok to call this before encoding any frames, since the initial values of fdec have b_kept_as_ref=0
- if( x264_reference_update( h ) )
+ if( reference_update( h ) )
return -1;
h->fdec->i_lines_completed = -1;
i_nal_type = NAL_SLICE_IDR;
i_nal_ref_idc = NAL_PRIORITY_HIGHEST;
h->sh.i_type = SLICE_TYPE_I;
- x264_reference_reset( h );
+ reference_reset( h );
h->frames.i_poc_last_open_gop = -1;
}
else if( h->fenc->i_type == X264_TYPE_I )
i_nal_type = NAL_SLICE;
i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/
h->sh.i_type = SLICE_TYPE_I;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
if( h->param.b_open_gop )
h->frames.i_poc_last_open_gop = h->fenc->b_keyframe ? h->fenc->i_poc : -1;
}
i_nal_type = NAL_SLICE;
i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/
h->sh.i_type = SLICE_TYPE_P;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
h->frames.i_poc_last_open_gop = -1;
}
else if( h->fenc->i_type == X264_TYPE_BREF )
i_nal_type = NAL_SLICE;
i_nal_ref_idc = h->param.i_bframe_pyramid == X264_B_PYRAMID_STRICT ? NAL_PRIORITY_LOW : NAL_PRIORITY_HIGH;
h->sh.i_type = SLICE_TYPE_B;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
}
else /* B frame */
{
/* ------------------- Init ----------------------------- */
/* build ref list 0/1 */
- x264_reference_build_list( h, h->fdec->i_poc );
+ reference_build_list( h, h->fdec->i_poc );
/* ---------------------- Write the bitstream -------------------------- */
/* Init bitstream context */
else
pic_type = 7;
- x264_nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE );
bs_write( &h->out.bs, 3, pic_type );
bs_rbsp_trailing( &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
}
if( h->param.b_repeat_headers )
{
/* generate sequence parameters */
- x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* Pad AUD/SPS to 256 bytes like Panasonic */
if( h->param.i_avcintra_class )
overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD;
/* generate picture parameters */
- x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
x264_pps_write( &h->out.bs, h->sps, h->pps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
if( h->param.i_avcintra_class )
h->out.nal[h->out.i_nal-1].i_padding = 256 - h->out.nal[h->out.i_nal-1].i_payload - NALU_OVERHEAD;
overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD;
}
- /* when frame threading is used, buffering period sei is written in x264_encoder_frame_end */
+ /* when frame threading is used, buffering period sei is written in encoder_frame_end */
if( h->i_thread_frames == 1 && h->sps->vui.b_nal_hrd_parameters_present )
{
x264_hrd_fullness( h );
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_buffering_period_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
/* write extra sei */
for( int i = 0; i < h->fenc->extra_sei.num_payloads; i++ )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_write( &h->out.bs, h->fenc->extra_sei.payloads[i].payload, h->fenc->extra_sei.payloads[i].payload_size,
h->fenc->extra_sei.payloads[i].payload_type );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
if( h->fenc->extra_sei.sei_free )
if( h->param.b_repeat_headers && h->fenc->i_frame == 0 && !h->param.i_avcintra_class )
{
/* identify ourself */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_version_write( h, &h->out.bs ) )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
if( h->fenc->i_type != X264_TYPE_IDR )
{
int time_to_recovery = h->param.b_open_gop ? 0 : X264_MIN( h->mb.i_mb_width - 1, h->param.i_keyint_max ) + h->param.i_bframe - 1;
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_recovery_point_write( h, &h->out.bs, time_to_recovery );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
if( h->param.i_frame_packing >= 0 && (h->fenc->b_keyframe || h->param.i_frame_packing == 5) )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_frame_packing_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
/* generate sei pic timing */
if( h->sps->vui.b_pic_struct_present || h->sps->vui.b_nal_hrd_parameters_present )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_pic_timing_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
if( !IS_X264_TYPE_B( h->fenc->i_type ) && h->b_sh_backup )
{
h->b_sh_backup = 0;
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_dec_ref_pic_marking_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
if( h->param.i_avcintra_class )
{
/* Write an empty filler NAL to mimic the AUD in the P2 format*/
- x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
x264_filler_write( h, &h->out.bs, 0 );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
/* All lengths are magic lengths that decoders expect to see */
/* "UMID" SEI */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_avcintra_umid_write( h, &h->out.bs ) < 0 )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
total_len = 9*512;
}
/* "VANC" SEI */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_avcintra_vanc_write( h, &h->out.bs, unpadded_len ) < 0 )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
h->out.nal[h->out.i_nal-1].i_padding = total_len - h->out.nal[h->out.i_nal-1].i_payload - SEI_OVERHEAD;
if( h->param.rc.b_stat_read && h->sh.i_type != SLICE_TYPE_I )
{
x264_reference_build_list_optimal( h );
- x264_reference_check_reorder( h );
+ reference_check_reorder( h );
}
if( h->i_ref[0] )
h->fdec->i_poc_l0ref0 = h->fref[0][0]->i_poc;
/* ------------------------ Create slice header ----------------------- */
- x264_slice_init( h, i_nal_type, i_global_qp );
+ slice_init( h, i_nal_type, i_global_qp );
/*------------------------- Weights -------------------------------------*/
if( h->sh.i_type == SLICE_TYPE_B )
x264_macroblock_bipred_init( h );
- x264_weighted_pred_init( h );
+ weighted_pred_init( h );
if( i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE )
h->i_frame_num++;
h->i_threadslice_end = h->mb.i_mb_height;
if( h->i_thread_frames > 1 )
{
- x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h );
+ x264_threadpool_run( h->threadpool, (void*)slices_write, h );
h->b_thread_active = 1;
}
else if( h->param.b_sliced_threads )
{
- if( x264_threaded_slices_write( h ) )
+ if( threaded_slices_write( h ) )
return -1;
}
else
- if( (intptr_t)x264_slices_write( h ) )
+ if( (intptr_t)slices_write( h ) )
return -1;
- return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
+ return encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
}
-static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
- x264_nal_t **pp_nal, int *pi_nal,
- x264_picture_t *pic_out )
+static int encoder_frame_end( x264_t *h, x264_t *thread_current,
+ x264_nal_t **pp_nal, int *pi_nal,
+ x264_picture_t *pic_out )
{
char psz_message[80];
if( h->i_thread_frames > 1 && h->fenc->b_keyframe && h->sps->vui.b_nal_hrd_parameters_present )
{
x264_hrd_fullness( h );
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_buffering_period_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* buffering period sei must follow AUD, SPS and PPS and precede all other SEIs */
int idx = 0;
h->out.nal[idx] = nal_tmp;
}
- int frame_size = x264_encoder_encapsulate_nals( h, 0 );
+ int frame_size = encoder_encapsulate_nals( h, 0 );
if( frame_size < 0 )
return -1;
* We don't know the size of the last slice until encapsulation so we add filler to the encapsulated NAL */
if( h->param.i_avcintra_class )
{
- if( x264_check_encapsulated_buffer( h, h->thread[0], h->out.i_nal, frame_size, frame_size + filler ) < 0 )
+ if( check_encapsulated_buffer( h, h->thread[0], h->out.i_nal, frame_size, frame_size + filler ) < 0 )
return -1;
x264_nal_t *nal = &h->out.nal[h->out.i_nal-1];
else
f = X264_MAX( 0, filler - overhead );
- if( x264_bitstream_check_buffer_filler( h, f ) )
+ if( bitstream_check_buffer_filler( h, f ) )
return -1;
- x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
x264_filler_write( h, &h->out.bs, f );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
- int total_size = x264_encoder_encapsulate_nals( h, h->out.i_nal-1 );
+ int total_size = encoder_encapsulate_nals( h, h->out.i_nal-1 );
if( total_size < 0 )
return -1;
frame_size += total_size;
x264_noise_reduction_update( h );
/* ---------------------- Compute/Print statistics --------------------- */
- x264_thread_sync_stat( h, h->thread[0] );
+ thread_sync_stat( h, h->thread[0] );
/* Slice stat */
h->stat.i_frame_count[h->sh.i_type]++;
};
int luma_size = h->param.i_width * h->param.i_height;
int chroma_size = CHROMA_SIZE( luma_size );
- pic_out->prop.f_psnr[0] = x264_psnr( ssd[0], luma_size );
- pic_out->prop.f_psnr[1] = x264_psnr( ssd[1], chroma_size );
- pic_out->prop.f_psnr[2] = x264_psnr( ssd[2], chroma_size );
- pic_out->prop.f_psnr_avg = x264_psnr( ssd[0] + ssd[1] + ssd[2], luma_size + chroma_size*2 );
+ pic_out->prop.f_psnr[0] = calc_psnr( ssd[0], luma_size );
+ pic_out->prop.f_psnr[1] = calc_psnr( ssd[1], chroma_size );
+ pic_out->prop.f_psnr[2] = calc_psnr( ssd[2], chroma_size );
+ pic_out->prop.f_psnr_avg = calc_psnr( ssd[0] + ssd[1] + ssd[2], luma_size + chroma_size*2 );
h->stat.f_ssd_global[h->sh.i_type] += dur * (ssd[0] + ssd[1] + ssd[2]);
h->stat.f_psnr_average[h->sh.i_type] += dur * pic_out->prop.f_psnr_avg;
psz_message );
// keep stats all in one place
- x264_thread_sync_stat( h->thread[0], h );
+ thread_sync_stat( h->thread[0], h );
// for the use of the next frame
- x264_thread_sync_stat( thread_current, h );
+ thread_sync_stat( thread_current, h );
#ifdef DEBUG_MB_TYPE
{
}
if( h->param.psz_dump_yuv )
- x264_frame_dump( h );
+ frame_dump( h );
x264_emms();
return frame_size;
}
-static void x264_print_intra( int64_t *i_mb_count, double i_count, int b_print_pcm, char *intra )
+static void print_intra( int64_t *i_mb_count, double i_count, int b_print_pcm, char *intra )
{
intra += sprintf( intra, "I16..4%s: %4.1f%% %4.1f%% %4.1f%%",
b_print_pcm ? "..PCM" : "",
#endif
if( h->param.b_sliced_threads )
- x264_threadpool_wait_all( h );
+ threadpool_wait_all( h );
if( h->param.i_threads > 1 )
x264_threadpool_delete( h->threadpool );
if( h->param.i_lookahead_threads > 1 )
(double)h->stat.i_frame_size[i_slice] / i_count,
h->stat.f_psnr_mean_y[i_slice] / dur, h->stat.f_psnr_mean_u[i_slice] / dur, h->stat.f_psnr_mean_v[i_slice] / dur,
h->stat.f_psnr_average[i_slice] / dur,
- x264_psnr( h->stat.f_ssd_global[i_slice], dur * i_yuv_size ) );
+ calc_psnr( h->stat.f_ssd_global[i_slice], dur * i_yuv_size ) );
}
else
{
{
int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_I];
double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_I] * h->mb.i_mb_count / 100.0;
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
x264_log( h, X264_LOG_INFO, "mb I %s\n", buf );
}
if( h->stat.i_frame_count[SLICE_TYPE_P] > 0 )
int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_P];
double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_P] * h->mb.i_mb_count / 100.0;
int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_P];
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
x264_log( h, X264_LOG_INFO,
"mb P %s P16..4: %4.1f%% %4.1f%% %4.1f%% %4.1f%% %4.1f%% skip:%4.1f%%\n",
buf,
double i_mb_list_count;
int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_B];
int64_t list_count[3] = {0}; /* 0 == L0, 1 == L1, 2 == BI */
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
for( int i = 0; i < X264_PARTTYPE_MAX; i++ )
for( int j = 0; j < 2; j++ )
{
if( h->param.analyse.b_ssim )
{
float ssim = SUM3( h->stat.f_ssim_mean_y ) / duration;
- x264_log( h, X264_LOG_INFO, "SSIM Mean Y:%.7f (%6.3fdb)\n", ssim, x264_ssim( ssim ) );
+ x264_log( h, X264_LOG_INFO, "SSIM Mean Y:%.7f (%6.3fdb)\n", ssim, calc_ssim_db( ssim ) );
}
if( h->param.analyse.b_psnr )
{
SUM3( h->stat.f_psnr_mean_u ) / duration,
SUM3( h->stat.f_psnr_mean_v ) / duration,
SUM3( h->stat.f_psnr_average ) / duration,
- x264_psnr( SUM3( h->stat.f_ssd_global ), duration * i_yuv_size ),
+ calc_psnr( SUM3( h->stat.f_ssd_global ), duration * i_yuv_size ),
f_bitrate );
}
else
#include "common/common.h"
#include "analyse.h"
-static void x264_lookahead_shift( x264_sync_frame_list_t *dst, x264_sync_frame_list_t *src, int count )
+static void lookahead_shift( x264_sync_frame_list_t *dst, x264_sync_frame_list_t *src, int count )
{
int i = count;
while( i-- )
}
}
-static void x264_lookahead_update_last_nonb( x264_t *h, x264_frame_t *new_nonb )
+static void lookahead_update_last_nonb( x264_t *h, x264_frame_t *new_nonb )
{
if( h->lookahead->last_nonb )
x264_frame_push_unused( h, h->lookahead->last_nonb );
}
#if HAVE_THREAD
-static void x264_lookahead_slicetype_decide( x264_t *h )
+static void lookahead_slicetype_decide( x264_t *h )
{
x264_stack_align( x264_slicetype_decide, h );
- x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
+ lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
int shift_frames = h->lookahead->next.list[0]->i_bframes + 1;
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_empty, &h->lookahead->ofbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
- x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
+ lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
/* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
}
-static void *x264_lookahead_thread( x264_t *h )
+static void *lookahead_thread( x264_t *h )
{
while( !h->lookahead->b_exit_thread )
{
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
int shift = X264_MIN( h->lookahead->next.i_max_size - h->lookahead->next.i_size, h->lookahead->ifbuf.i_size );
- x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift );
+ lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
if( h->lookahead->next.i_size <= h->lookahead->i_slicetype_length + h->param.b_vfr_input )
{
else
{
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
- x264_lookahead_slicetype_decide( h );
+ lookahead_slicetype_decide( h );
}
} /* end of input frames */
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
- x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, h->lookahead->ifbuf.i_size );
+ lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, h->lookahead->ifbuf.i_size );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
while( h->lookahead->next.i_size )
- x264_lookahead_slicetype_decide( h );
+ lookahead_slicetype_decide( h );
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
h->lookahead->b_thread_active = 0;
x264_pthread_cond_broadcast( &h->lookahead->ofbuf.cv_fill );
if( x264_macroblock_thread_allocate( look_h, 1 ) < 0 )
goto fail;
- if( x264_pthread_create( &look->thread_handle, NULL, (void*)x264_lookahead_thread, look_h ) )
+ if( x264_pthread_create( &look->thread_handle, NULL, (void*)lookahead_thread, look_h ) )
goto fail;
look->b_thread_active = 1;
return b_empty;
}
-static void x264_lookahead_encoder_shift( x264_t *h )
+static void lookahead_encoder_shift( x264_t *h )
{
if( !h->lookahead->ofbuf.i_size )
return;
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
while( !h->lookahead->ofbuf.i_size && h->lookahead->b_thread_active )
x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_fill, &h->lookahead->ofbuf.mutex );
- x264_lookahead_encoder_shift( h );
+ lookahead_encoder_shift( h );
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
}
else
return;
x264_stack_align( x264_slicetype_decide, h );
- x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
+ lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
int shift_frames = h->lookahead->next.list[0]->i_bframes + 1;
- x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
+ lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
/* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */
if( h->lookahead->b_analyse_keyframe && IS_X264_TYPE_I( h->lookahead->last_nonb->i_type ) )
x264_stack_align( x264_slicetype_analyse, h, shift_frames );
- x264_lookahead_encoder_shift( h );
+ lookahead_encoder_shift( h );
}
}
/* This means that decimation can be done merely by adjusting the CBP and NNZ
* rather than memsetting the coefficients. */
-static void x264_mb_encode_i16x16( x264_t *h, int p, int i_qp )
+static void mb_encode_i16x16( x264_t *h, int p, int i_qp )
{
pixel *p_src = h->mb.pic.p_fenc[p];
pixel *p_dst = h->mb.pic.p_fdec[p];
* Unlike luma blocks, this can't be done with a lookup table or
* other shortcut technique because of the interdependencies
* between the coefficients due to the chroma DC transform. */
-static ALWAYS_INLINE int x264_mb_optimize_chroma_dc( x264_t *h, dctcoef *dct_dc, int dequant_mf[6][16], int i_qp, int chroma422 )
+static ALWAYS_INLINE int mb_optimize_chroma_dc( x264_t *h, dctcoef *dct_dc, int dequant_mf[6][16], int i_qp, int chroma422 )
{
int dmf = dequant_mf[i_qp%6][0] << i_qp/6;
return h->quantf.optimize_chroma_2x2_dc( dct_dc, dmf );
}
-static ALWAYS_INLINE void x264_mb_encode_chroma_internal( x264_t *h, int b_inter, int i_qp, int chroma422 )
+static ALWAYS_INLINE void mb_encode_chroma_internal( x264_t *h, int b_inter, int i_qp, int chroma422 )
{
int nz, nz_dc;
int b_decimate = b_inter && h->mb.b_dct_decimate;
if( nz_dc )
{
- if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
+ if( !mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
continue;
h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 1;
if( chroma422 )
if( !nz_dc ) /* Whole block is empty */
continue;
- if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
+ if( !mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
{
h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 0;
continue;
void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp )
{
if( CHROMA_FORMAT == CHROMA_420 )
- x264_mb_encode_chroma_internal( h, b_inter, i_qp, 0 );
+ mb_encode_chroma_internal( h, b_inter, i_qp, 0 );
else
- x264_mb_encode_chroma_internal( h, b_inter, i_qp, 1 );
+ mb_encode_chroma_internal( h, b_inter, i_qp, 1 );
}
-static void x264_macroblock_encode_skip( x264_t *h )
+static void macroblock_encode_skip( x264_t *h )
{
M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) = 0;
M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ) = 0;
/*****************************************************************************
* x264_macroblock_encode:
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_internal( x264_t *h, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_encode_internal( x264_t *h, int plane_count, int chroma )
{
int i_qp = h->mb.i_qp;
int b_decimate = h->mb.b_dct_decimate;
}
}
- x264_macroblock_encode_skip( h );
+ macroblock_encode_skip( h );
return;
}
if( h->mb.i_type == B_SKIP )
/* don't do bskip motion compensation if it was already done in macroblock_analyse */
if( !h->mb.b_skip_mc )
x264_mb_mc( h );
- x264_macroblock_encode_skip( h );
+ macroblock_encode_skip( h );
return;
}
h->mb.b_transform_8x8 = 0;
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
- x264_mb_encode_i16x16( h, p, i_qp );
+ mb_encode_i16x16( h, p, i_qp );
}
else if( h->mb.i_type == I_8x8 )
{
void x264_macroblock_encode( x264_t *h )
{
if( CHROMA444 )
- x264_macroblock_encode_internal( h, 3, 0 );
+ macroblock_encode_internal( h, 3, 0 );
else
- x264_macroblock_encode_internal( h, 1, 1 );
+ macroblock_encode_internal( h, 1, 1 );
}
/*****************************************************************************
* x264_macroblock_probe_skip:
* Check if the current MB could be encoded as a [PB]_SKIP
*****************************************************************************/
-static ALWAYS_INLINE int x264_macroblock_probe_skip_internal( x264_t *h, int b_bidir, int plane_count, int chroma )
+static ALWAYS_INLINE int macroblock_probe_skip_internal( x264_t *h, int b_bidir, int plane_count, int chroma )
{
ALIGNED_ARRAY_64( dctcoef, dct4x4,[8],[16] );
ALIGNED_ARRAY_64( dctcoef, dctscan,[16] );
int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
{
if( CHROMA_FORMAT == CHROMA_444 )
- return x264_macroblock_probe_skip_internal( h, b_bidir, 3, CHROMA_444 );
+ return macroblock_probe_skip_internal( h, b_bidir, 3, CHROMA_444 );
else if( CHROMA_FORMAT == CHROMA_422 )
- return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_422 );
+ return macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_422 );
else
- return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_420 );
+ return macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_420 );
}
/****************************************************************************
* RD only; 4 calls to this do not make up for one macroblock_encode.
* doesn't transform chroma dc.
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_p8x8_internal( x264_t *h, int i8, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_encode_p8x8_internal( x264_t *h, int i8, int plane_count, int chroma )
{
int b_decimate = h->mb.b_dct_decimate;
int i_qp = h->mb.i_qp;
void x264_macroblock_encode_p8x8( x264_t *h, int i8 )
{
if( CHROMA444 )
- x264_macroblock_encode_p8x8_internal( h, i8, 3, CHROMA_444 );
+ macroblock_encode_p8x8_internal( h, i8, 3, CHROMA_444 );
else if( CHROMA_FORMAT == CHROMA_422 )
- x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_422 );
+ macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_422 );
else
- x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_420 );
+ macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_420 );
}
/*****************************************************************************
* RD only, luma only (for 4:2:0)
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_p4x4_internal( x264_t *h, int i4, int plane_count )
+static ALWAYS_INLINE void macroblock_encode_p4x4_internal( x264_t *h, int i4, int plane_count )
{
int i_qp = h->mb.i_qp;
void x264_macroblock_encode_p4x4( x264_t *h, int i8 )
{
if( CHROMA444 )
- x264_macroblock_encode_p4x4_internal( h, i8, 3 );
+ macroblock_encode_p4x4_internal( h, i8, 3 );
else
- x264_macroblock_encode_p4x4_internal( h, i8, 1 );
+ macroblock_encode_p4x4_internal( h, i8, 1 );
}
/* Uneven-cross Multi-Hexagon-grid Search
* as in JM, except with different early termination */
- static const uint8_t x264_pixel_size_shift[7] = { 0, 1, 1, 2, 3, 3, 4 };
+ static const uint8_t pixel_size_shift[7] = { 0, 1, 1, 2, 3, 3, 4 };
int ucost1, ucost2;
int cross_start = 1;
omx = bmx; omy = bmy;
/* early termination */
-#define SAD_THRESH(v) ( bcost < ( v >> x264_pixel_size_shift[i_pixel] ) )
+#define SAD_THRESH(v) ( bcost < ( v >> pixel_size_shift[i_pixel] ) )
if( bcost == ucost2 && SAD_THRESH(2000) )
{
COST_MV_X4( 0,-2, -1,-1, 1,-1, -2,0 );
* other than making its iteration count not a compile-time constant. */
int x264_iter_kludge = 0;
-static void ALWAYS_INLINE x264_me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd )
+static void ALWAYS_INLINE me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd )
{
int x = i8&1;
int y = i8>>1;
void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight )
{
- x264_me_refine_bidir( h, m0, m1, i_weight, 0, 0, 0 );
+ me_refine_bidir( h, m0, m1, i_weight, 0, 0, 0 );
}
void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 )
/* Motion compensation is done as part of bidir_rd; don't repeat
* it in encoding. */
h->mb.b_skip_mc = 1;
- x264_me_refine_bidir( h, m0, m1, i_weight, i8, i_lambda2, 1 );
+ me_refine_bidir( h, m0, m1, i_weight, i8, i_lambda2, 1 );
h->mb.b_skip_mc = 0;
}
}
// Find the total AC energy of the block in all planes.
-static NOINLINE uint32_t x264_ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame )
+static NOINLINE uint32_t ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame )
{
/* This function contains annoying hacks because GCC has a habit of reordering emms
* and putting it after floating point ops. As a result, we put the emms at the end of the
{
for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
- x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ ac_energy_mb( h, mb_x, mb_y, frame );
}
else
return;
for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
{
- uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ uint32_t energy = ac_energy_mb( h, mb_x, mb_y, frame );
float qp_adj = powf( energy * bit_depth_correction + 1, 0.125f );
frame->f_qp_offset[mb_x + mb_y*h->mb.i_mb_stride] = qp_adj;
avg_adj += qp_adj;
}
else
{
- uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ uint32_t energy = ac_energy_mb( h, mb_x, mb_y, frame );
qp_adj = strength * (x264_log2( X264_MAX(energy, 1) ) - (14.427f + 2*(BIT_DEPTH-8)));
}
if( quant_offsets )
}
}
-static int x264_macroblock_tree_rescale_init( x264_t *h, x264_ratecontrol_t *rc )
+static int macroblock_tree_rescale_init( x264_t *h, x264_ratecontrol_t *rc )
{
/* Use fractional QP array dimensions to compensate for edge padding */
float srcdim[2] = {rc->mbtree.srcdim[0] / 16.f, rc->mbtree.srcdim[1] / 16.f};
return -1;
}
-static void x264_macroblock_tree_rescale_destroy( x264_ratecontrol_t *rc )
+static void macroblock_tree_rescale_destroy( x264_ratecontrol_t *rc )
{
for( int i = 0; i < 2; i++ )
{
return sum;
}
-static void x264_macroblock_tree_rescale( x264_t *h, x264_ratecontrol_t *rc, float *dst )
+static void macroblock_tree_rescale( x264_t *h, x264_ratecontrol_t *rc, float *dst )
{
float *input, *output;
int filtersize, stride, height;
float *dst = rc->mbtree.rescale_enabled ? rc->mbtree.scale_buffer[0] : frame->f_qp_offset;
h->mc.mbtree_fix8_unpack( dst, rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], rc->mbtree.src_mb_count );
if( rc->mbtree.rescale_enabled )
- x264_macroblock_tree_rescale( h, rc, frame->f_qp_offset );
+ macroblock_tree_rescale( h, rc, frame->f_qp_offset );
if( h->frames.b_have_lowres )
for( int i = 0; i < h->mb.i_mb_count; i++ )
frame->i_inv_qscale_factor[i] = x264_exp2fix8( frame->f_qp_offset[i] );
return 0;
}
-static char *x264_strcat_filename( char *input, char *suffix )
+static char *strcat_filename( char *input, char *suffix )
{
char *output = x264_malloc( strlen( input ) + strlen( suffix ) + 1 );
if( !output )
}
if( h->param.rc.b_mb_tree )
{
- char *mbtree_stats_in = x264_strcat_filename( h->param.rc.psz_stat_in, ".mbtree" );
+ char *mbtree_stats_in = strcat_filename( h->param.rc.psz_stat_in, ".mbtree" );
if( !mbtree_stats_in )
return -1;
rc->p_mbtree_stat_file_in = x264_fopen( mbtree_stats_in, "rb" );
if( h->param.rc.b_stat_write )
{
char *p;
- rc->psz_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".temp" );
+ rc->psz_stat_file_tmpname = strcat_filename( h->param.rc.psz_stat_out, ".temp" );
if( !rc->psz_stat_file_tmpname )
return -1;
x264_free( p );
if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read )
{
- rc->psz_mbtree_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree.temp" );
- rc->psz_mbtree_stat_file_name = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree" );
+ rc->psz_mbtree_stat_file_tmpname = strcat_filename( h->param.rc.psz_stat_out, ".mbtree.temp" );
+ rc->psz_mbtree_stat_file_name = strcat_filename( h->param.rc.psz_stat_out, ".mbtree" );
if( !rc->psz_mbtree_stat_file_tmpname || !rc->psz_mbtree_stat_file_name )
return -1;
rc->mbtree.srcdim[0] = h->param.i_width;
rc->mbtree.srcdim[1] = h->param.i_height;
}
- if( x264_macroblock_tree_rescale_init( h, rc ) < 0 )
+ if( macroblock_tree_rescale_init( h, rc ) < 0 )
return -1;
}
x264_free( rc->pred_b_from_p );
x264_free( rc->entry );
x264_free( rc->entry_out );
- x264_macroblock_tree_rescale_destroy( rc );
+ macroblock_tree_rescale_destroy( rc );
if( rc->zones )
{
x264_free( rc->zones[0].param );
}
}
-static void x264_threads_normalize_predictors( x264_t *h )
+static void threads_normalize_predictors( x264_t *h )
{
double totalsize = 0;
for( int i = 0; i < h->param.i_threads; i++ )
}
if( rc->b_vbv && rc->frame_size_planned )
{
- x264_threads_normalize_predictors( h );
+ threads_normalize_predictors( h );
if( rc->single_frame_vbv )
{
float max_frame_error = x264_clip3f( 1.0 / (t->i_threadslice_end - t->i_threadslice_start), 0.05, 0.25 );
t->rc->slice_size_planned += 2 * max_frame_error * rc->frame_size_planned;
}
- x264_threads_normalize_predictors( h );
+ threads_normalize_predictors( h );
}
for( int i = 0; i < h->param.i_threads; i++ )
#define bs_write_ue(s,v) ((s)->i_bits_encoded += bs_size_ue(v))
#define bs_write_se(s,v) ((s)->i_bits_encoded += bs_size_se(v))
#define bs_write_te(s,v,l) ((s)->i_bits_encoded += bs_size_te(v,l))
-#define x264_macroblock_write_cavlc static x264_macroblock_size_cavlc
+#define x264_macroblock_write_cavlc static macroblock_size_cavlc
#include "cavlc.c"
/* CABAC: not exactly the same. x264_cabac_size_decision() keeps track of
#define x264_cabac_encode_terminal(c) ((c)->f8_bits_encoded += 7)
#define x264_cabac_encode_bypass(c,v) ((c)->f8_bits_encoded += 256)
#define x264_cabac_encode_ue_bypass(c,e,v) ((c)->f8_bits_encoded += (bs_size_ue_big(v+(1<<e)-1)-e)<<8)
-#define x264_macroblock_write_cabac static x264_macroblock_size_cabac
+#define x264_macroblock_write_cabac static macroblock_size_cabac
#include "cabac.c"
#define COPY_CABAC h->mc.memcpy_aligned( &cabac_tmp.f8_bits_encoded, &h->cabac.f8_bits_encoded, \
return ssd_plane(h, PIXEL_16x16, 0, 0, 0) + chroma_ssd;
}
-static int x264_rd_cost_mb( x264_t *h, int i_lambda2 )
+static int rd_cost_mb( x264_t *h, int i_lambda2 )
{
int b_transform_bak = h->mb.b_transform_8x8;
int i_ssd;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_macroblock_size_cabac( h, &cabac_tmp );
+ macroblock_size_cabac( h, &cabac_tmp );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 32768 ) >> 16;
}
else
{
- x264_macroblock_size_cavlc( h );
+ macroblock_size_cavlc( h );
i_bits = ( (uint64_t)h->out.bs.i_bits_encoded * i_lambda2 + 128 ) >> 8;
}
/* partition RD functions use 8 bits more precision to avoid large rounding errors at low QPs */
-static uint64_t x264_rd_cost_subpart( x264_t *h, int i_lambda2, int i4, int i_pixel )
+static uint64_t rd_cost_subpart( x264_t *h, int i_lambda2, int i4, int i_pixel )
{
uint64_t i_ssd, i_bits;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_subpartition_size_cabac( h, &cabac_tmp, i4, i_pixel );
+ subpartition_size_cabac( h, &cabac_tmp, i4, i_pixel );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = x264_subpartition_size_cavlc( h, i4, i_pixel );
+ i_bits = subpartition_size_cavlc( h, i4, i_pixel );
return (i_ssd<<8) + i_bits;
}
if( i_pixel == PIXEL_16x16 )
{
- int i_cost = x264_rd_cost_mb( h, i_lambda2 );
+ int i_cost = rd_cost_mb( h, i_lambda2 );
return i_cost;
}
if( i_pixel > PIXEL_8x8 )
- return x264_rd_cost_subpart( h, i_lambda2, i4, i_pixel );
+ return rd_cost_subpart( h, i_lambda2, i4, i_pixel );
h->mb.i_cbp_luma = 0;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_size_cabac( h, &cabac_tmp, i8, i_pixel );
+ partition_size_cabac( h, &cabac_tmp, i8, i_pixel );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_size_cavlc( h, i8, i_pixel ) * i_lambda2;
+ i_bits = (uint64_t)partition_size_cavlc( h, i8, i_pixel ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_i8x8( x264_t *h, int i_lambda2, int i8, int i_mode, pixel edge[4][32] )
+static uint64_t rd_cost_i8x8( x264_t *h, int i_lambda2, int i8, int i_mode, pixel edge[4][32] )
{
uint64_t i_ssd, i_bits;
int plane_count = CHROMA444 ? 3 : 1;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_i8x8_size_cabac( h, &cabac_tmp, i8, i_mode );
+ partition_i8x8_size_cabac( h, &cabac_tmp, i8, i_mode );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_i8x8_size_cavlc( h, i8, i_mode ) * i_lambda2;
+ i_bits = (uint64_t)partition_i8x8_size_cavlc( h, i8, i_mode ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_i4x4( x264_t *h, int i_lambda2, int i4, int i_mode )
+static uint64_t rd_cost_i4x4( x264_t *h, int i_lambda2, int i4, int i_mode )
{
uint64_t i_ssd, i_bits;
int plane_count = CHROMA444 ? 3 : 1;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_i4x4_size_cabac( h, &cabac_tmp, i4, i_mode );
+ partition_i4x4_size_cabac( h, &cabac_tmp, i4, i_mode );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_i4x4_size_cavlc( h, i4, i_mode ) * i_lambda2;
+ i_bits = (uint64_t)partition_i4x4_size_cavlc( h, i4, i_mode ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct )
+static uint64_t rd_cost_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct )
{
uint64_t i_ssd, i_bits;
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_chroma_size_cabac( h, &cabac_tmp );
+ chroma_size_cabac( h, &cabac_tmp );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_chroma_size_cavlc( h ) * i_lambda2;
+ i_bits = (uint64_t)chroma_size_cavlc( h ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
if( !coef_mask )
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );
else
- x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
+ cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
score = (int64_t)h->out.bs.i_bits_encoded * lambda2;
/* QNS loop: pick the change that improves RD the most, apply it, repeat.
if( !cur_mask )
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );
else
- x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
+ cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
cur_score += (int64_t)h->out.bs.i_bits_encoded * lambda2;
coefs[i] = old_coef;
DCT_LUMA_DC, h->mb.i_trellis_lambda2[0][b_intra], 0, 0, 1, 16, idx, 0 );
}
-static const uint8_t x264_zigzag_scan2x2[4] = { 0, 1, 2, 3 };
-static const uint8_t x264_zigzag_scan2x4[8] = { 0, 2, 1, 4, 6, 3, 5, 7 };
+static const uint8_t zigzag_scan2x2[4] = { 0, 1, 2, 3 };
+static const uint8_t zigzag_scan2x4[8] = { 0, 2, 1, 4, 6, 3, 5, 7 };
int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx )
{
if( CHROMA_FORMAT == CHROMA_422 )
{
- zigzag = x264_zigzag_scan2x4;
+ zigzag = zigzag_scan2x4;
num_coefs = 8;
}
else
{
- zigzag = x264_zigzag_scan2x2;
+ zigzag = zigzag_scan2x2;
num_coefs = 4;
}
h->opencl.pl_occupancy = 0;
}
-static void *x264_opencl_alloc_locked( x264_t *h, int bytes )
+static void *opencl_alloc_locked( x264_t *h, int bytes )
{
if( h->opencl.pl_occupancy + bytes >= PAGE_LOCKED_BUF_SIZE )
x264_opencl_flush( h );
/* Copy image to the GPU, downscale to unpadded 8x8, then continue for all scales */
- char *locked = x264_opencl_alloc_locked( h, luma_length );
+ char *locked = opencl_alloc_locked( h, luma_length );
memcpy( locked, fenc->plane[0], luma_length );
OCLCHECK( clEnqueueWriteBuffer, h->opencl.queue, h->opencl.luma_16x16_image[h->opencl.last_buf], CL_FALSE, 0, luma_length, locked, 0, NULL, NULL );
if( h->param.rc.i_aq_mode && fenc->i_inv_qscale_factor )
{
int size = h->mb.i_mb_count * sizeof(int16_t);
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
memcpy( locked, fenc->i_inv_qscale_factor, size );
OCLCHECK( clEnqueueWriteBuffer, h->opencl.queue, fenc->opencl.inv_qscale_factor, CL_FALSE, 0, size, locked, 0, NULL, NULL );
}
x264_opencl_flush( h );
int size = h->mb.i_mb_count * sizeof(int16_t);
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, fenc->opencl.intra_cost, CL_FALSE, 0, size, locked, 0, NULL, NULL );
h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_costs[0][0];
h->opencl.copies[h->opencl.num_copies].src = locked;
h->opencl.num_copies++;
size = h->mb.i_mb_height * sizeof(int);
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.row_satds[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL );
h->opencl.copies[h->opencl.num_copies].dest = fenc->i_row_satds[0][0];
h->opencl.copies[h->opencl.num_copies].src = locked;
h->opencl.num_copies++;
size = sizeof(int) * 4;
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.frame_stats[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL );
h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_cost_est[0][0];
h->opencl.copies[h->opencl.num_copies].src = locked;
* applications will have self-tuning code to try many possible variables and
* measure the runtime. Here we simply make an educated guess based on what we
* know GPUs typically prefer. */
-static void x264_optimal_launch_dims( x264_t *h, size_t *gdims, size_t *ldims, const cl_kernel kernel, const cl_device_id device )
+static void optimal_launch_dims( x264_t *h, size_t *gdims, size_t *ldims, const cl_kernel kernel, const cl_device_id device )
{
x264_opencl_function_t *ocl = h->opencl.ocl;
size_t max_work_group = 256; /* reasonable defaults for OpenCL 1.0 devices, below APIs may fail */
if( gdims[0] < 2 || gdims[1] < 2 )
continue;
gdims[0] <<= 2;
- x264_optimal_launch_dims( h, gdims, ldims, h->opencl.hme_kernel, h->opencl.device );
+ optimal_launch_dims( h, gdims, ldims, h->opencl.hme_kernel, h->opencl.device );
mb_per_group = (ldims[0] >> 2) * ldims[1];
cost_local_size = 4 * mb_per_group * sizeof(int16_t);
if( h->opencl.num_copies >= MAX_FINISH_COPIES - 1 )
x264_opencl_flush( h );
- char *locked = x264_opencl_alloc_locked( h, mvlen );
+ char *locked = opencl_alloc_locked( h, mvlen );
h->opencl.copies[h->opencl.num_copies].src = locked;
h->opencl.copies[h->opencl.num_copies].bytes = mvlen;
/* For B frames, use 4 threads per MB for BIDIR checks */
ldims = ldim_bidir;
gdims[0] <<= 2;
- x264_optimal_launch_dims( h, gdims, ldims, h->opencl.mode_select_kernel, h->opencl.device );
+ optimal_launch_dims( h, gdims, ldims, h->opencl.mode_select_kernel, h->opencl.device );
int mb_per_group = (ldims[0] >> 2) * ldims[1];
cost_local_size = 4 * mb_per_group * sizeof(int16_t);
satd_local_size = 16 * mb_per_group * sizeof(uint32_t);
x264_opencl_flush( h );
int size = h->mb.i_mb_count * sizeof(int16_t);
- char *locked = x264_opencl_alloc_locked( h, size );
+ char *locked = opencl_alloc_locked( h, size );
h->opencl.copies[h->opencl.num_copies].src = locked;
h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_costs[b - p0][p1 - b];
h->opencl.copies[h->opencl.num_copies].bytes = size;
h->opencl.num_copies++;
size = h->mb.i_mb_height * sizeof(int);
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
h->opencl.copies[h->opencl.num_copies].src = locked;
h->opencl.copies[h->opencl.num_copies].dest = fenc->i_row_satds[b - p0][p1 - b];
h->opencl.copies[h->opencl.num_copies].bytes = size;
h->opencl.num_copies++;
size = 4 * sizeof(int);
- locked = x264_opencl_alloc_locked( h, size );
+ locked = opencl_alloc_locked( h, size );
OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.frame_stats[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL );
h->opencl.last_buf = !h->opencl.last_buf;
// Indexed by pic_struct values
static const uint8_t delta_tfi_divisor[10] = { 0, 2, 1, 1, 2, 2, 3, 3, 4, 6 };
-static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
+static int slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
x264_frame_t **frames, int p0, int p1, int b );
void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead );
void x264_opencl_slicetype_end( x264_t *h );
#endif
-static void x264_lowres_context_init( x264_t *h, x264_mb_analysis_t *a )
+static void lowres_context_init( x264_t *h, x264_mb_analysis_t *a )
{
a->i_qp = X264_LOOKAHEAD_QP;
a->i_lambda = x264_lambda_tab[ a->i_qp ];
- x264_mb_analyse_load_costs( h, a );
+ mb_analyse_load_costs( h, a );
if( h->param.analyse.i_subpel_refine > 1 )
{
h->mb.i_me_method = X264_MIN( X264_ME_HEX, h->param.analyse.i_me_method );
}
/* makes a non-h264 weight (i.e. fix7), into an h264 weight */
-static void x264_weight_get_h264( int weight_nonh264, int offset, x264_weight_t *w )
+static void weight_get_h264( int weight_nonh264, int offset, x264_weight_t *w )
{
w->i_offset = offset;
w->i_denom = 7;
w->i_scale = X264_MIN( w->i_scale, 127 );
}
-static NOINLINE pixel *x264_weight_cost_init_luma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dest )
+static NOINLINE pixel *weight_cost_init_luma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dest )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
/* Note: this will never run during lookahead as weights_analyse is only called if no
* fenc = ref + offset
* v = u + stride * chroma height */
-static NOINLINE void x264_weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dstu, pixel *dstv )
+static NOINLINE void weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dstu, pixel *dstv )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
int i_stride = fenc->i_stride[1];
x264_emms();
}
-static NOINLINE pixel *x264_weight_cost_init_chroma444( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dst, int p )
+static NOINLINE pixel *weight_cost_init_chroma444( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dst, int p )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
int i_stride = fenc->i_stride[p];
return ref->plane[p];
}
-static int x264_weight_slice_header_cost( x264_t *h, x264_weight_t *w, int b_chroma )
+static int weight_slice_header_cost( x264_t *h, x264_weight_t *w, int b_chroma )
{
/* Add cost of weights in the slice header. */
int lambda = x264_lambda_tab[X264_LOOKAHEAD_QP];
return lambda * numslices * ( 10 + denom_cost + 2 * (bs_size_se( w[0].i_scale ) + bs_size_se( w[0].i_offset )) );
}
-static NOINLINE unsigned int x264_weight_cost_luma( x264_t *h, x264_frame_t *fenc, pixel *src, x264_weight_t *w )
+static NOINLINE unsigned int weight_cost_luma( x264_t *h, x264_frame_t *fenc, pixel *src, x264_weight_t *w )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride_lowres;
int cmp = h->pixf.mbcmp[PIXEL_8x8]( buf, 8, &fenc_plane[pixoff], i_stride );
cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] );
}
- cost += x264_weight_slice_header_cost( h, w, 0 );
+ cost += weight_slice_header_cost( h, w, 0 );
}
else
for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride )
return cost;
}
-static NOINLINE unsigned int x264_weight_cost_chroma( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w )
+static NOINLINE unsigned int weight_cost_chroma( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride[1];
* pixels. */
cost += h->pixf.asd8( buf, 8, &src[pixoff], i_stride, height );
}
- cost += x264_weight_slice_header_cost( h, w, 1 );
+ cost += weight_slice_header_cost( h, w, 1 );
}
else
for( int y = 0; y < i_lines; y += height, pixoff = y*i_stride )
return cost;
}
-static NOINLINE unsigned int x264_weight_cost_chroma444( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w, int p )
+static NOINLINE unsigned int weight_cost_chroma444( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w, int p )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride[p];
w->weightfn[16>>2]( buf, 16, &ref[pixoff], i_stride, w, 16 );
cost += h->pixf.mbcmp[PIXEL_16x16]( buf, 16, &src[pixoff], i_stride );
}
- cost += x264_weight_slice_header_cost( h, w, 1 );
+ cost += weight_slice_header_cost( h, w, 1 );
}
else
for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride )
}
}
else
- x264_weight_get_h264( round( guess_scale[plane] * 128 ), 0, &weights[plane] );
+ weight_get_h264( round( guess_scale[plane] * 128 ), 0, &weights[plane] );
found = 0;
mindenom = weights[plane].i_denom;
if( !fenc->b_intra_calculated )
{
x264_mb_analysis_t a;
- x264_lowres_context_init( h, &a );
- x264_slicetype_frame_cost( h, &a, &fenc, 0, 0, 0 );
+ lowres_context_init( h, &a );
+ slicetype_frame_cost( h, &a, &fenc, 0, 0, 0 );
}
- mcbuf = x264_weight_cost_init_luma( h, fenc, ref, h->mb.p_weight_buf[0] );
- origscore = minscore = x264_weight_cost_luma( h, fenc, mcbuf, NULL );
+ mcbuf = weight_cost_init_luma( h, fenc, ref, h->mb.p_weight_buf[0] );
+ origscore = minscore = weight_cost_luma( h, fenc, mcbuf, NULL );
}
else
{
if( CHROMA444 )
{
- mcbuf = x264_weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane );
- origscore = minscore = x264_weight_cost_chroma444( h, fenc, mcbuf, NULL, plane );
+ mcbuf = weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane );
+ origscore = minscore = weight_cost_chroma444( h, fenc, mcbuf, NULL, plane );
}
else
{
pixel *dstu = h->mb.p_weight_buf[0];
pixel *dstv = h->mb.p_weight_buf[0]+fenc->i_stride[1]*fenc->i_lines[1];
if( !chroma_initted++ )
- x264_weight_cost_init_chroma( h, fenc, ref, dstu, dstv );
+ weight_cost_init_chroma( h, fenc, ref, dstu, dstv );
mcbuf = plane == 1 ? dstu : dstv;
- origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL );
+ origscore = minscore = weight_cost_chroma( h, fenc, mcbuf, NULL );
}
}
if( plane )
{
if( CHROMA444 )
- s = x264_weight_cost_chroma444( h, fenc, mcbuf, &weights[plane], plane );
+ s = weight_cost_chroma444( h, fenc, mcbuf, &weights[plane], plane );
else
- s = x264_weight_cost_chroma( h, fenc, mcbuf, &weights[plane] );
+ s = weight_cost_chroma( h, fenc, mcbuf, &weights[plane] );
}
else
- s = x264_weight_cost_luma( h, fenc, mcbuf, &weights[plane] );
+ s = weight_cost_luma( h, fenc, mcbuf, &weights[plane] );
COPY4_IF_LT( minscore, s, minscale, cur_scale, minoff, i_off, found, 1 );
// Don't check any more offsets if the previous one had a lower cost than the current one
#define NUM_ROWS 3
#define ROW_SATD (NUM_INTS + (h->mb.i_mb_y - h->i_threadslice_start))
-static void x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
- x264_frame_t **frames, int p0, int p1, int b,
- int dist_scale_factor, int do_search[2], const x264_weight_t *w,
- int *output_inter, int *output_intra )
+static void slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
+ x264_frame_t **frames, int p0, int p1, int b,
+ int dist_scale_factor, int do_search[2], const x264_weight_t *w,
+ int *output_inter, int *output_intra )
{
x264_frame_t *fref0 = frames[p0];
x264_frame_t *fref1 = frames[p1];
int *output_intra;
} x264_slicetype_slice_t;
-static void x264_slicetype_slice_cost( x264_slicetype_slice_t *s )
+static void slicetype_slice_cost( x264_slicetype_slice_t *s )
{
x264_t *h = s->h;
for( h->mb.i_mb_y = start_y; h->mb.i_mb_y >= end_y; h->mb.i_mb_y-- )
for( h->mb.i_mb_x = start_x; h->mb.i_mb_x >= end_x; h->mb.i_mb_x-- )
- x264_slicetype_mb_cost( h, s->a, s->frames, s->p0, s->p1, s->b, s->dist_scale_factor,
- s->do_search, s->w, s->output_inter, s->output_intra );
+ slicetype_mb_cost( h, s->a, s->frames, s->p0, s->p1, s->b, s->dist_scale_factor,
+ s->do_search, s->w, s->output_inter, s->output_intra );
}
-static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
- x264_frame_t **frames, int p0, int p1, int b )
+static int slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
+ x264_frame_t **frames, int p0, int p1, int b )
{
int i_score = 0;
int do_search[2];
output_inter[i+1] = output_inter[i] + thread_output_size + PAD_SIZE;
output_intra[i+1] = output_intra[i] + thread_output_size + PAD_SIZE;
- x264_threadpool_run( h->lookaheadpool, (void*)x264_slicetype_slice_cost, &s[i] );
+ x264_threadpool_run( h->lookaheadpool, (void*)slicetype_slice_cost, &s[i] );
}
for( int i = 0; i < h->param.i_lookahead_threads; i++ )
x264_threadpool_wait( h->lookaheadpool, &s[i] );
output_inter[0][NUM_ROWS] = output_intra[0][NUM_ROWS] = h->mb.i_mb_height;
x264_slicetype_slice_t s = (x264_slicetype_slice_t){ h, a, frames, p0, p1, b, dist_scale_factor, do_search, w,
output_inter[0], output_intra[0] };
- x264_slicetype_slice_cost( &s );
+ slicetype_slice_cost( &s );
}
/* Sum up accumulators */
/* If MB-tree changes the quantizers, we need to recalculate the frame cost without
* re-running lookahead. */
-static int x264_slicetype_frame_cost_recalculate( x264_t *h, x264_frame_t **frames, int p0, int p1, int b )
+static int slicetype_frame_cost_recalculate( x264_t *h, x264_frame_t **frames, int p0, int p1, int b )
{
int i_score = 0;
int *row_satd = frames[b]->i_row_satds[b-p0][p1-b];
/* Trade off precision in mbtree for increased range */
#define MBTREE_PRECISION 0.5f
-static void x264_macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float average_duration, int ref0_distance )
+static void macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float average_duration, int ref0_distance )
{
int fps_factor = round( CLIP_DURATION(average_duration) / CLIP_DURATION(frame->f_duration) * 256 / MBTREE_PRECISION );
float weightdelta = 0.0;
}
}
-static void x264_macroblock_tree_propagate( x264_t *h, x264_frame_t **frames, float average_duration, int p0, int p1, int b, int referenced )
+static void macroblock_tree_propagate( x264_t *h, x264_frame_t **frames, float average_duration, int p0, int p1, int b, int referenced )
{
uint16_t *ref_costs[2] = {frames[p0]->i_propagate_cost,frames[p1]->i_propagate_cost};
int dist_scale_factor = ( ((b-p0) << 8) + ((p1-p0) >> 1) ) / (p1-p0);
}
if( h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead && referenced )
- x264_macroblock_tree_finish( h, frames[b], average_duration, b == p1 ? b - p0 : 0 );
+ macroblock_tree_finish( h, frames[b], average_duration, b == p1 ? b - p0 : 0 );
}
-static void x264_macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int b_intra )
+static void macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int b_intra )
{
int idx = !b_intra;
int last_nonb, cur_nonb = 1;
int i = num_frames;
if( b_intra )
- x264_slicetype_frame_cost( h, a, frames, 0, 0, 0 );
+ slicetype_frame_cost( h, a, frames, 0, 0, 0 );
while( i > 0 && IS_X264_TYPE_B( frames[i]->i_type ) )
i--;
cur_nonb--;
if( cur_nonb < idx )
break;
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb );
memset( frames[cur_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
bframes = last_nonb - cur_nonb - 1;
if( h->param.i_bframe_pyramid && bframes > 1 )
{
int middle = (bframes + 1)/2 + cur_nonb;
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, middle );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, middle );
memset( frames[middle]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
while( i > cur_nonb )
{
int p1 = i < middle ? middle : last_nonb;
if( i != middle )
{
- x264_slicetype_frame_cost( h, a, frames, p0, p1, i );
- x264_macroblock_tree_propagate( h, frames, average_duration, p0, p1, i, 0 );
+ slicetype_frame_cost( h, a, frames, p0, p1, i );
+ macroblock_tree_propagate( h, frames, average_duration, p0, p1, i, 0 );
}
i--;
}
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, middle, 1 );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, middle, 1 );
}
else
{
while( i > cur_nonb )
{
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i );
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, i, 0 );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, i, 0 );
i--;
}
}
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, last_nonb, 1 );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, last_nonb, 1 );
last_nonb = cur_nonb;
}
if( !h->param.rc.i_lookahead )
{
- x264_slicetype_frame_cost( h, a, frames, 0, last_nonb, last_nonb );
- x264_macroblock_tree_propagate( h, frames, average_duration, 0, last_nonb, last_nonb, 1 );
+ slicetype_frame_cost( h, a, frames, 0, last_nonb, last_nonb );
+ macroblock_tree_propagate( h, frames, average_duration, 0, last_nonb, last_nonb, 1 );
XCHG( uint16_t*, frames[last_nonb]->i_propagate_cost, frames[0]->i_propagate_cost );
}
- x264_macroblock_tree_finish( h, frames[last_nonb], average_duration, last_nonb );
+ macroblock_tree_finish( h, frames[last_nonb], average_duration, last_nonb );
if( h->param.i_bframe_pyramid && bframes > 1 && !h->param.rc.i_vbv_buffer_size )
- x264_macroblock_tree_finish( h, frames[last_nonb+(bframes+1)/2], average_duration, 0 );
+ macroblock_tree_finish( h, frames[last_nonb+(bframes+1)/2], average_duration, 0 );
}
-static int x264_vbv_frame_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int b )
+static int vbv_frame_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int b )
{
- int cost = x264_slicetype_frame_cost( h, a, frames, p0, p1, b );
+ int cost = slicetype_frame_cost( h, a, frames, p0, p1, b );
if( h->param.rc.i_aq_mode )
{
if( h->param.rc.b_mb_tree )
- return x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
+ return slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
else
return frames[b]->i_cost_est_aq[b-p0][p1-b];
}
return cost;
}
-static void x264_calculate_durations( x264_t *h, x264_frame_t *cur_frame, x264_frame_t *prev_frame, int64_t *i_cpb_delay, int64_t *i_coded_fields )
+static void calculate_durations( x264_t *h, x264_frame_t *cur_frame, x264_frame_t *prev_frame, int64_t *i_cpb_delay, int64_t *i_coded_fields )
{
cur_frame->i_cpb_delay = *i_cpb_delay;
cur_frame->i_dpb_output_delay = cur_frame->i_field_cnt - *i_coded_fields;
cur_frame->i_cpb_duration = cur_frame->i_duration;
}
-static void x264_vbv_lookahead( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int keyframe )
+static void vbv_lookahead( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int keyframe )
{
int last_nonb = 0, cur_nonb = 1, idx = 0;
x264_frame_t *prev_frame = NULL;
if( next_nonb != cur_nonb )
{
int p0 = IS_X264_TYPE_I( frames[cur_nonb]->i_type ) ? cur_nonb : last_nonb;
- frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, p0, cur_nonb, cur_nonb );
+ frames[next_nonb]->i_planned_satd[idx] = vbv_frame_cost( h, a, frames, p0, cur_nonb, cur_nonb );
frames[next_nonb]->i_planned_type[idx] = frames[cur_nonb]->i_type;
frames[cur_nonb]->i_coded_fields_lookahead = h->i_coded_fields_lookahead;
frames[cur_nonb]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead;
- x264_calculate_durations( h, frames[cur_nonb], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
+ calculate_durations( h, frames[cur_nonb], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
if( prev_frame )
{
frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration *
/* Handle the B-frames: coded order */
for( int i = last_nonb+1; i < cur_nonb; i++, idx++ )
{
- frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, last_nonb, cur_nonb, i );
+ frames[next_nonb]->i_planned_satd[idx] = vbv_frame_cost( h, a, frames, last_nonb, cur_nonb, i );
frames[next_nonb]->i_planned_type[idx] = X264_TYPE_B;
frames[i]->i_coded_fields_lookahead = h->i_coded_fields_lookahead;
frames[i]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead;
- x264_calculate_durations( h, frames[i], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
+ calculate_durations( h, frames[i], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
if( prev_frame )
{
frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration *
frames[next_nonb]->i_planned_type[idx] = X264_TYPE_AUTO;
}
-static int x264_slicetype_path_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, char *path, int threshold )
+static int slicetype_path_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, char *path, int threshold )
{
int loc = 1;
int cost = 0;
/* Add the cost of the non-B-frame found above */
if( path[next_nonb] == 'P' )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_nonb );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_nonb );
else /* I-frame */
- cost += x264_slicetype_frame_cost( h, a, frames, next_nonb, next_nonb, next_nonb );
+ cost += slicetype_frame_cost( h, a, frames, next_nonb, next_nonb, next_nonb );
/* Early terminate if the cost we have found is larger than the best path cost so far */
if( cost > threshold )
break;
if( h->param.i_bframe_pyramid && next_nonb - cur_nonb > 2 )
{
int middle = cur_nonb + (next_nonb - cur_nonb)/2;
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, middle );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, middle );
for( int next_b = loc; next_b < middle && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, middle, next_b );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, middle, next_b );
for( int next_b = middle+1; next_b < next_nonb && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, middle, next_nonb, next_b );
+ cost += slicetype_frame_cost( h, a, frames, middle, next_nonb, next_b );
}
else
for( int next_b = loc; next_b < next_nonb && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_b );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_b );
loc = next_nonb + 1;
cur_nonb = next_nonb;
/* Uses strings due to the fact that the speed of the control functions is
negligible compared to the cost of running slicetype_frame_cost, and because
it makes debugging easier. */
-static void x264_slicetype_path( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int length, char (*best_paths)[X264_LOOKAHEAD_MAX+1] )
+static void slicetype_path( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int length, char (*best_paths)[X264_LOOKAHEAD_MAX+1] )
{
char paths[2][X264_LOOKAHEAD_MAX+1];
int num_paths = X264_MIN( h->param.i_bframe+1, length );
if( possible && !best_possible )
best_cost = COST_MAX;
/* Calculate the actual cost of the current path */
- int cost = x264_slicetype_path_cost( h, a, frames, paths[idx], best_cost );
+ int cost = slicetype_path_cost( h, a, frames, paths[idx], best_cost );
if( cost < best_cost )
{
best_cost = cost;
if( real_scenecut && h->param.i_frame_packing == 5 && (frame->i_frame&1) )
return 0;
- x264_slicetype_frame_cost( h, a, frames, p0, p1, p1 );
+ slicetype_frame_cost( h, a, frames, p0, p1, p1 );
int icost = frame->i_cost_est[0][0];
int pcost = frame->i_cost_est[p1-p0][0];
x264_frame_t *frames[X264_LOOKAHEAD_MAX+3] = { NULL, };
int num_frames, orig_num_frames, keyint_limit, framecnt;
int i_max_search = X264_MIN( h->lookahead->next.i_size, X264_LOOKAHEAD_MAX );
- int vbv_lookahead = h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead;
+ int b_vbv_lookahead = h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead;
/* For determinism we should limit the search to the number of frames lookahead has for sure
* in h->lookahead->next.list buffer, except at the end of stream.
* For normal calls with (intra_minigop == 0) that is h->lookahead->i_slicetype_length + 1 frames.
for( framecnt = 0; framecnt < i_max_search; framecnt++ )
frames[framecnt+1] = h->lookahead->next.list[framecnt];
- x264_lowres_context_init( h, &a );
+ lowres_context_init( h, &a );
if( !framecnt )
{
if( h->param.rc.b_mb_tree )
- x264_macroblock_tree( h, &a, frames, 0, keyframe );
+ macroblock_tree( h, &a, frames, 0, keyframe );
return;
}
* there will be significant visual artifacts if the frames just before
* go down in quality due to being referenced less, despite it being
* more RD-optimal. */
- if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || vbv_lookahead )
+ if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || b_vbv_lookahead )
num_frames = framecnt;
else if( h->param.b_open_gop && num_frames < framecnt )
num_frames++;
/* Perform the frametype analysis. */
for( int j = 2; j <= num_frames; j++ )
- x264_slicetype_path( h, &a, frames, j, best_paths );
+ slicetype_path( h, &a, frames, j, best_paths );
/* Load the results of the analysis into the frame types. */
for( int j = 1; j < num_frames; j++ )
int bframes = j - last_nonb - 1;
memset( path, 'B', bframes );
strcpy( path+bframes, "PP" );
- int cost_p = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX );
+ int cost_p = slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX );
strcpy( path+bframes, "BP" );
- int cost_b = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p );
+ int cost_b = slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p );
if( cost_b < cost_p )
frames[j]->i_type = X264_TYPE_B;
/* Perform the actual macroblock tree analysis.
* Don't go farther than the maximum keyframe interval; this helps in short GOPs. */
if( h->param.rc.b_mb_tree )
- x264_macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe );
+ macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe );
/* Enforce keyframe limit. */
if( !h->param.b_intra_refresh )
}
}
- if( vbv_lookahead )
- x264_vbv_lookahead( h, &a, frames, num_frames, keyframe );
+ if( b_vbv_lookahead )
+ vbv_lookahead( h, &a, frames, num_frames, keyframe );
/* Restore frametypes for all frames that haven't actually been decided yet. */
for( int j = reset_start; j <= num_frames; j++ )
int p0, p1, b;
p1 = b = bframes + 1;
- x264_lowres_context_init( h, &a );
+ lowres_context_init( h, &a );
frames[0] = h->lookahead->last_nonb;
memcpy( &frames[1], h->lookahead->next.list, (bframes+1) * sizeof(x264_frame_t*) );
else // P
p0 = 0;
- x264_slicetype_frame_cost( h, &a, frames, p0, p1, b );
+ slicetype_frame_cost( h, &a, frames, p0, p1, b );
if( (p0 != p1 || bframes) && h->param.rc.i_vbv_buffer_size )
{
/* We need the intra costs for row SATDs. */
- x264_slicetype_frame_cost( h, &a, frames, b, b, b );
+ slicetype_frame_cost( h, &a, frames, b, b, b );
/* We need B-frame costs for row SATDs. */
p0 = 0;
p1++;
else
p1 = bframes + 1;
- x264_slicetype_frame_cost( h, &a, frames, p0, p1, b );
+ slicetype_frame_cost( h, &a, frames, p0, p1, b );
if( frames[b]->i_type == X264_TYPE_BREF )
p0 = b;
}
h->lookahead->next.list[i]->i_coded = i_coded++;
if( i )
{
- x264_calculate_durations( h, h->lookahead->next.list[i], h->lookahead->next.list[i-1], &h->i_cpb_delay, &h->i_coded_fields );
+ calculate_durations( h, h->lookahead->next.list[i], h->lookahead->next.list[i-1], &h->i_cpb_delay, &h->i_coded_fields );
h->lookahead->next.list[0]->f_planned_cpb_duration[i-1] = (double)h->lookahead->next.list[i]->i_cpb_duration *
h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale;
}
else
- x264_calculate_durations( h, h->lookahead->next.list[i], NULL, &h->i_cpb_delay, &h->i_coded_fields );
+ calculate_durations( h, h->lookahead->next.list[i], NULL, &h->i_cpb_delay, &h->i_coded_fields );
}
}
if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read )
{
- cost = x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
+ cost = slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
if( b && h->param.rc.i_vbv_buffer_size )
- x264_slicetype_frame_cost_recalculate( h, frames, b, b, b );
+ slicetype_frame_cost_recalculate( h, frames, b, b, b );
}
/* In AQ, use the weighted score instead. */
else if( h->param.rc.i_aq_mode )
return 0;
}
-static int x264_init_sws_context( resizer_hnd_t *h )
+static int init_sws_context( resizer_hnd_t *h )
{
if( h->ctx )
sws_freeContext( h->ctx );
return -1;
h->buffer_allocated = 1;
}
- FAIL_IF_ERROR( x264_init_sws_context( h ), "swscale init failed\n" );
+ FAIL_IF_ERROR( init_sws_context( h ), "swscale init failed\n" );
return 0;
}
} avs_hnd_t;
/* load the library and functions we require from it */
-static int x264_avs_load_library( avs_hnd_t *h )
+static int custom_avs_load_library( avs_hnd_t *h )
{
h->library = avs_open();
if( !h->library )
avs_hnd_t *h = calloc( 1, sizeof(avs_hnd_t) );
if( !h )
return -1;
- FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth\n" );
+ FAIL_IF_ERROR( custom_avs_load_library( h ), "failed to load avisynth\n" );
h->env = h->func.avs_create_script_environment( AVS_INTERFACE_25 );
if( h->func.avs_get_error )
{
return size;
}
-static int x264_cli_pic_init_internal( cli_pic_t *pic, int csp, int width, int height, int align, int alloc )
+static int cli_pic_init_internal( cli_pic_t *pic, int csp, int width, int height, int align, int alloc )
{
memset( pic, 0, sizeof(cli_pic_t) );
int csp_mask = csp & X264_CSP_MASK;
int x264_cli_pic_alloc( cli_pic_t *pic, int csp, int width, int height )
{
- return x264_cli_pic_init_internal( pic, csp, width, height, 1, 1 );
+ return cli_pic_init_internal( pic, csp, width, height, 1, 1 );
}
int x264_cli_pic_alloc_aligned( cli_pic_t *pic, int csp, int width, int height )
{
- return x264_cli_pic_init_internal( pic, csp, width, height, NATIVE_ALIGN, 1 );
+ return cli_pic_init_internal( pic, csp, width, height, NATIVE_ALIGN, 1 );
}
int x264_cli_pic_init_noalloc( cli_pic_t *pic, int csp, int width, int height )
{
- return x264_cli_pic_init_internal( pic, csp, width, height, 1, 0 );
+ return cli_pic_init_internal( pic, csp, width, height, 1, 0 );
}
void x264_cli_pic_clean( cli_pic_t *pic )
#endif
/* buf1, buf2: initialised to random data and shouldn't write into them */
-uint8_t *buf1, *buf2;
+static uint8_t *buf1, *buf2;
/* buf3, buf4: used to store output */
-uint8_t *buf3, *buf4;
+static uint8_t *buf3, *buf4;
/* pbuf1, pbuf2: initialised to random pixel data and shouldn't write into them. */
-pixel *pbuf1, *pbuf2;
+static pixel *pbuf1, *pbuf2;
/* pbuf3, pbuf4: point to buf3, buf4, just for type convenience */
-pixel *pbuf3, *pbuf4;
+static pixel *pbuf3, *pbuf4;
-int quiet = 0;
+static int quiet = 0;
#define report( name ) { \
if( used_asm && !quiet ) \
bench_t vers[MAX_CPUS];
} bench_func_t;
-int do_bench = 0;
-int bench_pattern_len = 0;
-const char *bench_pattern = "";
-char func_name[100];
+static int do_bench = 0;
+static int bench_pattern_len = 0;
+static const char *bench_pattern = "";
+static char func_name[100];
static bench_func_t benchs[MAX_FUNCS];
static const char *pixel_names[12] = { "16x16", "16x8", "8x16", "8x8", "8x4", "4x8", "4x4", "4x16", "4x2", "2x8", "2x4", "2x2" };