ffmpeg | branch: release/4.2 | James Almer <jamr...@gmail.com> | Sun Nov 17 21:08:56 2019 -0300| [252ef2329a53230327ef57f69c9dc3fa7737e704] | committer: James Almer
avcodec/cbs_av1: keep separate reference frame state for reading and writing In scearios where a Temporal Unit is written right after reading it using the same CBS context (av1_metadata, av1_frame_merge, etc), the reference frame state used by the writer must not be the state that's the result of the reader having already parsed the current frame in question. This fixes writing Switch frames, and frames using short ref signaling. Signed-off-by: James Almer <jamr...@gmail.com> (cherry picked from commit 4e2bef6a82b356772a5919c51c9be1530268bd79) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=252ef2329a53230327ef57f69c9dc3fa7737e704 --- libavcodec/cbs_av1.c | 4 ++++ libavcodec/cbs_av1.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index eb6b801790..533a4ffa16 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -940,6 +940,8 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx, priv->spatial_id = 0; } + priv->ref = (AV1ReferenceFrameState *)&priv->read_ref; + switch (obu->header.obu_type) { case AV1_OBU_SEQUENCE_HEADER: { @@ -1082,6 +1084,8 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, td = NULL; start_pos = put_bits_count(pbc); + priv->ref = (AV1ReferenceFrameState *)&priv->write_ref; + switch (obu->header.obu_type) { case AV1_OBU_SEQUENCE_HEADER: { diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h index 1fb668ada4..675ed28f60 100644 --- a/libavcodec/cbs_av1.h +++ b/libavcodec/cbs_av1.h @@ -441,7 +441,9 @@ typedef struct CodedBitstreamAV1Context { int tile_cols; int tile_rows; - AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES]; + AV1ReferenceFrameState *ref; + AV1ReferenceFrameState read_ref[AV1_NUM_REF_FRAMES]; + AV1ReferenceFrameState write_ref[AV1_NUM_REF_FRAMES]; // Write buffer. uint8_t *write_buffer; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".