summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-10 22:24:31 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:43 +0200
commitd12c624ea8c58be40181cfbd7816f50e9e6c00ce (patch)
tree2c5706c559e3897f40e7912d72562440c5328a86 /libmpcodecs
parent1663d97a112261c10f989b70547545048f9e31c3 (diff)
downloadmpv-d12c624ea8c58be40181cfbd7816f50e9e6c00ce.tar.bz2
mpv-d12c624ea8c58be40181cfbd7816f50e9e6c00ce.tar.xz
Use AV_RL* macros instead of typecasts where appropriate
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31680 b3059339-0415-0410-9bf9-f77b7e298cf2 100l compialtion fix and use AV_RB32. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31683 b3059339-0415-0410-9bf9-f77b7e298cf2 Current FFmpeg installs intreadwrite.h, but keep using the internal version for now to keep the possibility of compiling against older FFmpeg lib versions.
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_dk3adpcm.c9
-rw-r--r--libmpcodecs/ad_imaadpcm.c11
-rw-r--r--libmpcodecs/vd_mtga.c6
-rw-r--r--libmpcodecs/vd_realvid.c8
-rw-r--r--libmpcodecs/vd_sgi.c14
5 files changed, 21 insertions, 27 deletions
diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c
index 9ee168dc45..d1792ee46b 100644
--- a/libmpcodecs/ad_dk3adpcm.c
+++ b/libmpcodecs/ad_dk3adpcm.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include "config.h"
-#include "mpbswap.h"
+#include "ffmpeg_files/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(unsigned short *output, unsigned char *input,
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;
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c
index 11a561315a..2ca71f29de 100644
--- a/libmpcodecs/ad_imaadpcm.c
+++ b/libmpcodecs/ad_imaadpcm.c
@@ -39,7 +39,7 @@
#include <inttypes.h>
#include "config.h"
-#include "libavutil/common.h"
+#include "ffmpeg_files/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(unsigned short *output,
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(unsigned short *output,
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(unsigned short *output,
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];
}
diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c
index 310d6e2702..390166a3e6 100644
--- a/libmpcodecs/vd_mtga.c
+++ b/libmpcodecs/vd_mtga.c
@@ -29,7 +29,7 @@
#include "config.h"
#include "mp_msg.h"
-#include "mpbswap.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libvo/fastmemcpy.h"
#include "vd_internal.h"
@@ -176,8 +176,8 @@ static short read_tga_header(unsigned char *buf, TGAInfo *info)
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];
diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c
index 5f4d7cb8a8..04ac9efba7 100644
--- a/libmpcodecs/vd_realvid.c
+++ b/libmpcodecs/vd_realvid.c
@@ -26,7 +26,7 @@
#endif
#include "mp_msg.h"
-#include "mpbswap.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "path.h"
#include "vd_internal.h"
@@ -289,9 +289,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.subformat);
path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
if (!path) return 0;
@@ -327,7 +327,7 @@ static int init(sh_video_t *sh){
return 0;
}
// setup rv30 codec (codec sub-type and image dimensions):
- if((sh->format<=0x30335652) && (be2me_32(((unsigned int*)extrahdr)[1])>=0x20200002)){
+ if((sh->format<=0x30335652) && AV_RB32(extrahdr + 4)>=0x20200002){
int i, cmsg_cnt;
uint32_t cmsg24[16]={sh->disp_w,sh->disp_h};
cmsg_data_t cmsg_data={0x24,1+(extrahdr[1]&7), &cmsg24[0]};
diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c
index e951542a8b..fff6d6f60b 100644
--- a/libmpcodecs/vd_sgi.c
+++ b/libmpcodecs/vd_sgi.c
@@ -23,7 +23,7 @@
#include "config.h"
#include "mp_msg.h"
-#include "libavutil/common.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "vd_internal.h"
@@ -194,7 +194,7 @@ decode_rle_sgi(SGIInfo *info, unsigned char *data, mp_image_t *mpi)
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]);
}