Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Nov 6, 2022
2 parents 8e8141f + b093bbe commit 011686c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
11 changes: 7 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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}-"
Expand Down Expand Up @@ -147,14 +149,15 @@ 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}
CONTRIB_NAME=$(sed -n -e "s@.*href=\"\(vlc-contrib-${_TRIPLET}-[^\"]*\.tar\.bz2\)\".*@\1@p" vlc-contrib.txt | sed -n -e '1p')
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}"
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions autocomplete.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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( ' ' );
}
}

Expand All @@ -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 );
}
Expand Down Expand Up @@ -403,5 +403,6 @@ int x264_cli_autocomplete( const char *prev, const char *cur )
suggest_list( opts_special );
}

putchar( '\n' );
return 0;
}
23 changes: 12 additions & 11 deletions common/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/macroblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 4 additions & 0 deletions input/ffms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down

0 comments on commit 011686c

Please sign in to comment.