[vlc-commits] [Git][videolan/vlc][master] 6 commits: direct3d11: set the format mask after setting the chroma

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Aug 28 17:44:57 UTC 2023



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


Commits:
459280cd by Steve Lhomme at 2023-08-28T17:07:11+00:00
direct3d11: set the format mask after setting the chroma

- - - - -
58aa6c76 by Steve Lhomme at 2023-08-28T17:07:11+00:00
mft: set the RGB mask after setting the D3D11 chroma

- - - - -
0f417e58 by Steve Lhomme at 2023-08-28T17:07:11+00:00
mock: set the RGB mask after setting the chroma

The chroma is set by the user, it may be one of the RGB with a mask chromas.
And the user can't specify a mask, so later is will be assumed to be using
these masks.

- - - - -
c5a1d28a by Steve Lhomme at 2023-08-28T17:07:11+00:00
avcodec: use the default RGB mask for temporary RGB32

Although with push we should not need this hack anymore. Especially if we
assume we have to use the palette from each picture and not the format.

- - - - -
9f7679c1 by Steve Lhomme at 2023-08-28T17:07:11+00:00
interop_sw: remove useless call

video_format_FixRgb() only sets the RGB mask if it's not set. So the call
will have no effect.
Furthermore the masks it would set for VLC_CODEC_RGB32 don't match the
ones set locally.
So it's probably not the call we want, unless the local masks are wrong.

- - - - -
14798e65 by Steve Lhomme at 2023-08-28T17:07:11+00:00
opengl/filters: copy the source mask with the chroma

If we copy the chroma from glfmt_in, we have to copy the RGB mask as well
otherwise they may not end up being matching values.

- - - - -


6 changed files:

- modules/codec/avcodec/video.c
- modules/codec/mft.cpp
- modules/demux/mock.c
- modules/video_output/opengl/filters.c
- modules/video_output/opengl/interop_sw.c
- modules/video_output/win32/direct3d11.cpp


Changes:

=====================================
modules/codec/avcodec/video.c
=====================================
@@ -198,7 +198,10 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
          * are waiting for a valid palette. Indeed, fmt_out.video.p_palette
          * doesn't trigger a new vout request, but a new chroma yes. */
         if (pix_fmt == AV_PIX_FMT_PAL8 && !dec->fmt_out.video.p_palette)
+        {
             fmt->i_chroma = VLC_CODEC_RGB32;
+            video_format_FixRgb( fmt );
+        }
 
         avcodec_align_dimensions2(ctx, &width, &height, aligns);
     }


=====================================
modules/codec/mft.cpp
=====================================
@@ -930,6 +930,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id, bool & keep_re
 
                             p_dec->fmt_out.i_codec = p_sys->cfg->fourcc;
                             p_dec->fmt_out.video.i_chroma = p_sys->cfg->fourcc;
+                            DxgiFormatMask(p_sys->cfg->formatTexture, &p_dec->fmt_out.video);
 
                             // pre allocate all the SRV for that texture
                             for (size_t slice=0; slice < desc.ArraySize; slice++)


=====================================
modules/demux/mock.c
=====================================
@@ -660,6 +660,7 @@ ConfigureVideoTrack(demux_t *demux,
 
     fmt->i_codec = chroma;
     fmt->video.i_chroma = chroma;
+    video_format_FixRgb( &fmt->video );
     fmt->video.i_width = fmt->video.i_visible_width = options->width;
     fmt->video.i_height = fmt->video.i_visible_height = options->height;
     fmt->video.i_frame_rate = options->frame_rate;


=====================================
modules/video_output/opengl/filters.c
=====================================
@@ -243,6 +243,12 @@ vlc_gl_filters_Append(struct vlc_gl_filters *filters, const char *name,
 
         video_format_t *fmt = &glfmt->fmt;
         video_format_Init(fmt, chroma);
+        if (prev_filter->filter.config.filter_planes)
+        {
+            fmt->i_rmask = prev_filter->glfmt_in.fmt.i_rmask;
+            fmt->i_gmask = prev_filter->glfmt_in.fmt.i_gmask;
+            fmt->i_bmask = prev_filter->glfmt_in.fmt.i_bmask;
+        }
         fmt->i_width = fmt->i_visible_width = prev_filter->size_out.width;
         fmt->i_height = fmt->i_visible_height = prev_filter->size_out.height;
 


=====================================
modules/video_output/opengl/interop_sw.c
=====================================
@@ -769,7 +769,6 @@ interop_init:
     /* We found a chroma with matching parameters for OpenGL. The interop can
      * be created. */
 
-    // TODO: video_format_FixRgb is not fixing the mask we assign here
     if (i_chroma == VLC_CODEC_RGB32)
     {
 #if defined(WORDS_BIGENDIAN)
@@ -781,7 +780,6 @@ interop_init:
         interop->fmt_out.i_gmask  = 0x0000ff00;
         interop->fmt_out.i_bmask  = 0x00ff0000;
 #endif
-        video_format_FixRgb(&interop->fmt_out);
     }
 
     static const struct vlc_gl_interop_ops ops = {


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -324,7 +324,10 @@ static int UpdateStaging(vout_display_t *vd, const video_format_t *fmt)
         texture_fmt.i_width  = sys->picQuad.generic.i_width;
         texture_fmt.i_height = sys->picQuad.generic.i_height;
         if (!is_d3d11_opaque(fmt->i_chroma))
+        {
             texture_fmt.i_chroma = sys->picQuad.generic.textureFormat->fourcc;
+            DxgiFormatMask(sys->picQuad.generic.textureFormat->formatTexture, &texture_fmt);
+        }
 
         if (AllocateTextures(vd, sys->d3d_dev, sys->picQuad.generic.textureFormat, &texture_fmt,
                              false, textures, sys->stagingPlanes))
@@ -829,7 +832,10 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
 
     video_format_Copy(&sys->picQuad.quad_fmt, &fmt);
     if (!is_d3d11_opaque(fmt.i_chroma))
+    {
         sys->picQuad.quad_fmt.i_chroma = sys->picQuad.generic.textureFormat->fourcc;
+        DxgiFormatMask(sys->picQuad.generic.textureFormat->formatTexture, &sys->picQuad.quad_fmt);
+    }
 
     /* adjust the decoder sizes to have proper padding */
     if ( sys->picQuad.generic.textureFormat->formatTexture != DXGI_FORMAT_R8G8B8A8_UNORM &&



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c94ec24e78a616c6f967b9a50d3bae8deabab262...14798e65bf9bbb81e30e6120d7e990a910013327

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c94ec24e78a616c6f967b9a50d3bae8deabab262...14798e65bf9bbb81e30e6120d7e990a910013327
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