Compare commits

...

5 Commits

Author SHA1 Message Date
Gyan Doshi 535d4047d3 ffmpeg: unbreak max_error_rate application
The calculation of decode error rate neglected to cast
its operands to float, thus always leading to a value of 0.
2025-10-21 13:22:08 +00:00
Zhao Zhili edf5b777c9 avcodec/vvc: fix false alarm of missing ref on RASL 2025-10-21 13:21:52 +00:00
Andreas Rheinhardt 05b8608c76 avcodec/x86/mpegvideoencdsp_init: Fix left shift of negative number
Uncovered by UBSan when running the mpegvideoencdsp checkasm
test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-10-21 12:11:55 +02:00
Martin Storsjö e442128944 movenc: Make sure to flush the delayed moov atom for hybrid fragmented
If using the delay_moov flag in combination with hybrid_fragment
(which is a potentially problematic combination otherwise - the
ftyp box does end up hidden in the end), then we need to flush
twice to get both the moov box and the first fragment, if the
file is finished before the first fragment is completed.
2025-10-21 08:38:32 +00:00
Martin Storsjö 27f5561885 movenc: Fix sample clustering for hybrid_fragmented+delay_moov
If samples were available when the moov was written, chunking
for those samples has been done already, which has to be reset
here.

This is the case when not using empty_moov, when the moov box
describes the first fragment - this case was accounted for already.
But if using the delay_moov flag, then those samples also were
available when writing the moov, so chunking for them has already
been done in this case as well.

Therefore, always reset chunking here (it should be harmless to
always do it), and update the comment to clarify the cases
involved here.
2025-10-21 08:38:32 +00:00
4 changed files with 10 additions and 7 deletions

View File

@ -1007,7 +1007,7 @@ static int decoder_thread(void *arg)
ret = 0;
err_rate = (dp->dec.frames_decoded || dp->dec.decode_errors) ?
dp->dec.decode_errors / (dp->dec.frames_decoded + dp->dec.decode_errors) : 0.f;
(float)dp->dec.decode_errors / (dp->dec.frames_decoded + dp->dec.decode_errors) : 0.f;
if (err_rate > max_error_rate) {
av_log(dp, AV_LOG_FATAL, "Decode error rate %g exceeds maximum %g\n",
err_rate, max_error_rate);

View File

@ -450,7 +450,8 @@ static int add_candidate_ref(VVCContext *s, VVCFrameContext *fc, RefPicList *lis
if (!IS_CVSS(s)) {
const bool ref_corrupt = !ref || (ref->flags & VVC_FRAME_FLAG_CORRUPT);
const bool recovering = s->no_output_before_recovery_flag && !GDR_IS_RECOVERED(s);
const bool recovering = s->no_output_before_recovery_flag &&
(IS_RASL(s) || !GDR_IS_RECOVERED(s));
if (ref_corrupt && !recovering) {
if (!(s->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&

View File

@ -42,7 +42,7 @@ static int try_8x8basis_ssse3(const int16_t rem[64], const int16_t weight[64], c
x86_reg i=0;
av_assert2(FFABS(scale) < MAX_ABS);
scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
scale *= 1 << (16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT);
__asm__ volatile(
"pxor %%xmm2, %%xmm2 \n\t"
@ -87,7 +87,7 @@ static void add_8x8basis_ssse3(int16_t rem[64], const int16_t basis[64], int sca
x86_reg i=0;
if (FFABS(scale) < 1024) {
scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
scale *= 1 << (16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT);
__asm__ volatile(
"movd %3, %%xmm2 \n\t"
"punpcklwd %%xmm2, %%xmm2 \n\t"

View File

@ -6390,8 +6390,10 @@ static int mov_finish_fragment(MOVMuxContext *mov, MOVTrack *track,
if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
for (i = 0; i < track->entry; i++)
track->cluster[i].pos += ref_pos + track->data_offset;
if (track->cluster_written == 0 && !(mov->flags & FF_MOV_FLAG_EMPTY_MOOV)) {
// First flush. If this was a case of not using empty moov, reset chunking.
if (track->cluster_written == 0) {
// First flush. Chunking for this fragment may already have been
// done, either if we didn't use empty_moov, or if we did use
// delay_moov. In either case, reset chunking here.
for (i = 0; i < track->entry; i++) {
track->cluster[i].chunkNum = 0;
track->cluster[i].samples_in_chunk = track->cluster[i].entries;
@ -8608,7 +8610,7 @@ static int mov_write_trailer(AVFormatContext *s)
if (!(mov->flags & FF_MOV_FLAG_FRAGMENT) ||
mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
mov_flush_fragment(s, 1);
mov_auto_flush_fragment(s, 1);
mov->mdat_size = avio_tell(pb) - mov->mdat_pos - 8;
for (i = 0; i < mov->nb_tracks; i++) {
MOVTrack *track = &mov->tracks[i];