diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb62a9765..b5d4d9451 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,6 +42,7 @@ stages: _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-x86_64/" _XCFLAGS: "-arch x86_64" _XLDFLAGS: "-arch x86_64" + _BIN_PATH: /Users/videolanci/sandbox/bin .variables-macos-arm64: &variables-macos-arm64 _TRIPLET: "aarch64-apple-darwin19" @@ -50,6 +51,7 @@ stages: _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-arm64/" _XCFLAGS: "-arch arm64" _XLDFLAGS: "-arch arm64" + _BIN_PATH: /Users/videolanci/sandbox/bin .build: stage: build @@ -106,7 +108,7 @@ build-debian-aarch64: curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 ${_CONTRIB_URL}${CONTRIB_NAME} bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2 tar xvf vlc-contrib-${_TRIPLET}-latest.tar - sed -i.bak -e "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc + perl -pi -e "s'@@CONTRIB_PREFIX@@'$(sed -e "s/'/\\\\'/g" <<< "${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}-" @@ -147,6 +149,7 @@ build-llvm-mingw-aarch64: extends: .build script: | set -x + export PATH="${_BIN_PATH}:$PATH" LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET} export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig curl -f -o vlc-contrib.txt ${_CONTRIB_URL} @@ -154,7 +157,7 @@ build-llvm-mingw-aarch64: curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 ${_CONTRIB_URL}${CONTRIB_NAME} bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2 tar xvf vlc-contrib-${_TRIPLET}-latest.tar - sed -i.bak -e "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc + perl -pi -e "s'@@CONTRIB_PREFIX@@'$(sed -e "s/'/\\\\'/g" <<< "${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}" --extra-cflags="${_XCFLAGS}" --extra-ldflags="${_XLDFLAGS}" @@ -168,14 +171,14 @@ build-macos-x86_64: extends: .build-macos tags: - amd64 - - catalina + - monterey variables: *variables-macos-x86_64 build-macos-arm64: extends: .build-macos tags: - amd64 - - catalina + - monterey variables: *variables-macos-arm64 .test: &test diff --git a/Makefile b/Makefile index 0ba46aa10..cfb72dabb 100644 --- a/Makefile +++ b/Makefile @@ -242,12 +242,12 @@ cli: x264$(EXE) lib-static: $(LIBX264) lib-shared: $(SONAME) -$(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM) +$(LIBX264): $(OBJS) $(OBJASM) rm -f $(LIBX264) $(AR)$@ $(OBJS) $(OBJASM) $(if $(RANLIB), $(RANLIB) $@) -$(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO) +$(SONAME): $(OBJS) $(OBJASM) $(OBJSO) $(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS) $(IMPLIBNAME): $(SONAME) @@ -260,16 +260,16 @@ checkasm10: checkasm10$(EXE) example: example$(EXE) endif -x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264) +x264$(EXE): $(OBJCLI) $(CLI_LIBX264) $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS) -checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264) +checkasm8$(EXE): $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LD)$@ $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LDFLAGS) -checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_10) $(LIBX264) +checkasm10$(EXE): $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LD)$@ $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LDFLAGS) -example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264) +example$(EXE): $(OBJEXAMPLE) $(LIBX264) $(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS) $(OBJS) $(OBJSO): CFLAGS += $(CFLAGSSO) @@ -316,7 +316,7 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXA %.o: %.rc x264.h x264res.manifest $(RC) $(RCFLAGS)$@ $< -.depend: config.mak +.depend: config.mak $(GENERATED) @rm -f .depend @echo 'dependency file generation...' ifeq ($(COMPILER),CL) diff --git a/autocomplete.c b/autocomplete.c index 3038b9bfc..2b32a8ad9 100644 --- a/autocomplete.c +++ b/autocomplete.c @@ -240,7 +240,7 @@ static int list_contains( const char * const *list, const char *s ) static void suggest( const char *s, const char *cur, int cur_len ) { if( s && *s && !strncmp( s, cur, cur_len ) ) - printf( "%s\n", s ); + printf( "%s ", s ); } static void suggest_lower( const char *s, const char *cur, int cur_len ) @@ -249,7 +249,7 @@ static void suggest_lower( const char *s, const char *cur, int cur_len ) { for( ; *s; s++ ) putchar( *s < 'A' || *s > 'Z' ? *s : *s | 0x20 ); - putchar( '\n' ); + putchar( ' ' ); } } @@ -273,7 +273,7 @@ static void suggest_token( const char *s, int delim, const char *cur, int cur_le { int tok_len = tok_end - s; if( tok_len && tok_len >= cur_len && !strncmp( s, cur, cur_len ) ) - printf( "%.*s\n", tok_len, s ); + printf( "%.*s ", tok_len, s ); } suggest( s, cur, cur_len ); } @@ -403,5 +403,6 @@ int x264_cli_autocomplete( const char *prev, const char *cur ) suggest_list( opts_special ); } + putchar( '\n' ); return 0; } diff --git a/common/frame.c b/common/frame.c index d21db7321..daad76479 100644 --- a/common/frame.c +++ b/common/frame.c @@ -211,24 +211,25 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec ) for( int j = 0; j <= !!h->param.i_bframe; j++ ) for( int i = 0; i <= h->param.i_bframe; i++ ) { - PREALLOC( frame->lowres_mvs[j][i], 2*h->mb.i_mb_count*sizeof(int16_t) ); - PREALLOC( frame->lowres_mv_costs[j][i], h->mb.i_mb_count*sizeof(int) ); + PREALLOC( frame->lowres_mvs[j][i], 2*i_mb_count*sizeof(int16_t) ); + PREALLOC( frame->lowres_mv_costs[j][i], i_mb_count*sizeof(int) ); } PREALLOC( frame->i_propagate_cost, i_mb_count * sizeof(uint16_t) ); for( int j = 0; j <= h->param.i_bframe+1; j++ ) for( int i = 0; i <= h->param.i_bframe+1; i++ ) PREALLOC( frame->lowres_costs[j][i], i_mb_count * sizeof(uint16_t) ); - - /* mbtree asm can overread the input buffers, make sure we don't read outside of allocated memory. */ - prealloc_size += NATIVE_ALIGN; } if( h->param.rc.i_aq_mode ) { - PREALLOC( frame->f_qp_offset, h->mb.i_mb_count * sizeof(float) ); - PREALLOC( frame->f_qp_offset_aq, h->mb.i_mb_count * sizeof(float) ); + PREALLOC( frame->f_qp_offset, i_mb_count * sizeof(float) ); + PREALLOC( frame->f_qp_offset_aq, i_mb_count * sizeof(float) ); if( h->frames.b_have_lowres ) - PREALLOC( frame->i_inv_qscale_factor, (h->mb.i_mb_count+3) * sizeof(uint16_t) ); + PREALLOC( frame->i_inv_qscale_factor, i_mb_count * sizeof(uint16_t) ); } + + /* mbtree asm can overread the input buffers, make sure we don't read outside of allocated memory. */ + if( h->frames.b_have_lowres ) + prealloc_size += NATIVE_ALIGN; } PREALLOC_END( frame->base ); @@ -281,14 +282,14 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec ) for( int j = 0; j <= !!h->param.i_bframe; j++ ) for( int i = 0; i <= h->param.i_bframe; i++ ) - memset( frame->lowres_mvs[j][i], 0, 2*h->mb.i_mb_count*sizeof(int16_t) ); + memset( frame->lowres_mvs[j][i], 0, 2*i_mb_count*sizeof(int16_t) ); frame->i_intra_cost = frame->lowres_costs[0][0]; - memset( frame->i_intra_cost, -1, (i_mb_count+3) * sizeof(uint16_t) ); + memset( frame->i_intra_cost, -1, i_mb_count * sizeof(uint16_t) ); if( h->param.rc.i_aq_mode ) /* shouldn't really be initialized, just silences a valgrind false-positive in x264_mbtree_propagate_cost_sse2 */ - memset( frame->i_inv_qscale_factor, 0, (h->mb.i_mb_count+3) * sizeof(uint16_t) ); + memset( frame->i_inv_qscale_factor, 0, i_mb_count * sizeof(uint16_t) ); } } diff --git a/common/macroblock.c b/common/macroblock.c index b4e56cc40..0f86051a6 100644 --- a/common/macroblock.c +++ b/common/macroblock.c @@ -388,7 +388,7 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead ) ((me_range*2+24) * sizeof(int16_t) + (me_range+4) * (me_range+1) * 4 * sizeof(mvsad_t)); scratch_size = X264_MAX3( buf_hpel, buf_ssim, buf_tesa ); } - int buf_mbtree = h->param.rc.b_mb_tree * ((h->mb.i_mb_width+15)&~15) * sizeof(int16_t); + int buf_mbtree = h->param.rc.b_mb_tree * ALIGN( h->mb.i_mb_width * sizeof(int16_t), NATIVE_ALIGN ); scratch_size = X264_MAX( scratch_size, buf_mbtree ); if( scratch_size ) CHECKED_MALLOC( h->scratch_buffer, scratch_size ); diff --git a/input/ffms.c b/input/ffms.c index 16cb0e180..a6d72b8e3 100644 --- a/input/ffms.c +++ b/input/ffms.c @@ -190,6 +190,10 @@ static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame ) memcpy( pic->img.stride, frame->Linesize, sizeof(pic->img.stride) ); memcpy( pic->img.plane, frame->Data, sizeof(pic->img.plane) ); + int is_fullrange = 0; + pic->img.width = frame->EncodedWidth; + pic->img.height = frame->EncodedHeight; + pic->img.csp = handle_jpeg( frame->EncodedPixelFormat, &is_fullrange ) | X264_CSP_OTHER; if( h->vfr_input ) {