[FFmpeg-devel] [PATCH v9 13/13] vvcdec: add vvc decoder
James Almer
jamrial at gmail.com
Fri Jan 5 22:48:57 EET 2024
On 1/1/2024 11:12 AM, Nuo Mi wrote:
> +static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt)
> +{
> + const CodedBitstreamH266Context *h266 = s->cbc->priv_data;
> + CodedBitstreamFragment *frame = &s->current_frame;
> + int ret = 0;
> + int eos_at_start = 1;
This never changes, yet it's checked below like it does.
> + s->last_eos = s->eos;
> + s->eos = 0;
> +
> + ff_cbs_fragment_reset(frame);
> + ret = ff_cbs_read_packet(s->cbc, frame, avpkt);
> + if (ret < 0) {
> + av_log(s->avctx, AV_LOG_ERROR, "Failed to read packet.\n");
> + return ret;
> + }
> + /* decode the NAL units */
> + for (int i = 0; i < frame->nb_units; i++) {
> + const H2645NAL *nal = h266->common.read_packet.nals + i;
> + const CodedBitstreamUnit *unit = frame->units + i;
> +
> + if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) {
> + if (eos_at_start)
> + s->last_eos = 1;
> + else
> + s->eos = 1;
> + } else {
> + ret = decode_nal_unit(s, fc, nal, unit);
> + if (ret < 0) {
> + av_log(s->avctx, AV_LOG_WARNING,
> + "Error parsing NAL unit #%d.\n", i);
> + goto fail;
> + }
> + }
> + }
More information about the ffmpeg-devel
mailing list