Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2017/02/24 06:58:53... | ... |
@@ -2513,7 +2513,7 @@ rv20_encoder_select="h263_encoder" |
2513 | 2513 |
rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" |
2514 | 2514 |
rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" |
2515 | 2515 |
screenpresso_decoder_select="zlib" |
2516 |
-shorten_decoder_select="golomb" |
|
2516 |
+shorten_decoder_select="golomb bswapdsp" |
|
2517 | 2517 |
sipr_decoder_select="lsp" |
2518 | 2518 |
snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp" |
2519 | 2519 |
snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder" |
... | ... |
@@ -27,6 +27,7 @@ |
27 | 27 |
|
28 | 28 |
#include <limits.h> |
29 | 29 |
#include "avcodec.h" |
30 |
+#include "bswapdsp.h" |
|
30 | 31 |
#include "bytestream.h" |
31 | 32 |
#include "get_bits.h" |
32 | 33 |
#include "golomb.h" |
... | ... |
@@ -109,6 +110,8 @@ typedef struct ShortenContext { |
109 | 109 |
int32_t lpcqoffset; |
110 | 110 |
int got_header; |
111 | 111 |
int got_quit_command; |
112 |
+ int swap; |
|
113 |
+ BswapDSPContext bdsp; |
|
112 | 114 |
} ShortenContext; |
113 | 115 |
|
114 | 116 |
static av_cold int shorten_decode_init(AVCodecContext *avctx) |
... | ... |
@@ -116,6 +119,8 @@ static av_cold int shorten_decode_init(AVCodecContext *avctx) |
116 | 116 |
ShortenContext *s = avctx->priv_data; |
117 | 117 |
s->avctx = avctx; |
118 | 118 |
|
119 |
+ ff_bswapdsp_init(&s->bdsp); |
|
120 |
+ |
|
119 | 121 |
return 0; |
120 | 122 |
} |
121 | 123 |
|
... | ... |
@@ -202,6 +207,7 @@ static int init_offset(ShortenContext *s) |
202 | 202 |
static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header, |
203 | 203 |
int header_size) |
204 | 204 |
{ |
205 |
+ ShortenContext *s = avctx->priv_data; |
|
205 | 206 |
int len, bps, exp; |
206 | 207 |
GetByteContext gb; |
207 | 208 |
uint64_t val; |
... | ... |
@@ -217,7 +223,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header, |
217 | 217 |
bytestream2_skip(&gb, 4); /* chunk size */ |
218 | 218 |
|
219 | 219 |
tag = bytestream2_get_le32(&gb); |
220 |
- if (tag != MKTAG('A', 'I', 'F', 'F')) { |
|
220 |
+ if (tag != MKTAG('A', 'I', 'F', 'F') && |
|
221 |
+ tag != MKTAG('A', 'I', 'F', 'C')) { |
|
221 | 222 |
av_log(avctx, AV_LOG_ERROR, "missing AIFF tag\n"); |
222 | 223 |
return AVERROR_INVALIDDATA; |
223 | 224 |
} |
... | ... |
@@ -241,6 +248,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header, |
241 | 241 |
bps = bytestream2_get_be16(&gb); |
242 | 242 |
avctx->bits_per_coded_sample = bps; |
243 | 243 |
|
244 |
+ s->swap = tag == MKTAG('A', 'I', 'F', 'C'); |
|
245 |
+ |
|
244 | 246 |
if (bps != 16 && bps != 8) { |
245 | 247 |
av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample: %d\n", bps); |
246 | 248 |
return AVERROR(ENOSYS); |
... | ... |
@@ -721,6 +730,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, |
721 | 721 |
break; |
722 | 722 |
} |
723 | 723 |
} |
724 |
+ if (s->swap && s->internal_ftype != TYPE_U8) |
|
725 |
+ s->bdsp.bswap16_buf(((uint16_t **)frame->extended_data)[chan], |
|
726 |
+ ((uint16_t **)frame->extended_data)[chan], |
|
727 |
+ s->blocksize); |
|
728 |
+ |
|
724 | 729 |
} |
725 | 730 |
|
726 | 731 |
*got_frame_ptr = 1; |