Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/cbs_av1.c | 12 ++++++++++++ libavcodec/cbs_av1.h | 5 +++++ 2 files changed, 17 insertions(+)
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index 72ad18151e..726a2211da 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -1247,6 +1247,18 @@ static void cbs_av1_close(CodedBitstreamContext *ctx) av_buffer_unref(&priv->frame_header_ref); } +int ff_cbs_av1_get_frame_width(const AV1RawFrameHeader *frame) +{ + int denom, frame_width = frame->frame_width_minus_1 + 1; + + if (!frame->use_superres) + return frame_width; + + denom = frame->coded_denom + AV1_SUPERRES_DENOM_MIN; + + return (frame_width * AV1_SUPERRES_NUM + denom / 2) / denom; +} + const CodedBitstreamType ff_cbs_type_av1 = { .codec_id = AV_CODEC_ID_AV1, diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h index 704a231209..fa41af666f 100644 --- a/libavcodec/cbs_av1.h +++ b/libavcodec/cbs_av1.h @@ -445,4 +445,9 @@ typedef struct CodedBitstreamAV1Context { } CodedBitstreamAV1Context; +/** + * Return the frame's width with superres upscaling applied, if any. + */ +int ff_cbs_av1_get_frame_width(const AV1RawFrameHeader *frame); + #endif /* AVCODEC_CBS_AV1_H */ -- 2.27.0 _______________________________________________ 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".