Skip to content

Commit

Permalink
Обновлен ffmpeg n7.1-dev-1969-g719e46f54c.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Jul 27, 2024
1 parent 318e99c commit d3551e3
Show file tree
Hide file tree
Showing 30 changed files with 517 additions and 326 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-1805-g9af348bd1a;
ffmpeg n7.1-dev-1969-g719e46f54c;
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-1805-g9af348bd1a;
ffmpeg n7.1-dev-1969-g719e46f54c;
Little-CMS git-lcms2.16-60-g1c9021b;
MediaInfo git-v24.06-10-g88f3ea4aa;
ResizableLib v1.5.3-8-g25a89da;
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ static av_cold int che_configure(AACDecContext *ac,
ac->proc.sbr_ctx_close(ac->che[type][id]);
}
av_freep(&ac->che[type][id]);
memset(ac->output_element, 0, sizeof(ac->output_element));
}
return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec_lpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ int ff_aac_parse_fac_data(AACUsacElemData *ce, GetBitContext *gb,
if (use_gain)
ce->fac.gain = get_bits(gb, 7);

if (len/8 > 8)
return AVERROR_PATCHWELCOME;

for (int i = 0; i < len/8; i++) {
ret = parse_codebook_idx(gb, ce->fac.kv[i], 1, 1);
if (ret < 0)
Expand Down
1 change: 1 addition & 0 deletions src/ExtLib/ffmpeg/libavcodec/aac/aacdec_usac.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ static int setup_sce(AACDecContext *ac, SingleChannelElement *sce,
"Number of scalefactor bands in group (%d) "
"exceeds limit (%d).\n",
ics->max_sfb, ics->num_swb);
ics->max_sfb = 0;
return AVERROR(EINVAL);
}

Expand Down
44 changes: 32 additions & 12 deletions src/ExtLib/ffmpeg/libavcodec/adpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
break;
case AV_CODEC_ID_ADPCM_DTK:
case AV_CODEC_ID_ADPCM_EA:
min_channels = 2;
min_channels = 1;
break;
case AV_CODEC_ID_ADPCM_AFC:
case AV_CODEC_ID_ADPCM_EA_R1:
Expand Down Expand Up @@ -914,10 +914,12 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
bytestream2_seek(gb, -8, SEEK_CUR);
break;
case AV_CODEC_ID_ADPCM_EA:
/* Stereo is 30 bytes per block */
/* Mono is 15 bytes per block */
has_coded_samples = 1;
*coded_samples = bytestream2_get_le32(gb);
*coded_samples -= *coded_samples % 28;
nb_samples = (buf_size - 12) / 30 * 28;
nb_samples = (buf_size - 12) / (ch == 2 ? 30 : 15) * 28;
break;
case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
has_coded_samples = 1;
Expand Down Expand Up @@ -1652,10 +1654,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int coeff1l, coeff2l, coeff1r, coeff2r;
int shift_left, shift_right;

/* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
each coding 28 stereo samples. */
/* Each EA ADPCM frame has a 12-byte header followed by 30-byte (stereo) or 15-byte (mono) pieces,
each coding 28 stereo/mono samples. */

if (channels != 2)
if (channels != 2 && channels != 1)
return AVERROR_INVALIDDATA;

current_left_sample = sign_extend(bytestream2_get_le16u(&gb), 16);
Expand All @@ -1670,11 +1672,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
coeff1r = ea_adpcm_table[ byte & 0x0F];
coeff2r = ea_adpcm_table[(byte & 0x0F) + 4];

byte = bytestream2_get_byteu(&gb);
shift_left = 20 - (byte >> 4);
shift_right = 20 - (byte & 0x0F);
if (channels == 2){
byte = bytestream2_get_byteu(&gb);
shift_left = 20 - (byte >> 4);
shift_right = 20 - (byte & 0x0F);
} else{
/* Mono packs the shift into the coefficient byte's lower nibble instead */
shift_left = 20 - (byte & 0x0F);
}

for (int count2 = 0; count2 < 28; count2++) {
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);
Expand All @@ -1691,11 +1698,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
*samples++ = current_left_sample;
*samples++ = current_right_sample;

if (channels == 2){
*samples++ = current_right_sample;
} else {
next_left_sample = sign_extend(byte, 4) * (1 << shift_left);

next_left_sample = (next_left_sample +
(current_left_sample * coeff1l) +
(previous_left_sample * coeff2l) + 0x80) >> 8;

previous_left_sample = current_left_sample;
current_left_sample = av_clip_int16(next_left_sample);

*samples++ = current_left_sample;
}
}
}

bytestream2_skip(&gb, 2); // Skip terminating 0x0000
bytestream2_skip(&gb, channels == 2 ? 2 : 3); // Skip terminating NULs
) /* End of CASE */
CASE(ADPCM_EA_MAXIS_XA,
int coeff[2][2], shift[2];
Expand Down
4 changes: 2 additions & 2 deletions src/ExtLib/ffmpeg/libavcodec/alsdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,8 +2110,8 @@ static av_cold int decode_init(AVCodecContext *avctx)

if (sconf->floating) {
ctx->acf = av_malloc_array(channels, sizeof(*ctx->acf));
ctx->shift_value = av_malloc_array(channels, sizeof(*ctx->shift_value));
ctx->last_shift_value = av_malloc_array(channels, sizeof(*ctx->last_shift_value));
ctx->shift_value = av_calloc(channels, sizeof(*ctx->shift_value));
ctx->last_shift_value = av_calloc(channels, sizeof(*ctx->last_shift_value));
ctx->last_acf_mantissa = av_malloc_array(channels, sizeof(*ctx->last_acf_mantissa));
ctx->raw_mantissa = av_calloc(channels, sizeof(*ctx->raw_mantissa));

Expand Down
18 changes: 13 additions & 5 deletions src/ExtLib/ffmpeg/libavcodec/cbs_av1.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
CBS_TRACE_READ_START();

zeroes = 0;
while (1) {
while (zeroes < 32) {
if (get_bits_left(gbc) < 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
"%s: bitstream ended.\n", name);
Expand All @@ -49,10 +49,18 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
}

if (zeroes >= 32) {
// Note that the spec allows an arbitrarily large number of
// zero bits followed by a one bit in this case, but the
// libaom implementation does not support it.
value = MAX_UINT_BITS(32);
// The spec allows at least thirty-two zero bits followed by a
// one to mean 2^32-1, with no constraint on the number of
// zeroes. The libaom reference decoder does not match this,
// instead reading thirty-two zeroes but not the following one
// to mean 2^32-1. These two interpretations are incompatible
// and other implementations may follow one or the other.
// Therefore we reject thirty-two zeroes because the intended
// behaviour is not clear.
av_log(ctx->log_ctx, AV_LOG_ERROR, "Thirty-two zero bits in "
"%s uvlc code: considered invalid due to conflicting "
"standard and reference decoder behaviour.\n", name);
return AVERROR_INVALIDDATA;
} else {
if (get_bits_left(gbc) < zeroes) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
Expand Down
9 changes: 8 additions & 1 deletion src/ExtLib/ffmpeg/libavcodec/cbs_h2645.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
size_t size = nal->size;
enum AVCodecID codec_id = ctx->codec->codec_id;

if (codec_id != AV_CODEC_ID_VVC && nal->nuh_layer_id > 0)
if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 &&
(nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS))
continue;

// Remove trailing zeroes.
Expand Down Expand Up @@ -2274,6 +2275,12 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = {
sizeof(H265RawSEIAlphaChannelInfo),
SEI_MESSAGE_RW(h265, sei_alpha_channel_info),
},
{
SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO,
1, 0,
sizeof(H265RawSEI3DReferenceDisplaysInfo),
SEI_MESSAGE_RW(h265, sei_3d_reference_displays_info),
},
SEI_MESSAGE_TYPE_END
};

Expand Down
65 changes: 65 additions & 0 deletions src/ExtLib/ffmpeg/libavcodec/cbs_h265.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,16 @@ typedef struct H265RawSPS {
uint8_t sps_video_parameter_set_id;

uint8_t sps_max_sub_layers_minus1;
uint8_t sps_ext_or_max_sub_layers_minus1;
uint8_t sps_temporal_id_nesting_flag;

H265RawProfileTierLevel profile_tier_level;

uint8_t sps_seq_parameter_set_id;

uint8_t update_rep_format_flag;
uint8_t sps_rep_format_idx;

uint8_t chroma_format_idc;
uint8_t separate_colour_plane_flag;

Expand Down Expand Up @@ -284,6 +288,8 @@ typedef struct H265RawSPS {
uint8_t max_transform_hierarchy_depth_intra;

uint8_t scaling_list_enabled_flag;
uint8_t sps_infer_scaling_list_flag;
uint8_t sps_scaling_list_ref_layer_id;
uint8_t sps_scaling_list_data_present_flag;
H265RawScalingList scaling_list;

Expand Down Expand Up @@ -342,6 +348,9 @@ typedef struct H265RawSPS {

uint8_t motion_vector_resolution_control_idc;
uint8_t intra_boundary_filtering_disable_flag;

// Multilayer extension.
uint8_t inter_view_mv_vert_constraint_flag;
} H265RawSPS;

typedef struct H265RawPPS {
Expand Down Expand Up @@ -433,6 +442,46 @@ typedef struct H265RawPPS {
uint8_t luma_bit_depth_entry_minus8;
uint8_t chroma_bit_depth_entry_minus8;
uint16_t pps_palette_predictor_initializers[3][128];

// Multilayer extension.
uint8_t poc_reset_info_present_flag;
uint8_t pps_infer_scaling_list_flag;
uint8_t pps_scaling_list_ref_layer_id;
uint8_t num_ref_loc_offsets;
uint8_t ref_loc_offset_layer_id[64];
uint8_t scaled_ref_layer_offset_present_flag[64];
int16_t scaled_ref_layer_left_offset[64];
int16_t scaled_ref_layer_top_offset[64];
int16_t scaled_ref_layer_right_offset[64];
int16_t scaled_ref_layer_bottom_offset[64];
uint8_t ref_region_offset_present_flag[64];
int16_t ref_region_left_offset[64];
int16_t ref_region_top_offset[64];
int16_t ref_region_right_offset[64];
int16_t ref_region_bottom_offset[64];
uint8_t resample_phase_set_present_flag[64];
uint8_t phase_hor_luma[64];
uint8_t phase_ver_luma[64];
uint8_t phase_hor_chroma_plus8[64];
uint8_t phase_ver_chroma_plus8[64];
uint8_t colour_mapping_enabled_flag;
uint8_t num_cm_ref_layers_minus1;
uint8_t cm_ref_layer_id[62];
uint8_t cm_octant_depth;
uint8_t cm_y_part_num_log2;
uint8_t luma_bit_depth_cm_input_minus8;
uint8_t chroma_bit_depth_cm_input_minus8;
uint8_t luma_bit_depth_cm_output_minus8;
uint8_t chroma_bit_depth_cm_output_minus8;
uint8_t cm_res_quant_bits;
uint8_t cm_delta_flc_bits_minus1;
int16_t cm_adapt_threshold_u_delta;
int16_t cm_adapt_threshold_v_delta;
uint8_t split_octant_flag[2];
uint8_t coded_res_flag[12][2][2][4];
uint8_t res_coeff_q[12][2][2][4][3];
uint32_t res_coeff_s[12][2][2][4][3];
uint8_t res_coeff_r[12][2][2][4][3];
} H265RawPPS;

typedef struct H265RawAUD {
Expand Down Expand Up @@ -671,6 +720,22 @@ typedef struct H265RawSEIAlphaChannelInfo {
uint8_t alpha_channel_clip_type_flag;
} H265RawSEIAlphaChannelInfo;

typedef struct H265RawSEI3DReferenceDisplaysInfo {
uint8_t prec_ref_display_width;
uint8_t ref_viewing_distance_flag;
uint8_t prec_ref_viewing_dist;
uint8_t num_ref_displays_minus1;
uint8_t left_view_id[31];
uint8_t right_view_id[31];
uint8_t exponent_ref_display_width[31];
uint8_t mantissa_ref_display_width[31];
uint8_t exponent_ref_viewing_distance[31];
uint8_t mantissa_ref_viewing_distance[31];
uint8_t additional_shift_present_flag[31];
uint16_t num_sample_shift_plus512[31];
uint8_t three_dimensional_reference_displays_extension_flag;
} H265RawSEI3DReferenceDisplaysInfo;

typedef struct H265RawSEI {
H265RawNALUnitHeader nal_unit_header;
SEIRawMessageList message_list;
Expand Down
Loading

7 comments on commit d3551e3

@qwerttvv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this update introduces some bugs

@qwerttvv
Copy link

@qwerttvv qwerttvv commented on d3551e3 Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit
[build.bat Build Packages]
compilation results
https://github.com/qwerttvv/Player/releases/tag/2024.07.28-2354

this commit
[build.bat Build All Packages]
compilation results
https://github.com/qwerttvv/Player/releases/tag/2024.07.28-2320

there was no problem before this commit
318e99c
[build.bat Build All Packages]
compilation results
https://github.com/qwerttvv/Player/releases/tag/2024.07.27-1646

logs.zip

@v0lt
Copy link
Collaborator Author

@v0lt v0lt commented on d3551e3 Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error	LNK2019	unresolved external symbol __imp__sopen referenced in function win32_open	MpcAudioRenderer	MPC-BE\src\filters\renderer\MpcAudioRenderer\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__sopen referenced in function win32_open	AudioSwitcher	MPC-BE\src\filters\switcher\AudioSwitcher\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__wsopen referenced in function win32_open	MpcAudioRenderer	MPC-BE\src\filters\renderer\MpcAudioRenderer\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__wsopen referenced in function win32_open	AudioSwitcher	MPC-BE\src\filters\switcher\AudioSwitcher\ffmpeg.lib(file_open.o)	1

This is strange. I don't understand why this started happening when building standalone_filters.

@qwerttvv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filters_errors_Release_Win32.log

23:19:49.778    50>ffmpeg.lib(file_open.o) : error LNK2001: unresolved external symbol __imp___wsopen [C:\repos\MPC-BE\src\filters\switcher\AudioSwitcher\AudioSwitcher.vcxproj]
23:19:49.778    50>ffmpeg.lib(file_open.o) : error LNK2001: unresolved external symbol __imp___sopen [C:\repos\MPC-BE\src\filters\switcher\AudioSwitcher\AudioSwitcher.vcxproj]
23:19:49.778    50>C:\repos\MPC-BE\_bin\Filters_x86\AudioSwitcher.ax : fatal error LNK1120: 2 unresolved externals [C:\repos\MPC-BE\src\filters\switcher\AudioSwitcher\AudioSwitcher.vcxproj]
23:20:52.197    39>ffmpeg.lib(file_open.o) : error LNK2001: unresolved external symbol __imp___wsopen [C:\repos\MPC-BE\src\filters\renderer\MpcAudioRenderer\MpcAudioRenderer.vcxproj]
23:20:52.197    39>ffmpeg.lib(file_open.o) : error LNK2001: unresolved external symbol __imp___sopen [C:\repos\MPC-BE\src\filters\renderer\MpcAudioRenderer\MpcAudioRenderer.vcxproj]
23:20:52.197    39>C:\repos\MPC-BE\_bin\Filters_x86\MpcAudioRenderer.ax : fatal error LNK1120: 2 unresolved externals [C:\repos\MPC-BE\src\filters\renderer\MpcAudioRenderer\MpcAudioRenderer.vcxproj]

@qwerttvv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error	LNK2019	unresolved external symbol __imp__sopen referenced in function win32_open	MpcAudioRenderer	MPC-BE\src\filters\renderer\MpcAudioRenderer\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__sopen referenced in function win32_open	AudioSwitcher	MPC-BE\src\filters\switcher\AudioSwitcher\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__wsopen referenced in function win32_open	MpcAudioRenderer	MPC-BE\src\filters\renderer\MpcAudioRenderer\ffmpeg.lib(file_open.o)	1		
Error	LNK2019	unresolved external symbol __imp__wsopen referenced in function win32_open	AudioSwitcher	MPC-BE\src\filters\switcher\AudioSwitcher\ffmpeg.lib(file_open.o)	1

This is strange. I don't understand why this started happening when building standalone_filters.

maybe try the latest version of ffmprg first?

@v0lt
Copy link
Collaborator Author

@v0lt v0lt commented on d3551e3 Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try building after commit 75e03d4.

@qwerttvv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool
tested&working

Please sign in to comment.