[FFmpeg-cvslog] mtv: make output endian independant

Michael Niedermayer git at videolan.org
Tue May 15 11:17:02 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue May 15 11:12:51 2012 +0200| [b9777797be2f4a49894e682ad83f680b563e23d5] | committer: Michael Niedermayer

mtv: make output endian independant

should fix fate-mtv test

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9777797be2f4a49894e682ad83f680b563e23d5
---

 libavformat/mtv.c  |   16 +----------
 tests/ref/fate/mtv |   80 ++++++++++++++++++++++++++--------------------------
 2 files changed, 41 insertions(+), 55 deletions(-)

diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index 2f7e5fd..6558a23 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -136,7 +136,7 @@ static int mtv_read_header(AVFormatContext *s)
     avpriv_set_pts_info(st, 64, 1, mtv->video_fps);
     st->codec->codec_type      = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id        = CODEC_ID_RAWVIDEO;
-    st->codec->pix_fmt         = PIX_FMT_RGB565;
+    st->codec->pix_fmt         = PIX_FMT_RGB565BE;
     st->codec->width           = mtv->img_width;
     st->codec->height          = mtv->img_height;
     st->codec->sample_rate     = mtv->video_fps;
@@ -169,9 +169,6 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
     MTVDemuxContext *mtv = s->priv_data;
     AVIOContext *pb = s->pb;
     int ret;
-#if !HAVE_BIGENDIAN
-    int i;
-#endif
 
     if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
     {
@@ -190,17 +187,6 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
         if(ret < 0)
             return ret;
 
-#if !HAVE_BIGENDIAN
-
-        /* pkt->data is GGGRRRR BBBBBGGG
-         * and we need RRRRRGGG GGGBBBBB
-         * for PIX_FMT_RGB565 so here we
-         * just swap bytes as they come
-         */
-
-        for(i=0;i<ret/2;i++)
-            *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
-#endif
         pkt->stream_index = 0;
     }
 
diff --git a/tests/ref/fate/mtv b/tests/ref/fate/mtv
index 2e88bd8..4f8f616 100644
--- a/tests/ref/fate/mtv
+++ b/tests/ref/fate/mtv
@@ -1,138 +1,138 @@
 #tb 0: 1/16
 #tb 1: 1/44100
-0,          0,          0,        1,    12288, 0x80398ebc
+0,          0,          0,        1,    12288, 0xc2258ebc
 1,          0,          0,     1152,      417, 0xae1cc66a
 1,       1152,       1152,     1152,      418, 0xdc3ec850
 1,       2304,       2304,     1152,      418, 0x4e8ed05f
-0,          1,          1,        1,    12288, 0x80398ebc
+0,          1,          1,        1,    12288, 0xc2258ebc
 1,       3456,       3456,     1152,      418, 0xeb43d574
 1,       4608,       4608,     1152,      418, 0x9357c91d
-0,          2,          2,        1,    12288, 0x6678829c
+0,          2,          2,        1,    12288, 0xb3fe829c
 1,       5760,       5760,     1152,      418, 0x5306d16b
 1,       6912,       6912,     1152,      418, 0x46e0d4da
 1,       8064,       8064,     1152,      418, 0xac11ce79
-0,          3,          3,        1,    12288, 0xda08884a
+0,          3,          3,        1,    12288, 0x2315884a
 1,       9216,       9216,     1152,      418, 0xffdfc4ad
 1,      10368,      10368,     1152,      418, 0xf8a8c2ff
-0,          4,          4,        1,    12288, 0x45ae8046
+0,          4,          4,        1,    12288, 0x95a08046
 1,      11520,      11520,     1152,      418, 0x2d66d83f
 1,      12672,      12672,     1152,      418, 0x65c0da12
-0,          5,          5,        1,    12288, 0x926c886b
+0,          5,          5,        1,    12288, 0xdb49886b
 1,      13824,      13824,     1152,      418, 0x0eafd20f
 1,      14976,      14976,     1152,      418, 0x8c6dd949
 1,      16128,      16128,     1152,      418, 0x9094c02d
-0,          6,          6,        1,    12288, 0x926c886b
+0,          6,          6,        1,    12288, 0xdb49886b
 1,      17280,      17280,     1152,      418, 0xb47bd944
 1,      18432,      18432,     1152,      418, 0x935ccce7
-0,          7,          7,        1,    12288, 0x926c886b
+0,          7,          7,        1,    12288, 0xdb49886b
 1,      19584,      19584,     1152,      418, 0x6e3ed020
 1,      20736,      20736,     1152,      418, 0x8922cd6c
 1,      21888,      21888,     1152,      418, 0xe811c8f8
-0,          8,          8,        1,    12288, 0x926c886b
+0,          8,          8,        1,    12288, 0xdb49886b
 1,      23040,      23040,     1152,      418, 0xb84adc72
 1,      24192,      24192,     1152,      418, 0xa2bbc5f4
-0,          9,          9,        1,    12288, 0x926c886b
+0,          9,          9,        1,    12288, 0xdb49886b
 1,      25344,      25344,     1152,      418, 0xec0cb67d
 1,      26496,      26496,     1152,      418, 0x89d1d014
-0,         10,         10,        1,    12288, 0x926c886b
+0,         10,         10,        1,    12288, 0xdb49886b
 1,      27648,      27648,     1152,      418, 0xfb5bc872
 1,      28800,      28800,     1152,      417, 0x8bfcc7a0
 1,      29952,      29952,     1152,      418, 0xeb4ac61b
-0,         11,         11,        1,    12288, 0x926c886b
+0,         11,         11,        1,    12288, 0xdb49886b
 1,      31104,      31104,     1152,      418, 0xd3cbc3c4
 1,      32256,      32256,     1152,      418, 0xa272d092
-0,         12,         12,        1,    12288, 0x926c886b
+0,         12,         12,        1,    12288, 0xdb49886b
 1,      33408,      33408,     1152,      418, 0x611ec37e
 1,      34560,      34560,     1152,      418, 0x70a3d423
 1,      35712,      35712,     1152,      418, 0xeff9ccf4
-0,         13,         13,        1,    12288, 0x926c886b
+0,         13,         13,        1,    12288, 0xdb49886b
 1,      36864,      36864,     1152,      418, 0x9788c65b
 1,      38016,      38016,     1152,      418, 0xe9a8cb8c
-0,         14,         14,        1,    12288, 0x926c886b
+0,         14,         14,        1,    12288, 0xdb49886b
 1,      39168,      39168,     1152,      418, 0x5834c300
 1,      40320,      40320,     1152,      418, 0xa4b8cd3a
-0,         15,         15,        1,    12288, 0x926c886b
+0,         15,         15,        1,    12288, 0xdb49886b
 1,      41472,      41472,     1152,      418, 0x6de2c7f9
 1,      42624,      42624,     1152,      418, 0x961bbbf3
 1,      43776,      43776,     1152,      418, 0x53edc13a
-0,         16,         16,        1,    12288, 0x45ae8046
+0,         16,         16,        1,    12288, 0x95a08046
 1,      44928,      44928,     1152,      418, 0x2fedc4b0
 1,      46080,      46080,     1152,      418, 0xb756c18b
-0,         17,         17,        1,    12288, 0x926c886b
+0,         17,         17,        1,    12288, 0xdb49886b
 1,      47232,      47232,     1152,      418, 0xaf0ed0e4
 1,      48384,      48384,     1152,      418, 0x019fd3f0
 1,      49536,      49536,     1152,      418, 0x6e29d83e
-0,         18,         18,        1,    12288, 0x45ae8046
+0,         18,         18,        1,    12288, 0x95a08046
 1,      50688,      50688,     1152,      418, 0x2ddad6bb
 1,      51840,      51840,     1152,      418, 0xafefca99
-0,         19,         19,        1,    12288, 0x926c886b
+0,         19,         19,        1,    12288, 0xdb49886b
 1,      52992,      52992,     1152,      418, 0x366ed013
 1,      54144,      54144,     1152,      418, 0x532ac7e0
-0,         20,         20,        1,    12288, 0x45ae8046
+0,         20,         20,        1,    12288, 0x95a08046
 1,      55296,      55296,     1152,      418, 0x1d0cd1ce
 1,      56448,      56448,     1152,      417, 0x572ad1e3
 1,      57600,      57600,     1152,      418, 0x858cd91f
-0,         21,         21,        1,    12288, 0x926c886b
+0,         21,         21,        1,    12288, 0xdb49886b
 1,      58752,      58752,     1152,      418, 0x82cacdfd
 1,      59904,      59904,     1152,      418, 0xf4dcc6ed
-0,         22,         22,        1,    12288, 0x45ae8046
+0,         22,         22,        1,    12288, 0x95a08046
 1,      61056,      61056,     1152,      418, 0x2cf3ca72
 1,      62208,      62208,     1152,      418, 0x5963c859
 1,      63360,      63360,     1152,      418, 0xa667c53d
-0,         23,         23,        1,    12288, 0x926c886b
+0,         23,         23,        1,    12288, 0xdb49886b
 1,      64512,      64512,     1152,      418, 0xb2f1d09c
 1,      65664,      65664,     1152,      418, 0x2ec1c8d3
-0,         24,         24,        1,    12288, 0x926c886b
+0,         24,         24,        1,    12288, 0xdb49886b
 1,      66816,      66816,     1152,      418, 0x5754d2e8
 1,      67968,      67968,     1152,      418, 0x1956bdba
-0,         25,         25,        1,    12288, 0x926c886b
+0,         25,         25,        1,    12288, 0xdb49886b
 1,      69120,      69120,     1152,      418, 0x3e18bd55
 1,      70272,      70272,     1152,      418, 0xe4cfc339
 1,      71424,      71424,     1152,      418, 0xb426c835
-0,         26,         26,        1,    12288, 0x926c886b
+0,         26,         26,        1,    12288, 0xdb49886b
 1,      72576,      72576,     1152,      418, 0xd7b6cbcf
 1,      73728,      73728,     1152,      418, 0x340ec315
-0,         27,         27,        1,    12288, 0x926c886b
+0,         27,         27,        1,    12288, 0xdb49886b
 1,      74880,      74880,     1152,      418, 0x23a9baec
 1,      76032,      76032,     1152,      418, 0x9f04cd01
-0,         28,         28,        1,    12288, 0x926c886b
+0,         28,         28,        1,    12288, 0xdb49886b
 1,      77184,      77184,     1152,      418, 0xa80ec223
 1,      78336,      78336,     1152,      418, 0x23d6bd5d
 1,      79488,      79488,     1152,      418, 0xcb25cf5b
-0,         29,         29,        1,    12288, 0x926c886b
+0,         29,         29,        1,    12288, 0xdb49886b
 1,      80640,      80640,     1152,      418, 0xccccc217
 1,      81792,      81792,     1152,      418, 0x757abbfe
-0,         30,         30,        1,    12288, 0x926c886b
+0,         30,         30,        1,    12288, 0xdb49886b
 1,      82944,      82944,     1152,      418, 0xa2e6cc68
 1,      84096,      84096,     1152,      418, 0xdf77cc05
 1,      85248,      85248,     1152,      417, 0xe9d2c5d5
-0,         31,         31,        1,    12288, 0x926c886b
+0,         31,         31,        1,    12288, 0xdb49886b
 1,      86400,      86400,     1152,      418, 0x50dec174
 1,      87552,      87552,     1152,      418, 0xf654b27e
-0,         32,         32,        1,    12288, 0x45ae8046
+0,         32,         32,        1,    12288, 0x95a08046
 1,      88704,      88704,     1152,      418, 0x4d8bc26e
 1,      89856,      89856,     1152,      418, 0xccd2bf37
-0,         33,         33,        1,    12288, 0x926c886b
+0,         33,         33,        1,    12288, 0xdb49886b
 1,      91008,      91008,     1152,      418, 0x6ce2c18a
 1,      92160,      92160,     1152,      418, 0xb3cdcf0c
 1,      93312,      93312,     1152,      418, 0x55eebe9a
-0,         34,         34,        1,    12288, 0x45ae8046
+0,         34,         34,        1,    12288, 0x95a08046
 1,      94464,      94464,     1152,      418, 0x9031c9ec
 1,      95616,      95616,     1152,      418, 0xb037c49d
-0,         35,         35,        1,    12288, 0x926c886b
+0,         35,         35,        1,    12288, 0xdb49886b
 1,      96768,      96768,     1152,      418, 0x377bcc78
 1,      97920,      97920,     1152,      418, 0x3762c725
 1,      99072,      99072,     1152,      418, 0x39afbd4d
-0,         36,         36,        1,    12288, 0x45ae8046
+0,         36,         36,        1,    12288, 0x95a08046
 1,     100224,     100224,     1152,      418, 0x655ed6cd
 1,     101376,     101376,     1152,      418, 0x09aec202
-0,         37,         37,        1,    12288, 0x926c886b
+0,         37,         37,        1,    12288, 0xdb49886b
 1,     102528,     102528,     1152,      418, 0xf2d2ce55
 1,     103680,     103680,     1152,      418, 0x254ebf04
-0,         38,         38,        1,    12288, 0x45ae8046
+0,         38,         38,        1,    12288, 0x95a08046
 1,     104832,     104832,     1152,      418, 0xa105cdcc
 1,     105984,     105984,     1152,      418, 0x1477ba58
 1,     107136,     107136,     1152,      418, 0x8d0dcdb2
-0,         39,         39,        1,     3584, 0xba46c435
+0,         39,         39,        1,     3584, 0x0354c435
 1,     108288,     108288,     1152,      418, 0x0d7cbef4
 1,     109440,     109440,     1152,      294, 0x5e2b87c4



More information about the ffmpeg-cvslog mailing list