[FFmpeg-devel] [PATCH v2] avcodec: add AV1 frame split bitstream filter
Ronald S. Bultje
rsbultje at gmail.com
Mon Mar 25 21:30:35 EET 2019
Hi,
On Mon, Mar 25, 2019 at 12:42 PM James Almer <jamrial at gmail.com> wrote:
> On 3/25/2019 12:29 PM, James Almer wrote:
> > + ret = ff_cbs_read_packet(s->cbc, td, s->buffer_pkt);
> > + if (ret < 0) {
> > + av_log(ctx, AV_LOG_ERROR, "Failed to parse temporal
> unit.\n");
> > + return ret;
>
> > + if (split) {
> > + AV1RawFrameHeader *frame = NULL;
> > + int cur_frame_type = -1, size = 0;
> > +
> > + for (i = s->cur_frame_idx; i < td->nb_units; i++) {
> > + CodedBitstreamUnit *unit = &td->units[i];
> > +
> > + size += unit->data_size;
> > + if (unit->type == AV1_OBU_FRAME) {
> > + AV1RawOBU *obu = unit->content;
> > +
> > + if (frame) {
> > + ret = AVERROR_INVALIDDATA;
> > + goto fail;
>
> > + } else if (unit->type == AV1_OBU_FRAME_HEADER) {
> > + AV1RawOBU *obu = unit->content;
> > +
> > + if (frame) {
> > + ret = AVERROR_INVALIDDATA;
> > + goto fail;
>
> > + } else if (unit->type == AV1_OBU_TILE_GROUP) {
> > + AV1RawOBU *obu = unit->content;
> > + AV1RawTileGroup *group = &obu->obu.tile_group;
> > +
> > + if (!frame || cur_frame_type != AV1_OBU_FRAME_HEADER) {
> > + ret = AVERROR_INVALIDDATA;
> > + goto fail;
>
> I'm not sure if we should abort and discard the packet in these cases,
> or just pass it through.
>
> In all these the Temporal Unit is invalid in some form (Orphaned Tile
> Group OBUs, Frame Headers showing up when the Tile Groups from a
> previous Frame Header were expected, etc), but maybe it should be left
> to the decoder to decide what to do with them.
Is cur_frame_type the previous OBU's type? Is something like
framehdr-highdynamicrangframedata-tiledata valid?
Ronald
More information about the ffmpeg-devel
mailing list