[vlc-commits] aom: encoder: add "lag-in-frames", "usage", "rc-end-usage" and "cpu-used" options
Tristan Matthews
git at videolan.org
Wed Jul 22 14:15:34 CEST 2020
vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Thu Jul 16 02:54:57 2020 -0400| [2505dddadd1052560dd8a50a172ee0eed304e882] | committer: Tristan Matthews
aom: encoder: add "lag-in-frames", "usage", "rc-end-usage" and "cpu-used" options
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2505dddadd1052560dd8a50a172ee0eed304e882
---
modules/codec/aom.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 2a0362e26a..b3d703933f 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -36,6 +36,7 @@
#include <aom/aomdx.h>
#ifdef ENABLE_SOUT
+#include <aom/aom_encoder.h>
# include <aom/aomcx.h>
# include <aom/aom_image.h>
# define SOUT_CFG_PREFIX "sout-aom-"
@@ -84,6 +85,14 @@ vlc_module_begin ()
change_integer_range( 0, 6 ) /* 1 << 6 == MAX_TILE_ROWS */
add_integer( SOUT_CFG_PREFIX "tile-columns", 0, "Tile Columns (in log2 units)", NULL, true )
change_integer_range( 0, 6 ) /* 1 << 6 == MAX_TILE_COLS */
+ add_integer( SOUT_CFG_PREFIX "cpu-used", 1, "Speed setting", NULL, true )
+ change_integer_range( 0, 8 ) /* good: 0-5, realtime: 6-8 */
+ add_integer( SOUT_CFG_PREFIX "lag-in-frames", 16, "Maximum number of lookahead frames", NULL, true )
+ change_integer_range(0, 70 /* MAX_LAG_BUFFERS + MAX_LAP_BUFFERS */ )
+ add_integer( SOUT_CFG_PREFIX "usage", 0, "Usage (0: good, 1: realtime)", NULL, true )
+ change_integer_range( 0, 1 )
+ add_integer( SOUT_CFG_PREFIX "rc-end-usage", 1, "Usage (0: VBR, 1: CBR, 2: CQ, 3: Q)", NULL, true )
+ change_integer_range( 0, 4 )
#ifdef AOM_CTRL_AV1E_SET_ROW_MT
add_bool( SOUT_CFG_PREFIX "row-mt", false, "Row Multithreading", NULL, true )
#endif
@@ -429,7 +438,15 @@ static int OpenEncoder(vlc_object_t *p_this)
enccfg.g_threads = __MIN(vlc_GetCPUCount(), 4);
enccfg.g_w = p_enc->fmt_in.video.i_visible_width;
enccfg.g_h = p_enc->fmt_in.video.i_visible_height;
- enccfg.g_lag_in_frames = 16; /* we have no pcr on sout */
+ enccfg.rc_end_usage = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "rc-end-usage" );
+ enccfg.g_usage = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "usage" );
+ /* we have no pcr on sout, hence this defaulting to 16 */
+ enccfg.g_lag_in_frames = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "lag-in-frames" );
+ if( enccfg.g_usage == AOM_USAGE_REALTIME && enccfg.g_lag_in_frames != 0 )
+ {
+ msg_Warn( p_enc, "Non-zero lag in frames is not supported for realtime, forcing 0" );
+ enccfg.g_lag_in_frames = 0;
+ }
int enc_flags;
int i_profile = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "profile" );
@@ -516,6 +533,15 @@ static int OpenEncoder(vlc_object_t *p_this)
}
#endif
+ int i_cpu_used = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "cpu-used" );
+ if (aom_codec_control(ctx, AOME_SET_CPUUSED, i_cpu_used))
+ {
+ AOM_ERR(p_this, ctx, "Failed to set cpu-used");
+ destroy_context(p_this, ctx);
+ free(p_sys);
+ return VLC_EGENERIC;
+ }
+
p_enc->pf_encode_video = Encode;
return VLC_SUCCESS;
More information about the vlc-commits
mailing list