[vlc-commits] [Git][videolan/vlc][master] 6 commits: schroedinger: use vlc_fourcc_t for VLC chromas

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Oct 13 14:03:59 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
9e8a4155 by Steve Lhomme at 2023-10-13T13:36:02+00:00
schroedinger: use vlc_fourcc_t for VLC chromas

- - - - -
db959279 by Steve Lhomme at 2023-10-13T13:36:02+00:00
chroma: cvpx: use local variable consistently

- - - - -
7b47c92a by Steve Lhomme at 2023-10-13T13:36:02+00:00
video_filter: assert when the input chroma is unknown

This should never happen. Maybe the chroma is 0 so we should not
display it as a string.

- - - - -
79f26ed2 by Steve Lhomme at 2023-10-13T13:36:02+00:00
direct3d11: only set the chroma if it might be used

- - - - -
e7af761f by Steve Lhomme at 2023-10-13T13:36:02+00:00
direct3d11: use auto for long structure name

- - - - -
2706a5a5 by Steve Lhomme at 2023-10-13T13:36:02+00:00
transcode: don't set output encoder chroma

The output is in a codec, which is very unlikely to be a valid chroma as well.

- - - - -


11 changed files:

- modules/codec/schroedinger.c
- modules/stream_out/transcode/encoder/video.c
- modules/video_chroma/cvpx.c
- modules/video_filter/croppadd.c
- modules/video_filter/freeze.c
- modules/video_filter/grain.c
- modules/video_filter/oldmovie.c
- modules/video_filter/psychedelic.c
- modules/video_filter/sharpen.c
- modules/video_filter/vhs.c
- modules/video_output/win32/direct3d11.cpp


Changes:

=====================================
modules/codec/schroedinger.c
=====================================
@@ -1014,7 +1014,7 @@ static inline bool SchroSetEnum( encoder_t *p_enc, int i_list_size, const char *
     return false;
 }
 
-static bool SetEncChromaFormat( encoder_t *p_enc, uint32_t i_codec )
+static bool SetEncChromaFormat( encoder_t *p_enc, vlc_fourcc_t i_codec )
 {
     encoder_sys_t *p_sys = p_enc->p_sys;
 
@@ -1022,7 +1022,7 @@ static bool SetEncChromaFormat( encoder_t *p_enc, uint32_t i_codec )
     case VLC_CODEC_I420:
         p_enc->fmt_in.i_codec = i_codec;
         p_sys->p_format->chroma_format = SCHRO_CHROMA_420;
-           break;
+        break;
     case VLC_CODEC_I422:
         p_enc->fmt_in.i_codec = i_codec;
         p_sys->p_format->chroma_format = SCHRO_CHROMA_422;
@@ -1165,22 +1165,22 @@ static int OpenEncoder( vlc_object_t *p_this )
     if( !psz_tmp )
         goto error;
     else {
-        uint32_t i_codec;
+        vlc_fourcc_t i_chroma;
         if( !strcmp( psz_tmp, "420" ) ) {
-            i_codec = VLC_CODEC_I420;
+            i_chroma = VLC_CODEC_I420;
         }
         else if( !strcmp( psz_tmp, "422" ) ) {
-            i_codec = VLC_CODEC_I422;
+            i_chroma = VLC_CODEC_I422;
         }
         else if( !strcmp( psz_tmp, "444" ) ) {
-            i_codec = VLC_CODEC_I444;
+            i_chroma = VLC_CODEC_I444;
         }
         else {
             msg_Err( p_enc, "Invalid chroma format: %s", psz_tmp );
             free( psz_tmp );
             goto error;
         }
-        SetEncChromaFormat( p_enc, i_codec );
+        SetEncChromaFormat( p_enc, i_chroma );
     }
     free( psz_tmp );
 


=====================================
modules/stream_out/transcode/encoder/video.c
=====================================
@@ -236,7 +236,7 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
     video_format_t *p_enc_out = &p_enc->p_encoder->fmt_out.video;
 
     /* Complete destination format */
-    p_enc->p_encoder->fmt_out.i_codec = p_enc_out->i_chroma = p_cfg->i_codec;
+    p_enc->p_encoder->fmt_out.i_codec = p_cfg->i_codec;
     p_enc->p_encoder->fmt_out.i_bitrate = p_cfg->video.i_bitrate;
     p_enc_out->i_sar_num = p_enc_out->i_sar_den = 0;
     transcode_encoder_video_set_src(p_enc->p_encoder, p_src, p_cfg);


=====================================
modules/video_chroma/cvpx.c
=====================================
@@ -121,7 +121,7 @@ static void Copy(filter_t *p_filter, picture_t *dst, picture_t *src,
                 DO(Copy420_SP_to_SP);
             else
             {
-                assert(dst->format.i_chroma == VLC_CODEC_I420_10L);
+                assert(outfcc == VLC_CODEC_I420_10L);
                 DO_S(Copy420_16_SP_to_P, 6);
             }
             break;


=====================================
modules/video_filter/croppadd.c
=====================================
@@ -165,10 +165,10 @@ static int OpenFilter( filter_t *p_filter )
 
     const vlc_chroma_description_t *p_chroma =
         vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
-    if( p_chroma == NULL || p_chroma->plane_count == 0 )
+    assert( p_chroma != NULL );
+    if( p_chroma->plane_count == 0 )
     {
-        msg_Err( p_filter, "Unknown input chroma %4.4s", p_filter->fmt_in.video.i_chroma?
-                     (const char*)&p_filter->fmt_in.video.i_chroma : "xxxx" );
+        msg_Err( p_filter, "Unsupported input chroma %4.4s", (char*)&p_chroma->fcc );
         return VLC_EGENERIC;
     }
 


=====================================
modules/video_filter/freeze.c
=====================================
@@ -109,8 +109,9 @@ static int Open( filter_t *p_filter )
     /* Reject 0 bpp and unsupported chroma */
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma
-          = vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
-    if( !p_chroma || p_chroma->pixel_size == 0
+          = vlc_fourcc_GetChromaDescription( fourcc );
+    assert( p_chroma != NULL );
+    if( p_chroma->pixel_size == 0
         || p_chroma->plane_count < 3 || p_chroma->pixel_size > 1
         || !vlc_fourcc_IsYUV( fourcc ) )
     {


=====================================
modules/video_filter/grain.c
=====================================
@@ -363,9 +363,9 @@ static int Open(filter_t *filter)
 {
     const vlc_chroma_description_t *chroma =
         vlc_fourcc_GetChromaDescription(filter->fmt_in.video.i_chroma);
-    if (!chroma || chroma->plane_count < 3 || chroma->pixel_size != 1) {
-        msg_Err(filter, "Unsupported chroma (%4.4s)",
-                (char*)&(filter->fmt_in.video.i_chroma));
+    assert( chroma != NULL );
+    if (chroma->plane_count < 3 || chroma->pixel_size != 1) {
+        msg_Err(filter, "Unsupported chroma (%4.4s)", (char*)&chroma->fcc);
         return VLC_EGENERIC;
     }
 


=====================================
modules/video_filter/oldmovie.c
=====================================
@@ -198,8 +198,9 @@ static int Open( filter_t *p_filter ) {
     /* Reject 0 bpp and unsupported chroma */
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma =
-        vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
-    if( !p_chroma || p_chroma->pixel_size == 0
+        vlc_fourcc_GetChromaDescription( fourcc );
+    assert( p_chroma != NULL );
+    if( p_chroma->pixel_size == 0
         || p_chroma->plane_count < 3 || p_chroma->pixel_size > 1
         || !vlc_fourcc_IsYUV( fourcc ) ) {
 


=====================================
modules/video_filter/psychedelic.c
=====================================
@@ -79,7 +79,8 @@ static int Create( filter_t *p_filter )
 {
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
-    if( !p_chroma || p_chroma->plane_count != 3 || p_chroma->pixel_size != 1 ) {
+    assert( p_chroma != NULL );
+    if( p_chroma->plane_count != 3 || p_chroma->pixel_size != 1 ) {
         msg_Err( p_filter, "Unsupported chroma (%4.4s)", (char*)&fourcc );
         return VLC_EGENERIC;
     }


=====================================
modules/video_filter/sharpen.c
=====================================
@@ -99,10 +99,11 @@ static int Create( filter_t *p_filter )
 {
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
-    if( !p_chroma || p_chroma->plane_count != 3 ||
+    assert( p_chroma != NULL );
+    if( p_chroma->plane_count != 3 ||
         (p_chroma->pixel_size != 1 &&
-         p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420_10L &&
-         p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420_10B)) {
+         fourcc != VLC_CODEC_I420_10L &&
+         fourcc != VLC_CODEC_I420_10B)) {
         msg_Dbg( p_filter, "Unsupported chroma (%4.4s)", (char*)&fourcc );
         return VLC_EGENERIC;
     }


=====================================
modules/video_filter/vhs.c
=====================================
@@ -126,7 +126,8 @@ static int Open( filter_t *p_filter )
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma =
         vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
-    if( !p_chroma || p_chroma->pixel_size == 0
+    assert( p_chroma != NULL );
+    if( p_chroma->pixel_size == 0
         || p_chroma->plane_count < 3 || p_chroma->pixel_size > 1
         || !vlc_fourcc_IsYUV( fourcc ) )
     {


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -178,7 +178,7 @@ static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
         break;
     default:
         {
-            const vlc_chroma_description_t *p_format = vlc_fourcc_GetChromaDescription(fmt->i_chroma);
+            const auto *p_format = vlc_fourcc_GetChromaDescription(fmt->i_chroma);
             if (p_format == NULL)
             {
                 cfg.bitdepth = 8;
@@ -809,9 +809,9 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
         {
             const vlc_fourcc_t *list = vlc_fourcc_GetFallback(vd->source->i_chroma);
             for (unsigned i = 0; list[i] != 0; i++) {
-                fmt.i_chroma = list[i];
-                if (fmt.i_chroma == vd->source->i_chroma)
+                if (list[i] == vd->source->i_chroma)
                     continue;
+                fmt.i_chroma = list[i];
                 err = SetupOutputFormat(vd, &fmt, NULL);
                 if (err == VLC_SUCCESS)
                     break;
@@ -938,7 +938,7 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_
             break;
         default:
             {
-                const vlc_chroma_description_t *p_format = vlc_fourcc_GetChromaDescription(fmt->i_chroma);
+                const auto *p_format = vlc_fourcc_GetChromaDescription(fmt->i_chroma);
                 if (p_format == NULL)
                 {
                     bits_per_channel = 8;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d81b7508446cb982c04787a2dca3bed579d29d1d...2706a5a5c77a86987143999a08f6988626299477

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d81b7508446cb982c04787a2dca3bed579d29d1d...2706a5a5c77a86987143999a08f6988626299477
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