[vlc-devel] [PATCH 5/7] video_format: use interlaced field from video format rather than picture flag
Steve Lhomme
robux4 at ycbcr.xyz
Fri Nov 6 15:42:12 CET 2020
---
modules/codec/avcodec/encoder.c | 2 +-
modules/codec/mft.c | 10 ++++++----
modules/codec/qsv.c | 2 +-
modules/codec/schroedinger.c | 4 ++--
modules/hw/mmal/mmal_picture.c | 2 +-
modules/hw/mmal/vout.c | 5 +++--
modules/hw/vdpau/deinterlace.c | 2 +-
modules/video_output/yuv.c | 2 +-
src/video_output/video_output.c | 2 +-
9 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 2564e0a5183..ca30e9ad56b 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1197,7 +1197,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
frame->pict_type = 0;
frame->repeat_pict = p_pict->i_nb_fields - 2;
- frame->interlaced_frame = !p_pict->b_progressive;
+ frame->interlaced_frame = p_pict->format.interlaced;
frame->top_field_first = !!p_pict->b_top_field_first;
frame->format = p_sys->p_context->pix_fmt;
diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index 46e03bdcab0..ba22df77c40 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -725,16 +725,18 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id)
if (p_dec->fmt_in.i_cat == VIDEO_ES)
{
+ UINT32 interlaced = false;
+ hr = IMFSample_GetUINT32(output_sample, &MFSampleExtension_Interlaced, &interlaced);
+ if (FAILED(hr))
+ goto error;
+ p_dec->fmt_out.video.interlaced = interlaced;
+
if (decoder_UpdateVideoFormat(p_dec))
return VLC_SUCCESS;
picture = decoder_NewPicture(p_dec);
if (!picture)
return VLC_SUCCESS;
- UINT32 interlaced = false;
- hr = IMFSample_GetUINT32(output_sample, &MFSampleExtension_Interlaced, &interlaced);
- picture->b_progressive = !interlaced;
-
picture->date = samp_time;
}
else
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index 8f5e2aa003a..d643b61cdbc 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -749,7 +749,7 @@ static int submit_frame(encoder_t *enc, picture_t *pic, QSVFrame **new_frame)
qf->surface.Info = sys->params.mfx.FrameInfo;
// Specify picture structure at runtime.
- if (pic->b_progressive)
+ if (!pic->format.interlaced)
qf->surface.Info.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
else if (pic->b_top_field_first)
qf->surface.Info.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index 23fca47d7f9..32cca737f91 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -1436,11 +1436,11 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
/* we only know if the sequence is interlaced when the first
* picture arrives, so final setup is done here */
/* XXX todo, detect change of interlace */
- p_sys->p_format->interlaced = !p_pic->b_progressive;
+ p_sys->p_format->interlaced = p_pic->format.interlaced;
p_sys->p_format->top_field_first = p_pic->b_top_field_first;
if( p_sys->b_auto_field_coding )
- schro_encoder_setting_set_double( p_sys->p_schro, "interlaced_coding", !p_pic->b_progressive );
+ schro_encoder_setting_set_double( p_sys->p_schro, "interlaced_coding", p_sys->p_format->interlaced );
}
if( !p_sys->started ) {
diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index 915ee063c82..63b97f00675 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -560,7 +560,7 @@ static MMAL_BOOL_T rep_buf_free_cb(MMAL_BUFFER_HEADER_T *header, void *userdata)
static void pic_to_buf_copy_props(MMAL_BUFFER_HEADER_T * const buf, const picture_t * const pic)
{
- if (!pic->b_progressive)
+ if (pic->format.interlaced)
{
buf->flags |= MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED;
buf->type->video.flags |= MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED;
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 93dadd4dede..e294ca7e9f6 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -804,15 +804,16 @@ static void vd_prepare(vout_display_t *vd, picture_t *p_pic,
vd_manage(vd);
+ bool pic_progressive = !p_pic->format.interlaced;
if (sys->force_config ||
p_pic->format.i_frame_rate != sys->i_frame_rate ||
p_pic->format.i_frame_rate_base != sys->i_frame_rate_base ||
- p_pic->b_progressive != sys->b_progressive ||
+ pic_progressive != sys->b_progressive ||
p_pic->b_top_field_first != sys->b_top_field_first)
{
sys->force_config = false;
sys->b_top_field_first = p_pic->b_top_field_first;
- sys->b_progressive = p_pic->b_progressive;
+ sys->b_progressive = pic_progressive;
sys->i_frame_rate = p_pic->format.i_frame_rate;
sys->i_frame_rate_base = p_pic->format.i_frame_rate_base;
configure_display(vd, NULL, &p_pic->format);
diff --git a/modules/hw/vdpau/deinterlace.c b/modules/hw/vdpau/deinterlace.c
index 510892cba04..818a42749ec 100644
--- a/modules/hw/vdpau/deinterlace.c
+++ b/modules/hw/vdpau/deinterlace.c
@@ -80,7 +80,7 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
assert(!picture_HasChainedPics(src));
vlc_picture_chain_AppendChain( src, dst );
- if (src->b_progressive || src->b_top_field_first)
+ if (!src->format.interlaced || src->b_top_field_first)
{
f1->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
f2->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD;
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index e7460a1d2fb..c9692b439ad 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -177,7 +177,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
/* */
char type;
- if (picture->b_progressive)
+ if (!picture->format.interlaced)
type = 'p';
else if (picture->b_top_field_first)
type = 't';
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index de515b4546e..806d7a6abbe 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1093,7 +1093,7 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
sys->filter.changed = true;
}
- vout_SetInterlacingState(&vout->sys.obj, &sys->sys.private, !decoded->b_progressive);
+ vout_SetInterlacingState(&vout->sys.obj, &sys->sys.private, decoded->format.interlaced);
if (sys->filter.changed ||
sys->sys.private.interlacing.has_deint != sys->filter.new_interlaced)
--
2.26.2
More information about the vlc-devel
mailing list