changeset 5831:6ff00deb94fb libavformat

export rm_reorder_sipr_data() for future use by matroska demuxer
author aurel
date Fri, 12 Mar 2010 23:35:59 +0000
parents f8093c5208f6
children cf9f77508e9c
files rm.h rmdec.c
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rm.h	Fri Mar 12 23:34:30 2010 +0000
+++ b/rm.h	Fri Mar 12 23:35:59 2010 +0000
@@ -91,4 +91,11 @@
 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 */
--- a/rmdec.c	Fri Mar 12 23:34:30 2010 +0000
+++ b/rmdec.c	Fri Mar 12 23:35:59 2010 +0000
@@ -696,16 +696,14 @@
  * 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 @@
             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;