...
 
Commits (12)
......@@ -37,12 +37,20 @@ stages:
stage: build
script: |
set -x
curl -L -- https://download.videolan.org/videolan/x264/av.tar.gz > av.tar.gz && tar xfzv av.tar.gz
cd av
./bootstrap
LOCAL_INSTALL_DIR=`pwd`/local_install
export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig
git clone --depth 1 --branch master https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix="${LOCAL_INSTALL_DIR}" --enable-pic --disable-debug --extra-ldflags="-static" --disable-programs --disable-doc --disable-avdevice --disable-postproc --disable-avfilter --disable-network --disable-encoders --disable-muxers
make -j$(getconf _NPROCESSORS_ONLN)
make -j$(getconf _NPROCESSORS_ONLN) install
cd ..
git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash
cd lsmash
./configure --prefix="${LOCAL_INSTALL_DIR}" --extra-ldflags="-static"
make -j$(getconf _NPROCESSORS_ONLN)
make -j$(getconf _NPROCESSORS_ONLN) install
cd ..
export PKG_CONFIG_PATH=`/bin/ls -d $PWD/av/*/lib/pkgconfig`
./configure --enable-pic --enable-strip --extra-ldflags="-static"
make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm
artifacts:
......@@ -73,12 +81,19 @@ build-debian-aarch64:
extends: build-debian-amd64
script: |
set -x
curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 https://nightlies.videolan.org/build/contribs/vlc-contrib-${_TRIPLET}-latest.tar.bz2 || curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 https://nightlies.videolan.org/build/${_PATH}/last/vlc-contrib-${_TRIPLET}-`date +%Y%m%d`.tar.bz2
LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET}
export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig
curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 https://nightlies.videolan.org/build/contribs/vlc-contrib-${_TRIPLET}-latest.tar.bz2
bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2
tar xvf vlc-contrib-${_TRIPLET}-latest.tar
sed -i "s#@@CONTRIB_PREFIX@@#`pwd`/${_TRIPLET}#g" ${_TRIPLET}/lib/pkgconfig/*.pc
export PKG_CONFIG_LIBDIR=`pwd`/${_TRIPLET}/lib/pkgconfig
./configure --host=${_TRIPLET} --cross-prefix=${_TRIPLET}- --enable-pic --enable-strip
sed -i "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc
git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash
cd lsmash
./configure --prefix="${LOCAL_INSTALL_DIR}" --target-os="${_TRIPLET}" --cross-prefix="${_TRIPLET}-"
make -j$(getconf _NPROCESSORS_ONLN)
make -j$(getconf _NPROCESSORS_ONLN) install
cd ..
./configure --host="${_TRIPLET}" --cross-prefix="${_TRIPLET}-" --enable-pic --enable-strip
make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm
build-win32:
......@@ -95,12 +110,19 @@ build-macos:
- macos
script: |
set -x
curl -O https://nightlies.videolan.org/build/contribs/vlc-contrib-${_TRIPLET}-latest.tar.bz2
LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET}
export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig
curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 https://nightlies.videolan.org/build/contribs/vlc-contrib-${_TRIPLET}-latest.tar.bz2
bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2
tar xvf vlc-contrib-${_TRIPLET}-latest.tar
sed -i.bak "s#@@CONTRIB_PREFIX@@#`pwd`/${_TRIPLET}#g" ${_TRIPLET}/lib/pkgconfig/*.pc
export PKG_CONFIG_LIBDIR=`pwd`/${_TRIPLET}/lib/pkgconfig
./configure --enable-strip
sed -i.bak "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc
git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash
cd lsmash
./configure --prefix="${LOCAL_INSTALL_DIR}"
make -j$(getconf _NPROCESSORS_ONLN)
make -j$(getconf _NPROCESSORS_ONLN) install
cd ..
./configure --enable-pic --enable-strip
make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm
variables: *variables-macos
......
......@@ -272,7 +272,7 @@ PLANE_INTERLEAVE(neon)
PROPAGATE_LIST(neon)
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf )
void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......
......@@ -27,6 +27,6 @@
#define X264_AARCH64_MC_H
#define x264_mc_init_aarch64 x264_template(mc_init_aarch64)
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -28,7 +28,7 @@
#include "predict.h"
#include "pixel.h"
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......@@ -47,7 +47,7 @@ void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......@@ -67,7 +67,7 @@ void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] )
}
void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -82,7 +82,7 @@ void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -100,7 +100,7 @@ void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_pred
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......
......@@ -106,14 +106,14 @@ void x264_predict_16x16_h_neon( uint8_t *src );
void x264_predict_16x16_dc_neon( uint8_t *src );
#define x264_predict_4x4_init_aarch64 x264_template(predict_4x4_init_aarch64)
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_aarch64 x264_template(predict_8x8_init_aarch64)
void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#define x264_predict_8x8c_init_aarch64 x264_template(predict_8x8c_init_aarch64)
void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_aarch64 x264_template(predict_8x16c_init_aarch64)
void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_16x16_init_aarch64 x264_template(predict_16x16_init_aarch64)
void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#endif /* X264_AARCH64_PREDICT_H */
......@@ -725,15 +725,15 @@ function sub8x16_dct_dc_neon
vadd.s16 q3, q3, q15
vsub.s16 d17, d0, d1 @ b4
vadd.s16 d18, d2, d3 @ b1
vsub.s16 d19, d2, d3 @ b5
vsub.s16 d19, d2, d3 @ b5
vadd.s16 d20, d4, d5 @ b2
vsub.s16 d21, d4, d5 @ b6
vsub.s16 d21, d4, d5 @ b6
vadd.s16 d22, d6, d7 @ b3
vsub.s16 d23, d6, d7 @ b7
vsub.s16 d23, d6, d7 @ b7
vadd.s16 q0, q8, q9 @ b0 + b1, b4 + b5; a0, a2
vsub.s16 q1, q8, q9 @ b0 - b1, b4 - b5; a4, a6
vsub.s16 q1, q8, q9 @ b0 - b1, b4 - b5; a4, a6
vadd.s16 q2, q10, q11 @ b2 + b3, b6 + b7; a1, a3
vsub.s16 q3, q10, q11 @ b2 - b3, b6 - b7; a5, a7
vsub.s16 q3, q10, q11 @ b2 - b3, b6 - b7; a5, a7
vadd.s16 q8, q0, q2 @ a0 + a1, a2 + a3
vsub.s16 q9, q0, q2 @ a0 - a1, a2 - a3
......
......@@ -296,7 +296,7 @@ PLANE_INTERLEAVE(neon)
PROPAGATE_LIST(neon)
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf )
void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
......
......@@ -27,6 +27,6 @@
#define X264_ARM_MC_H
#define x264_mc_init_arm x264_template(mc_init_arm)
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -27,7 +27,7 @@
#include "predict.h"
#include "pixel.h"
void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
......@@ -46,7 +46,7 @@ void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -61,7 +61,7 @@ void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -74,7 +74,7 @@ void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -92,7 +92,7 @@ void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......
......@@ -92,14 +92,14 @@ void x264_predict_16x16_v_neon( uint8_t *src );
void x264_predict_16x16_p_neon( uint8_t *src );
#define x264_predict_4x4_init_arm x264_template(predict_4x4_init_arm)
void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_arm x264_template(predict_8x8_init_arm)
void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#define x264_predict_8x8c_init_arm x264_template(predict_8x8c_init_arm)
void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_arm x264_template(predict_8x16c_init_arm)
void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_16x16_init_arm x264_template(predict_16x16_init_arm)
void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#endif
......@@ -103,7 +103,7 @@ void *x264_malloc( int64_t i_size )
{
#define HUGE_PAGE_SIZE 2*1024*1024
#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */
if( i_size < 0 || i_size > (SIZE_MAX - HUGE_PAGE_SIZE) /*|| i_size > (SIZE_MAX - NATIVE_ALIGN - sizeof(void **))*/ )
if( i_size < 0 || (uint64_t)i_size > (SIZE_MAX - HUGE_PAGE_SIZE) /*|| (uint64_t)i_size > (SIZE_MAX - NATIVE_ALIGN - sizeof(void **))*/ )
{
x264_log_internal( X264_LOG_ERROR, "invalid size of malloc: %"PRId64"\n", i_size );
return NULL;
......@@ -180,7 +180,7 @@ char *x264_slurp_file( const char *filename )
if( !buf )
goto error;
b_error |= fread( buf, 1, i_size, fh ) != i_size;
b_error |= fread( buf, 1, i_size, fh ) != (uint64_t)i_size;
fclose( fh );
if( b_error )
{
......@@ -428,7 +428,7 @@ static int param_apply_preset( x264_param_t *param, const char *preset )
{
char *end;
int i = strtol( preset, &end, 10 );
if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 )
if( *end == 0 && i >= 0 && i < ARRAY_ELEMS(x264_preset_names)-1 )
preset = x264_preset_names[i];
if( !strcasecmp( preset, "ultrafast" ) )
......@@ -1259,7 +1259,7 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
OPT("zones")
p->rc.psz_zones = strdup(value);
OPT("crop-rect")
b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
b_error |= sscanf( value, "%d,%d,%d,%d", &p->crop_rect.i_left, &p->crop_rect.i_top,
&p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
OPT("psnr")
p->analyse.b_psnr = atobool(value);
......@@ -1425,7 +1425,7 @@ char *x264_param2string( x264_param_t *p, int b_res )
if( p->rc.i_vbv_buffer_size )
s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
s += sprintf( s, " crop_rect=%d,%d,%d,%d", p->crop_rect.i_left, p->crop_rect.i_top,
p->crop_rect.i_right, p->crop_rect.i_bottom );
if( p->i_frame_packing >= 0 )
s += sprintf( s, " frame-packing=%d", p->i_frame_packing );
......
......@@ -53,7 +53,7 @@
****************************************************************************/
#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
#define FIX8(f) ((int)(f*(1<<8)+.5))
#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
#define ARRAY_ELEMS(a) ((int)((sizeof(a))/(sizeof(a[0]))))
#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
......@@ -303,7 +303,7 @@ do {\
do {\
var = (void*)(intptr_t)prealloc_size;\
preallocs[prealloc_idx++] = (uint8_t**)&var;\
prealloc_size += ALIGN(size, NATIVE_ALIGN);\
prealloc_size += ALIGN((int64_t)(size), NATIVE_ALIGN);\
} while( 0 )
#define PREALLOC_END( ptr )\
......
......@@ -103,7 +103,7 @@ void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
x264_emms();
}
void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf )
void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf )
{
memset( pf, 0, sizeof(*pf) );
......
......@@ -66,7 +66,7 @@ typedef struct
} x264_bitstream_function_t;
#define x264_bitstream_init x264_template(bitstream_init)
void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf );
void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf );
/* A larger level table size theoretically could help a bit at extremely
* high bitrates, but the cost in cache is usually too high for it to be
......
......@@ -108,6 +108,8 @@
# define MPIXEL_X4(src) M32(src)
#endif
#define SIZEOF_PIXEL ((int)sizeof(pixel))
#define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src)
/****************************************************************************
......@@ -528,7 +530,7 @@ struct x264_t
int16_t (*mvr[2][X264_REF_MAX*2])[2];/* 16x16 mv for each possible ref */
int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */
uint32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
int32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
uint8_t *field;
/* buffer for weighted versions of the reference frames */
......
......@@ -362,7 +362,7 @@ int x264_cpu_fast_neon_mrc_test( void );
uint32_t x264_cpu_detect( void )
{
int flags = 0;
uint32_t flags = 0;
flags |= X264_CPU_ARMV6;
// don't do this hack if compiled with -mfpu=neon
......@@ -449,7 +449,7 @@ int x264_cpu_num_processors( void )
return CPU_COUNT(&p_aff);
#else
int np = 0;
for( unsigned int bit = 0; bit < 8 * sizeof(p_aff); bit++ )
for( size_t bit = 0; bit < 8 * sizeof(p_aff); bit++ )
np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1;
return np;
#endif
......
......@@ -472,7 +472,7 @@ static void add16x16_idct_dc( pixel *p_dst, dctcoef dct[16] )
/****************************************************************************
* x264_dct_init:
****************************************************************************/
void x264_dct_init( int cpu, x264_dct_function_t *dctf )
void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf )
{
dctf->sub4x4_dct = sub4x4_dct;
dctf->add4x4_idct = add4x4_idct;
......@@ -901,7 +901,7 @@ static void zigzag_interleave_8x8_cavlc( dctcoef *dst, dctcoef *src, uint8_t *nn
}
}
void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
{
pf_interlaced->scan_8x8 = zigzag_scan_8x8_field;
pf_progressive->scan_8x8 = zigzag_scan_8x8_frame;
......
......@@ -70,8 +70,8 @@ typedef struct
} x264_zigzag_function_t;
#define x264_dct_init x264_template(dct_init)
void x264_dct_init( int cpu, x264_dct_function_t *dctf );
void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf );
#define x264_zigzag_init x264_template(zigzag_init)
void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
#endif
......@@ -681,7 +681,7 @@ void x264_macroblock_deblock( x264_t *h )
#include "mips/deblock.h"
#endif
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff )
void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff )
{
pf->deblock_luma[1] = deblock_v_luma_c;
pf->deblock_luma[0] = deblock_h_luma_c;
......
......@@ -77,7 +77,7 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
#endif
/* ensure frame alignment after PADH is added */
int padh_align = X264_MAX( align - PADH * (int)sizeof(pixel), 0 ) / sizeof(pixel);
int padh_align = X264_MAX( align - PADH * SIZEOF_PIXEL, 0 ) / SIZEOF_PIXEL;
CHECKED_MALLOCZERO( frame, sizeof(x264_frame_t) );
PREALLOC_INIT
......@@ -152,9 +152,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12);
int chroma_plane_size = (frame->i_stride[1] * (frame->i_lines[1] + 2*chroma_padv));
PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
if( PARAM_INTERLACED )
PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
}
/* all 4 luma planes allocated together, since the cacheline split code
......@@ -167,9 +167,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
luma_plane_size *= 4;
/* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */
PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
if( PARAM_INTERLACED )
PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
}
frame->b_duplicate = 0;
......@@ -207,7 +207,7 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
int64_t luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * SIZEOF_PIXEL );
for( int j = 0; j <= !!h->param.i_bframe; j++ )
for( int i = 0; i <= h->param.i_bframe; i++ )
......@@ -419,7 +419,7 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
h->mc.plane_copy_deinterleave_v210( dst->plane[0], dst->i_stride[0],
dst->plane[1], dst->i_stride[1],
(uint32_t *)pix[0], stride[0]/sizeof(uint32_t), h->param.i_width, h->param.i_height );
(uint32_t *)pix[0], stride[0]/(int)sizeof(uint32_t), h->param.i_width, h->param.i_height );
}
else if( i_csp >= X264_CSP_BGR )
{
......@@ -434,25 +434,25 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
h->mc.plane_copy_deinterleave_rgb( dst->plane[1+b], dst->i_stride[1+b],
dst->plane[0], dst->i_stride[0],
dst->plane[2-b], dst->i_stride[2-b],
(pixel*)pix[0], stride[0]/sizeof(pixel), i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
(pixel*)pix[0], stride[0]/SIZEOF_PIXEL, i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
}
else
{
int v_shift = CHROMA_V_SHIFT;
get_plane_ptr( h, src, &pix[0], &stride[0], 0, 0, 0 );
h->mc.plane_copy( dst->plane[0], dst->i_stride[0], (pixel*)pix[0],
stride[0]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[0]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );
stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_NV21 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy_swap( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width>>1, h->param.i_height>>v_shift );
stride[1]/SIZEOF_PIXEL, h->param.i_width>>1, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_I420 || i_csp == X264_CSP_I422 || i_csp == X264_CSP_YV12 || i_csp == X264_CSP_YV16 )
{
......@@ -460,8 +460,8 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
get_plane_ptr( h, src, &pix[1], &stride[1], uv_swap ? 2 : 1, 1, v_shift );
get_plane_ptr( h, src, &pix[2], &stride[2], uv_swap ? 1 : 2, 1, v_shift );
h->mc.plane_copy_interleave( dst->plane[1], dst->i_stride[1],
(pixel*)pix[1], stride[1]/sizeof(pixel),
(pixel*)pix[2], stride[2]/sizeof(pixel),
(pixel*)pix[1], stride[1]/SIZEOF_PIXEL,
(pixel*)pix[2], stride[2]/SIZEOF_PIXEL,
h->param.i_width>>1, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_I444 || i_csp == X264_CSP_YV24 )
......@@ -469,9 +469,9 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
get_plane_ptr( h, src, &pix[1], &stride[1], i_csp==X264_CSP_I444 ? 1 : 2, 0, 0 );
get_plane_ptr( h, src, &pix[2], &stride[2], i_csp==X264_CSP_I444 ? 2 : 1, 0, 0 );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
h->mc.plane_copy( dst->plane[2], dst->i_stride[2], (pixel*)pix[2],
stride[2]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[2]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
}
}
return 0;
......@@ -535,18 +535,18 @@ static ALWAYS_INLINE void plane_expand_border( pixel *pix, int i_stride, int i_w
for( int y = 0; y < i_height; y++ )
{
/* left band */
pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
/* right band */
pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
}
/* upper band */
if( b_pad_top )
for( int y = 0; y < i_padv; y++ )
memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * sizeof(pixel) );
memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * SIZEOF_PIXEL );
/* lower band */
if( b_pad_bottom )
for( int y = 0; y < i_padv; y++ )
memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * sizeof(pixel) );
memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * SIZEOF_PIXEL );
#undef PPIXEL
}
......@@ -650,14 +650,14 @@ void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame )
for( int y = 0; y < i_height; y++ )
pixel_memset( &frame->plane[i][y*frame->i_stride[i] + i_width],
&frame->plane[i][y*frame->i_stride[i] + i_width - 1-h_shift],
i_padx>>h_shift, sizeof(pixel)<<h_shift );
i_padx>>h_shift, SIZEOF_PIXEL<<h_shift );
}
if( i_pady )
{
for( int y = i_height; y < i_height + i_pady; y++ )
memcpy( &frame->plane[i][y*frame->i_stride[i]],
&frame->plane[i][(i_height-(~y&PARAM_INTERLACED)-1)*frame->i_stride[i]],
(i_width + i_padx) * sizeof(pixel) );
(i_width + i_padx) * SIZEOF_PIXEL );
}
}
}
......@@ -672,7 +672,7 @@ void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y )
int pady = (h->mb.i_mb_height * 16 - h->param.i_height) >> v_shift;
pixel *fenc = h->fenc->plane[i] + 16*mb_x;
for( int y = height; y < height + pady; y++ )
memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*sizeof(pixel) );
memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*SIZEOF_PIXEL );
}
}
......@@ -685,12 +685,14 @@ void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed )
x264_pthread_mutex_unlock( &frame->mutex );
}
void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed )
int x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed )
{
int completed;
x264_pthread_mutex_lock( &frame->mutex );
while( frame->i_lines_completed < i_lines_completed )
while( (completed = frame->i_lines_completed) < i_lines_completed && i_lines_completed >= 0 )
x264_pthread_cond_wait( &frame->cv, &frame->mutex );
x264_pthread_mutex_unlock( &frame->mutex );
return completed;
}
void x264_threadslice_cond_broadcast( x264_t *h, int pass )
......
......@@ -246,12 +246,12 @@ void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b
void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame );
#define x264_deblock_init x264_template(deblock_init)
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff );
void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff );
#define x264_frame_cond_broadcast x264_template(frame_cond_broadcast)
void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed );
#define x264_frame_cond_wait x264_template(frame_cond_wait)
void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
int x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
#define x264_frame_new_slice x264_template(frame_new_slice)
int x264_frame_new_slice( x264_t *h, x264_frame_t *frame );
......
......@@ -260,7 +260,7 @@ int x264_macroblock_cache_allocate( x264_t *h )
PREALLOC( h->mb.qp, i_mb_count * sizeof(int8_t) );
PREALLOC( h->mb.cbp, i_mb_count * sizeof(int16_t) );
PREALLOC( h->mb.mb_transform_size, i_mb_count * sizeof(int8_t) );
PREALLOC( h->mb.slice_table, i_mb_count * sizeof(uint32_t) );
PREALLOC( h->mb.slice_table, i_mb_count * sizeof(int32_t) );
/* 0 -> 3 top(4), 4 -> 6 : left(3) */
PREALLOC( h->mb.intra4x4_pred_mode, i_mb_count * 8 * sizeof(int8_t) );
......@@ -321,12 +321,12 @@ int x264_macroblock_cache_allocate( x264_t *h )
}
for( int i = 0; i < numweightbuf; i++ )
PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * sizeof(pixel) );
PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * SIZEOF_PIXEL );
}
PREALLOC_END( h->mb.base );
memset( h->mb.slice_table, -1, i_mb_count * sizeof(uint32_t) );
memset( h->mb.slice_table, -1, i_mb_count * sizeof(int32_t) );
for( int i = 0; i < 2; i++ )
{
......@@ -357,7 +357,7 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
for( int i = 0; i < (PARAM_INTERLACED ? 5 : 2); i++ )
for( int j = 0; j < (CHROMA444 ? 3 : 2); j++ )
{
CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * sizeof(pixel) );
CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * SIZEOF_PIXEL );
h->intra_border_backup[i][j] += 16;
}
for( int i = 0; i <= PARAM_INTERLACED; i++ )
......@@ -586,15 +586,15 @@ static ALWAYS_INLINE void macroblock_load_pic_pointers( x264_t *h, int mb_x, int
if( b_chroma )
{
h->mc.load_deinterleave_chroma_fenc( h->mb.pic.p_fenc[1], h->mb.pic.p_fenc_plane[1], i_stride2, height );
memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*SIZEOF_PIXEL );
memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*SIZEOF_PIXEL );
h->mb.pic.p_fdec[1][-FDEC_STRIDE-1] = intra_fdec[-1-8];
h->mb.pic.p_fdec[2][-FDEC_STRIDE-1] = intra_fdec[-1];
}
else
{
h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[i], FENC_STRIDE, h->mb.pic.p_fenc_plane[i], i_stride2, 16 );
memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*SIZEOF_PIXEL );
h->mb.pic.p_fdec[i][-FDEC_STRIDE-1] = intra_fdec[-1];
}
if( b_mbaff || h->mb.b_reencode_mb )
......@@ -1642,17 +1642,17 @@ static ALWAYS_INLINE void macroblock_backup_intra( x264_t *h, int mb_x, int mb_y
* bottom row of each field. We also store samples needed for the next
* mbpair in intra_border_backup[2]. */
int backup_dst = !b_mbaff ? (mb_y&1) : (mb_y&1) ? 1 : MB_INTERLACED ? 0 : 2;
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
}
else if( CHROMA_FORMAT )
{
int backup_src = (15>>CHROMA_V_SHIFT) * FDEC_STRIDE;
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*SIZEOF_PIXEL );
}
if( b_mbaff )
{
......@@ -1660,18 +1660,18 @@ static ALWAYS_INLINE void macroblock_backup_intra( x264_t *h, int mb_x, int mb_y
{
int backup_src = (MB_INTERLACED ? 7 : 14) * FDEC_STRIDE;
backup_dst = MB_INTERLACED ? 2 : 0;
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*SIZEOF_PIXEL );
}
else if( CHROMA_FORMAT )
{
if( CHROMA_FORMAT == CHROMA_420 )
backup_src = (MB_INTERLACED ? 3 : 6) * FDEC_STRIDE;
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*SIZEOF_PIXEL );
}
}
}
......
......@@ -160,7 +160,7 @@ static void mc_copy( pixel *src, intptr_t i_src_stride, pixel *dst, intptr_t i_d
{
for( int y = 0; y < i_height; y++ )
{
memcpy( dst, src, i_width * sizeof(pixel) );
memcpy( dst, src, i_width * SIZEOF_PIXEL );
src += i_src_stride;
dst += i_dst_stride;
......@@ -293,7 +293,7 @@ void x264_plane_copy_c( pixel *dst, intptr_t i_dst,
{
while( h-- )
{
memcpy( dst, src, w * sizeof(pixel) );
memcpy( dst, src, w * SIZEOF_PIXEL );
dst += i_dst;
src += i_src;
}
......@@ -462,7 +462,7 @@ void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame )
// duplicate last row and column so that their interpolation doesn't have to be special-cased
for( int y = 0; y < i_height; y++ )
src[i_width+y*i_stride] = src[i_width-1+y*i_stride];
memcpy( src+i_stride*i_height, src+i_stride*(i_height-1), (i_width+1) * sizeof(pixel) );
memcpy( src+i_stride*i_height, src+i_stride*(i_height-1), (i_width+1) * SIZEOF_PIXEL );
h->mc.frame_init_lowres_core( src, frame->lowres[0], frame->lowres[1], frame->lowres[2], frame->lowres[3],
i_stride, frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres );
x264_frame_expand_border_lowres( frame );
......@@ -529,7 +529,7 @@ static void mbtree_propagate_list( x264_t *h, uint16_t *ref_costs, int16_t (*mvs
unsigned width = h->mb.i_mb_width;
unsigned height = h->mb.i_mb_height;
for( unsigned i = 0; i < len; i++ )
for( int i = 0; i < len; i++ )
{
int lists_used = lowres_costs[i]>>LOWRES_COST_SHIFT;
......@@ -607,7 +607,7 @@ static void mbtree_fix8_unpack( float *dst, uint16_t *src, int count )
dst[i] = (int16_t)endian_fix16( src[i] ) * (1.0f/256.0f);
}
void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent )
void x264_mc_init( uint32_t cpu, x264_mc_functions_t *pf, int cpu_independent )
{
pf->mc_luma = mc_luma;
pf->get_ref = get_ref;
......
......@@ -53,7 +53,7 @@ static void mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t
unsigned width = h->mb.i_mb_width;\
unsigned height = h->mb.i_mb_height;\
\
for( unsigned i = 0; i < len; current += 32 )\
for( int i = 0; i < len; current += 32 )\
{\
int end = X264_MIN( i+8, len );\
for( ; i < end; i++, current += 2 )\
......@@ -107,7 +107,7 @@ void x264_plane_copy_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY(align, cpu)\
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;\
int c_w = (align) / SIZEOF_PIXEL - 1;\
if( w < 256 ) /* tiny resolutions don't want non-temporal hints. dunno the exact threshold. */\
x264_plane_copy_c( dst, i_dst, src, i_src, w, h );\
else if( !(w&c_w) )\
......@@ -126,7 +126,7 @@ static void plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i
x264_plane_copy_core_##cpu( dst+i_dst, i_dst, src+i_src, i_src, (w+c_w)&~c_w, h );\
}\
/* use plain memcpy on the last line (in memory order) to avoid overreading src. */\
memcpy( dst, src, w*sizeof(pixel) );\
memcpy( dst, src, w*SIZEOF_PIXEL );\
}\
}
......@@ -136,7 +136,7 @@ void x264_plane_copy_swap_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h
#define PLANE_COPY_SWAP(align, cpu)\
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;\
int c_w = (align>>1) / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_swap_core_##cpu( dst, i_dst, src, i_src, w, h );\
else if( w > c_w )\
......@@ -173,7 +173,7 @@ void x264_plane_copy_deinterleave_c( pixel *dsta, intptr_t i_dsta, pixel *dstb,
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;\
int c_w = (align>>1) / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_deinterleave_##cpu( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\
else if( w > c_w )\
......@@ -207,7 +207,7 @@ 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;\
int c_w = 16 / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_interleave_core_##cpu( dst, i_dst, srcu, i_srcu, srcv, i_srcv, w, h );\
else if( w > c_w && (i_srcu ^ i_srcv) >= 0 ) /* only works correctly for strides with identical signs */\
......@@ -340,6 +340,6 @@ typedef struct
} x264_mc_functions_t;
#define x264_mc_init x264_template(mc_init)
void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent );
void x264_mc_init( uint32_t cpu, x264_mc_functions_t *pf, int cpu_independent );
#endif
......@@ -3650,7 +3650,7 @@ static weight_fn_t mc_weight_wtab_msa[6] =
};
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_mips( int32_t cpu, x264_mc_functions_t *pf )
void x264_mc_init_mips( uint32_t cpu, x264_mc_functions_t *pf )
{
#if !HIGH_BIT_DEPTH
if( cpu & X264_CPU_MSA )
......
......@@ -27,6 +27,6 @@
#define X264_MIPS_MC_H
#define x264_mc_init_mips x264_template(mc_init_mips)
void x264_mc_init_mips( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_mips( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -133,7 +133,7 @@ static cl_program opencl_cache_load( x264_t *h, const char *dev_name, const char
fseek( fp, 0, SEEK_END );
int64_t file_size = ftell( fp );
fseek( fp, 0, SEEK_SET );
if( file_size < 0 || file_size > SIZE_MAX )
if( file_size < 0 || (uint64_t)file_size > SIZE_MAX )
goto fail;
size_t size = file_size;
CHECKED_MALLOC( binary, size );
......
......@@ -185,7 +185,7 @@ static inline int x264_vfprintf( FILE *stream, const char *format, va_list arg )
int length = vsnprintf( buf, sizeof(buf), format, arg2 );
va_end( arg2 );
if( length > 0 && length < sizeof(buf) )
if( length > 0 && (unsigned)length < sizeof(buf) )
{
/* WriteConsoleW is the most reliable way to output Unicode to a console. */
int length_utf16 = MultiByteToWideChar( CP_UTF8, 0, buf, length, buf_utf16, sizeof(buf_utf16)/sizeof(wchar_t) );
......@@ -423,7 +423,7 @@ static ALWAYS_INLINE uint64_t endian_fix64( uint64_t x )
return endian_fix32(x>>32) + ((uint64_t)endian_fix32(x)<<32);
}
#endif
static ALWAYS_INLINE intptr_t endian_fix( intptr_t x )
static ALWAYS_INLINE uintptr_t endian_fix( uintptr_t x )
{
return WORD_SIZE == 8 ? endian_fix64(x) : endian_fix32(x);
}
......
......@@ -804,7 +804,7 @@ static int x264_pixel_ads1( int enc_dc[1], uint16_t *sums, int delta,
/****************************************************************************
* x264_pixel_init:
****************************************************************************/
void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
void x264_pixel_init( uint32_t cpu, x264_pixel_function_t *pixf )
{
memset( pixf, 0, sizeof(*pixf) );
......
......@@ -144,7 +144,7 @@ typedef struct
} x264_pixel_function_t;
#define x264_pixel_init x264_template(pixel_init)
void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
void x264_pixel_init( uint32_t cpu, x264_pixel_function_t *pixf );
#define x264_pixel_ssd_nv12 x264_template(pixel_ssd_nv12)
void x264_pixel_ssd_nv12 ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
......
......@@ -883,7 +883,7 @@ static void predict_8x8_hu_c( pixel *src, pixel edge[36] )
/****************************************************************************
* Exported functions:
****************************************************************************/
void x264_predict_16x16_init( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_16x16_V ] = x264_predict_16x16_v_c;
pf[I_PRED_16x16_H ] = x264_predict_16x16_h_c;
......@@ -926,7 +926,7 @@ void x264_predict_16x16_init( int cpu, x264_predict_t pf[7] )
#endif
}
void x264_predict_8x8c_init( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_CHROMA_V ] = x264_predict_8x8c_v_c;
pf[I_PRED_CHROMA_H ] = x264_predict_8x8c_h_c;
......@@ -963,7 +963,7 @@ void x264_predict_8x8c_init( int cpu, x264_predict_t pf[7] )
#endif
}
void x264_predict_8x16c_init( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_CHROMA_V ] = x264_predict_8x16c_v_c;
pf[I_PRED_CHROMA_H ] = x264_predict_8x16c_h_c;
......@@ -986,7 +986,7 @@ void x264_predict_8x16c_init( int cpu, x264_predict_t pf[7] )
#endif
}
void x264_predict_8x8_init( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
void x264_predict_8x8_init( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
pf[I_PRED_8x8_V] = x264_predict_8x8_v_c;
pf[I_PRED_8x8_H] = x264_predict_8x8_h_c;
......@@ -1024,7 +1024,7 @@ void x264_predict_8x8_init( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_
#endif
}
void x264_predict_4x4_init( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init( uint32_t cpu, x264_predict_t pf[12] )
{
pf[I_PRED_4x4_V] = x264_predict_4x4_v_c;
pf[I_PRED_4x4_H] = x264_predict_4x4_h_c;
......
......@@ -147,14 +147,14 @@ void x264_predict_8x16c_v_c ( pixel *src );
void x264_predict_8x16c_p_c ( pixel *src );
#define x264_predict_16x16_init x264_template(predict_16x16_init)
void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init ( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x8c_init x264_template(predict_8x8c_init)
void x264_predict_8x8c_init ( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init ( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init x264_template(predict_8x16c_init)
void x264_predict_8x16c_init ( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init ( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_4x4_init x264_template(predict_4x4_init)
void x264_predict_4x4_init ( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init ( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init x264_template(predict_8x8_init)
void x264_predict_8x8_init ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
void x264_predict_8x8_init ( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#endif
......@@ -408,7 +408,7 @@ level_run(16)
#define INIT_TRELLIS(...)
#endif
void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf )
void x264_quant_init( x264_t *h, uint32_t cpu, x264_quant_function_t *pf )
{
pf->quant_8x8 = quant_8x8;
pf->quant_4x4 = quant_4x4;
......
......@@ -70,6 +70,6 @@ typedef struct
} x264_quant_function_t;
#define x264_quant_init x264_template(quant_init)
void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf );
void x264_quant_init( x264_t *h, uint32_t cpu, x264_quant_function_t *pf );
#endif
......@@ -2535,5 +2535,5 @@ const vlc_t x264_run_before_init[7][16] =
},
};
/* psy_trellis_init() has the largest size requirement of 16*FDEC_STRIDE*sizeof(pixel) */
/* psy_trellis_init() has the largest size requirement of 16*FDEC_STRIDE*SIZEOF_PIXEL */
ALIGNED_64( uint8_t x264_zero[1024] ) = { 0 };
......@@ -674,7 +674,7 @@ cglobal cabac_block_residual_internal, 4,15,0,-4*64
xor r10d, r10d
cmp countcatd, 63
je .sigmap_8x8
SIGMAP_LOOP 0, r12d, countcatd,
SIGMAP_LOOP 0, r12d, countcatd
.sigmap_8x8:
SIGMAP_LOOP 1, r11d, 63, _8x8
.level_loop_start:
......
......@@ -56,7 +56,7 @@ const pw_4, times 8 dw 4
const pw_8, times 8 dw 8
const pw_64, times 8 dw 64
const pw_256, times 8 dw 256
const pw_32_0, times 4 dw 32,
const pw_32_0, times 4 dw 32
times 4 dw 0
const pw_8000, times 8 dw 0x8000
const pw_3fff, times 8 dw 0x3fff
......
......@@ -791,7 +791,7 @@ static void mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_
}
#endif
void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf )
void x264_mc_init_mmx( uint32_t cpu, x264_mc_functions_t *pf )
{
if( !(cpu&X264_CPU_MMX) )
return;
......
......@@ -28,6 +28,6 @@
#define X264_X86_MC_H
#define x264_mc_init_mmx x264_template(mc_init_mmx)
void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_mmx( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -311,7 +311,7 @@ static void predict_8x8c_dc_left( uint8_t *src )
/****************************************************************************
* Exported functions:
****************************************************************************/
void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX2) )
return;
......@@ -370,7 +370,7 @@ void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] )
}
}
void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX) )
return;
......@@ -428,7 +428,7 @@ void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] )
}
}
void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX) )
return;
......@@ -479,7 +479,7 @@ void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] )
}
}
void x264_predict_8x8_init_mmx( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter )
void x264_predict_8x8_init_mmx( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter )
{
if( !(cpu&X264_CPU_MMX2) )
return;
......@@ -563,7 +563,7 @@ void x264_predict_8x8_init_mmx( int cpu, x264_predict8x8_t pf[12], x264_predict_
#endif // HIGH_BIT_DEPTH
}
void x264_predict_4x4_init_mmx( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init_mmx( uint32_t cpu, x264_predict_t pf[12] )
{
if( !(cpu&X264_CPU_MMX2) )
return;
......
......@@ -28,15 +28,15 @@
#define X264_X86_PREDICT_H
#define x264_predict_16x16_init_mmx x264_template(predict_16x16_init_mmx)
void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init_mmx( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_mmx x264_template(predict_8x16c_init_mmx)
void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init_mmx( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x8c_init_mmx x264_template(predict_8x8c_init_mmx)
void x264_predict_8x8c_init_mmx ( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init_mmx ( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_4x4_init_mmx x264_template(predict_4x4_init_mmx)
void x264_predict_4x4_init_mmx ( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init_mmx ( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_mmx x264_template(predict_8x8_init_mmx)
void x264_predict_8x8_init_mmx ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter );
void x264_predict_8x8_init_mmx ( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter );
#define x264_predict_16x16_v_mmx2 x264_template(predict_16x16_v_mmx2)
void x264_predict_16x16_v_mmx2( pixel *src );
......
......@@ -356,7 +356,7 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%define vzeroupper_required (mmsize > 16 && (ARCH_X86_64 == 0 || xmm_regs_used > 16 || notcpuflag(avx512)))
%define high_mm_regs (16*cpuflag(avx512))
%macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only)
%macro ALLOC_STACK 0-2 0, 0 ; stack_size, n_xmm_regs (for win64 only)
%ifnum %1
%if %1 != 0
%assign %%pad 0
......@@ -401,7 +401,7 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%endif
%endmacro
%macro SETUP_STACK_POINTER 1
%macro SETUP_STACK_POINTER 0-1 0
%ifnum %1
%if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
%if %1 > 0
......@@ -423,16 +423,6 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%endif
%endmacro
%macro DEFINE_ARGS_INTERNAL 3+
%ifnum %2
DEFINE_ARGS %3
%elif %1 == 4
DEFINE_ARGS %2
%elif %1 > 4
DEFINE_ARGS %2, %3
%endif
%endmacro
%if WIN64 ; Windows x64 ;=================================================
DECLARE_REG 0, rcx
......@@ -451,7 +441,7 @@ DECLARE_REG 12, R15, 104
DECLARE_REG 13, R12, 112
DECLARE_REG 14, R13, 120
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
......@@ -463,7 +453,15 @@ DECLARE_REG 14, R13, 120
WIN64_SPILL_XMM %3
%endif
LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%if %0 > 4
%ifnum %4
DEFINE_ARGS %5
%else
DEFINE_ARGS %4, %5
%endif
%elifnnum %4
DEFINE_ARGS %4
%endif
%endmacro
%macro WIN64_PUSH_XMM 0
......@@ -559,7 +557,7 @@ DECLARE_REG 12, R15, 56
DECLARE_REG 13, R12, 64
DECLARE_REG 14, R13, 72
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
%assign xmm_regs_used %3
......@@ -569,7 +567,15 @@ DECLARE_REG 14, R13, 72
PUSH_IF_USED 9, 10, 11, 12, 13, 14
ALLOC_STACK %4
LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%if %0 > 4
%ifnum %4
DEFINE_ARGS %5
%else
DEFINE_ARGS %4, %5
%endif
%elifnnum %4
DEFINE_ARGS %4
%endif
%endmacro
%define has_epilogue regs_used > 9 || stack_size > 0 || vzeroupper_required
......@@ -610,7 +616,7 @@ DECLARE_REG 6, ebp, 28
DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
......@@ -625,7 +631,15 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
DEFINE_ARGS_INTERNAL %0, %4, %5
%if %0 > 4
%ifnum %4
DEFINE_ARGS %5
%else
DEFINE_ARGS %4, %5
%endif
%elifnnum %4
DEFINE_ARGS %4
%endif
%endmacro
%define has_epilogue regs_used > 3 || stack_size > 0 || vzeroupper_required
......
......@@ -584,8 +584,10 @@
%elif %1==2
%if mmsize==8
SBUTTERFLY dq, %3, %4, %5
%else
%elif %0==6
TRANS q, ORDER, %3, %4, %5, %6
%else
TRANS q, ORDER, %3, %4, %5
%endif
%elif %1==4
SBUTTERFLY qdq, %3, %4, %5
......
......@@ -811,7 +811,7 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
......