Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/x264
  • EwoutH/x264
  • gramner/x264
  • BugMaster/x264
  • MaskRay/x264
  • thresh/x264
  • tpm/x264
  • wolfired/x264
  • ifb/x264
  • robinstorm/x264
  • ltnokiago/x264
  • janne/x264
  • Kromjunya/x264
  • trisnaayu0596/x264
  • felipegarcia1402/x264
  • coder2004/x264
  • philou/x264
  • walagnatalia/x264
  • DonDiego/x264
  • JHammler/x264
  • qyot27/x264
  • dwbuiten/x264
  • Kagami/x264
  • andriy-andreyev/x264
  • gxw/x264
  • trofi/x264
  • kierank/x264
  • aureliendavid/x264
  • galad/x264
  • roommini/x264
  • ocrete/x264
  • mstorsjo/x264
  • yinsj0116/x264
  • mamonet/x264
  • 1div0/x264
  • ko1265/x264
  • sergiomb2/x264
  • xutongda/x264
  • wenzhiwu/x264
  • arrowd/x264
  • FranceBB/x264
  • ziemek99/x264
  • longervision/x264
  • xopok/x264
  • jbk/x264
  • szatmary/x264
  • pekdon/x264
  • Jiangguyu/x264
  • jrtc27/x264
  • kankanol1/x264
  • gxwLite/x264
  • brad/x264
  • Gc6026/x264
  • jdek/x264
  • appcrash/x264
  • tguillem/x264
  • As/x264
  • wevian/x264
  • wangluls/x264
  • RellikJaeger/x264
  • hum/x264
  • rogerhardiman/x264
  • jankowalski12611/x264
  • zhijie1996/x264
  • yinshiyou/x264
  • Freed-Wu/x264
  • yajcoca/x264
  • bUd/x264
  • chienvannguyen2020/x264
  • nurbinakhatun386/x264
  • Siberiawind/x-264-meson
  • HecaiYuan/x264
  • david.chen/x264
  • Ytsejam76/x264
  • robUx4/x264
  • zhaoshiz/x-264-arm64ec
  • yintong.ustc/x-264-bd-ventana
  • nekobasu/x264
  • Courmisch/x264
  • BD-qjy/x264
  • quink/x264
  • markos/x264
  • pranavk/x264
83 results
Show changes
/****************************************************************************
* quant.S: arm quantization and level-run
*****************************************************************************
* Copyright (C) 2009-2021 x264 project
* Copyright (C) 2009-2022 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
......
/*****************************************************************************
* quant.h: arm quantization and level-run
*****************************************************************************
* Copyright (C) 2005-2021 x264 project
* Copyright (C) 2005-2022 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
......
/*****************************************************************************
* base.c: misc common functions (bit depth independent)
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -35,6 +35,8 @@
#include <sys/mman.h>
#endif
#define X264_ISDIGIT(x) isdigit((unsigned char)(x))
/****************************************************************************
* x264_reduce_fraction:
****************************************************************************/
......@@ -207,7 +209,7 @@ typedef struct {
void *ptr[];
} strdup_buffer;
#define BUFFER_OFFSET offsetof(strdup_buffer, ptr)
#define BUFFER_OFFSET (int)offsetof(strdup_buffer, ptr)
#define BUFFER_DEFAULT_SIZE 16
char *x264_param_strdup( x264_param_t *param, const char *src )
......@@ -922,7 +924,7 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
if( 0 );
OPT("asm")
{
p->cpu = isdigit(value[0]) ? atoi(value) :
p->cpu = X264_ISDIGIT(value[0]) ? (uint32_t)atoi(value) :
!strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
if( b_error )
{
......@@ -993,8 +995,8 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
b_error |= parse_enum( value, x264_avcintra_flavor_names, &p->i_avcintra_flavor );
OPT("sar")
{
b_error = ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) &&
2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) );
b_error |= ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) &&
2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) );
}
OPT("overscan")
b_error |= parse_enum( value, x264_overscan_names, &p->vui.i_overscan );
......@@ -1011,7 +1013,7 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
OPT("chromaloc")
{
p->vui.i_chroma_loc = atoi(value);
b_error = ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 );
b_error |= ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 );
}
OPT("mastering-display")
{
......@@ -1043,10 +1045,20 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
b_error |= parse_enum( value, x264_transfer_names, &p->i_alternative_transfer );
OPT("fps")
{
if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
int64_t i_fps_num;
int64_t i_fps_den;
if( sscanf( value, "%"SCNd64"/%"SCNd64, &i_fps_num, &i_fps_den ) == 2 )
{
p->i_fps_num = i_fps_num;
p->i_fps_den = i_fps_den;
b_error |= i_fps_num < 1 || i_fps_num > UINT32_MAX || i_fps_den < 1 || i_fps_den > UINT32_MAX;
}
else
{
double fps = atof(value);
if( fps > 0.0 && fps <= INT_MAX/1000.0 )
if( fps < 0.0005 || fps > INT_MAX )
b_error = 1;
else if( fps <= INT_MAX/1000.0 )
{
p->i_fps_num = (int)(fps * 1000.0 + .5);
p->i_fps_den = 1000;
......
/*****************************************************************************
* base.h: misc common functions (bit depth independent)
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......@@ -82,7 +82,7 @@ typedef union { x264_uint128_t i; uint64_t q[2]; uint32_t d[4]; uint16_t w[8]; u
#define MEM_DYN(x, t) (*(t (*)[])(x))
#else
//older versions of gcc prefer casting to structure instead of array
#define MEM_FIX(x, t, s) (*(struct { t a[s]; } (*))(x))
#define MEM_FIX(x, t, s) (*(struct { t a[s]; } MAY_ALIAS (*))(x))
//let's set an arbitrary large constant size
#define MEM_DYN(x, t) MEM_FIX(x, t, 4096)
#endif
......
/*****************************************************************************
* bitstream.c: bitstream writing
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Fiona Glaser <fiona@x264.com>
......@@ -92,10 +92,10 @@ void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
{
/* Size doesn't include the size of the header we're writing now. */
int chunk_size = size - 4;
orig_dst[0] = chunk_size >> 24;
orig_dst[1] = chunk_size >> 16;
orig_dst[2] = chunk_size >> 8;
orig_dst[3] = chunk_size >> 0;
orig_dst[0] = (uint8_t)(chunk_size >> 24);
orig_dst[1] = (uint8_t)(chunk_size >> 16);
orig_dst[2] = (uint8_t)(chunk_size >> 8);
orig_dst[3] = (uint8_t)(chunk_size >> 0);
}
nal->i_payload = size;
......
/*****************************************************************************
* bitstream.h: bitstream writing
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
......
/*****************************************************************************
* cabac.c: arithmetic coder
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......@@ -89,10 +89,10 @@ static inline void cabac_putbyte( x264_cabac_t *cb )
cb->p[-1] += carry;
while( bytes_outstanding > 0 )
{
*(cb->p++) = carry-1;
*(cb->p++) = (uint8_t)(carry-1);
bytes_outstanding--;
}
*(cb->p++) = out;
*(cb->p++) = (uint8_t)out;
cb->i_bytes_outstanding = 0;
}
}
......@@ -143,7 +143,7 @@ void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val )
{
uint32_t v = val + (1<<exp_bits);
int k = 31 - x264_clz( v );
uint32_t x = (bypass_lut[k-exp_bits]<<exp_bits) + v;
uint32_t x = ((uint32_t)bypass_lut[k-exp_bits]<<exp_bits) + v;
k = 2*k+1-exp_bits;
int i = ((k-1)&7)+1;
do {
......
/*****************************************************************************
* cabac.h: arithmetic coder
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......
/*****************************************************************************
* common.c: misc common functions
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......
/*****************************************************************************
* common.h: misc common functions
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......
/*****************************************************************************
* cpu.c: cpu detection
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -27,19 +27,24 @@
#include "base.h"
#if HAVE_POSIXTHREAD && SYS_LINUX
#if SYS_CYGWIN || SYS_SunOS || SYS_OPENBSD
#include <unistd.h>
#endif
#if SYS_LINUX
#ifdef __ANDROID__
#include <unistd.h>
#else
#include <sched.h>
#endif
#endif
#if SYS_BEOS
#include <kernel/OS.h>
#endif
#if SYS_MACOSX || SYS_FREEBSD
#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#if SYS_OPENBSD
#include <sys/param.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#endif
......@@ -301,7 +306,7 @@ uint32_t x264_cpu_detect( void )
#elif HAVE_ALTIVEC
#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
#include <sys/sysctl.h>
uint32_t x264_cpu_detect( void )
{
/* Thank you VLC */
......
/*****************************************************************************
* cpu.h: cpu detection
*****************************************************************************
* Copyright (C) 2004-2021 x264 project
* Copyright (C) 2004-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
......
/*****************************************************************************
* dct.c: transform and zigzag
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......
/*****************************************************************************
* dct.h: transform and zigzag
*****************************************************************************
* Copyright (C) 2004-2021 x264 project
* Copyright (C) 2004-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
......
/*****************************************************************************
* deblock.c: deblocking
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......@@ -102,7 +102,7 @@ static ALWAYS_INLINE void deblock_edge_luma_c( pixel *pix, intptr_t xstride, int
tc++;
}
delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
delta = x264_clip3( (((q0 - p0 ) * 4) + (p1 - q1) + 4) >> 3, -tc, tc );
pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */
pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */
}
......@@ -143,7 +143,7 @@ static ALWAYS_INLINE void deblock_edge_chroma_c( pixel *pix, intptr_t xstride, i
if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
{
int delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
int delta = x264_clip3( (((q0 - p0 ) * 4) + (p1 - q1) + 4) >> 3, -tc, tc );
pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */
pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */
}
......@@ -315,10 +315,10 @@ static ALWAYS_INLINE void deblock_edge( x264_t *h, pixel *pix, intptr_t i_stride
if( !M32(bS) || !alpha || !beta )
return;
tc[0] = (tc0_table(index_a)[bS[0]] << (BIT_DEPTH-8)) + b_chroma;
tc[1] = (tc0_table(index_a)[bS[1]] << (BIT_DEPTH-8)) + b_chroma;
tc[2] = (tc0_table(index_a)[bS[2]] << (BIT_DEPTH-8)) + b_chroma;
tc[3] = (tc0_table(index_a)[bS[3]] << (BIT_DEPTH-8)) + b_chroma;
tc[0] = (tc0_table(index_a)[bS[0]] * (1 << (BIT_DEPTH-8))) + b_chroma;
tc[1] = (tc0_table(index_a)[bS[1]] * (1 << (BIT_DEPTH-8))) + b_chroma;
tc[2] = (tc0_table(index_a)[bS[2]] * (1 << (BIT_DEPTH-8))) + b_chroma;
tc[3] = (tc0_table(index_a)[bS[3]] * (1 << (BIT_DEPTH-8))) + b_chroma;
pf_inter( pix, i_stride, alpha, beta, tc );
}
......@@ -655,11 +655,11 @@ void x264_macroblock_deblock( x264_t *h )
} while( 0 )
if( !transform_8x8 ) FILTER( 0, 1 );
FILTER( 0, 2 );
FILTER( 0, 2 );
if( !transform_8x8 ) FILTER( 0, 3 );
if( !transform_8x8 ) FILTER( 1, 1 );
FILTER( 1, 2 );
FILTER( 1, 2 );
if( !transform_8x8 ) FILTER( 1, 3 );
#undef FILTER
......
/*****************************************************************************
* frame.c: frame handling
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......
/*****************************************************************************
* frame.h: frame handling
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......
/*****************************************************************************
* macroblock.c: macroblock common functions
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -1249,7 +1249,7 @@ static ALWAYS_INLINE void macroblock_cache_load( x264_t *h, int mb_x, int mb_y,
if( h->mb.cache.varref[l][index] >= 0 )\
{\
h->mb.cache.varref[l][index] >>= 1;\
h->mb.cache.varmv[l][index][1] <<= 1;\
h->mb.cache.varmv[l][index][1] *= 2;\
h->mb.cache.mvd[l][index][1] <<= 1;\
}
MAP_MVS
......
/*****************************************************************************
* macroblock.h: macroblock common functions
*****************************************************************************
* Copyright (C) 2005-2021 x264 project
* Copyright (C) 2005-2022 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -361,7 +361,7 @@ int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed );
* uses all neighbors, even those that didn't end up using this ref.
* h->mb. need only valid values from other blocks */
#define x264_mb_predict_mv_ref16x16 x264_template(mb_predict_mv_ref16x16)
void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[8][2], int *i_mvc );
void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t (*mvc)[2], int *i_mvc );
#define x264_mb_mc x264_template(mb_mc)
void x264_mb_mc( x264_t *h );
......@@ -395,9 +395,9 @@ static ALWAYS_INLINE uint32_t pack8to32( uint32_t a, uint32_t b, uint32_t c, uin
static ALWAYS_INLINE uint32_t pack16to32_mask( int a, int b )
{
#if WORDS_BIGENDIAN
return (b&0xFFFF) + (a<<16);
return (b&0xFFFF) + ((uint32_t)a<<16);
#else
return (a&0xFFFF) + (b<<16);
return (a&0xFFFF) + ((uint32_t)b<<16);
#endif
}
static ALWAYS_INLINE uint64_t pack32to64( uint32_t a, uint32_t b )
......
/*****************************************************************************
* mc.c: motion compensation
*****************************************************************************
* Copyright (C) 2003-2021 x264 project
* Copyright (C) 2003-2022 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
......@@ -116,7 +116,7 @@ static void weight_cache( x264_t *h, x264_weight_t *w )
static void mc_weight( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride,
const x264_weight_t *weight, int i_width, int i_height )
{
int offset = weight->i_offset << (BIT_DEPTH-8);
int offset = weight->i_offset * (1 << (BIT_DEPTH-8));
int scale = weight->i_scale;
int denom = weight->i_denom;
if( denom >= 1 )
......@@ -423,7 +423,7 @@ static void integral_init4h( uint16_t *sum, pixel *pix, intptr_t stride )
int v = pix[0]+pix[1]+pix[2]+pix[3];
for( int x = 0; x < stride-4; x++ )
{
sum[x] = v + sum[x-stride];
sum[x] = (uint16_t)(v + sum[x-stride]);
v += pix[x+4] - pix[x];
}
}
......@@ -433,7 +433,7 @@ static void integral_init8h( uint16_t *sum, pixel *pix, intptr_t stride )
int v = pix[0]+pix[1]+pix[2]+pix[3]+pix[4]+pix[5]+pix[6]+pix[7];
for( int x = 0; x < stride-8; x++ )
{
sum[x] = v + sum[x-stride];
sum[x] = (uint16_t)(v + sum[x-stride]);
v += pix[x+8] - pix[x];
}
}
......@@ -441,15 +441,15 @@ static void integral_init8h( uint16_t *sum, pixel *pix, intptr_t stride )
static void integral_init4v( uint16_t *sum8, uint16_t *sum4, intptr_t stride )
{
for( int x = 0; x < stride-8; x++ )
sum4[x] = sum8[x+4*stride] - sum8[x];
sum4[x] = (uint16_t)(sum8[x+4*stride] - sum8[x]);
for( int x = 0; x < stride-8; x++ )
sum8[x] = sum8[x+8*stride] + sum8[x+8*stride+4] - sum8[x] - sum8[x+4];
sum8[x] = (uint16_t)(sum8[x+8*stride] + sum8[x+8*stride+4] - sum8[x] - sum8[x+4]);
}
static void integral_init8v( uint16_t *sum8, intptr_t stride )
{
for( int x = 0; x < stride-8; x++ )
sum8[x] = sum8[x+8*stride] - sum8[x];
sum8[x] = (uint16_t)(sum8[x+8*stride] - sum8[x]);
}
void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame )
......@@ -550,8 +550,8 @@ static void mbtree_propagate_list( x264_t *h, uint16_t *ref_costs, int16_t (*mvs
int x = mvs[i][0];
int y = mvs[i][1];
unsigned mbx = (x>>5)+i;
unsigned mby = (y>>5)+mb_y;
unsigned mbx = (unsigned)((x>>5)+i);
unsigned mby = (unsigned)((y>>5)+mb_y);
unsigned idx0 = mbx + mby * stride;
unsigned idx2 = idx0 + stride;
x &= 31;
......