mirror of https://git.ffmpeg.org/ffmpeg.git
lavc/adpcm: THP: don't use the ADPC/SEEK table when not seeking
This is almost certainly closer to how the actual Nintendo players work, and fixes some output pops in files with blank ADPC/SEEK tables (like those from brawlcustommusic).
This commit is contained in:
parent
d2ce10093e
commit
0f67351944
|
@ -86,6 +86,7 @@ static const int swf_index_tables[4][16] = {
|
|||
typedef struct ADPCMDecodeContext {
|
||||
ADPCMChannelStatus status[10];
|
||||
int vqa_version; /**< VQA version. Used for ADPCM_IMA_WS */
|
||||
int has_status;
|
||||
} ADPCMDecodeContext;
|
||||
|
||||
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
||||
|
@ -1455,10 +1456,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||
for (n = 0; n < 16; n++)
|
||||
table[i][n] = THP_GET16(gb);
|
||||
|
||||
/* Initialize the previous sample. */
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
c->status[i].sample1 = THP_GET16(gb);
|
||||
c->status[i].sample2 = THP_GET16(gb);
|
||||
if (!c->has_status) {
|
||||
/* Initialize the previous sample. */
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
c->status[i].sample1 = THP_GET16(gb);
|
||||
c->status[i].sample2 = THP_GET16(gb);
|
||||
}
|
||||
c->has_status = 1;
|
||||
} else {
|
||||
bytestream2_skip(&gb, avctx->channels * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1562,6 +1568,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||
return bytestream2_tell(&gb);
|
||||
}
|
||||
|
||||
static void adpcm_flush(AVCodecContext *avctx)
|
||||
{
|
||||
ADPCMDecodeContext *c = avctx->priv_data;
|
||||
c->has_status = 0;
|
||||
}
|
||||
|
||||
|
||||
static const enum AVSampleFormat sample_fmts_s16[] = { AV_SAMPLE_FMT_S16,
|
||||
AV_SAMPLE_FMT_NONE };
|
||||
|
@ -1580,6 +1592,7 @@ AVCodec ff_ ## name_ ## _decoder = { \
|
|||
.priv_data_size = sizeof(ADPCMDecodeContext), \
|
||||
.init = adpcm_decode_init, \
|
||||
.decode = adpcm_decode_frame, \
|
||||
.flush = adpcm_flush, \
|
||||
.capabilities = CODEC_CAP_DR1, \
|
||||
.sample_fmts = sample_fmts_, \
|
||||
}
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
#tb 0: 1/32000
|
||||
0, 0, 0, 1078, 4312, 0x469714f6
|
||||
0, 1078, 1078, 1064, 4256, 0xe03dd882
|
||||
0, 2142, 2142, 1078, 4312, 0x46b901f7
|
||||
0, 3220, 3220, 1064, 4256, 0x8d4a54e4
|
||||
0, 4284, 4284, 1064, 4256, 0xfd616b67
|
||||
0, 5348, 5348, 1078, 4312, 0xefe62302
|
||||
0, 6426, 6426, 1064, 4256, 0xab11684e
|
||||
0, 7490, 7490, 1064, 4256, 0xb4b3feb8
|
||||
0, 8554, 8554, 1078, 4312, 0x71db6461
|
||||
0, 9632, 9632, 1064, 4256, 0x090e5efa
|
||||
0, 10696, 10696, 1064, 4256, 0x36f49c28
|
||||
0, 11760, 11760, 1078, 4312, 0x0fe3d262
|
||||
0, 12838, 12838, 1064, 4256, 0x199ce269
|
||||
0, 13902, 13902, 1064, 4256, 0x98342d05
|
||||
0, 14966, 14966, 1078, 4312, 0xb6fb7ebe
|
||||
0, 16044, 16044, 1064, 4256, 0x033dd562
|
||||
0, 17108, 17108, 1064, 4256, 0xc2cc17e0
|
||||
0, 18172, 18172, 1078, 4312, 0x4bb3ff50
|
||||
0, 19250, 19250, 1064, 4256, 0x6f2671ef
|
||||
0, 20314, 20314, 1064, 4256, 0x5a337bf4
|
||||
0, 21378, 21378, 1078, 4312, 0xa71f6967
|
||||
0, 22456, 22456, 1064, 4256, 0x48084aa9
|
||||
0, 23520, 23520, 1064, 4256, 0x3cce4218
|
||||
0, 24584, 24584, 1078, 4312, 0xcbb8f73d
|
||||
0, 25662, 25662, 1064, 4256, 0x36825021
|
||||
0, 26726, 26726, 1064, 4256, 0xeae036c6
|
||||
0, 27790, 27790, 1078, 4312, 0x0d650ac6
|
||||
0, 28868, 28868, 1064, 4256, 0xfba4f58c
|
||||
0, 29932, 29932, 1064, 4256, 0x54311f9b
|
||||
0, 30996, 30996, 1078, 4312, 0x286386b3
|
||||
0, 32074, 32074, 1064, 4256, 0x871896de
|
||||
0, 33138, 33138, 1064, 4256, 0x9ef9f970
|
||||
0, 34202, 34202, 1078, 4312, 0xf9ae97f1
|
||||
0, 35280, 35280, 1064, 4256, 0x0ad0d765
|
||||
0, 36344, 36344, 1064, 4256, 0x8e6aa9b5
|
||||
0, 37408, 37408, 1078, 4312, 0x8362787b
|
||||
0, 38486, 38486, 1064, 4256, 0x9b6a5d9c
|
||||
0, 39550, 39550, 1064, 4256, 0xfb715d8f
|
||||
0, 40614, 40614, 1078, 4312, 0x02bd8075
|
||||
0, 41692, 41692, 1064, 4256, 0x428eb932
|
||||
0, 42756, 42756, 1064, 4256, 0x17ea8c94
|
||||
0, 43820, 43820, 1078, 4312, 0xb3e761d7
|
||||
0, 44898, 44898, 1064, 4256, 0x0919755a
|
||||
0, 45962, 45962, 1064, 4256, 0x5e520edd
|
||||
0, 47026, 47026, 1078, 4312, 0x69aa070e
|
||||
0, 48104, 48104, 1064, 4256, 0xf8192f7d
|
||||
0, 49168, 49168, 1064, 4256, 0xaad4475c
|
||||
0, 50232, 50232, 1078, 4312, 0x0cabcfcb
|
||||
0, 51310, 51310, 1064, 4256, 0x952f0f96
|
||||
0, 52374, 52374, 1064, 4256, 0x1b805a0c
|
||||
0, 53438, 53438, 1078, 4312, 0x93043d2a
|
||||
0, 54516, 54516, 1064, 4256, 0x38b99e44
|
||||
0, 55580, 55580, 1064, 4256, 0x60cc52ff
|
||||
0, 56644, 56644, 1078, 4312, 0x6a875849
|
||||
0, 57722, 57722, 1064, 4256, 0xd08d6d0e
|
||||
0, 58786, 58786, 1064, 4256, 0x36bfe48e
|
||||
0, 59850, 59850, 1078, 4312, 0x795c6134
|
||||
0, 60928, 60928, 1064, 4256, 0x4fd79583
|
||||
0, 61992, 61992, 1064, 4256, 0x65e2ab9f
|
||||
0, 63056, 63056, 1078, 4312, 0xedeede4a
|
||||
0, 64134, 64134, 1064, 4256, 0x097e0d09
|
||||
0, 65198, 65198, 1064, 4256, 0x58afa133
|
||||
0, 66262, 66262, 1078, 4312, 0x442525b5
|
||||
0, 67340, 67340, 1064, 4256, 0x6645c591
|
||||
0, 68404, 68404, 1064, 4256, 0xb0dd948a
|
||||
0, 69468, 69468, 1078, 4312, 0x12684e69
|
||||
0, 70546, 70546, 1064, 4256, 0xb45098e3
|
||||
0, 71610, 71610, 1064, 4256, 0xb6d3c61c
|
||||
0, 72674, 72674, 1078, 4312, 0xb46b5b22
|
||||
0, 73752, 73752, 1064, 4256, 0x9a556830
|
||||
0, 74816, 74816, 1064, 4256, 0x67ca2b35
|
||||
0, 1078, 1078, 1064, 4256, 0x6ca28f25
|
||||
0, 2142, 2142, 1078, 4312, 0xd466f806
|
||||
0, 3220, 3220, 1064, 4256, 0x59d69463
|
||||
0, 4284, 4284, 1064, 4256, 0xf4805f42
|
||||
0, 5348, 5348, 1078, 4312, 0x579f22aa
|
||||
0, 6426, 6426, 1064, 4256, 0xbdc88f45
|
||||
0, 7490, 7490, 1064, 4256, 0xc71ebf04
|
||||
0, 8554, 8554, 1078, 4312, 0xc1c86e49
|
||||
0, 9632, 9632, 1064, 4256, 0x96365506
|
||||
0, 10696, 10696, 1064, 4256, 0xaf59bfe5
|
||||
0, 11760, 11760, 1078, 4312, 0x4f00811d
|
||||
0, 12838, 12838, 1064, 4256, 0x0d8a243a
|
||||
0, 13902, 13902, 1064, 4256, 0x98fc3477
|
||||
0, 14966, 14966, 1078, 4312, 0xbf327cc1
|
||||
0, 16044, 16044, 1064, 4256, 0xdc52d5bd
|
||||
0, 17108, 17108, 1064, 4256, 0x29eb1ca6
|
||||
0, 18172, 18172, 1078, 4312, 0xf647067f
|
||||
0, 19250, 19250, 1064, 4256, 0x4f4b70db
|
||||
0, 20314, 20314, 1064, 4256, 0xa73b7e5d
|
||||
0, 21378, 21378, 1078, 4312, 0x1f5464ff
|
||||
0, 22456, 22456, 1064, 4256, 0xcd7a46f2
|
||||
0, 23520, 23520, 1064, 4256, 0x7e203f8e
|
||||
0, 24584, 24584, 1078, 4312, 0x82e5f5ee
|
||||
0, 25662, 25662, 1064, 4256, 0xfbb65050
|
||||
0, 26726, 26726, 1064, 4256, 0x474d33ff
|
||||
0, 27790, 27790, 1078, 4312, 0x737a0586
|
||||
0, 28868, 28868, 1064, 4256, 0xf677f86a
|
||||
0, 29932, 29932, 1064, 4256, 0xe35919f9
|
||||
0, 30996, 30996, 1078, 4312, 0x74f382b2
|
||||
0, 32074, 32074, 1064, 4256, 0xe10095c1
|
||||
0, 33138, 33138, 1064, 4256, 0x5af2f855
|
||||
0, 34202, 34202, 1078, 4312, 0x55239722
|
||||
0, 35280, 35280, 1064, 4256, 0xf904da45
|
||||
0, 36344, 36344, 1064, 4256, 0xdd8ca94f
|
||||
0, 37408, 37408, 1078, 4312, 0xcc7a76f6
|
||||
0, 38486, 38486, 1064, 4256, 0x67aa5b74
|
||||
0, 39550, 39550, 1064, 4256, 0x6559608f
|
||||
0, 40614, 40614, 1078, 4312, 0x7d297e71
|
||||
0, 41692, 41692, 1064, 4256, 0x15c2b2e3
|
||||
0, 42756, 42756, 1064, 4256, 0x0bf2896c
|
||||
0, 43820, 43820, 1078, 4312, 0x17f75da7
|
||||
0, 44898, 44898, 1064, 4256, 0x90b27489
|
||||
0, 45962, 45962, 1064, 4256, 0xcc7d0de4
|
||||
0, 47026, 47026, 1078, 4312, 0x0c8a0586
|
||||
0, 48104, 48104, 1064, 4256, 0x184a2e34
|
||||
0, 49168, 49168, 1064, 4256, 0xfe354354
|
||||
0, 50232, 50232, 1078, 4312, 0x4e3bd1c1
|
||||
0, 51310, 51310, 1064, 4256, 0x37a50e20
|
||||
0, 52374, 52374, 1064, 4256, 0x2556584a
|
||||
0, 53438, 53438, 1078, 4312, 0x380f3466
|
||||
0, 54516, 54516, 1064, 4256, 0x25b4a1db
|
||||
0, 55580, 55580, 1064, 4256, 0x77f15645
|
||||
0, 56644, 56644, 1078, 4312, 0x278b5864
|
||||
0, 57722, 57722, 1064, 4256, 0xcf2e701d
|
||||
0, 58786, 58786, 1064, 4256, 0x8924e60f
|
||||
0, 59850, 59850, 1078, 4312, 0x54db60f9
|
||||
0, 60928, 60928, 1064, 4256, 0x365993ef
|
||||
0, 61992, 61992, 1064, 4256, 0x37e4a996
|
||||
0, 63056, 63056, 1078, 4312, 0x0b9bda87
|
||||
0, 64134, 64134, 1064, 4256, 0x2eed0d61
|
||||
0, 65198, 65198, 1064, 4256, 0xa826a02f
|
||||
0, 66262, 66262, 1078, 4312, 0x9620255e
|
||||
0, 67340, 67340, 1064, 4256, 0x0f3cc6f2
|
||||
0, 68404, 68404, 1064, 4256, 0x14d89149
|
||||
0, 69468, 69468, 1078, 4312, 0x87c74a3d
|
||||
0, 70546, 70546, 1064, 4256, 0x73ca9dd9
|
||||
0, 71610, 71610, 1064, 4256, 0x8419cab6
|
||||
0, 72674, 72674, 1078, 4312, 0x7d1c59ec
|
||||
0, 73752, 73752, 1064, 4256, 0xbf927052
|
||||
0, 74816, 74816, 1064, 4256, 0x4a422bc3
|
||||
|
|
Loading…
Reference in New Issue