You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/vvc/dec: export sei to the frame when the frame starts
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
This commit is contained in:
@ -44,8 +44,9 @@
|
||||
#include "h2645_sei.h"
|
||||
#include "itut35.h"
|
||||
|
||||
#define IS_H264(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
|
||||
#define IS_HEVC(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
|
||||
#define IS_H264(codec_id) (CONFIG_H264_SEI && (CONFIG_HEVC_SEI || CONFIG_VVC_SEI ) ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
|
||||
#define IS_HEVC(codec_id) (CONFIG_HEVC_SEI && (CONFIG_H264_SEI || CONFIG_VVC_SEI ) ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
|
||||
#define IS_VVC(codec_id) (CONFIG_VVC_SEI && (CONFIG_H264_SEI || CONFIG_HEVC_SEI) ? codec_id == AV_CODEC_ID_VVC : CONFIG_VVC_SEI )
|
||||
|
||||
#if CONFIG_HEVC_SEI
|
||||
static int decode_registered_user_data_dynamic_hdr_plus(HEVCSEIDynamicHDRPlus *s,
|
||||
@ -427,7 +428,7 @@ static int decode_film_grain_characteristics(H2645SEIFilmGrainCharacteristics *h
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IS_HEVC(codec_id))
|
||||
if (!IS_H264(codec_id))
|
||||
h->persistence_flag = get_bits1(gb);
|
||||
else
|
||||
h->repetition_period = get_ue_golomb_long(gb);
|
||||
@ -854,7 +855,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
fgp->subsampling_x = fgp->subsampling_y = 0;
|
||||
|
||||
h274->model_id = fgc->model_id;
|
||||
if (fgc->separate_colour_description_present_flag) {
|
||||
if (IS_VVC(codec_id) || fgc->separate_colour_description_present_flag) {
|
||||
fgp->bit_depth_luma = fgc->bit_depth_luma;
|
||||
fgp->bit_depth_chroma = fgc->bit_depth_chroma;
|
||||
fgp->color_range = fgc->full_range + 1;
|
||||
|
@ -108,7 +108,7 @@ typedef struct H2645SEIFilmGrainCharacteristics {
|
||||
uint8_t intensity_interval_upper_bound[3][256];
|
||||
int16_t comp_model_value[3][256][6];
|
||||
int repetition_period; //< H.264 only
|
||||
int persistence_flag; //< HEVC only
|
||||
int persistence_flag; //< HEVC/VVC
|
||||
} H2645SEIFilmGrainCharacteristics;
|
||||
|
||||
typedef struct H2645SEIMasteringDisplay {
|
||||
|
@ -735,6 +735,14 @@ static void decode_prefix_sei(VVCFrameContext *fc, VVCContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
static int set_side_data(VVCContext *s, VVCFrameContext *fc)
|
||||
{
|
||||
AVFrame *out = fc->ref->frame;
|
||||
|
||||
return ff_h2645_sei_to_frame(out, &fc->sei.common, AV_CODEC_ID_VVC, s->avctx,
|
||||
NULL, fc->ps.sps->bit_depth, fc->ps.sps->bit_depth, fc->ref->poc);
|
||||
}
|
||||
|
||||
static int frame_start(VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
|
||||
{
|
||||
const VVCPH *ph = &fc->ps.ph;
|
||||
@ -750,6 +758,10 @@ static int frame_start(VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
|
||||
|
||||
decode_prefix_sei(fc, s);
|
||||
|
||||
ret = set_side_data(s, fc);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (!IS_IDR(s))
|
||||
ff_vvc_bump_frame(s, fc);
|
||||
|
||||
|
Reference in New Issue
Block a user