Skip to content

Commit

Permalink
Обновление ffmpeg git-n6.2-dev-1636-g53a51e70f2.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Mar 15, 2024
1 parent 37e1bc3 commit 29076fa
Show file tree
Hide file tree
Showing 26 changed files with 362 additions and 351 deletions.
2 changes: 1 addition & 1 deletion docs/Changelog.Rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MPC Video Renderer 0.7.3 включен в инсталлятор.
Обновлены библиотеки:
dav1d git-1.4.0-83-g872e470;
fdk-aac git-v2.0.3;
ffmpeg git-n6.2-dev-1539-g64634e809f;
ffmpeg git-n6.2-dev-1636-g53a51e70f2;
Little-CMS git-lcms2.16-41-gfcf6792;
MediaInfo git-v24.01-19-gb7bb56e8d;
nanosvg git-93ce879;
Expand Down
2 changes: 1 addition & 1 deletion docs/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Updated German translation (by Klaus1189).
Updated libraries:
dav1d git-1.4.0-83-g872e470;
fdk-aac git-v2.0.3;
ffmpeg git-n6.2-dev-1539-g64634e809f;
ffmpeg git-n6.2-dev-1636-g53a51e70f2;
Little-CMS git-lcms2.16-41-gfcf6792;
MediaInfo git-v24.01-19-gb7bb56e8d;
nanosvg git-93ce879;
Expand Down
2 changes: 2 additions & 0 deletions src/ExtLib/ffmpeg/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ Muxers/Demuxers:
dss.c Oleksij Rempel
dtsdec.c foo86
dv.c Roman Shaposhnik
dvdvideodec.c Marth64
electronicarts.c Peter Ross
evc* Samsung (Dawid Kozinski)
ffm* Baptiste Coudurier
Expand Down Expand Up @@ -425,6 +426,7 @@ Muxers/Demuxers:
pva.c Ivo van Poorten
r3d.c Baptiste Coudurier
raw.c Michael Niedermayer
rcwtenc.c Marth64
rdt.c Ronald S. Bultje
rl2.c Sascha Sommer
rmdec.c, rmenc.c Ronald S. Bultje
Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/8bps.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
unsigned int planes = c->planes;
int ret;

if (buf_size < planes * height * 2)
if (buf_size < planes * height * (2 + 2*((avctx->width+128)/129)))
return AVERROR_INVALIDDATA;

if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
Expand Down
25 changes: 25 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/av1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ static av_cold int av1_decode_free(AVCodecContext *avctx)

ff_cbs_fragment_free(&s->current_obu);
ff_cbs_close(&s->cbc);
ff_dovi_ctx_unref(&s->dovi);

return 0;
}
Expand Down Expand Up @@ -828,6 +829,7 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
{
AV1DecContext *s = avctx->priv_data;
AV1RawSequenceHeader *seq;
const AVPacketSideData *sd;
int ret;

s->avctx = avctx;
Expand Down Expand Up @@ -883,6 +885,12 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
ff_cbs_fragment_reset(&s->current_obu);
}

s->dovi.logctx = avctx;
s->dovi.dv_profile = 10; // default for AV1
sd = ff_get_coded_side_data(avctx, AV_PKT_DATA_DOVI_CONF);
if (sd && sd->size > 0)
ff_dovi_update_cfg(&s->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data);

return ret;
}

Expand Down Expand Up @@ -936,6 +944,7 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
const AV1RawMetadataITUTT35 *itut_t35)
{
GetByteContext gb;
AV1DecContext *s = avctx->priv_data;
int ret, provider_code;

bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size);
Expand Down Expand Up @@ -985,6 +994,22 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
return ret;
break;
}
case 0x3B: { // dolby_provider_code
int provider_oriented_code = bytestream2_get_be32(&gb);
if (itut_t35->itu_t_t35_country_code != 0xB5 || provider_oriented_code != 0x800)
break;

ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer);
if (ret < 0) {
av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n");
break; // ignore
}

ret = ff_dovi_attach_side_data(&s->dovi, frame);
if (ret < 0)
return ret;
break;
}
default: // ignore unsupported provider codes
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/av1dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "packet.h"
#include "cbs.h"
#include "cbs_av1.h"
#include "dovi_rpu.h"

typedef struct AV1Frame {
AVFrame *f;
Expand Down Expand Up @@ -81,6 +82,7 @@ typedef struct AV1DecContext {
AV1RawMetadataHDRCLL *cll;
AV1RawOBU *mdcv_ref; ///< RefStruct reference backing mdcv
AV1RawMetadataHDRMDCV *mdcv;
DOVIContext dovi;
AVFifo *itut_t35_fifo;

uint16_t tile_num;
Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ typedef struct AVCodecContext {
*/
int hwaccel_flags;

/*
/**
* Video decoding only. Sets the number of extra hardware frames which
* the decoder will allocate for use by the caller. This must be set
* before avcodec_open2() is called.
Expand Down
45 changes: 42 additions & 3 deletions src/ExtLib/ffmpeg/libavcodec/dovi_rpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ static inline int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *
return 0; /* unreachable */
}

static inline unsigned get_variable_bits(GetBitContext *gb, int n)
{
unsigned int value = get_bits(gb, n);
int read_more = get_bits1(gb);
while (read_more) {
value = (value + 1) << n;
value |= get_bits(gb, n);
read_more = get_bits1(gb);
}
return value;
}

#define VALIDATE(VAR, MIN, MAX) \
do { \
if (VAR < MIN || VAR > MAX) { \
Expand All @@ -200,9 +212,36 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0)
return ret;

/* RPU header, common values */
nal_prefix = get_bits(gb, 8);
VALIDATE(nal_prefix, 25, 25);
/* Container header */
if (s->dv_profile == 10 /* dav1.10 */) {
/* DV inside AV1 re-uses an EMDF container skeleton, but with fixed
* values - so we can effectively treat this as a magic byte sequence.
*
* The exact fields are, as follows:
* emdf_version : f(2) = 0
* key_id : f(3) = 6
* emdf_payload_id : f(5) = 31
* emdf_payload_id_ext : var(5) = 225
* smploffste : f(1) = 0
* duratione : f(1) = 0
* groupide : f(1) = 0
* codecdatae : f(1) = 0
* discard_unknown_payload : f(1) = 1
*/
const unsigned header_magic = 0x01be6841u;
unsigned header, emdf_payload_size;
header = get_bits_long(gb, 27);
VALIDATE(header, header_magic, header_magic);
emdf_payload_size = get_variable_bits(gb, 8);
VALIDATE(emdf_payload_size, 6, 512);
if (emdf_payload_size * 8 > get_bits_left(gb))
return AVERROR_INVALIDDATA;
} else {
nal_prefix = get_bits(gb, 8);
VALIDATE(nal_prefix, 25, 25);
}

/* RPU header */
rpu_type = get_bits(gb, 6);
if (rpu_type != 2) {
av_log(s->logctx, AV_LOG_WARNING, "Unrecognized RPU type "
Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/h264_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,

sps->vui_parameters_present_flag = get_bits1(gb);
if (sps->vui_parameters_present_flag) {
int ret = decode_vui_parameters(gb, avctx, sps);
ret = decode_vui_parameters(gb, avctx, sps);
if (ret < 0)
goto fail;
}
Expand Down
Loading

0 comments on commit 29076fa

Please sign in to comment.