[vlc-devel] [PATCH 1/2] aom: encoder: add "lag-in-frames", "usage", "rc-end-usage" and "cpu-used" options

Steve Lhomme robux4 at ycbcr.xyz
Tue Jul 21 07:56:59 CEST 2020


On 2020-07-21 6:16, Tristan Matthews wrote:
> ---
>   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 )

Shouldn't these strings be translated ? So maybe try to reuse strings 
already found elsewhere in the code.

> +            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;
> -- 
> 2.25.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list