[FFmpeg-cvslog] avcodec/adpcm_ima_swf: fix frame size to 4096

Zane van Iperen git at videolan.org
Sat Nov 7 16:02:17 EET 2020


ffmpeg | branch: master | Zane van Iperen <zane at zanevaniperen.com> | Fri Nov  6 22:03:37 2020 +1000| [406879f49c414763bbb1b2e75ca1826d179ee2c1] | committer: Zane van Iperen

avcodec/adpcm_ima_swf: fix frame size to 4096

SWF File Format Specification, Version 19 says this is 1 raw
sample + 4095 nibbles.

https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf

Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=406879f49c414763bbb1b2e75ca1826d179ee2c1
---

 libavcodec/adpcmenc.c                   |  2 +-
 tests/ref/acodec/adpcm-swf              |  8 +++---
 tests/ref/acodec/adpcm-swf-trellis      |  8 +++---
 tests/ref/acodec/adpcm-swf-wav          |  8 +++---
 tests/ref/seek/acodec-adpcm-swf         | 46 ++++++++++++++++-----------------
 tests/ref/seek/acodec-adpcm-swf-trellis | 46 ++++++++++++++++-----------------
 6 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index ee13faa4cb..5670da1dea 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -153,7 +153,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
                    "22050 or 44100\n");
             return AVERROR(EINVAL);
         }
-        avctx->frame_size  = (s->block_size / 2) * (avctx->sample_rate / 11025);
+        avctx->frame_size  = 4096; /* Hardcoded according to the SWF spec. */
         avctx->block_align = (2 + avctx->channels * (22 + 4 * (avctx->frame_size - 1)) + 7) / 8;
         break;
     case AV_CODEC_ID_ADPCM_IMA_SSI:
diff --git a/tests/ref/acodec/adpcm-swf b/tests/ref/acodec/adpcm-swf
index 2cb9e905ca..61d92da084 100644
--- a/tests/ref/acodec/adpcm-swf
+++ b/tests/ref/acodec/adpcm-swf
@@ -1,4 +1,4 @@
-42d4639866ed4d692eaf126228a4fa2a *tests/data/fate/acodec-adpcm-swf.flv
-269166 tests/data/fate/acodec-adpcm-swf.flv
-628089745a7059ae4055c2515b6d668b *tests/data/fate/acodec-adpcm-swf.out.wav
-stddev:  933.58 PSNR: 36.93 MAXDIFF:51119 bytes:  1058400/  1064960
+64aedd1487cb355406dde36d2bba374f *tests/data/fate/acodec-adpcm-swf.flv
+267801 tests/data/fate/acodec-adpcm-swf.flv
+9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf.out.wav
+stddev:  919.82 PSNR: 37.06 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/acodec/adpcm-swf-trellis b/tests/ref/acodec/adpcm-swf-trellis
index a2bb565e1c..f4c69ca622 100644
--- a/tests/ref/acodec/adpcm-swf-trellis
+++ b/tests/ref/acodec/adpcm-swf-trellis
@@ -1,4 +1,4 @@
-ec8859b3206ea0c45701fbdcf60dbe48 *tests/data/fate/acodec-adpcm-swf-trellis.flv
-269166 tests/data/fate/acodec-adpcm-swf-trellis.flv
-29820ce5b95b3b0a2feafa808cc264a7 *tests/data/fate/acodec-adpcm-swf-trellis.out.wav
-stddev:  747.92 PSNR: 38.85 MAXDIFF:51119 bytes:  1058400/  1064960
+fde151ce9b8be0e144e72113508bcff6 *tests/data/fate/acodec-adpcm-swf-trellis.flv
+267801 tests/data/fate/acodec-adpcm-swf-trellis.flv
+6a0007e42d92a225a8becddedccf9a0f *tests/data/fate/acodec-adpcm-swf-trellis.out.wav
+stddev:  731.05 PSNR: 39.05 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/acodec/adpcm-swf-wav b/tests/ref/acodec/adpcm-swf-wav
index 553e0bac54..80ce287b01 100644
--- a/tests/ref/acodec/adpcm-swf-wav
+++ b/tests/ref/acodec/adpcm-swf-wav
@@ -1,4 +1,4 @@
-af5ffee897bad0174f4c7fc16c54aa5d *tests/data/fate/acodec-adpcm-swf-wav.wav
-266948 tests/data/fate/acodec-adpcm-swf-wav.wav
-628089745a7059ae4055c2515b6d668b *tests/data/fate/acodec-adpcm-swf-wav.out.wav
-stddev:  933.58 PSNR: 36.93 MAXDIFF:51119 bytes:  1058400/  1064960
+a21ee5ba531ec89e306d78c861eb6ed1 *tests/data/fate/acodec-adpcm-swf-wav.wav
+266624 tests/data/fate/acodec-adpcm-swf-wav.wav
+9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf-wav.out.wav
+stddev:  919.82 PSNR: 37.06 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/seek/acodec-adpcm-swf b/tests/ref/seek/acodec-adpcm-swf
index 5905b33b6e..7f9111d6b1 100644
--- a/tests/ref/seek/acodec-adpcm-swf
+++ b/tests/ref/seek/acodec-adpcm-swf
@@ -1,49 +1,49 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  82956 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  82536 size:  4101
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos:  35369 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.836000 pts: 0.836000 pos:  37249 size:  4101
 ret:-1         st: 0 flags:1  ts:-0.317000
 ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 116060 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 115472 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  64335 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.393000 pts: 1.393000 pos:  61951 size:  4101
 ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  16748 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  16664 size:  4101
 ret:-1         st: 0 flags:1  ts:-0.741000
 ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.183000 pts: 2.183000 pos:  97439 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  99004 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.022000 pts: 1.022000 pos:  45714 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.022000 pts: 1.022000 pos:  45483 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 126405 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 123706 size:  4101
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.765000 pts: 1.765000 pos:  78818 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.765000 pts: 1.765000 pos:  78419 size:  4101
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos:  27093 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  24898 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 2.368000 pts: 2.368000 pos: 105715 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.322000 pts: 2.322000 pos: 103121 size:  4101
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.347000 pts: 1.347000 pos:  60197 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.393000 pts: 1.393000 pos:  61951 size:  4101
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   8472 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   8430 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.950000 pts: 1.950000 pos:  87094 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.950000 pts: 1.950000 pos:  86653 size:  4101
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  41576 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  41366 size:  4101
 ret:-1         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 120198 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 119589 size:  4101
 ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.533000 pts: 1.533000 pos:  68473 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  66068 size:  4101
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  20886 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  20781 size:  4101
 ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/acodec-adpcm-swf-trellis b/tests/ref/seek/acodec-adpcm-swf-trellis
index 5905b33b6e..7f9111d6b1 100644
--- a/tests/ref/seek/acodec-adpcm-swf-trellis
+++ b/tests/ref/seek/acodec-adpcm-swf-trellis
@@ -1,49 +1,49 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  82956 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  82536 size:  4101
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos:  35369 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.836000 pts: 0.836000 pos:  37249 size:  4101
 ret:-1         st: 0 flags:1  ts:-0.317000
 ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 116060 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 115472 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  64335 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.393000 pts: 1.393000 pos:  61951 size:  4101
 ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  16748 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  16664 size:  4101
 ret:-1         st: 0 flags:1  ts:-0.741000
 ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.183000 pts: 2.183000 pos:  97439 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  99004 size:  4101
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.022000 pts: 1.022000 pos:  45714 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.022000 pts: 1.022000 pos:  45483 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 126405 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 123706 size:  4101
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.765000 pts: 1.765000 pos:  78818 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.765000 pts: 1.765000 pos:  78419 size:  4101
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos:  27093 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  24898 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 2.368000 pts: 2.368000 pos: 105715 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.322000 pts: 2.322000 pos: 103121 size:  4101
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.347000 pts: 1.347000 pos:  60197 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.393000 pts: 1.393000 pos:  61951 size:  4101
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   8472 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   8430 size:  4101
 ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    196 size:  4101
 ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.950000 pts: 1.950000 pos:  87094 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.950000 pts: 1.950000 pos:  86653 size:  4101
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  41576 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  41366 size:  4101
 ret:-1         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 120198 size:  2053
+ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 119589 size:  4101
 ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.533000 pts: 1.533000 pos:  68473 size:  2053
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  66068 size:  4101
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  20886 size:  2053
+ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  20781 size:  4101
 ret:-1         st:-1 flags:1  ts:-0.645825



More information about the ffmpeg-cvslog mailing list