[FFmpeg-devel] [PATCH 2/5] avcodec/cbs_mpeg2: Change assertion from bytes to bits

Michael Niedermayer michael at niedermayer.cc
Wed Dec 11 17:34:20 EET 2019

On Mon, Dec 09, 2019 at 12:52:45PM +0100, Andreas Rheinhardt wrote:
> On Mon, Dec 9, 2019 at 2:54 AM James Almer <jamrial at gmail.com> wrote:
> > On 12/8/2019 6:31 PM, Michael Niedermayer wrote:
> > > This allows writing empty slices
> >
> > Are empty slices valid in mpeg2 to begin with? Or is that the result of
> > invalid/truncated data exclusively?
> >
> > It's invalid data, unless data partitioning (which we do not and IMO
> should never support) is in use. Data partitioning allows to split the
> bitstream into two that can be sent independently (and over channels of
> different reliability) and it allows the slice in the base layer to only
> contain everything excluding the macroblocks (i.e. everything that we put
> into the slice header).
> But if data partitioning is not in use, there has to be a macroblock after
> the extra_information_slice and a macroblock consists of more than zero
> bits; in fact, there always has to be a bit set to 1 among the first eight
> bits (which is not meant to imply that every macroblock needs to contain
> eight bits at all).
> I will add a check to error out if slices without data beyond the slice
> header are encountered upon reading. And also similar patches for cbs_h2645.

well, we can be more picky and error out yes.
Thats primarly a question what to do when the input isnt strictly valid, 
do we support maintaining all parts in their invalid form or do we do 
something else like droping parts that arent valid.


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191211/ca573559/attachment.sig>

More information about the ffmpeg-devel mailing list