* [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio @ 2022-05-03 16:30 Michael Niedermayer 2022-05-03 16:30 ` [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output Michael Niedermayer 2022-07-07 18:24 ` [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer 0 siblings, 2 replies; 8+ messages in thread From: Michael Niedermayer @ 2022-05-03 16:30 UTC (permalink / raw) To: FFmpeg development discussions and patches Fixes: Timeout Fixes: 47043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-4824799337119744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 288aa63313..0eddeaf69a 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -202,6 +202,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_SANM: maxpixels /= 16; break; case AV_CODEC_ID_SCPR: maxpixels /= 32; break; case AV_CODEC_ID_SCREENPRESSO:maxpixels /= 64; break; + case AV_CODEC_ID_SMACKAUDIO: maxsamples /= 4096; break; case AV_CODEC_ID_SMACKVIDEO: maxpixels /= 64; break; case AV_CODEC_ID_SNOW: maxpixels /= 128; break; case AV_CODEC_ID_TARGA: maxpixels /= 128; break; -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-05-03 16:30 [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer @ 2022-05-03 16:30 ` Michael Niedermayer 2022-05-04 9:39 ` Tomas Härdin 2022-07-07 18:24 ` [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer 1 sibling, 1 reply; 8+ messages in thread From: Michael Niedermayer @ 2022-05-03 16:30 UTC (permalink / raw) To: FFmpeg development discussions and patches Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/smacker.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 179c70f1ee..5d94a54179 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -601,7 +601,7 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, int i, res, ret; int unp_size; int bits, stereo; - unsigned pred[2], val; + unsigned pred[2], val, val2; if (buf_size <= 4) { av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); @@ -672,7 +672,11 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, pred[i] = av_bswap16(get_bits(&gb, 16)); for(i = 0; i <= stereo; i++) *samples++ = pred[i]; - for(; i < unp_size / 2; i++) { + unp_size /= 2; + + if (vlc[0 ].table || vlc[ 1].table || + vlc[2*stereo].table || vlc[2*stereo+1].table) { + for(; i < unp_size ; i++) { unsigned idx = 2 * (i & stereo); if (get_bits_left(&gb) < 0) { ret = AVERROR_INVALIDDATA; @@ -691,6 +695,22 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, pred[idx / 2] += val; *samples++ = pred[idx / 2]; } + } else if (stereo) { + val = 256*values[1] + values[0]; + val2 = 256*values[3] + values[2]; + for(; i < unp_size; i+=2) { + pred[0] += val; + pred[1] += val2; + *samples++ = pred[0]; + *samples++ = pred[1]; + } + } else { + val = 256*values[1] + values[0]; + for(; i < unp_size; i++) { + pred[0] += val; + *samples++ = pred[0]; + } + } } else { //8-bit data for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-05-03 16:30 ` [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output Michael Niedermayer @ 2022-05-04 9:39 ` Tomas Härdin 2022-07-06 17:11 ` Michael Niedermayer 0 siblings, 1 reply; 8+ messages in thread From: Tomas Härdin @ 2022-05-04 9:39 UTC (permalink / raw) To: FFmpeg development discussions and patches tis 2022-05-03 klockan 18:30 +0200 skrev Michael Niedermayer: > > + } else if (stereo) { > + val = 256*values[1] + values[0]; > + val2 = 256*values[3] + values[2]; > + for(; i < unp_size; i+=2) { > + pred[0] += val; > + pred[1] += val2; > + *samples++ = pred[0]; > + *samples++ = pred[1]; > + } > + } else { > + val = 256*values[1] + values[0]; > + for(; i < unp_size; i++) { > + pred[0] += val; > + *samples++ = pred[0]; > + } > + } Got any numbers on how much faster this is? Just out of curiosity Probably want to follow this up with a reindent patch /Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-05-04 9:39 ` Tomas Härdin @ 2022-07-06 17:11 ` Michael Niedermayer 2022-07-06 17:18 ` Paul B Mahol 2022-07-06 18:26 ` Tomas Härdin 0 siblings, 2 replies; 8+ messages in thread From: Michael Niedermayer @ 2022-07-06 17:11 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 1227 bytes --] On Wed, May 04, 2022 at 11:39:54AM +0200, Tomas Härdin wrote: > tis 2022-05-03 klockan 18:30 +0200 skrev Michael Niedermayer: > > > > + } else if (stereo) { > > + val = 256*values[1] + values[0]; > > + val2 = 256*values[3] + values[2]; > > + for(; i < unp_size; i+=2) { > > + pred[0] += val; > > + pred[1] += val2; > > + *samples++ = pred[0]; > > + *samples++ = pred[1]; > > + } > > + } else { > > + val = 256*values[1] + values[0]; > > + for(; i < unp_size; i++) { > > + pred[0] += val; > > + *samples++ = pred[0]; > > + } > > + } > > Got any numbers on how much faster this is? Just out of curiosity With the fuzzed sample: before: 3263902379 decicycles in ABBB, 128 runs, 0 skips after: 398977744 decicycles in ABBB, 1024 runs, 0 skips the first times out after 128 runs which is why the runs differ thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-07-06 17:11 ` Michael Niedermayer @ 2022-07-06 17:18 ` Paul B Mahol 2022-07-07 18:24 ` Michael Niedermayer 2022-07-06 18:26 ` Tomas Härdin 1 sibling, 1 reply; 8+ messages in thread From: Paul B Mahol @ 2022-07-06 17:18 UTC (permalink / raw) To: FFmpeg development discussions and patches lgtm _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-07-06 17:18 ` Paul B Mahol @ 2022-07-07 18:24 ` Michael Niedermayer 0 siblings, 0 replies; 8+ messages in thread From: Michael Niedermayer @ 2022-07-07 18:24 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 261 bytes --] On Wed, Jul 06, 2022 at 07:18:45PM +0200, Paul B Mahol wrote: > lgtm will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output 2022-07-06 17:11 ` Michael Niedermayer 2022-07-06 17:18 ` Paul B Mahol @ 2022-07-06 18:26 ` Tomas Härdin 1 sibling, 0 replies; 8+ messages in thread From: Tomas Härdin @ 2022-07-06 18:26 UTC (permalink / raw) To: FFmpeg development discussions and patches ons 2022-07-06 klockan 19:11 +0200 skrev Michael Niedermayer: > On Wed, May 04, 2022 at 11:39:54AM +0200, Tomas Härdin wrote: > > tis 2022-05-03 klockan 18:30 +0200 skrev Michael Niedermayer: > > > > > > + } else if (stereo) { > > > + val = 256*values[1] + values[0]; > > > + val2 = 256*values[3] + values[2]; > > > + for(; i < unp_size; i+=2) { > > > + pred[0] += val; > > > + pred[1] += val2; > > > + *samples++ = pred[0]; > > > + *samples++ = pred[1]; > > > + } > > > + } else { > > > + val = 256*values[1] + values[0]; > > > + for(; i < unp_size; i++) { > > > + pred[0] += val; > > > + *samples++ = pred[0]; > > > + } > > > + } > > > > Got any numbers on how much faster this is? Just out of curiosity > > With the fuzzed sample: > before: > 3263902379 decicycles in ABBB, 128 runs, 0 skips > > after: > 398977744 decicycles in ABBB, 1024 runs, 0 skips > > the first times out after 128 runs which is why the runs differ Cool. Well, looks good /Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio 2022-05-03 16:30 [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer 2022-05-03 16:30 ` [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output Michael Niedermayer @ 2022-07-07 18:24 ` Michael Niedermayer 1 sibling, 0 replies; 8+ messages in thread From: Michael Niedermayer @ 2022-07-07 18:24 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 656 bytes --] On Tue, May 03, 2022 at 06:30:58PM +0200, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: 47043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-4824799337119744 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > tools/target_dec_fuzzer.c | 1 + > 1 file changed, 1 insertion(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Elect your leaders based on what they did after the last election, not based on what they say before an election. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-07 18:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-05-03 16:30 [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer 2022-05-03 16:30 ` [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output Michael Niedermayer 2022-05-04 9:39 ` Tomas Härdin 2022-07-06 17:11 ` Michael Niedermayer 2022-07-06 17:18 ` Paul B Mahol 2022-07-07 18:24 ` Michael Niedermayer 2022-07-06 18:26 ` Tomas Härdin 2022-07-07 18:24 ` [FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Adjust threshold for smacker audio Michael Niedermayer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git