[MPlayer-cvslog] r31680 - in trunk/libmpcodecs: ad_dk3adpcm.c ad_imaadpcm.c vd_mtga.c vd_realvid.c vd_sgi.c

reimar subversion at mplayerhq.hu
Sun Jul 11 00:24:31 CEST 2010


Author: reimar
Date: Sun Jul 11 00:24:31 2010
New Revision: 31680

Log:
Use AV_RL* macros instead of typecasts where appropriate.

Modified:
   trunk/libmpcodecs/ad_dk3adpcm.c
   trunk/libmpcodecs/ad_imaadpcm.c
   trunk/libmpcodecs/vd_mtga.c
   trunk/libmpcodecs/vd_realvid.c
   trunk/libmpcodecs/vd_sgi.c

Modified: trunk/libmpcodecs/ad_dk3adpcm.c
==============================================================================
--- trunk/libmpcodecs/ad_dk3adpcm.c	Sun Jul 11 00:12:38 2010	(r31679)
+++ trunk/libmpcodecs/ad_dk3adpcm.c	Sun Jul 11 00:24:31 2010	(r31680)
@@ -33,7 +33,7 @@
 #include <unistd.h>
 
 #include "config.h"
-#include "mpbswap.h"
+#include "libavutil/intreadwrite.h"
 #include "ad_internal.h"
 
 static const ad_info_t info =
@@ -49,9 +49,6 @@ LIBAD_EXTERN(dk3adpcm)
 
 #define DK3_ADPCM_PREAMBLE_SIZE 16
 
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
-
 // useful macros
 // clamp a number between 0 and 88
 #define CLAMP_0_TO_88(x)  if (x < 0) x = 0; else if (x > 88) x = 88;
@@ -154,8 +151,8 @@ static int dk3_adpcm_decode_block(unsign
   int step;
   int diff;
 
-  sum_pred = LE_16(&input[10]);
-  diff_pred = LE_16(&input[12]);
+  sum_pred = AV_RL16(&input[10]);
+  diff_pred = AV_RL16(&input[12]);
   SE_16BIT(sum_pred);
   SE_16BIT(diff_pred);
   diff_channel = diff_pred;

Modified: trunk/libmpcodecs/ad_imaadpcm.c
==============================================================================
--- trunk/libmpcodecs/ad_imaadpcm.c	Sun Jul 11 00:12:38 2010	(r31679)
+++ trunk/libmpcodecs/ad_imaadpcm.c	Sun Jul 11 00:24:31 2010	(r31680)
@@ -39,7 +39,7 @@
 #include <inttypes.h>
 
 #include "config.h"
-#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
 #include "mpbswap.h"
 #include "ad_internal.h"
 
@@ -49,9 +49,6 @@
 #define QT_IMA_ADPCM_BLOCK_SIZE 0x22
 #define QT_IMA_ADPCM_SAMPLES_PER_BLOCK 64
 
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-
 // pertinent tables for IMA ADPCM
 static const int16_t adpcm_step[89] =
 {
@@ -189,7 +186,7 @@ static int qt_ima_adpcm_decode_block(uns
     return -1;
 
   for (i = 0; i < channels; i++) {
-    initial_index[i] = initial_predictor[i] = (int16_t)BE_16(&input[i * QT_IMA_ADPCM_BLOCK_SIZE]);
+    initial_index[i] = initial_predictor[i] = (int16_t)AV_RB16(&input[i * QT_IMA_ADPCM_BLOCK_SIZE]);
 
     // mask, sign-extend, and clamp the predictor portion
     initial_predictor[i] &= ~0x7F;
@@ -239,7 +236,7 @@ static int ms_ima_adpcm_decode_block(uns
     return -1;
 
   for (i = 0; i < channels; i++) {
-    predictor[i] = (int16_t)LE_16(&input[i * 4]);
+    predictor[i] = (int16_t)AV_RL16(&input[i * 4]);
     index[i] = input[i * 4 + 2];
   }
 
@@ -303,7 +300,7 @@ static int dk4_ima_adpcm_decode_block(un
 
   for (i = 0; i < channels; i++) {
     // the first predictor value goes straight to the output
-    predictor[i] = output[i] = (int16_t)LE_16(&input[i * 4]);
+    predictor[i] = output[i] = (int16_t)AV_RL16(&input[i * 4]);
     index[i] = input[i * 4 + 2];
   }
 

Modified: trunk/libmpcodecs/vd_mtga.c
==============================================================================
--- trunk/libmpcodecs/vd_mtga.c	Sun Jul 11 00:12:38 2010	(r31679)
+++ trunk/libmpcodecs/vd_mtga.c	Sun Jul 11 00:24:31 2010	(r31680)
@@ -29,7 +29,7 @@
 #include "config.h"
 #include "mp_msg.h"
 
-#include "mpbswap.h"
+#include "libavutil/intreadwrite.h"
 #include "libvo/fastmemcpy.h"
 
 #include "vd_internal.h"
@@ -176,8 +176,8 @@ static short read_tga_header(unsigned ch
     info->img_type = buf[2];
 
     /* targa data is always stored in little endian byte order */
-    info->width = le2me_16(*(unsigned short *) &buf[12]);
-    info->height = le2me_16(*(unsigned short *) &buf[14]);
+    info->width  = AV_RL16(&buf[12]);
+    info->height = AV_RL16(&buf[14]);
 
     info->bpp = buf[16];
 

Modified: trunk/libmpcodecs/vd_realvid.c
==============================================================================
--- trunk/libmpcodecs/vd_realvid.c	Sun Jul 11 00:12:38 2010	(r31679)
+++ trunk/libmpcodecs/vd_realvid.c	Sun Jul 11 00:24:31 2010	(r31680)
@@ -270,9 +270,9 @@ static int init(sh_video_t *sh){
 	    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", sh->bih->biSize - sizeof(BITMAPINFOHEADER));
 	    return 0;
 	}
-	init_data = (struct rv_init_t){11, sh->disp_w, sh->disp_h, 0, 0, be2me_32(((unsigned int*)extrahdr)[0]), 1, be2me_32(((unsigned int*)extrahdr)[1])}; // rv30
+	init_data = (struct rv_init_t){11, sh->disp_w, sh->disp_h, 0, 0, AV_RB32(extrahdr), 1, AV_RB32(extrahdr + 4)}; // rv30
 
-	mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X  sub-id: 0x%08X\n",be2me_32(((unsigned int*)extrahdr)[1]),be2me_32(((unsigned int*)extrahdr)[0]));
+	mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X  sub-id: 0x%08X\n",init_data.format,init_data.sub_format);
 
 	path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
 	if (!path) return 0;

Modified: trunk/libmpcodecs/vd_sgi.c
==============================================================================
--- trunk/libmpcodecs/vd_sgi.c	Sun Jul 11 00:12:38 2010	(r31679)
+++ trunk/libmpcodecs/vd_sgi.c	Sun Jul 11 00:24:31 2010	(r31680)
@@ -23,7 +23,7 @@
 
 #include "config.h"
 #include "mp_msg.h"
-#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
 #include "mpbswap.h"
 #include "vd_internal.h"
 
@@ -194,7 +194,7 @@ decode_rle_sgi(SGIInfo *info, unsigned c
        dest_row = mpi->planes[0] + mpi->stride[0] * (ysize - 1 - y);
 
       /* set start of next run (offsets are from start of header) */
-      start_offset = be2me_32(*(uint32_t*) &starttab[y + z * ysize]);
+      start_offset = AV_RB32(&starttab[y + z * ysize]);
 
       rle_data = &data[start_offset];
 
@@ -261,13 +261,13 @@ static void
 read_sgi_header(unsigned char *buf, SGIInfo *info)
 {
   /* sgi data is always stored in big endian byte order */
-  info->magic = be2me_16(*(unsigned short *) &buf[0]);
+  info->magic = AV_RB16(&buf[0]);
   info->rle = buf[2];
   info->bytes_per_channel = buf[3];
-  info->dimension = be2me_16(*(unsigned short *) &buf[4]);
-  info->xsize = be2me_16(*(unsigned short *) &buf[6]);
-  info->ysize = be2me_16(*(unsigned short *) &buf[8]);
-  info->zsize = be2me_16(*(unsigned short *) &buf[10]);
+  info->dimension = AV_RB16(&buf[4]);
+  info->xsize = AV_RB16(&buf[6]);
+  info->ysize = AV_RB16(&buf[8]);
+  info->zsize = AV_RB16(&buf[10]);
 }
 
 


More information about the MPlayer-cvslog mailing list