media-video/x264-encoder: fix patches (?)

This commit is contained in:
odrling 2021-04-24 17:31:13 +02:00
parent 094443aeaf
commit c63403dbdc
4 changed files with 76 additions and 39 deletions

View File

@ -1,7 +1,17 @@
diff -uNrp ./x264.logfile/x264.c ./x264.enctime/x264.c
--- ./x264.logfile/x264.c 2018-05-04 20:38:52.735094600 +0300
+++ ./x264.enctime/x264.c 2018-05-04 20:50:15.213061200 +0300
@@ -1910,11 +1910,24 @@ static int encode_frame( x264_t *h, hnd_
From 49d36068a4bf958b553c62fe6f47ef2d81cbf8f6 Mon Sep 17 00:00:00 2001
From: DJATOM <djatom@beatrice-raws.org>
Date: Tue, 26 Jan 2021 00:57:07 +0200
Subject: [PATCH] Improve encoding status view Extend final stats
---
x264.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/x264.c b/x264.c
index 11dd6c6e..bc2415c3 100644
--- a/x264.c
+++ b/x264.c
@@ -1932,11 +1932,24 @@ static int encode_frame( x264_t *h, hnd_t hout, x264_picture_t *pic, int64_t *la
static int64_t print_status( int64_t i_start, int64_t i_previous, int i_frame, int i_frame_total, int64_t i_file, x264_param_t *param, int64_t last_ts )
{
@ -26,7 +36,7 @@ diff -uNrp ./x264.logfile/x264.c ./x264.enctime/x264.c
double fps = i_elapsed > 0 ? i_frame * 1000000. / i_elapsed : 0;
double bitrate;
if( last_ts )
@@ -1924,12 +1937,13 @@ static int64_t print_status( int64_t i_s
@@ -1946,12 +1959,13 @@ static int64_t print_status( int64_t i_start, int64_t i_previous, int i_frame, i
if( i_frame_total )
{
int eta = i_elapsed * (i_frame_total - i_frame) / ((int64_t)i_frame * 1000000);
@ -43,7 +53,7 @@ diff -uNrp ./x264.logfile/x264.c ./x264.enctime/x264.c
fprintf( stderr, "%s \r", buf+5 );
x264_cli_set_console_title( buf );
fflush( stderr ); // needed in windows
@@ -2116,8 +2130,11 @@ fail:
@@ -2138,8 +2152,11 @@ static int encode( x264_param_t *param, cli_opt_t *opt )
i_end = x264_mdate();
/* Erase progress indicator before printing encoding stats. */
@ -57,7 +67,7 @@ diff -uNrp ./x264.logfile/x264.c ./x264.enctime/x264.c
if( h )
x264_encoder_close( h );
fprintf( stderr, "\n" );
@@ -2132,9 +2149,11 @@ fail:
@@ -2154,9 +2171,11 @@ static int encode( x264_param_t *param, cli_opt_t *opt )
{
double fps = (double)i_frame_output * (double)1000000 /
(double)( i_end - i_start );

View File

@ -1,7 +1,17 @@
diff -uNrp ./x264.003/x264.c ./x264.004/x264.c
--- ./x264.003/x264.c 2018-05-05 00:03:09.866224400 +0300
+++ ./x264.004/x264.c 2018-05-05 00:04:33.918824700 +0300
@@ -1919,10 +1919,10 @@ static int64_t print_status( int64_t i_s
From e920dd0c68231e77c2fbc811abc7eeea6a301fc0 Mon Sep 17 00:00:00 2001
From: DJATOM <djatom@beatrice-raws.org>
Date: Tue, 26 Jan 2021 00:59:38 +0200
Subject: [PATCH] Calculate estimated file size
---
x264.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/x264.c b/x264.c
index bc2415c3..deac5e41 100644
--- a/x264.c
+++ b/x264.c
@@ -1941,10 +1941,10 @@ static int64_t print_status( int64_t i_start, int64_t i_previous, int i_frame, i
if( print_progress_header )
{
if( i_frame_total )
@ -15,7 +25,7 @@ diff -uNrp ./x264.003/x264.c ./x264.004/x264.c
print_progress_header = 0;
}
@@ -1937,13 +1937,17 @@ static int64_t print_status( int64_t i_s
@@ -1959,13 +1959,17 @@ static int64_t print_status( int64_t i_start, int64_t i_previous, int i_frame, i
if( i_frame_total )
{
int eta = i_elapsed * (i_frame_total - i_frame) / ((int64_t)i_frame * 1000000);

View File

@ -1,7 +1,22 @@
diff -uNrp ./x264.opts1/common/base.c ./x264.opts2/common/base.c
--- ./x264.opts1/common/base.c 2018-05-04 19:38:38.702651100 +0300
+++ ./x264.opts2/common/base.c 2018-05-04 19:39:02.143412100 +0300
@@ -1244,6 +1244,8 @@ int x264_param_parse( x264_param_t *p, c
From 43e589ef727752f459ee1dec5bc8d274c3c2db42 Mon Sep 17 00:00:00 2001
From: DJATOM <djatom@beatrice-raws.org>
Date: Tue, 26 Jan 2021 01:47:09 +0200
Subject: [PATCH] Add --fade-compensate option
Allocates more bitrate on fades
---
common/base.c | 5 +++++
encoder/encoder.c | 5 +++++
encoder/slicetype.c | 4 ++--
x264.c | 3 +++
x264.h | 1 +
5 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/common/base.c b/common/base.c
index 7a230ade..e1baeeb5 100644
--- a/common/base.c
+++ b/common/base.c
@@ -1322,6 +1322,8 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
p->rc.i_aq_mode = atoi(value);
OPT("aq-strength")
p->rc.f_aq_strength = atof(value);
@ -10,22 +25,22 @@ diff -uNrp ./x264.opts1/common/base.c ./x264.opts2/common/base.c
OPT("pass")
{
int pass = x264_clip3( atoi(value), 0, 3 );
@@ -1382,7 +1384,10 @@ char *x264_param2string( x264_param_t *p
@@ -1460,7 +1462,10 @@ char *x264_param2string( x264_param_t *p, int b_res )
s += sprintf( s, " subme=%d", p->analyse.i_subpel_refine );
s += sprintf( s, " psy=%d", p->analyse.b_psy );
if( p->analyse.b_psy )
- s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
+ {
+ s += sprintf( s, " fade_compensate=%.2f", p->rc.f_fade_compensate );
+ s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
+ }
s += sprintf( s, " mixed_ref=%d", p->analyse.b_mixed_references );
s += sprintf( s, " me_range=%d", p->analyse.i_me_range );
s += sprintf( s, " chroma_me=%d", p->analyse.b_chroma_me );
diff -uNrp ./x264.opts1/encoder/encoder.c ./x264.opts2/encoder/encoder.c
--- ./x264.opts1/encoder/encoder.c 2018-05-04 19:38:33.636593300 +0300
+++ ./x264.opts2/encoder/encoder.c 2018-05-04 19:39:02.149407400 +0300
@@ -1124,10 +1124,15 @@ static int validate_parameters( x264_t *
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 266e91ec..ca5f39c9 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -1154,10 +1154,15 @@ static int validate_parameters( x264_t *h, int b_open )
x264_log( h, X264_LOG_WARNING, "--tune %s should be used if attempting to benchmark %s!\n", s, s );
}
@ -41,10 +56,11 @@ diff -uNrp ./x264.opts1/encoder/encoder.c ./x264.opts2/encoder/encoder.c
}
h->param.analyse.f_psy_rd = x264_clip3f( h->param.analyse.f_psy_rd, 0, 10 );
h->param.analyse.f_psy_trellis = x264_clip3f( h->param.analyse.f_psy_trellis, 0, 10 );
diff -uNrp ./x264.opts1/encoder/slicetype.c ./x264.opts2/encoder/slicetype.c
--- ./x264.opts1/encoder/slicetype.c 2018-05-04 19:47:15.672399600 +0300
+++ ./x264.opts2/encoder/slicetype.c 2018-05-04 19:47:16.695603800 +0300
@@ -451,7 +451,7 @@ void x264_weights_analyse( x264_t *h, x2
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index b2e0e335..0972cc75 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -460,7 +460,7 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
else
SET_WEIGHT( weights[plane], 1, minscale, mindenom, minoff );
@ -53,7 +69,7 @@ diff -uNrp ./x264.opts1/encoder/slicetype.c ./x264.opts2/encoder/slicetype.c
fenc->f_weighted_cost_delta[i_delta_index] = (float)minscore / origscore;
}
@@ -1023,7 +1023,7 @@ static void macroblock_tree_finish( x264
@@ -1032,7 +1032,7 @@ static void macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float averag
int fps_factor = round( CLIP_DURATION(average_duration) / CLIP_DURATION(frame->f_duration) * 256 / MBTREE_PRECISION );
float weightdelta = 0.0;
if( ref0_distance && frame->f_weighted_cost_delta[ref0_distance-1] > 0 )
@ -62,11 +78,11 @@ diff -uNrp ./x264.opts1/encoder/slicetype.c ./x264.opts2/encoder/slicetype.c
/* Allow the strength to be adjusted via qcompress, since the two
* concepts are very similar. */
Binary files ./x264.opts1/x264.7z and ./x264.opts2/x264.7z differ
diff -uNrp ./x264.opts1/x264.c ./x264.opts2/x264.c
--- ./x264.opts1/x264.c 2018-05-04 19:38:38.713642700 +0300
+++ ./x264.opts2/x264.c 2018-05-04 19:39:02.169391900 +0300
@@ -815,6 +815,8 @@ static void help( x264_param_t *defaults
diff --git a/x264.c b/x264.c
index a12fa099..9dbd9831 100644
--- a/x264.c
+++ b/x264.c
@@ -812,6 +812,8 @@ static void help( x264_param_t *defaults, int longhelp )
" - 3: Auto-variance AQ with bias to dark scenes\n", defaults->rc.i_aq_mode );
H1( " --aq-strength <float> Reduces blocking and blurring in flat and\n"
" textured areas. [%.1f]\n", defaults->rc.f_aq_strength );
@ -75,7 +91,7 @@ diff -uNrp ./x264.opts1/x264.c ./x264.opts2/x264.c
H1( "\n" );
H0( " -p, --pass <integer> Enable multipass ratecontrol\n"
" - 1: First pass, creates stats file\n"
@@ -1155,6 +1157,7 @@ static struct option long_options[] =
@@ -1160,6 +1162,7 @@ static struct option long_options[] =
{ "no-dct-decimate", no_argument, NULL, 0 },
{ "aq-strength", required_argument, NULL, 0 },
{ "aq-mode", required_argument, NULL, 0 },
@ -83,10 +99,11 @@ diff -uNrp ./x264.opts1/x264.c ./x264.opts2/x264.c
{ "deadzone-inter", required_argument, NULL, 0 },
{ "deadzone-intra", required_argument, NULL, 0 },
{ "level", required_argument, NULL, 0 },
diff -uNrp ./x264.opts1/x264.h ./x264.opts2/x264.h
--- ./x264.opts1/x264.h 2018-05-04 19:38:38.724634000 +0300
+++ ./x264.opts2/x264.h 2018-05-04 19:39:02.174387800 +0300
@@ -445,6 +445,7 @@ typedef struct x264_param_t
diff --git a/x264.h b/x264.h
index 8689aa03..18abda8e 100644
--- a/x264.h
+++ b/x264.h
@@ -469,6 +469,7 @@ typedef struct x264_param_t
int i_aq_mode; /* psy adaptive QP. (X264_AQ_*) */
float f_aq_strength;

View File

@ -37,7 +37,7 @@ DEPEND="${RDEPEND}
x86-fbsd? ( ${ASM_DEP} )"
BDEPEND="virtual/pkgconfig"
PATCHES=( ${FILESDIR}/enc-time.diff ${FILESDIR/enc-size.diff} ${FILESDIR}/fadecomp.diff )
PATCHES=( ${FILESDIR}/enc-time.patch ${FILESDIR}/enc-size.patch ${FILESDIR}/fadecomp.patch )
src_prepare() {
default