[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
Wed Jul 22 07:31:18 CEST 2020


OK for me

On 2020-07-21 17:19, Tristan Matthews wrote:
> On Tue, Jul 21, 2020 at 10:59 AM Thomas Guillem <thomas at gllm.fr> wrote:
>>
>> Hello,
>>
>> I don't think it's useful to translate such advanced options.
> 
> Initially I held off because these were changing all the time, but
> yeah, even now that they've settled, I tend to agree.
> 
> Ok to merge?
> 
> Best,
> -t
> 
>>
>> On Tue, Jul 21, 2020, at 15:59, Tristan Matthews wrote:
>>> On Tue, Jul 21, 2020 at 1:57 AM Steve Lhomme <robux4 at ycbcr.xyz> wrote:
>>>>
>>>>
>>>> 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.
>>>
>>> Currently none of the option strings are translated but yes I could do
>>> a patch for that. Note that from a quick glance, while there are
>>> similar strings already, usage here is pretty libaom specific.
>>>
>>> Best,
>>> -t
>>>
>>>>
>>>>> +            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
>>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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