!59 手动同步PR!50
From: @zhong-wei-shen Reviewed-by: @liqingqing_1229 Signed-off-by: @liqingqing_1229
This commit is contained in:
commit
09ae54a152
35
Documentation-man-flac.md-fix-typo.patch
Normal file
35
Documentation-man-flac.md-fix-typo.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 7317471efb25f65f2d63b3de20d55c2519770d52 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Lee=20Carr=C3=A9?=
|
||||
<83581502+Lee-Carre@users.noreply.github.com>
|
||||
Date: Sat, 2 Sep 2023 18:17:44 +0000
|
||||
Subject: [PATCH] Documentation (man/flac.md); fix typo
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Section: `Apodization functions`
|
||||
|
||||
From:
|
||||
|
||||
> For partial_tukey(n) and punchout_tukey(n), […] The use of this is that different parts of a block are ignored as the might contain transients which are hard to predict anyway. […]
|
||||
|
||||
to (emphasis added only in this summary, not in the source):
|
||||
|
||||
> For partial_tukey(n) and punchout_tukey(n), […] The use of this is that different parts of a block are ignored as the**y** might contain transients which are hard to predict anyway. […]
|
||||
---
|
||||
man/flac.md | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/man/flac.md b/man/flac.md
|
||||
index b51ac698a4..87969bf6d9 100644
|
||||
--- a/man/flac.md
|
||||
+++ b/man/flac.md
|
||||
@@ -715,7 +715,7 @@ yield sane results. If necessary, an overlap can be specified, as can be
|
||||
the taper parameter, for example partial_tukey(2/0.2) or
|
||||
partial_tukey(2/0.2/0.5). ov should be smaller than 1 and can be
|
||||
negative. The use of this is that different parts of a block are ignored
|
||||
-as the might contain transients which are hard to predict anyway. The
|
||||
+as they might contain transients which are hard to predict anyway. The
|
||||
encoder will try each different added apodization (each covering a
|
||||
different part of the block) to see which resulting predictor results in
|
||||
the smallest representation.
|
||||
35
Fix-format-ending-up-with-wrong-subformat.patch
Normal file
35
Fix-format-ending-up-with-wrong-subformat.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From df57d1d6b009e8044938390b21599d2910f867ea Mon Sep 17 00:00:00 2001
|
||||
From: Martijn van Beurden <mvanb1@gmail.com>
|
||||
Date: Tue, 5 Mar 2024 14:28:26 +0100
|
||||
Subject: [PATCH] Fix format ending up with wrong subformat
|
||||
|
||||
It was possible the format was taken from foreign metadata and the
|
||||
subformat from command-line options.
|
||||
|
||||
Credit: Oss-Fuzz
|
||||
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63790
|
||||
---
|
||||
src/flac/main.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/flac/main.c b/src/flac/main.c
|
||||
index d57ad9ccaa..46a2dcc742 100644
|
||||
--- a/src/flac/main.c
|
||||
+++ b/src/flac/main.c
|
||||
@@ -2192,10 +2192,14 @@ int decode_file(const char *infilename)
|
||||
output_format = FORMAT_WAVE;
|
||||
|
||||
/* Now do subformats */
|
||||
- if(option_values.force_legacy_wave_format)
|
||||
+ if(option_values.force_legacy_wave_format) {
|
||||
+ output_format = FORMAT_WAVE;
|
||||
output_subformat = SUBFORMAT_WAVE_PCM;
|
||||
- else if(option_values.force_extensible_wave_format)
|
||||
+ }
|
||||
+ else if(option_values.force_extensible_wave_format) {
|
||||
+ output_format = FORMAT_WAVE;
|
||||
output_subformat = SUBFORMAT_WAVE_EXTENSIBLE;
|
||||
+ }
|
||||
else if(option_values.force_aiff_c_none_format) {
|
||||
output_format = FORMAT_AIFF_C;
|
||||
output_subformat = SUBFORMAT_AIFF_C_NONE;
|
||||
103
Limit-the-number-of-clock-calls.patch
Normal file
103
Limit-the-number-of-clock-calls.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 32b73cbced65208758d0d610327c600828db45ae Mon Sep 17 00:00:00 2001
|
||||
From: Martijn van Beurden <mvanb1@gmail.com>
|
||||
Date: Tue, 27 Jun 2023 10:39:09 +0200
|
||||
Subject: [PATCH] Limit the number of clock() calls
|
||||
|
||||
The overhead of calling clock() when encoding/decoding very small
|
||||
frames turned out to be very large, for framesize 16 these syscalls
|
||||
took over half the execution time. This commit only calls clock()
|
||||
when at least 10.000 samples have been encoded or 25.000 samples
|
||||
have been decoded since the last call to clock()
|
||||
---
|
||||
src/flac/decode.c | 19 ++++++++++++++-----
|
||||
src/flac/encode.c | 19 ++++++++++++++-----
|
||||
2 files changed, 28 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/flac/decode.c b/src/flac/decode.c
|
||||
index 90f7a6c860..e832d70731 100644
|
||||
--- a/src/flac/decode.c
|
||||
+++ b/src/flac/decode.c
|
||||
@@ -94,7 +94,8 @@ typedef struct {
|
||||
foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */
|
||||
FLAC__off_t fm_offset1, fm_offset2, fm_offset3;
|
||||
|
||||
- clock_t old_clock_t;
|
||||
+ clock_t old_clock;
|
||||
+ FLAC__uint64 old_samples_processed;
|
||||
} DecoderSession;
|
||||
|
||||
|
||||
@@ -253,7 +254,8 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
|
||||
|
||||
d->foreign_metadata = foreign_metadata;
|
||||
|
||||
- d->old_clock_t = 0;
|
||||
+ d->old_clock = 0;
|
||||
+ d->old_samples_processed = 0;
|
||||
|
||||
FLAC__ASSERT(!(d->test_only && d->analysis_mode));
|
||||
|
||||
@@ -1239,9 +1241,16 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
|
||||
if(!(decoder_session->frame_counter & 0x1ff))
|
||||
print_stats(decoder_session);
|
||||
#else
|
||||
- if((clock() - decoder_session->old_clock_t) > (CLOCKS_PER_SEC/4)) {
|
||||
- print_stats(decoder_session);
|
||||
- decoder_session->old_clock_t = clock();
|
||||
+ if(decoder_session->samples_processed - decoder_session->old_samples_processed > 25000) {
|
||||
+ /* We're assuming that even on old hardware libFLAC can easily process
|
||||
+ * 100.000 samples per second, even on old hardware. To limit the number
|
||||
+ * of (expensive) syscalls, we only check clock every 25.000 samples */
|
||||
+ clock_t cur_clock = clock();
|
||||
+ decoder_session->old_samples_processed = decoder_session->samples_processed;
|
||||
+ if((cur_clock - decoder_session->old_clock) > (CLOCKS_PER_SEC/4)) {
|
||||
+ print_stats(decoder_session);
|
||||
+ decoder_session->old_clock = cur_clock;
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/src/flac/encode.c b/src/flac/encode.c
|
||||
index a945b356a5..0eb9a172f2 100644
|
||||
--- a/src/flac/encode.c
|
||||
+++ b/src/flac/encode.c
|
||||
@@ -94,7 +94,8 @@ typedef struct {
|
||||
uint32_t stats_frames_interval;
|
||||
uint32_t old_frames_written;
|
||||
#else
|
||||
- clock_t old_clock_t;
|
||||
+ uint32_t old_samples_written;
|
||||
+ clock_t old_clock;
|
||||
#endif
|
||||
|
||||
SampleInfo info;
|
||||
@@ -1407,7 +1408,8 @@ FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options,
|
||||
e->stats_frames_interval = 0;
|
||||
e->old_frames_written = 0;
|
||||
#else
|
||||
- e->old_clock_t = 0;
|
||||
+ e->old_clock = 0;
|
||||
+ e->old_samples_written = 0;
|
||||
#endif
|
||||
e->compression_ratio = 0.0;
|
||||
|
||||
@@ -2422,9 +2424,16 @@ void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64
|
||||
e->old_frames_written = frames_written;
|
||||
}
|
||||
#else
|
||||
- if(e->total_samples_to_encode > 0 && (clock() - e->old_clock_t) > (CLOCKS_PER_SEC/4)) {
|
||||
- print_stats(e);
|
||||
- e->old_clock_t = clock();
|
||||
+ if(e->total_samples_to_encode > 0 && samples_written - e->old_samples_written > 10000) {
|
||||
+ /* We're assuming that except for extremely slow settings, libFLAC can easily
|
||||
+ * process 40.000 samples per second, even on old hardware. To limit the number
|
||||
+ * of (expensive) syscalls, we only check clock every 10.000 samples */
|
||||
+ clock_t cur_clock = clock();
|
||||
+ e->old_samples_written = samples_written;
|
||||
+ if((cur_clock - e->old_clock) > (CLOCKS_PER_SEC/4)) {
|
||||
+ print_stats(e);
|
||||
+ e->old_clock = cur_clock;
|
||||
+ }
|
||||
}
|
||||
|
||||
#endif
|
||||
40
flac-foreign_metadata-fix-Walloc-size.patch
Normal file
40
flac-foreign_metadata-fix-Walloc-size.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 14ef37063f98786fcf4d5e81181c278a8000ea55 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sun, 5 Nov 2023 21:50:05 +0000
|
||||
Subject: [PATCH] flac: foreign_metadata: fix -Walloc-size
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
|
||||
```
|
||||
src/flac/foreign_metadata.c:803:33: warning: allocation of insufficient size ‘1’ for type ‘foreign_metadata_t’ with size ‘64’ [-Walloc-size]
|
||||
```
|
||||
|
||||
The calloc prototype is:
|
||||
```
|
||||
void *calloc(size_t nmemb, size_t size);
|
||||
```
|
||||
|
||||
So, just swap the number of members and size arguments to match the prototype, as
|
||||
we're initialising 1 struct of size `sizeof(foreign_metadata_t)`. GCC then sees we're not
|
||||
doing anything wrong.
|
||||
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
---
|
||||
src/flac/foreign_metadata.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c
|
||||
index f63fc3e60a..ab6644c301 100644
|
||||
--- a/src/flac/foreign_metadata.c
|
||||
+++ b/src/flac/foreign_metadata.c
|
||||
@@ -800,7 +800,7 @@ static FLAC__bool compare_with_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fou
|
||||
foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type)
|
||||
{
|
||||
/* calloc() to zero all the member variables */
|
||||
- foreign_metadata_t *x = calloc(sizeof(foreign_metadata_t), 1);
|
||||
+ foreign_metadata_t *x = calloc(1, sizeof(foreign_metadata_t));
|
||||
if(x) {
|
||||
x->type = type;
|
||||
x->is_rf64 = false;
|
||||
12
flac.spec
12
flac.spec
@ -1,6 +1,6 @@
|
||||
Name: flac
|
||||
Version: 1.4.3
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: encoder/decoder which support the Free Lossless Audio Codec
|
||||
License: BSD-3-Clause AND GPL-2.0-or-later AND GFDL-1.1-or-later
|
||||
Source0: http://downloads.xiph.org/releases/flac/flac-%{version}.tar.xz
|
||||
@ -9,6 +9,10 @@ URL: http://www.xiph.org/flac/
|
||||
%ifarch sw_64
|
||||
Patch0001: flac-1.4.3-sw.patch
|
||||
%endif
|
||||
Patch6001: Limit-the-number-of-clock-calls.patch
|
||||
Patch6002: Documentation-man-flac.md-fix-typo.patch
|
||||
Patch6003: flac-foreign_metadata-fix-Walloc-size.patch
|
||||
Patch6004: Fix-format-ending-up-with-wrong-subformat.patch
|
||||
|
||||
Provides: %{name}-libs
|
||||
Obsoletes: %{name}-libs
|
||||
@ -74,6 +78,12 @@ rm flac-doc/FLAC.tag %{buildroot}%{_libdir}/*.la
|
||||
%doc flac-doc-devel/*
|
||||
|
||||
%changelog
|
||||
* Fri Aug 9 2024 zhangxingrong <zhangxingrong@uniontech.cn> - 1.4.3-3
|
||||
- Limit the number of clock() calls
|
||||
- Documentation (man/flac.md); fix typo
|
||||
- flac: foreign_metadata: fix -Walloc-size
|
||||
- Fix format ending up with wrong subformat
|
||||
|
||||
* Fri Aug 9 2024 chenhaixiang<chenhaixiang3@huawei.com> - 1.4.3-2
|
||||
- fix flac license
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user