From cf2613a72c9c3d5a39bb5cd5c3dedcdafa3dd146 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 1 Sep 2023 08:34:14 +0200 Subject: [PATCH] modules: remove write-only video format i_bits_per_pixel --- modules/access/screen/mac.c | 1 - modules/access/screen/wayland.c | 1 - modules/access/vnc.c | 1 - modules/codec/arib/libaribcaption.c | 1 - modules/codec/dmo/dmo.c | 5 - modules/codec/kate.c | 1 - modules/codec/libass.c | 1 - modules/codec/qsv.c | 1 - modules/codec/schroedinger.c | 3 - modules/codec/zvbi.c | 7 +- modules/demux/avformat/demux.c | 1 - modules/demux/mp4/essetup.c | 3 - modules/demux/ogg.c | 11 +-- modules/demux/rawvid.c | 10 +- .../demux/smooth/playlist/CodecParameters.cpp | 1 - modules/hw/nvdec/nvdec.c | 2 - modules/text_renderer/svg.c | 1 - src/misc/es_format.c | 98 ------------------- 18 files changed, 9 insertions(+), 140 deletions(-) diff --git a/modules/access/screen/mac.c b/modules/access/screen/mac.c index 9039a9e127..acdfbbad16 100644 --- a/modules/access/screen/mac.c +++ b/modules/access/screen/mac.c @@ -130,7 +130,6 @@ int screen_InitCapture(demux_t *p_demux) p_sys->fmt.video.i_width = rect.size.width; p_sys->fmt.video.i_visible_height = p_sys->fmt.video.i_height = rect.size.height; - p_sys->fmt.video.i_bits_per_pixel = 32; p_sys->fmt.video.i_chroma = VLC_CODEC_RGB32; p_sys->fmt.video.i_rmask = 0x00ff0000; p_sys->fmt.video.i_gmask = 0x0000ff00; diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c index a71eae10b2..d29811cdb2 100644 --- a/modules/access/screen/wayland.c +++ b/modules/access/screen/wayland.c @@ -123,7 +123,6 @@ static void output_mode_cb(void *data, struct wl_output *output, es_format_Init(&fmt, VIDEO_ES, VLC_CODEC_RGB32); fmt.video.i_chroma = VLC_CODEC_RGB32; - fmt.video.i_bits_per_pixel = 32; fmt.video.i_sar_num = fmt.video.i_sar_den = 1; fmt.video.i_frame_rate = lroundf(1000.f * sys->rate); fmt.video.i_frame_rate_base = 1000; diff --git a/modules/access/vnc.c b/modules/access/vnc.c index 3a24d1af2e..ff70ac90a1 100644 --- a/modules/access/vnc.c +++ b/modules/access/vnc.c @@ -230,7 +230,6 @@ static rfbBool mallocFrameBufferHandler( rfbClient* p_client ) fmt.video.i_frame_rate_base = 1000; fmt.video.i_frame_rate = 1000 * p_sys->f_fps; - fmt.video.i_bits_per_pixel = i_bits_per_pixel; fmt.video.i_sar_num = fmt.video.i_sar_den = 1; /* declare the new es */ diff --git a/modules/codec/arib/libaribcaption.c b/modules/codec/arib/libaribcaption.c index 133c7c676d..c80d98ad49 100644 --- a/modules/codec/arib/libaribcaption.c +++ b/modules/codec/arib/libaribcaption.c @@ -167,7 +167,6 @@ static void SubpictureUpdate(subpicture_t *p_subpic, fmt.i_rmask = 0; fmt.i_gmask = 0; fmt.i_bmask = 0; - fmt.i_bits_per_pixel = 0; fmt.i_x_offset = 0; fmt.i_y_offset = 0; diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c index 5f8967450c..f9785ed4b2 100644 --- a/modules/codec/dmo/dmo.c +++ b/modules/codec/dmo/dmo.c @@ -458,7 +458,6 @@ static int DecOpen( decoder_t *p_dec ) p_dec->fmt_out.i_codec = i_chroma == VLC_CODEC_YV12 ? VLC_CODEC_I420 : i_chroma; p_dec->fmt_out.video.i_width = p_dec->fmt_in->video.i_width; p_dec->fmt_out.video.i_height = p_dec->fmt_in->video.i_height; - p_dec->fmt_out.video.i_bits_per_pixel = vlc_fourcc_GetChromaBPP(i_chroma); /* If an aspect-ratio was specified in the input format then force it */ if( p_dec->fmt_in->video.i_sar_num > 0 && @@ -1060,10 +1059,6 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo ) VIDEOINFOHEADER vih, *p_vih; BITMAPINFOHEADER *p_bih; - /* FIXME */ - p_enc->fmt_in.video.i_bits_per_pixel = - p_enc->fmt_out.video.i_bits_per_pixel = 12; - /* Enumerate input format (for debug output) */ i = 0; while( !IMediaObject_GetInputType( p_dmo, 0, i++, &dmo_type ) ) diff --git a/modules/codec/kate.c b/modules/codec/kate.c index 55fa93bf1b..702716618d 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -859,7 +859,6 @@ static void TigerUpdateSubpicture( subpicture_t *p_subpic, /* create a full frame region - this will also tell Tiger the size of the frame */ video_format_t fmt = *p_fmt_dst; fmt.i_chroma = VLC_CODEC_RGBA; - fmt.i_bits_per_pixel = 0; fmt.i_width = fmt.i_visible_width = p_fmt_src->i_width; fmt.i_height = diff --git a/modules/codec/libass.c b/modules/codec/libass.c index 1ec54b0a2d..c5278e382c 100644 --- a/modules/codec/libass.c +++ b/modules/codec/libass.c @@ -433,7 +433,6 @@ static int SubpictureValidate( subpicture_t *p_subpic, video_format_t fmt = *p_fmt_dst; fmt.i_chroma = VLC_CODEC_RGBA; - fmt.i_bits_per_pixel = 0; fmt.i_x_offset = 0; fmt.i_y_offset = 0; if( b_fmt_src || b_fmt_dst ) diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c index ccd79b1636..c4042617de 100644 --- a/modules/codec/qsv.c +++ b/modules/codec/qsv.c @@ -622,7 +622,6 @@ static int Open(vlc_object_t *this) enc->fmt_in.video.i_rmask = 0; enc->fmt_in.video.i_gmask = 0; enc->fmt_in.video.i_bmask = 0; - enc->fmt_in.video.i_bits_per_pixel = 12; // require aligned pictures on input, a filter may be added before the encoder enc->fmt_in.video.i_width = sys->params.mfx.FrameInfo.Width; enc->fmt_in.video.i_height = sys->params.mfx.FrameInfo.Height; diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c index 328af40d8b..c5e37382fc 100644 --- a/modules/codec/schroedinger.c +++ b/modules/codec/schroedinger.c @@ -1021,17 +1021,14 @@ static bool SetEncChromaFormat( encoder_t *p_enc, uint32_t i_codec ) switch( i_codec ) { case VLC_CODEC_I420: p_enc->fmt_in.i_codec = i_codec; - p_enc->fmt_in.video.i_bits_per_pixel = 12; p_sys->p_format->chroma_format = SCHRO_CHROMA_420; break; case VLC_CODEC_I422: p_enc->fmt_in.i_codec = i_codec; - p_enc->fmt_in.video.i_bits_per_pixel = 16; p_sys->p_format->chroma_format = SCHRO_CHROMA_422; break; case VLC_CODEC_I444: p_enc->fmt_in.i_codec = i_codec; - p_enc->fmt_in.video.i_bits_per_pixel = 24; p_sys->p_format->chroma_format = SCHRO_CHROMA_444; break; default: diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c index 8a5543145a..b315c94ad6 100644 --- a/modules/codec/zvbi.c +++ b/modules/codec/zvbi.c @@ -538,15 +538,10 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt, } video_format_Init(&fmt, b_text ? VLC_CODEC_TEXT : VLC_CODEC_RGBA); - if( b_text ) - { - fmt.i_bits_per_pixel = 0; - } - else + if( !b_text ) { fmt.i_width = fmt.i_visible_width = i_columns * 12; fmt.i_height = fmt.i_visible_height = i_rows * 10; - fmt.i_bits_per_pixel = 32; fmt.i_sar_num = fmt.i_sar_den = 0; /* let the vout set the correct AR */ } fmt.i_x_offset = fmt.i_y_offset = 0; diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c index c5e0774300..c70bf507aa 100644 --- a/modules/demux/avformat/demux.c +++ b/modules/demux/avformat/demux.c @@ -495,7 +495,6 @@ int avformat_OpenDemux( vlc_object_t *p_this ) es_format_Init( &es_fmt, VIDEO_ES, fcc ); es_fmt.i_original_fourcc = CodecTagToFourcc( cp->codec_tag ); - es_fmt.video.i_bits_per_pixel = cp->bits_per_coded_sample; /* Special case for raw video data */ if( cp->codec_id == AV_CODEC_ID_RAWVIDEO ) { diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c index 461ec501f6..89b1f124ae 100644 --- a/modules/demux/mp4/essetup.c +++ b/modules/demux/mp4/essetup.c @@ -290,7 +290,6 @@ int SetupVideoES( demux_t *p_demux, const mp4_track_t *p_track, const MP4_Box_t p_fmt->video.i_width = p_vide->i_width; p_fmt->video.i_height = p_vide->i_height; - p_fmt->video.i_bits_per_pixel = p_vide->i_depth; /* fall on display size */ if( p_fmt->video.i_width <= 0 ) @@ -722,7 +721,6 @@ int SetupVideoES( demux_t *p_demux, const mp4_track_t *p_track, const MP4_Box_t } p_fmt->video.color_range = p_data->i_fullrange ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED; - p_fmt->video.i_bits_per_pixel = p_data->i_bit_depth; CopyExtradata( p_data->p_codec_init_data, p_data->i_codec_init_datasize, @@ -766,7 +764,6 @@ int SetupVideoES( demux_t *p_demux, const mp4_track_t *p_track, const MP4_Box_t p_fmt->video.i_visible_width = p_fmt->video.i_width; p_fmt->video.i_height = BOXDATA(p_strf)->bmiHeader.biHeight; p_fmt->video.i_visible_height =p_fmt->video.i_height; - p_fmt->video.i_bits_per_pixel = BOXDATA(p_strf)->bmiHeader.biBitCount; CopyExtradata( BOXDATA(p_strf)->p_extra, BOXDATA(p_strf)->i_extra, p_fmt ); diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index 8103745009..3f832ab1a2 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -1866,11 +1866,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) p_stream->fmt.video.i_frame_rate = num; p_stream->fmt.video.i_frame_rate_base = den; date_Init( &p_stream->dts, num, den ); - p_stream->fmt.video.i_bits_per_pixel = - GetWLE((oggpacket.packet+182)); - if( !p_stream->fmt.video.i_bits_per_pixel ) - /* hack, FIXME */ - p_stream->fmt.video.i_bits_per_pixel = 24; + unsigned bpp = GetWLE((oggpacket.packet+182)); p_stream->fmt.video.i_width = GetDWLE((oggpacket.packet+176)); p_stream->fmt.video.i_height = @@ -1886,7 +1882,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) p_stream->fmt.video.i_frame_rate_base, p_stream->fmt.video.i_width, p_stream->fmt.video.i_height, - p_stream->fmt.video.i_bits_per_pixel); + bpp); if ( !p_stream->fmt.video.i_frame_rate || !p_stream->fmt.video.i_frame_rate_base ) @@ -2018,7 +2014,6 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) date_Init( &p_stream->dts, num, den ); p_stream->fmt.video.i_frame_rate = num; p_stream->fmt.video.i_frame_rate_base = den; - p_stream->fmt.video.i_bits_per_pixel = st->bits_per_sample; p_stream->fmt.video.i_width = st->sh.video.width; p_stream->fmt.video.i_height = st->sh.video.height; p_stream->fmt.video.i_visible_width = @@ -2032,7 +2027,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) p_stream->fmt.video.i_frame_rate_base, p_stream->fmt.video.i_width, p_stream->fmt.video.i_height, - p_stream->fmt.video.i_bits_per_pixel ); + st->bits_per_sample ); } /* Check for audio header (new format) */ else if( !strncmp( st->streamtype, "audio", 5 ) && diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c index db388d7ff2..c03ff3e53b 100644 --- a/modules/demux/rawvid.c +++ b/modules/demux/rawvid.c @@ -340,16 +340,16 @@ valid: p_sys->fmt_video.video.i_frame_rate_base ); date_Set( &p_sys->pcr, VLC_TICK_0 ); - if( !p_sys->fmt_video.video.i_bits_per_pixel ) + const vlc_chroma_description_t *dsc = + vlc_fourcc_GetChromaDescription(p_sys->fmt_video.video.i_chroma); + if (unlikely(dsc == NULL)) + goto error; + if (dsc->plane_count == 0) { msg_Err( p_demux, "Unsupported chroma 0x%.8x (%4.4s)", i_chroma, (char*)&i_chroma ); goto error; } - const vlc_chroma_description_t *dsc = - vlc_fourcc_GetChromaDescription(p_sys->fmt_video.video.i_chroma); - if (unlikely(dsc == NULL)) - goto error; p_sys->frame_size = 0; for (unsigned i=0; iplane_count; i++) { diff --git a/modules/demux/smooth/playlist/CodecParameters.cpp b/modules/demux/smooth/playlist/CodecParameters.cpp index f95122a2a0..85c5205767 100644 --- a/modules/demux/smooth/playlist/CodecParameters.cpp +++ b/modules/demux/smooth/playlist/CodecParameters.cpp @@ -120,7 +120,6 @@ void CodecParameters::initAndFillEsFmt(es_format_t *fmt) const else if( fmt->i_codec == VLC_FOURCC( 'W', 'V', 'C', '1' ) ) { fmt->i_codec = VLC_CODEC_VC1; -// fmt->video.i_bits_per_pixel = 0x18; // No clue why this was set in smooth streamfilter } FillExtradata(fmt, extradata); diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c index f768d17522..5de0811949 100644 --- a/modules/hw/nvdec/nvdec.c +++ b/modules/hw/nvdec/nvdec.c @@ -245,7 +245,6 @@ static int CUtoFMT(video_format_t *fmt, const CUVIDEOFORMAT *p_format) // frame rate fmt->i_frame_rate = p_format->frame_rate.numerator; fmt->i_frame_rate_base = p_format->frame_rate.denominator; - fmt->i_bits_per_pixel = i_bpp; return VLC_SUCCESS; } @@ -964,7 +963,6 @@ static int OpenDecoder(vlc_object_t *p_this) p_dec->fmt_out.video.i_sar_num = i_sar_num; p_dec->fmt_out.video.i_sar_den = i_sar_den; #undef ALIGN - p_dec->fmt_out.video.i_bits_per_pixel = i_depth_luma; p_dec->fmt_out.video.i_frame_rate = p_dec->fmt_in->video.i_frame_rate; p_dec->fmt_out.video.i_frame_rate_base = p_dec->fmt_in->video.i_frame_rate_base; diff --git a/modules/text_renderer/svg.c b/modules/text_renderer/svg.c index c9bc901bbc..06d646b6ba 100644 --- a/modules/text_renderer/svg.c +++ b/modules/text_renderer/svg.c @@ -252,7 +252,6 @@ static picture_t * svg_RenderPicture( filter_t *p_filter, /* Create a new subpicture region */ video_format_t fmt; video_format_Init( &fmt, VLC_CODEC_BGRA ); /* CAIRO_FORMAT_ARGB32 == VLC_CODEC_BGRA, go figure */ - fmt.i_bits_per_pixel = 32; fmt.i_chroma = VLC_CODEC_BGRA; fmt.i_width = fmt.i_visible_width = dim.width; fmt.i_height = fmt.i_visible_height = dim.height; diff --git a/src/misc/es_format.c b/src/misc/es_format.c index 267bdc7c80..d05f2da792 100644 --- a/src/misc/es_format.c +++ b/src/misc/es_format.c @@ -90,104 +90,6 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma, vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den, i_sar_num, i_sar_den, 0 ); video_format_FixRgb( p_fmt ); - - switch( p_fmt->i_chroma ) - { - case VLC_CODEC_YUVA: - p_fmt->i_bits_per_pixel = 32; - break; - case VLC_CODEC_YUV420A: - p_fmt->i_bits_per_pixel = 20; - break; - case VLC_CODEC_YUV422A: - p_fmt->i_bits_per_pixel = 24; - break; - case VLC_CODEC_I444: - case VLC_CODEC_J444: - p_fmt->i_bits_per_pixel = 24; - break; - case VLC_CODEC_I422: - case VLC_CODEC_YUYV: - case VLC_CODEC_YVYU: - case VLC_CODEC_UYVY: - case VLC_CODEC_YUV2: - case VLC_CODEC_VYUY: - case VLC_CODEC_J422: - p_fmt->i_bits_per_pixel = 16; - break; - case VLC_CODEC_I440: - case VLC_CODEC_J440: - p_fmt->i_bits_per_pixel = 16; - break; - case VLC_CODEC_P010: - p_fmt->i_bits_per_pixel = 15; - break; - case VLC_CODEC_P016: - p_fmt->i_bits_per_pixel = 20; - break; - case VLC_CODEC_I411: - case VLC_CODEC_YV12: - case VLC_CODEC_I420: - case VLC_CODEC_J420: - case VLC_CODEC_NV12: - p_fmt->i_bits_per_pixel = 12; - break; - case VLC_CODEC_YV9: - case VLC_CODEC_I410: - p_fmt->i_bits_per_pixel = 9; - break; - case VLC_CODEC_Y211: - p_fmt->i_bits_per_pixel = 8; - break; - case VLC_CODEC_YUVP: - p_fmt->i_bits_per_pixel = 8; - break; - - case VLC_CODEC_RGB32: - case VLC_CODEC_RGBA: - case VLC_CODEC_ARGB: - case VLC_CODEC_BGRA: - case VLC_CODEC_ABGR: - case VLC_CODEC_RGBX: - case VLC_CODEC_XRGB: - case VLC_CODEC_BGRX: - case VLC_CODEC_XBGR: - p_fmt->i_bits_per_pixel = 32; - break; - case VLC_CODEC_RGB24: - p_fmt->i_bits_per_pixel = 24; - break; - case VLC_CODEC_RGB15: - case VLC_CODEC_RGB16: - p_fmt->i_bits_per_pixel = 16; - break; - case VLC_CODEC_RGB8: - p_fmt->i_bits_per_pixel = 8; - break; - - case VLC_CODEC_GREY: - case VLC_CODEC_RGBP: - p_fmt->i_bits_per_pixel = 8; - break; - - case VLC_CODEC_GREY_10B: - case VLC_CODEC_GREY_10L: - p_fmt->i_bits_per_pixel = 10; - break; - - case VLC_CODEC_GREY_12B: - case VLC_CODEC_GREY_12L: - p_fmt->i_bits_per_pixel = 12; - break; - - case VLC_CODEC_XYZ12: - p_fmt->i_bits_per_pixel = 48; - break; - - default: - p_fmt->i_bits_per_pixel = 0; - break; - } } void video_format_CopyCrop( video_format_t *p_dst, const video_format_t *p_src )