diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/mdec.c | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/mdec.c')
| -rw-r--r-- | ffmpeg/libavcodec/mdec.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ffmpeg/libavcodec/mdec.c b/ffmpeg/libavcodec/mdec.c index 8fb29ce..1567e14 100644 --- a/ffmpeg/libavcodec/mdec.c +++ b/ffmpeg/libavcodec/mdec.c @@ -121,7 +121,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n) static inline int decode_mb(MDECContext *a, int16_t block[6][64]) { int i, ret; - const int block_index[6] = { 5, 4, 0, 1, 2, 3 }; + static const int block_index[6] = { 5, 4, 0, 1, 2, 3 }; a->dsp.clear_blocks(block[0]); @@ -163,21 +163,19 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ThreadFrame frame = { .f = data }; - int i, ret; + int ret; if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; frame.f->pict_type = AV_PICTURE_TYPE_I; frame.f->key_frame = 1; - av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size); if (!a->bitstream_buffer) return AVERROR(ENOMEM); - for (i = 0; i < buf_size; i += 2) { - a->bitstream_buffer[i] = buf[i + 1]; - a->bitstream_buffer[i + 1] = buf[i]; - } - init_get_bits(&a->gb, a->bitstream_buffer, buf_size * 8); + a->dsp.bswap16_buf((uint16_t *)a->bitstream_buffer, (uint16_t *)buf, (buf_size + 1) / 2); + if ((ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size)) < 0) + return ret; /* skip over 4 preamble bytes in stream (typically 0xXX 0xXX 0x00 0x38) */ skip_bits(&a->gb, 32); @@ -242,6 +240,7 @@ static av_cold int decode_end(AVCodecContext *avctx) AVCodec ff_mdec_decoder = { .name = "mdec", + .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_MDEC, .priv_data_size = sizeof(MDECContext), @@ -249,6 +248,5 @@ AVCodec ff_mdec_decoder = { .close = decode_end, .decode = decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, - .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"), .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy) }; |
