1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/vvc/sei: add decode_decoded_picture_hash

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
This commit is contained in:
Wu Jianhua
2025-04-27 19:44:39 +08:00
committed by Nuo Mi
parent 942cf59e9d
commit 8dfc24cdce
2 changed files with 21 additions and 0 deletions

View File

@ -80,6 +80,20 @@ static int decode_film_grain_characteristics(H2645SEIFilmGrainCharacteristics *h
return 0;
}
static int decode_decoded_picture_hash(H274SEIPictureHash *h, const SEIRawDecodedPictureHash *s)
{
h->present = 1;
h->hash_type = s->dph_sei_hash_type;
if (h->hash_type == 0)
memcpy(h->md5, s->dph_sei_picture_md5, sizeof(h->md5));
else if (h->hash_type == 1)
memcpy(h->crc, s->dph_sei_picture_crc, sizeof(h->crc));
else if (h->hash_type == 2)
memcpy(h->checksum, s->dph_sei_picture_checksum, sizeof(h->checksum));
return 0;
}
int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameContext *fc)
{
H2645SEI *c = &s->common;
@ -99,6 +113,9 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
return AVERROR(ENOMEM);
return decode_film_grain_characteristics(c->film_grain_characteristics, payload, fc);
case SEI_TYPE_DECODED_PICTURE_HASH:
return decode_decoded_picture_hash(&s->picture_hash, payload);
default:
av_log(fc->log_ctx, AV_LOG_DEBUG, "Skipped %s SEI %d\n",
sei->nal_unit_header.nal_unit_type == VVC_PREFIX_SEI_NUT ?
@ -112,10 +129,12 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
int ff_vvc_sei_replace(VVCSEI *dst, const VVCSEI *src)
{
dst->picture_hash.present = 0; // drop hash
return ff_h2645_sei_ctx_replace(&dst->common, &src->common);
}
void ff_vvc_sei_reset(VVCSEI *s)
{
ff_h2645_sei_reset(&s->common);
s->picture_hash.present = 0;
}

View File

@ -31,9 +31,11 @@
#include "libavcodec/h2645_sei.h"
#include "libavcodec/sei.h"
#include "libavcodec/vvc.h"
#include "libavcodec/h274.h"
typedef struct VVCSEI {
H2645SEI common;
H274SEIPictureHash picture_hash;
} VVCSEI;
struct VVCFrameContext;