Quoting James Almer (2021-02-20 15:38:42) > > + > > +static void handle_row(LSCRContext *s, AVFrame *frame) > > Unused frame argument.
Right, dropped locally. > > +static int decode_frame_lscr(AVCodecContext *avctx, > > + void *data, int *got_frame, > > + AVPacket *avpkt) > > +{ > > + LSCRContext *const s = avctx->priv_data; > > + GetByteContext *gb = &s->gb; > > + AVFrame *frame = data; > > + int ret, nb_blocks, offset = 0; > > + > > + if (avpkt->size < 2) > > + return AVERROR_INVALIDDATA; > > + if (avpkt->size == 2) > > + return 0; > > + > > + bytestream2_init(gb, avpkt->data, avpkt->size); > > + > > + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) > > + return ret; > > + > > + nb_blocks = bytestream2_get_le16(gb); > > + if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * (12 + 8)) > > + return AVERROR_INVALIDDATA; > > + > > + if (s->last_picture->data[0]) { > > + ret = av_frame_copy(frame, s->last_picture); > > You could use ff_reget_buf() instead. And if nb_blocks can be 0 (meaning > no changes since the previous frame), you could even use the > FF_REGET_BUFFER_FLAG_READONLY flag and completely avoid any memcpy. Good idea, but I'd do it in a separate patch, so that the split is closer to just a move. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".