[vlc-commits] [Git][videolan/vlc][master] 5 commits: vpx: allow lossy WebP to be encoded via VP8

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Jan 13 19:58:22 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
75a805a0 by Tristan Matthews at 2023-01-13T19:37:45+00:00
vpx: allow lossy WebP to be encoded via VP8

This is analogous to what we are already doing in the decoder.

- - - - -
ce9d8339 by Tristan Matthews at 2023-01-13T19:37:45+00:00
image: add webp

- - - - -
3b65dd07 by Tristan Matthews at 2023-01-13T19:37:45+00:00
vpx: default to best quality

- - - - -
301d40a5 by Tristan Matthews at 2023-01-13T19:37:45+00:00
vpx: refactor quality initialization

Pass in the value directly if valid, otherwise warn and force default.

- - - - -
6e88c716 by Tristan Matthews at 2023-01-13T19:37:45+00:00
snapshot: add webp as a snapshot format option

- - - - -


3 changed files:

- modules/codec/vpx.c
- src/libvlc-module.c
- src/misc/image.c


Changes:

=====================================
modules/codec/vpx.c
=====================================
@@ -79,7 +79,7 @@ vlc_module_begin ()
     set_description(N_("WebM video encoder"))
     set_callback(OpenEncoder)
 #   define ENC_CFG_PREFIX "sout-vpx-"
-    add_integer( ENC_CFG_PREFIX "quality-mode", VPX_DL_GOOD_QUALITY, QUALITY_MODE_TEXT,
+    add_integer( ENC_CFG_PREFIX "quality-mode", VPX_DL_BEST_QUALITY, QUALITY_MODE_TEXT,
                  QUALITY_MODE_LONGTEXT )
         change_integer_list( quality_values, quality_desc );
 #endif
@@ -406,6 +406,7 @@ static int OpenEncoder(vlc_object_t *p_this)
     switch (p_enc->fmt_out.i_codec)
     {
 #ifdef ENABLE_VP8_ENCODER
+    case VLC_CODEC_WEBP:
     case VLC_CODEC_VP8:
         iface = &vpx_codec_vp8_cx_algo;
         vp_version = 8;
@@ -442,15 +443,16 @@ static int OpenEncoder(vlc_object_t *p_this)
     config_ChainParse(p_enc, ENC_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg);
 
     /* Deadline (in ms) to spend in encoder */
-    switch (var_GetInteger(p_enc, ENC_CFG_PREFIX "quality-mode")) {
+    const unsigned long quality = var_GetInteger(p_enc, ENC_CFG_PREFIX "quality-mode");
+    switch (quality) {
         case VPX_DL_REALTIME:
-            p_sys->quality = VPX_DL_REALTIME;
-            break;
         case VPX_DL_BEST_QUALITY:
-            p_sys->quality = VPX_DL_BEST_QUALITY;
+        case VPX_DL_GOOD_QUALITY:
+            p_sys->quality = quality;
             break;
         default:
-            p_sys->quality = VPX_DL_GOOD_QUALITY;
+            msg_Warn(p_this, "Unexpected quality %lu, forcing %d", quality, VPX_DL_BEST_QUALITY);
+            p_sys->quality = VPX_DL_BEST_QUALITY;
             break;
     }
 


=====================================
src/libvlc-module.c
=====================================
@@ -49,7 +49,7 @@
 #include "clock/clock.h"
 
 static const char *const ppsz_snap_formats[] =
-{ "png", "jpg", "tiff" };
+{ "png", "jpg", "tiff", "webp" };
 
 /*****************************************************************************
  * Configuration options for the core module. Each module will also separately


=====================================
src/misc/image.c
=====================================
@@ -615,6 +615,7 @@ static const struct
     { VLC_CODEC_SVG,               "svg" },
     { VLC_CODEC_TIFF,              "tif" },
     { VLC_CODEC_TIFF,              "tiff" },
+    { VLC_CODEC_WEBP,              "webp" },
     { VLC_FOURCC('l','b','m',' '), "lbm" },
     { VLC_CODEC_PPM,               "ppm" },
 };
@@ -659,6 +660,7 @@ static const struct
     { VLC_CODEC_SVG,               "image/svg+xml" },
     { VLC_CODEC_TIFF,              "image/tiff" },
     { VLC_CODEC_TARGA,             "image/x-tga" },
+    { VLC_CODEC_WEBP,              "image/webp" },
     { VLC_FOURCC('x','p','m',' '), "image/x-xpixmap" },
     { 0, NULL }
 };



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1c8607bc970b2d34ec16c569b4025c9c2a5dac80...6e88c7160aa5a1aa7cef38c3f427daee578c42fc

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1c8607bc970b2d34ec16c569b4025c9c2a5dac80...6e88c7160aa5a1aa7cef38c3f427daee578c42fc
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list