[vlc-commits] [Git][videolan/vlc][master] 11 commits: aom: use define for default

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon Jan 10 08:01:26 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
ec35122f by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: use define for default

- - - - -
0a68423e by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: fix --sout-aom-profile range

only values 0-2 map to actual cases in the module's switch block.
(corresponding to 0=main, 1=high, and 2=professional respectively).

- - - - -
bad8e2fb by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: fix --sout-aom-rc-end-usage range

there are four variants in the enum it corresponds to, thus should be 0-3..

- - - - -
18dcdfdb by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: use choice list for --sout-aom-profile

and add longtext (taken from the comments in the switch block).

this gives better UX, with a drop list in gui prefs rather than a
numberic control, a mapping of values in help output, and the
longtext provides additional details to further explain the
differences.

note that it is correct to pair a range with a choice list, since
only ranges are enforced upon setting values.

- - - - -
c3a8e7cb by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: use choice list for --sout-aom-rc-end-usage

and clarify the label (from [1]).

gives better UX than trying to explain the values in the label text.

 - gives a drop list in gui prefs rather than a numberic control.
 - improves consistency in how such mappings are placed in help output.

note that it is correct to pair a range with a choice list, since
only ranges are enforced upon setting values.

[1]: https://github.com/master-of-zen/Av1an/blob/master/docs/Encoders/aomenc.md

- - - - -
1ae56986 by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: update range of --sout-aom-usage

the author of this module seems to have aligned the usage of this option
with the 'usage' param of `aom_codec_enc_config_default()`, which takes
one of the following three values:

 - AOM_USAGE_GOOD_QUALITY=0
 - AOM_USAGE_REALTIME=1
 - AOM_USAGE_ALL_INTRA=2

the 3rd is a recent addition from libaom v3.1.0.

i don't see any harm in expanding this to allow this additional new
value to be passed through to libaom.

- - - - -
9906864e by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: use choice list for --sout-aom-usage

gives better UX than trying to explain the values in the label text.

 - gives a drop list in gui prefs rather than a numberic control.
 - improves consistency in how such mappings are placed in help output.

note that it is correct to pair a range with a choice list, since
only ranges are enforced upon setting values.

- - - - -
34253d16 by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: add documentation for --sout-aom-cpu-used to longtext

to explain what ranges of values go with what --sout-aom-cpu-used modes.

this ignores for the moment the current dynamic upper bound difference
depending upon whether or not libaom is >= v3.2.0.

it also introduces documentation for values corresponding to the new
all-intra mode that we now allow to be used.

- - - - -
3724f6f4 by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: fix problematic range enforcement for --sout-aom-cpu-used

this almost entirely reverts 0f9bb18bc93423ff1775b0b2f9060c9ffe246277,
leaving just the updated larger upper range bound.

there were two problems with that change:
 1. it is problematic to use such library version detection in plugin
    descriptors.
 2. it is pointless to have introduced just this one very specific warning
    and clamping, while ignoring the existing fact that for the usage mode
    of good-quality the value should be 1-5, while for realtime it should
    be 6-8, now 6-10 with libaom >= v3.2.0. (and as of a few commits back,
    7-9 for mode all-intra). either we should clip and warn fully, or not
    bother and let libaom just accept/reject/clip as appropriate.

implementing clipping/warning handling for the different appliable ranges
just adds unnecessary extra burden to keeping this module up to date with
libaom changes.

it is problematic to use library version detection in the plugin descriptor
to set the corresponding upper bound, since the generated config set built
by executing the descriptor function is saved in a cache to make loading
vlc more efficient. this may work fine for builds that bundle libaom as a
contrib, if updates re-build the plugin cache, but does not work fine on
systems where libaom is a separate system library, which could at any time
be upgraded or downgraded without a rebuild of the vlc plugin cache, which
could leave the bound too low or too high depending upon the version
installed at the time of loading vlc.

let's just specify the new upper bound and leave it at that. if someone is
using an older system library and happens to use a value of 9 or 10,
then we can just let libaom clip the value or reject it.

- - - - -
2f694980 by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: update default for --sout-aom-lag-in-frames

the options seem to relate strongly to options provided by the aomenc tool,
and their current documentation for this option states that the default
they currently use is 19 ([1]). i don't see any harm in adjusting ours to
match.

---

note, i'm curious about the fact that our max range is 70, while their
documentation states 35, though there is conflicting information later on
in their documentation.

the author of our module has commented `MAX_LAG_BUFFERS + MAX_LAP_BUFFERS`
besides the range, which correspods to this in ([2]), but doesn't help me
understand at all:

```
 #define MAX_LAG_BUFFERS 35
 #define MAX_LAP_BUFFERS 35
 #define MAX_TOTAL_BUFFERS (MAX_LAG_BUFFERS + MAX_LAP_BUFFERS)
```

is aomenc maybe taking the user value (0-35) and adding `MAX_LAP_BUFFERS`
(35) to it, whilst we are expecting the user to account for this??

[1]: https://github.com/master-of-zen/Av1an/blob/master/docs/Encoders/aomenc.md
[2]: https://aomedia.googlesource.com/aom/+/refs/heads/applejack/av1/encoder/lookahead.h

- - - - -
09d668bf by Lyndon Brown at 2022-01-10T07:23:02+00:00
aom: rename confusing --sout-aom-rc-end-usage to --sout-aom-rate-control

- - - - -


1 changed file:

- modules/codec/aom.c


Changes:

=====================================
modules/codec/aom.c
=====================================
@@ -54,22 +54,38 @@ static int OpenEncoder(vlc_object_t *);
 static void CloseEncoder(encoder_t *);
 static block_t *Encode(encoder_t *p_enc, picture_t *p_pict);
 
+static const int pi_profile_values_list[] =
+  { 0, 1, 2 };
+static const char *const ppsz_profile_text [] =
+  { N_("Main"), N_("High"), N_("Professional") };
+
 static const int pi_enc_bitdepth_values_list[] =
   { 8, 10, 12 };
 static const char *const ppsz_enc_bitdepth_text [] =
   { N_("8 bpp"), N_("10 bpp"), N_("12 bpp") };
-#endif
 
-/* Range of values for cpu-used was increased to 10 in libaom 3.2.0 */
-static bool aom_has_max_speed_10()
-{
-    return aom_codec_version() >= 197120;
-}
+static const int pi_usage_values_list[] =
+  { AOM_USAGE_GOOD_QUALITY, AOM_USAGE_REALTIME, AOM_USAGE_ALL_INTRA };
+static const char *const ppsz_usage_text [] =
+  { N_("Good quality"), N_("Realtime"), N_("All intra") };
+
+static const int pi_rc_end_usage_values_list[] =
+  { AOM_VBR, AOM_CBR, AOM_CQ, AOM_Q };
+static const char *const ppsz_rc_end_usage_text [] =
+  { N_("VBR"), N_("CBR"), N_("CQ"), N_("Q") };
+#endif
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 
+#define PROFILE_LONGTEXT \
+    "Main Profile: 8 and 10-bit 4:2:0. " \
+    "High Profile: 8 and 10-bit 4:4:4. " \
+    "Professional Profile: 8, 10 and 12-bit for 4:2:2, otherwise 12-bit."
+
+#define CPU_USED_LONGTEXT "CPU speed setting. Ranges differ depending upon usage mode (good quality: 0-5, realtime: 6-10, all-intra: 7-9)."
+
 vlc_module_begin ()
     set_shortname("aom")
     set_description(N_("AOM video decoder"))
@@ -82,22 +98,26 @@ vlc_module_begin ()
         set_capability("video encoder", 101)
         set_description(N_("AOM video encoder"))
         set_callback(OpenEncoder)
-        add_integer( SOUT_CFG_PREFIX "profile", 0, "Profile", NULL )
-            change_integer_range( 0, 3 )
+        add_integer( SOUT_CFG_PREFIX "profile", 0, "Profile", PROFILE_LONGTEXT )
+            change_integer_range( 0, 2 )
+            change_integer_list( pi_profile_values_list, ppsz_profile_text )
         add_integer( SOUT_CFG_PREFIX "bitdepth", 8, "Bit Depth", NULL )
             change_integer_list( pi_enc_bitdepth_values_list, ppsz_enc_bitdepth_text )
         add_integer( SOUT_CFG_PREFIX "tile-rows", 0, "Tile Rows (in log2 units)", NULL )
             change_integer_range( 0, 6 ) /* 1 << 6 == MAX_TILE_ROWS */
         add_integer( SOUT_CFG_PREFIX "tile-columns", 0, "Tile Columns (in log2 units)", NULL )
             change_integer_range( 0, 6 ) /* 1 << 6 == MAX_TILE_COLS */
-        add_integer( SOUT_CFG_PREFIX "cpu-used", 1, "Speed setting", NULL )
-            change_integer_range( 0, aom_has_max_speed_10() ? 10 : 8 ) /* good: 0-5, realtime: 6-8 (or 10 for libaom >= 3.2.0) */
-        add_integer( SOUT_CFG_PREFIX "lag-in-frames", 16, "Maximum number of lookahead frames", NULL )
+        add_integer( SOUT_CFG_PREFIX "cpu-used", 1, "Speed setting", CPU_USED_LONGTEXT )
+            change_integer_range( 0, 10 )
+        add_integer( SOUT_CFG_PREFIX "lag-in-frames", 19, "Maximum number of lookahead frames", NULL )
             change_integer_range(0, 70 /* MAX_LAG_BUFFERS + MAX_LAP_BUFFERS */ )
-        add_integer( SOUT_CFG_PREFIX "usage", 0, "Usage (0: good, 1: realtime)", NULL )
-            change_integer_range( 0, 1 )
-        add_integer( SOUT_CFG_PREFIX "rc-end-usage", 1, "Usage (0: VBR, 1: CBR, 2: CQ, 3: Q)", NULL )
-            change_integer_range( 0, 4 )
+        add_integer( SOUT_CFG_PREFIX "usage", 0, "Usage", NULL )
+            change_integer_range( 0, 2 )
+            change_integer_list( pi_usage_values_list, ppsz_usage_text )
+        add_obsolete_integer( "sout-aom-rc-end-usage" ) /* since 4.0.0 */
+        add_integer( SOUT_CFG_PREFIX "rate-control", AOM_CBR, "Rate control mode", NULL )
+            change_integer_range( 0, 3 )
+            change_integer_list( pi_rc_end_usage_values_list, ppsz_rc_end_usage_text )
 #ifdef AOM_CTRL_AV1E_SET_ROW_MT
         add_bool( SOUT_CFG_PREFIX "row-mt", false, "Row Multithreading", NULL )
 #endif
@@ -545,12 +565,6 @@ static int OpenEncoder(vlc_object_t *p_this)
 #endif
 
     int i_cpu_used = var_InheritInteger( p_enc, SOUT_CFG_PREFIX "cpu-used" );
-    if( aom_has_max_speed_10() && i_cpu_used == 10 && enccfg.g_usage != AOM_USAGE_REALTIME )
-    {
-        msg_Warn( p_enc, "CPU speed 10 only valid for realtime, clamping to 9" );
-        i_cpu_used = 9;
-    }
-
     if (aom_codec_control(ctx, AOME_SET_CPUUSED, i_cpu_used))
     {
         AOM_ERR(p_this, ctx, "Failed to set cpu-used");



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b10f5a02e1787ce044226094e257ff3449e4c8d8...09d668bf47e14470affd8fbc331a11ae797a5088

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b10f5a02e1787ce044226094e257ff3449e4c8d8...09d668bf47e14470affd8fbc331a11ae797a5088
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list