Skip to content

Commit

Permalink
Обновлен ffmpeg n7.1-dev-2058-g677f28b310.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Aug 3, 2024
1 parent dcdde30 commit e798dfe
Show file tree
Hide file tree
Showing 33 changed files with 496 additions and 436 deletions.
2 changes: 1 addition & 1 deletion docs/Changelog.Rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MPCVideoDec

Обновлены библиотеки:
dav1d 1.4.2-15-g2355eeb;
ffmpeg n7.1-dev-1969-g719e46f54c;
ffmpeg n7.1-dev-2058-g677f28b310;
Little-CMS git-lcms2.16-60-g1c9021b;
MediaInfo git-v24.06-10-g88f3ea4aa;
ResizableLib v1.5.3-8-g25a89da;
Expand Down
2 changes: 1 addition & 1 deletion docs/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Updated Japanese translation (by tsubasanouta).

Updated libraries:
dav1d 1.4.2-15-g2355eeb;
ffmpeg n7.1-dev-1969-g719e46f54c;
ffmpeg n7.1-dev-2058-g677f28b310;
Little-CMS git-lcms2.16-60-g1c9021b;
MediaInfo git-v24.06-10-g88f3ea4aa;
ResizableLib v1.5.3-8-g25a89da;
Expand Down
18 changes: 8 additions & 10 deletions src/ExtLib/ffmpeg/libavcodec/adpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
case AV_CODEC_ID_ADPCM_IMA_AMV:
max_channels = 1;
break;
case AV_CODEC_ID_ADPCM_DTK:
case AV_CODEC_ID_ADPCM_EA:
min_channels = 1;
break;
case AV_CODEC_ID_ADPCM_AFC:
case AV_CODEC_ID_ADPCM_EA_R1:
case AV_CODEC_ID_ADPCM_EA_R2:
Expand Down Expand Up @@ -1684,22 +1680,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
for (int count2 = 0; count2 < (channels == 2 ? 28 : 14); count2++) {
byte = bytestream2_get_byteu(&gb);
next_left_sample = sign_extend(byte >> 4, 4) * (1 << shift_left);
next_right_sample = sign_extend(byte, 4) * (1 << shift_right);

next_left_sample = (next_left_sample +
(current_left_sample * coeff1l) +
(previous_left_sample * coeff2l) + 0x80) >> 8;
next_right_sample = (next_right_sample +
(current_right_sample * coeff1r) +
(previous_right_sample * coeff2r) + 0x80) >> 8;

previous_left_sample = current_left_sample;
current_left_sample = av_clip_int16(next_left_sample);
previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
*samples++ = current_left_sample;

if (channels == 2){
next_right_sample = sign_extend(byte, 4) * (1 << shift_right);

next_right_sample = (next_right_sample +
(current_right_sample * coeff1r) +
(previous_right_sample * coeff2r) + 0x80) >> 8;

previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
*samples++ = current_right_sample;
} else {
next_left_sample = sign_extend(byte, 4) * (1 << shift_left);
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ extern const FFCodec ff_vp9_mediacodec_encoder;
extern const FFCodec ff_vp9_qsv_decoder;
extern const FFCodec ff_vp9_vaapi_encoder;
extern const FFCodec ff_vp9_qsv_encoder;
extern const FFCodec ff_vvc_qsv_decoder;

// null codecs
extern const FFCodec ff_vnull_decoder;
Expand Down
53 changes: 6 additions & 47 deletions src/ExtLib/ffmpeg/libavcodec/audiodsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,16 @@
#include "libavutil/common.h"
#include "audiodsp.h"

static inline float clipf_c_one(float a, uint32_t mini,
uint32_t maxi, uint32_t maxisign)
{
uint32_t ai = av_float2int(a);

if (ai > mini)
return av_int2float(mini);
else if ((ai ^ (1U << 31)) > maxisign)
return av_int2float(maxi);
else
return a;
}

static void vector_clipf_c_opposite_sign(float *dst, const float *src,
float min, float max, int len)
{
int i;
uint32_t mini = av_float2int(min);
uint32_t maxi = av_float2int(max);
uint32_t maxisign = maxi ^ (1U << 31);

for (i = 0; i < len; i += 8) {
dst[i + 0] = clipf_c_one(src[i + 0], mini, maxi, maxisign);
dst[i + 1] = clipf_c_one(src[i + 1], mini, maxi, maxisign);
dst[i + 2] = clipf_c_one(src[i + 2], mini, maxi, maxisign);
dst[i + 3] = clipf_c_one(src[i + 3], mini, maxi, maxisign);
dst[i + 4] = clipf_c_one(src[i + 4], mini, maxi, maxisign);
dst[i + 5] = clipf_c_one(src[i + 5], mini, maxi, maxisign);
dst[i + 6] = clipf_c_one(src[i + 6], mini, maxi, maxisign);
dst[i + 7] = clipf_c_one(src[i + 7], mini, maxi, maxisign);
}
}

static void vector_clipf_c(float *dst, const float *src, int len,
float min, float max)
{
int i;
for (int i = 0; i < len; i += 8) {
float tmp[8];

if (min < 0 && max > 0) {
vector_clipf_c_opposite_sign(dst, src, min, max, len);
} else {
for (i = 0; i < len; i += 8) {
dst[i] = av_clipf(src[i], min, max);
dst[i + 1] = av_clipf(src[i + 1], min, max);
dst[i + 2] = av_clipf(src[i + 2], min, max);
dst[i + 3] = av_clipf(src[i + 3], min, max);
dst[i + 4] = av_clipf(src[i + 4], min, max);
dst[i + 5] = av_clipf(src[i + 5], min, max);
dst[i + 6] = av_clipf(src[i + 6], min, max);
dst[i + 7] = av_clipf(src[i + 7], min, max);
}
for (int j = 0; j < 8; j++)
tmp[j]= av_clipf(src[i + j], min, max);
for (int j = 0; j < 8; j++)
dst[i + j] = tmp[j];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/av1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
if (!ret)
break;

ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &buf, NULL);
ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &buf);
if (ret < 0)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ int ff_frame_new_side_data_from_buf_ext(const AVCodecContext *avctx,

int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx,
AVFrame *frame, enum AVFrameSideDataType type,
AVBufferRef **buf, AVFrameSideData **psd)
AVBufferRef **buf)
{
return ff_frame_new_side_data_from_buf_ext(avctx,
&frame->side_data, &frame->nb_side_data,
Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame,
*/
int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx,
AVFrame *frame, enum AVFrameSideDataType type,
AVBufferRef **buf, AVFrameSideData **sd);
AVBufferRef **buf);

/**
* Same as `ff_frame_new_side_data_from_buf`, but taking a AVFrameSideData
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/dovi_rpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0)
for (int i = 0; i <= DOVI_MAX_DM_ID; i++)
ff_refstruct_replace(&s->vdr[i], s0->vdr[i]);
ff_refstruct_replace(&s->ext_blocks, s0->ext_blocks);
s->num_ext_blocks = s0->num_ext_blocks;
}

int ff_dovi_guess_profile_hevc(const AVDOVIRpuDataHeader *hdr)
Expand Down
5 changes: 3 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/dovi_rpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ void ff_dovi_ctx_unref(DOVIContext *s);
void ff_dovi_ctx_flush(DOVIContext *s);

/**
* Parse the contents of a Dovi RPU NAL and update the parsed values in the
* DOVIContext struct.
* Parse the contents of a Dolby Vision RPU and update the parsed values in the
* DOVIContext struct. This function should receive the decoded unit payload,
* without any T.35 or NAL unit headers.
*
* Returns 0 or an error code.
*
Expand Down
2 changes: 1 addition & 1 deletion src/ExtLib/ffmpeg/libavcodec/dovi_rpudec.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size,
emdf_protection = get_bits(gb, 5 + 12);
VALIDATE(emdf_protection, 0x400, 0x400);
} else {
/* NAL RBSP with prefix and trailing zeroes */
/* NAL unit with prefix and trailing zeroes */
VALIDATE(rpu[0], 25, 25); /* NAL prefix */
rpu++;
rpu_size--;
Expand Down
119 changes: 64 additions & 55 deletions src/ExtLib/ffmpeg/libavcodec/ffv1.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "avcodec.h"
#include "ffv1.h"
#include "refstruct.h"

av_cold int ff_ffv1_common_init(AVCodecContext *avctx)
{
Expand All @@ -52,16 +53,33 @@ av_cold int ff_ffv1_common_init(AVCodecContext *avctx)
return 0;
}

av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs)
static void planes_free(FFRefStructOpaque opaque, void *obj)
{
PlaneContext *planes = obj;

for (int i = 0; i < MAX_PLANES; i++) {
PlaneContext *p = &planes[i];

av_freep(&p->state);
av_freep(&p->vlc_state);
}
}

PlaneContext* ff_ffv1_planes_alloc(void)
{
return ff_refstruct_alloc_ext(sizeof(PlaneContext) * MAX_PLANES,
0, NULL, planes_free);
}

av_cold int ff_ffv1_init_slice_state(const FFV1Context *f,
FFV1SliceContext *sc)
{
int j, i;

fs->plane_count = f->plane_count;
fs->transparency = f->transparency;
for (j = 0; j < f->plane_count; j++) {
PlaneContext *const p = &fs->plane[j];
PlaneContext *const p = &sc->plane[j];

if (fs->ac != AC_GOLOMB_RICE) {
if (f->ac != AC_GOLOMB_RICE) {
if (!p->state)
p->state = av_malloc_array(p->context_count, CONTEXT_SIZE *
sizeof(uint8_t));
Expand All @@ -80,11 +98,11 @@ av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs)
}
}

if (fs->ac == AC_RANGE_CUSTOM_TAB) {
if (f->ac == AC_RANGE_CUSTOM_TAB) {
//FIXME only redo if state_transition changed
for (j = 1; j < 256; j++) {
fs->c. one_state[ j] = f->state_transition[j];
fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j];
sc->c. one_state[ j] = f->state_transition[j];
sc->c.zero_state[256 - j] = 256 - sc->c.one_state[j];
}
}

Expand All @@ -95,53 +113,51 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
{
int i, ret;
for (i = 0; i < f->max_slice_count; i++) {
FFV1Context *fs = f->slice_context[i];
if ((ret = ff_ffv1_init_slice_state(f, fs)) < 0)
if ((ret = ff_ffv1_init_slice_state(f, &f->slices[i])) < 0)
return AVERROR(ENOMEM);
}
return 0;
}

av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
{
int i, max_slice_count = f->num_h_slices * f->num_v_slices;
int max_slice_count = f->num_h_slices * f->num_v_slices;

av_assert0(max_slice_count > 0);

for (i = 0; i < max_slice_count;) {
f->slices = av_calloc(max_slice_count, sizeof(*f->slices));
if (!f->slices)
return AVERROR(ENOMEM);

f->max_slice_count = max_slice_count;

for (int i = 0; i < max_slice_count; i++) {
FFV1SliceContext *sc = &f->slices[i];
int sx = i % f->num_h_slices;
int sy = i / f->num_h_slices;
int sxs = f->avctx->width * sx / f->num_h_slices;
int sxe = f->avctx->width * (sx + 1) / f->num_h_slices;
int sys = f->avctx->height * sy / f->num_v_slices;
int sye = f->avctx->height * (sy + 1) / f->num_v_slices;
FFV1Context *fs = av_mallocz(sizeof(*fs));

if (!fs)
goto memfail;

f->slice_context[i++] = fs;
memcpy(fs, f, sizeof(*fs));
memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2));

fs->slice_width = sxe - sxs;
fs->slice_height = sye - sys;
fs->slice_x = sxs;
fs->slice_y = sys;

fs->sample_buffer = av_malloc_array((fs->width + 6), 3 * MAX_PLANES *
sizeof(*fs->sample_buffer));
fs->sample_buffer32 = av_malloc_array((fs->width + 6), 3 * MAX_PLANES *
sizeof(*fs->sample_buffer32));
if (!fs->sample_buffer || !fs->sample_buffer32)
goto memfail;

sc->slice_width = sxe - sxs;
sc->slice_height = sye - sys;
sc->slice_x = sxs;
sc->slice_y = sys;

sc->sample_buffer = av_malloc_array((f->width + 6), 3 * MAX_PLANES *
sizeof(*sc->sample_buffer));
sc->sample_buffer32 = av_malloc_array((f->width + 6), 3 * MAX_PLANES *
sizeof(*sc->sample_buffer32));
if (!sc->sample_buffer || !sc->sample_buffer32)
return AVERROR(ENOMEM);

sc->plane = ff_ffv1_planes_alloc();
if (!sc->plane)
return AVERROR(ENOMEM);
}
f->max_slice_count = max_slice_count;
return 0;

memfail:
f->max_slice_count = i;
return AVERROR(ENOMEM);
return 0;
}

int ff_ffv1_allocate_initial_states(FFV1Context *f)
Expand All @@ -159,17 +175,14 @@ int ff_ffv1_allocate_initial_states(FFV1Context *f)
return 0;
}

void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1Context *fs)
void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1SliceContext *sc)
{
int i, j;

for (i = 0; i < f->plane_count; i++) {
PlaneContext *p = &fs->plane[i];

p->interlace_bit_state[0] = 128;
p->interlace_bit_state[1] = 128;
PlaneContext *p = &sc->plane[i];

if (fs->ac != AC_GOLOMB_RICE) {
if (f->ac != AC_GOLOMB_RICE) {
if (f->initial_states[p->quant_table_index]) {
memcpy(p->state, f->initial_states[p->quant_table_index],
CONTEXT_SIZE * p->context_count);
Expand All @@ -193,29 +206,25 @@ av_cold int ff_ffv1_close(AVCodecContext *avctx)
int i, j;

for (j = 0; j < s->max_slice_count; j++) {
FFV1Context *fs = s->slice_context[j];
for (i = 0; i < s->plane_count; i++) {
PlaneContext *p = &fs->plane[i];
FFV1SliceContext *sc = &s->slices[j];

av_freep(&p->state);
av_freep(&p->vlc_state);
}
av_freep(&fs->sample_buffer);
av_freep(&fs->sample_buffer32);
av_freep(&sc->sample_buffer);
av_freep(&sc->sample_buffer32);

ff_refstruct_unref(&sc->plane);
}

av_freep(&avctx->stats_out);
for (j = 0; j < s->quant_table_count; j++) {
av_freep(&s->initial_states[j]);
for (i = 0; i < s->max_slice_count; i++) {
FFV1Context *sf = s->slice_context[i];
av_freep(&sf->rc_stat2[j]);
FFV1SliceContext *sc = &s->slices[i];
av_freep(&sc->rc_stat2[j]);
}
av_freep(&s->rc_stat2[j]);
}

for (i = 0; i < s->max_slice_count; i++)
av_freep(&s->slice_context[i]);
av_freep(&s->slices);

return 0;
}
Loading

0 comments on commit e798dfe

Please sign in to comment.