diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2010-03-12 23:35:59 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2010-03-12 23:35:59 +0000 |
commit | 1ab0406db1f338d72fbdda3a03bd9ddddb9c9d08 (patch) | |
tree | 3a986ad14c71319f3a201753c8f34cb57be184df | |
parent | adae9fa65e69dd5ac1c5d411fcc66affb554c79b (diff) | |
download | ffmpeg-1ab0406db1f338d72fbdda3a03bd9ddddb9c9d08.tar.gz |
export rm_reorder_sipr_data() for future use by matroska demuxer
Originally committed as revision 22491 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/rm.h | 7 | ||||
-rw-r--r-- | libavformat/rmdec.c | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/rm.h b/libavformat/rm.h index 9838cb7f29..f5110b93e1 100644 --- a/libavformat/rm.h +++ b/libavformat/rm.h @@ -91,4 +91,11 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, AVStream *st, RMStream *rst, AVPacket *pkt); +/** + * Perform 4-bit block reordering for SIPR data. + * + * @param buf SIPR data + */ +void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize); + #endif /* AVFORMAT_RM_H */ diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index a3f46abac2..350970ab03 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -696,16 +696,14 @@ rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt) * Perform 4-bit block reordering for SIPR data. * @todo This can be optimized, e.g. use memcpy() if data blocks are aligned */ -static void -rm_reorder_sipr_data (RMStream *ast) +void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize) { - int n, bs = ast->sub_packet_h * ast->audio_framesize * 2 / 96; // nibbles per subpacket + int n, bs = sub_packet_h * framesize * 2 / 96; // nibbles per subpacket for (n = 0; n < 38; n++) { int j; int i = bs * sipr_swaps[n][0]; int o = bs * sipr_swaps[n][1]; - uint8_t *buf = ast->pkt.data; /* swap 4bit-nibbles of block 'i' with 'o' */ for (j = 0; j < bs; j++, i++, o++) { @@ -766,7 +764,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, if (++(ast->sub_packet_cnt) < h) return -1; if (st->codec->codec_id == CODEC_ID_SIPR) - rm_reorder_sipr_data(ast); + ff_rm_reorder_sipr_data(ast->pkt.data, h, w); ast->sub_packet_cnt = 0; rm->audio_stream_num = st->index; |