mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-04 14:40:26 +00:00
avcodec/h2645_sei: use the ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
cf5284b491
commit
070bd112be
9 changed files with 56 additions and 296 deletions
|
|
@ -115,10 +115,9 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h264_ps.o h264data.o \
|
|||
h2645data.o h2645_parse.o h2645_vui.o
|
||||
OBJS-$(CONFIG_H264PRED) += h264pred.o
|
||||
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
|
||||
OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o aom_film_grain.o
|
||||
OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o
|
||||
OBJS-$(CONFIG_HEVCPARSE) += h2645data.o h2645_parse.o h2645_vui.o
|
||||
OBJS-$(CONFIG_HEVC_SEI) += h2645_sei.o aom_film_grain.o \
|
||||
dynamic_hdr_vivid.o
|
||||
OBJS-$(CONFIG_HEVC_SEI) += h2645_sei.o
|
||||
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
|
||||
OBJS-$(CONFIG_HUFFMAN) += huffman.o
|
||||
OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
|
||||
|
|
@ -462,7 +461,7 @@ OBJS-$(CONFIG_HCA_DECODER) += hcadec.o
|
|||
OBJS-$(CONFIG_HCOM_DECODER) += hcom.o
|
||||
OBJS-$(CONFIG_HDR_DECODER) += hdrdec.o
|
||||
OBJS-$(CONFIG_HDR_ENCODER) += hdrenc.o
|
||||
OBJS-$(CONFIG_HEVC_DECODER) += aom_film_grain.o h274.o
|
||||
OBJS-$(CONFIG_HEVC_DECODER) += h274.o
|
||||
OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_AMF_DECODER) += amfdec.o
|
||||
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o
|
||||
|
|
@ -838,7 +837,7 @@ OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
|||
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
|
||||
OBJS-$(CONFIG_VQC_DECODER) += vqcdec.o
|
||||
OBJS-$(CONFIG_VVC_DECODER) += executor.o h2645data.o
|
||||
OBJS-$(CONFIG_VVC_SEI) += h2645_sei.o aom_film_grain.o h274.o
|
||||
OBJS-$(CONFIG_VVC_SEI) += h2645_sei.o h274.o
|
||||
OBJS-$(CONFIG_WADY_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_WAVARC_DECODER) += wavarc.o
|
||||
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o wavpackdata.o dsd.o
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "libavutil/ambient_viewing_environment.h"
|
||||
#include "libavutil/buffer.h"
|
||||
#include "libavutil/display.h"
|
||||
#include "libavutil/hdr_dynamic_metadata.h"
|
||||
#include "libavutil/film_grain_params.h"
|
||||
#include "libavutil/mastering_display_metadata.h"
|
||||
#include "libavutil/mem.h"
|
||||
|
|
@ -38,7 +37,6 @@
|
|||
#include "atsc_a53.h"
|
||||
#include "avcodec.h"
|
||||
#include "decode.h"
|
||||
#include "dynamic_hdr_vivid.h"
|
||||
#include "get_bits.h"
|
||||
#include "golomb.h"
|
||||
#include "h2645_sei.h"
|
||||
|
|
@ -48,240 +46,22 @@
|
|||
#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,
|
||||
GetByteContext *gb)
|
||||
{
|
||||
size_t meta_size;
|
||||
int err;
|
||||
AVDynamicHDRPlus *metadata = av_dynamic_hdr_plus_alloc(&meta_size);
|
||||
if (!metadata)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
err = av_dynamic_hdr_plus_from_t35(metadata, gb->buffer,
|
||||
bytestream2_get_bytes_left(gb));
|
||||
if (err < 0) {
|
||||
av_free(metadata);
|
||||
return err;
|
||||
}
|
||||
|
||||
av_buffer_unref(&s->info);
|
||||
s->info = av_buffer_create((uint8_t *)metadata, meta_size, NULL, NULL, 0);
|
||||
if (!s->info) {
|
||||
av_free(metadata);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_registered_user_data_dynamic_hdr_vivid(HEVCSEIDynamicHDRVivid *s,
|
||||
GetByteContext *gb)
|
||||
{
|
||||
size_t meta_size;
|
||||
int err;
|
||||
AVDynamicHDRVivid *metadata = av_dynamic_hdr_vivid_alloc(&meta_size);
|
||||
if (!metadata)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
err = ff_parse_itu_t_t35_to_dynamic_hdr_vivid(metadata,
|
||||
gb->buffer, bytestream2_get_bytes_left(gb));
|
||||
if (err < 0) {
|
||||
av_free(metadata);
|
||||
return err;
|
||||
}
|
||||
|
||||
av_buffer_unref(&s->info);
|
||||
s->info = av_buffer_create((uint8_t *)metadata, meta_size, NULL, NULL, 0);
|
||||
if (!s->info) {
|
||||
av_free(metadata);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int decode_registered_user_data_lcevc(HEVCSEILCEVC *s,
|
||||
GetByteContext *gb)
|
||||
{
|
||||
int size = bytestream2_get_bytes_left(gb);
|
||||
|
||||
av_buffer_unref(&s->info);
|
||||
s->info = av_buffer_alloc(size);
|
||||
if (!s->info)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
bytestream2_get_bufferu(gb, s->info->data, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_registered_user_data_afd(H2645SEIAFD *h, GetByteContext *gb)
|
||||
{
|
||||
int flag;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
flag = !!(bytestream2_get_byteu(gb) & 0x40); // active_format_flag
|
||||
|
||||
if (flag) {
|
||||
if (bytestream2_get_bytes_left(gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
h->active_format_description = bytestream2_get_byteu(gb) & 0xF;
|
||||
h->present = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_registered_user_data_closed_caption(H2645SEIA53Caption *h,
|
||||
GetByteContext *gb)
|
||||
{
|
||||
return ff_parse_a53_cc(&h->buf_ref, gb->buffer,
|
||||
bytestream2_get_bytes_left(gb));
|
||||
}
|
||||
|
||||
static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
|
||||
enum AVCodecID codec_id, void *logctx)
|
||||
{
|
||||
int country_code, provider_code = -1;
|
||||
FFITUTT35 itut_t35 = { 0 };
|
||||
FFITUTT35Aux aux = { NULL };
|
||||
int ret;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = ff_itut_t35_parse_buffer(&itut_t35, gb->buffer, bytestream2_get_bytes_left(gb), 0);
|
||||
if (!ret)
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d, provider_code = %d)\n",
|
||||
itut_t35.country_code, itut_t35.provider_code);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
country_code = bytestream2_get_byteu(gb); // itu_t_t35_country_code
|
||||
if (country_code == 0xFF) {
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_skipu(gb, 1); // itu_t_t35_country_code_extension_byte
|
||||
}
|
||||
|
||||
/* itu_t_t35_payload_byte follows */
|
||||
|
||||
switch (country_code) {
|
||||
case ITU_T_T35_COUNTRY_CODE_US:
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_ATSC: {
|
||||
uint32_t user_identifier;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
user_identifier = bytestream2_get_be32u(gb);
|
||||
switch (user_identifier) {
|
||||
case MKBETAG('D', 'T', 'G', '1'): // afd_data
|
||||
return decode_registered_user_data_afd(&h->afd, gb);
|
||||
case MKBETAG('G', 'A', '9', '4'): // closed captions
|
||||
return decode_registered_user_data_closed_caption(&h->a53_caption, gb);
|
||||
default:
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
|
||||
user_identifier);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if CONFIG_HEVC_SEI
|
||||
case ITU_T_T35_PROVIDER_CODE_AOM: {
|
||||
const uint16_t aom_grain_provider_oriented_code = 0x0001;
|
||||
uint16_t provider_oriented_code;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == aom_grain_provider_oriented_code) {
|
||||
return ff_aom_parse_film_grain_sets(&h->aom_film_grain,
|
||||
gb->buffer,
|
||||
bytestream2_get_bytes_left(gb));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITU_T_T35_PROVIDER_CODE_SAMSUNG: {
|
||||
// A/341 Amendment - 2094-40
|
||||
const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
|
||||
const uint8_t smpte2094_40_application_identifier = 0x04;
|
||||
uint16_t provider_oriented_code;
|
||||
uint8_t application_identifier;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
application_identifier = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
|
||||
application_identifier == smpte2094_40_application_identifier) {
|
||||
return decode_registered_user_data_dynamic_hdr_plus(&h->dynamic_hdr_plus, gb);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ITU_T_T35_COUNTRY_CODE_UK:
|
||||
bytestream2_skipu(gb, 1); // t35_uk_country_code_second_octet
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_VNOVA:
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return decode_registered_user_data_lcevc(&h->lcevc, gb);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#if CONFIG_HEVC_SEI
|
||||
case ITU_T_T35_COUNTRY_CODE_CN: {
|
||||
const uint16_t cuva_provider_oriented_code = 0x0005;
|
||||
uint16_t provider_oriented_code;
|
||||
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_HDR_VIVID:
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
if (provider_oriented_code == cuva_provider_oriented_code) {
|
||||
return decode_registered_user_data_dynamic_hdr_vivid(&h->dynamic_hdr_vivid, gb);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d, provider_code = %d)\n",
|
||||
country_code, provider_code);
|
||||
|
||||
return 0;
|
||||
return ff_itut_t35_parse_payload_to_struct(&itut_t35, &aux, &h->itut_t35, 0);
|
||||
}
|
||||
|
||||
static int decode_unregistered_user_data(H2645SEIUnregistered *h,
|
||||
|
|
@ -539,8 +319,8 @@ int ff_h2645_sei_message_decode(H2645SEI *h, enum SEIType type,
|
|||
|
||||
int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
|
||||
{
|
||||
int ret = av_buffer_replace(&dst->a53_caption.buf_ref,
|
||||
src->a53_caption.buf_ref);
|
||||
int ret = av_buffer_replace(&dst->itut_t35.a53_cc,
|
||||
src->itut_t35.a53_cc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -548,7 +328,7 @@ int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
|
|||
av_buffer_unref(&dst->unregistered.buf_ref[i]);
|
||||
dst->unregistered.nb_buf_ref = 0;
|
||||
|
||||
ret = av_buffer_replace(&dst->lcevc.info, src->lcevc.info);
|
||||
ret = av_buffer_replace(&dst->itut_t35.lcevc, src->itut_t35.lcevc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -567,13 +347,13 @@ int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
|
|||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < FF_ARRAY_ELEMS(dst->aom_film_grain.sets); i++) {
|
||||
ret = av_buffer_replace(&dst->aom_film_grain.sets[i],
|
||||
src->aom_film_grain.sets[i]);
|
||||
for (unsigned i = 0; i < FF_ARRAY_ELEMS(dst->itut_t35.aom_film_grain.sets); i++) {
|
||||
ret = av_buffer_replace(&dst->itut_t35.aom_film_grain.sets[i],
|
||||
src->itut_t35.aom_film_grain.sets[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
dst->aom_film_grain.enable = src->aom_film_grain.enable;
|
||||
dst->itut_t35.aom_film_grain.enable = src->itut_t35.aom_film_grain.enable;
|
||||
|
||||
dst->ambient_viewing_environment = src->ambient_viewing_environment;
|
||||
dst->mastering_display = src->mastering_display;
|
||||
|
|
@ -742,6 +522,7 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
|
|||
int seed)
|
||||
{
|
||||
H2645SEIFramePacking *fp = &sei->frame_packing;
|
||||
FFITUTT35Meta *itut_t35 = &sei->itut_t35;
|
||||
int ret;
|
||||
|
||||
if (fp->present &&
|
||||
|
|
@ -821,12 +602,11 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
|
|||
o->hflip, o->vflip);
|
||||
}
|
||||
|
||||
if (sei->a53_caption.buf_ref) {
|
||||
H2645SEIA53Caption *a53 = &sei->a53_caption;
|
||||
AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_A53_CC, a53->buf_ref);
|
||||
if (itut_t35->a53_cc) {
|
||||
AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_A53_CC, itut_t35->a53_cc);
|
||||
if (!sd)
|
||||
av_buffer_unref(&a53->buf_ref);
|
||||
a53->buf_ref = NULL;
|
||||
av_buffer_unref(&itut_t35->a53_cc);
|
||||
itut_t35->a53_cc = NULL;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
|
|
@ -838,19 +618,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (sei->afd.present) {
|
||||
AVFrameSideData *sd = av_frame_new_side_data(frame, AV_FRAME_DATA_AFD,
|
||||
sizeof(uint8_t));
|
||||
|
||||
if (sd) {
|
||||
*sd->data = sei->afd.active_format_description;
|
||||
sei->afd.present = 0;
|
||||
}
|
||||
if (itut_t35->afd) {
|
||||
if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_AFD, itut_t35->afd))
|
||||
av_buffer_unref(&itut_t35->afd);
|
||||
itut_t35->afd = NULL;
|
||||
}
|
||||
|
||||
if (sei->lcevc.info) {
|
||||
HEVCSEILCEVC *lcevc = &sei->lcevc;
|
||||
ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_LCEVC, &lcevc->info);
|
||||
if (itut_t35->lcevc) {
|
||||
ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_LCEVC,
|
||||
&itut_t35->lcevc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -921,7 +697,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
}
|
||||
|
||||
#if CONFIG_HEVC_SEI
|
||||
ret = ff_aom_attach_film_grain_sets(&sei->aom_film_grain, frame);
|
||||
ret = ff_aom_attach_film_grain_sets(&itut_t35->aom_film_grain, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
|
@ -937,20 +713,14 @@ int ff_h2645_sei_to_context(AVCodecContext *avctx, H2645SEI *sei)
|
|||
|
||||
void ff_h2645_sei_reset(H2645SEI *s)
|
||||
{
|
||||
av_buffer_unref(&s->a53_caption.buf_ref);
|
||||
|
||||
for (unsigned i = 0; i < s->unregistered.nb_buf_ref; i++)
|
||||
av_buffer_unref(&s->unregistered.buf_ref[i]);
|
||||
s->unregistered.nb_buf_ref = 0;
|
||||
av_freep(&s->unregistered.buf_ref);
|
||||
av_buffer_unref(&s->dynamic_hdr_plus.info);
|
||||
av_buffer_unref(&s->dynamic_hdr_vivid.info);
|
||||
av_buffer_unref(&s->lcevc.info);
|
||||
|
||||
ff_itut_t35_unref(&s->itut_t35);
|
||||
s->ambient_viewing_environment.present = 0;
|
||||
s->mastering_display.present = 0;
|
||||
s->content_light.present = 0;
|
||||
|
||||
av_refstruct_unref(&s->film_grain_characteristics);
|
||||
ff_aom_uninit_film_grain_params(&s->aom_film_grain);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
#include "libavutil/frame.h"
|
||||
#include "libavutil/film_grain_params.h"
|
||||
|
||||
#include "aom_film_grain.h"
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "codec_id.h"
|
||||
#include "get_bits.h"
|
||||
#include "h2645_vui.h"
|
||||
#include "itut35.h"
|
||||
#include "sei.h"
|
||||
|
||||
typedef struct H2645SEIA53Caption {
|
||||
|
|
@ -126,11 +126,7 @@ typedef struct H2645SEIContentLight {
|
|||
} H2645SEIContentLight;
|
||||
|
||||
typedef struct H2645SEI {
|
||||
H2645SEIA53Caption a53_caption;
|
||||
H2645SEIAFD afd;
|
||||
HEVCSEIDynamicHDRPlus dynamic_hdr_plus; //< HEVC only
|
||||
HEVCSEIDynamicHDRVivid dynamic_hdr_vivid; //< HEVC only
|
||||
HEVCSEILCEVC lcevc;
|
||||
FFITUTT35Meta itut_t35;
|
||||
H2645SEIUnregistered unregistered;
|
||||
H2645SEIFramePacking frame_packing;
|
||||
H2645SEIDisplayOrientation display_orientation;
|
||||
|
|
@ -138,7 +134,6 @@ typedef struct H2645SEI {
|
|||
H2645SEIAmbientViewingEnvironment ambient_viewing_environment;
|
||||
H2645SEIMasteringDisplay mastering_display;
|
||||
H2645SEIContentLight content_light;
|
||||
AVFilmGrainAFGS1Params aom_film_grain;
|
||||
|
||||
// Dynamic allocations due to large size.
|
||||
H2645SEIFilmGrainCharacteristics *film_grain_characteristics;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ void ff_h264_sei_uninit(H264SEIContext *h)
|
|||
h->buffering_period.present = 0;
|
||||
h->common.frame_packing.present = 0;
|
||||
h->common.display_orientation.present = 0;
|
||||
h->common.afd.present = 0;
|
||||
|
||||
ff_h2645_sei_reset(&h->common);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,9 +191,8 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
|
|||
|
||||
av_assert0(!pic->f->data[0]);
|
||||
|
||||
if (h->sei.common.lcevc.info) {
|
||||
HEVCSEILCEVC *lcevc = &h->sei.common.lcevc;
|
||||
ret = ff_frame_new_side_data_from_buf(h->avctx, pic->f, AV_FRAME_DATA_LCEVC, &lcevc->info);
|
||||
if (h->sei.common.itut_t35.lcevc) {
|
||||
ret = ff_frame_new_side_data_from_buf(h->avctx, pic->f, AV_FRAME_DATA_LCEVC, &h->sei.common.itut_t35.lcevc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ static int export_stream_params_from_sei(HEVCContext *s)
|
|||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (s->sei.common.a53_caption.buf_ref)
|
||||
if (s->sei.common.itut_t35.a53_cc)
|
||||
s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
|
@ -404,7 +404,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if ((s->sei.common.film_grain_characteristics && s->sei.common.film_grain_characteristics->present) ||
|
||||
s->sei.common.aom_film_grain.enable)
|
||||
s->sei.common.itut_t35.aom_film_grain.enable)
|
||||
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
|
@ -3132,8 +3132,8 @@ static int set_side_data(HEVCContext *s)
|
|||
s->sei.timecode.num_clock_ts = 0;
|
||||
}
|
||||
|
||||
if (s->sei.common.dynamic_hdr_plus.info) {
|
||||
AVBufferRef *info_ref = av_buffer_ref(s->sei.common.dynamic_hdr_plus.info);
|
||||
if (s->sei.common.itut_t35.hdr_plus) {
|
||||
AVBufferRef *info_ref = av_buffer_ref(s->sei.common.itut_t35.hdr_plus);
|
||||
if (!info_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
|
@ -3153,10 +3153,10 @@ static int set_side_data(HEVCContext *s)
|
|||
if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0)
|
||||
return ret;
|
||||
|
||||
if (s->sei.common.dynamic_hdr_vivid.info) {
|
||||
if (s->sei.common.itut_t35.hdr_vivid) {
|
||||
if (!av_frame_side_data_add(&out->side_data, &out->nb_side_data,
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
|
||||
&s->sei.common.dynamic_hdr_vivid.info,
|
||||
&s->sei.common.itut_t35.hdr_vivid,
|
||||
AV_FRAME_SIDE_DATA_FLAG_NEW_REF))
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
|
@ -3350,7 +3350,7 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
|
|||
|
||||
s->cur_frame->needs_fg = ((s->sei.common.film_grain_characteristics &&
|
||||
s->sei.common.film_grain_characteristics->present) ||
|
||||
s->sei.common.aom_film_grain.enable) &&
|
||||
s->sei.common.itut_t35.aom_film_grain.enable) &&
|
||||
!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
|
||||
!s->avctx->hwaccel;
|
||||
|
||||
|
|
@ -4080,8 +4080,8 @@ static int hevc_update_thread_context(AVCodecContext *dst,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_buffer_replace(&s->sei.common.dynamic_hdr_plus.info,
|
||||
s0->sei.common.dynamic_hdr_plus.info);
|
||||
ret = av_buffer_replace(&s->sei.common.itut_t35.hdr_plus,
|
||||
s0->sei.common.itut_t35.hdr_plus);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -4091,8 +4091,8 @@ static int hevc_update_thread_context(AVCodecContext *dst,
|
|||
|
||||
ff_dovi_ctx_replace(&s->dovi_ctx, &s0->dovi_ctx);
|
||||
|
||||
ret = av_buffer_replace(&s->sei.common.dynamic_hdr_vivid.info,
|
||||
s0->sei.common.dynamic_hdr_vivid.info);
|
||||
ret = av_buffer_replace(&s->sei.common.itut_t35.hdr_vivid,
|
||||
s0->sei.common.itut_t35.hdr_vivid);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,10 +122,9 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l)
|
|||
return NULL;
|
||||
|
||||
// Add LCEVC SEI metadata here, as it's needed in get_buffer()
|
||||
if (s->sei.common.lcevc.info) {
|
||||
HEVCSEILCEVC *lcevc = &s->sei.common.lcevc;
|
||||
if (s->sei.common.itut_t35.lcevc) {
|
||||
ret = ff_frame_new_side_data_from_buf(s->avctx, frame->tf.f,
|
||||
AV_FRAME_DATA_LCEVC, &lcevc->info);
|
||||
AV_FRAME_DATA_LCEVC, &s->sei.common.itut_t35.lcevc);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ static int check_film_grain(VVCContext *s, VVCFrameContext *fc)
|
|||
|
||||
fc->ref->needs_fg = (fc->sei.common.film_grain_characteristics &&
|
||||
fc->sei.common.film_grain_characteristics->present ||
|
||||
fc->sei.common.aom_film_grain.enable) &&
|
||||
fc->sei.common.itut_t35.aom_film_grain.enable) &&
|
||||
!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
|
||||
!s->avctx->hwaccel;
|
||||
|
||||
|
|
|
|||
|
|
@ -134,10 +134,9 @@ static VVCFrame *alloc_frame(VVCContext *s, VVCFrameContext *fc)
|
|||
frame->pps = av_refstruct_ref_c(fc->ps.pps);
|
||||
|
||||
// Add LCEVC SEI metadata here, as it's needed in get_buffer()
|
||||
if (fc->sei.common.lcevc.info) {
|
||||
HEVCSEILCEVC *lcevc = &fc->sei.common.lcevc;
|
||||
if (fc->sei.common.itut_t35.lcevc) {
|
||||
ret = ff_frame_new_side_data_from_buf(s->avctx, frame->frame,
|
||||
AV_FRAME_DATA_LCEVC, &lcevc->info);
|
||||
AV_FRAME_DATA_LCEVC, &fc->sei.common.itut_t35.lcevc);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue