Browse Source

* UINTX -> uintx_t INTX -> intx_t

Originally committed as revision 1578 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Zdenek Kabelac 23 years ago
parent
commit
0c1a9edad4
100 changed files with 1645 additions and 1678 deletions
  1. +26
    -26
      ffmpeg.c
  2. +40
    -40
      ffserver.c
  3. +6
    -6
      libavcodec/a52dec.c
  4. +12
    -12
      libavcodec/ac3.h
  5. +6
    -6
      libavcodec/ac3dec.c
  6. +51
    -51
      libavcodec/ac3enc.c
  7. +21
    -21
      libavcodec/ac3tab.h
  8. +3
    -3
      libavcodec/adpcm.c
  9. +5
    -5
      libavcodec/apiexample.c
  10. +4
    -4
      libavcodec/armv4l/mpegvideo_arm.c
  11. +12
    -12
      libavcodec/avcodec.h
  12. +12
    -12
      libavcodec/common.c
  13. +36
    -67
      libavcodec/common.h
  14. +1
    -1
      libavcodec/cyuv.c
  15. +9
    -9
      libavcodec/dct-test.c
  16. +194
    -194
      libavcodec/dsputil.c
  17. +28
    -28
      libavcodec/dsputil.h
  18. +37
    -37
      libavcodec/dv.c
  19. +13
    -13
      libavcodec/dvdata.h
  20. +20
    -20
      libavcodec/error_resilience.c
  21. +3
    -3
      libavcodec/fft-test.c
  22. +53
    -54
      libavcodec/h263.c
  23. +16
    -16
      libavcodec/h263data.h
  24. +3
    -3
      libavcodec/h263dec.c
  25. +1
    -1
      libavcodec/huffyuv.c
  26. +42
    -42
      libavcodec/i386/dsputil_mmx.c
  27. +16
    -16
      libavcodec/i386/dsputil_mmx_avg.h
  28. +14
    -14
      libavcodec/i386/dsputil_mmx_rnd.h
  29. +17
    -17
      libavcodec/i386/motion_est_mmx.c
  30. +11
    -11
      libavcodec/i386/mpegvideo_mmx.c
  31. +2
    -2
      libavcodec/i386/mpegvideo_mmx_template.c
  32. +2
    -2
      libavcodec/i386/simple_idct_mmx.c
  33. +53
    -53
      libavcodec/imgconvert.c
  34. +36
    -36
      libavcodec/imgresample.c
  35. +5
    -5
      libavcodec/jfdctfst.c
  36. +17
    -17
      libavcodec/jfdctint.c
  37. +10
    -10
      libavcodec/jrevdct.c
  38. +21
    -21
      libavcodec/mace.c
  39. +46
    -46
      libavcodec/mjpeg.c
  40. +4
    -4
      libavcodec/mlib/dsputil_mlib.c
  41. +10
    -10
      libavcodec/motion_est.c
  42. +20
    -20
      libavcodec/motion_test.c
  43. +30
    -30
      libavcodec/mpeg12.c
  44. +19
    -19
      libavcodec/mpeg12data.h
  45. +13
    -13
      libavcodec/mpeg4data.h
  46. +2
    -2
      libavcodec/mpegaudio.c
  47. +3
    -3
      libavcodec/mpegaudio.h
  48. +78
    -78
      libavcodec/mpegaudiodec.c
  49. +41
    -41
      libavcodec/mpegaudiodectab.h
  50. +2
    -2
      libavcodec/mpegaudiotab.h
  51. +87
    -87
      libavcodec/mpegvideo.c
  52. +77
    -77
      libavcodec/mpegvideo.h
  53. +16
    -16
      libavcodec/msmpeg4.c
  54. +1
    -1
      libavcodec/oggvorbis.c
  55. +6
    -6
      libavcodec/pcm.c
  56. +4
    -4
      libavcodec/ppc/dsputil_altivec.c
  57. +5
    -5
      libavcodec/ppc/dsputil_altivec.h
  58. +1
    -1
      libavcodec/ppc/gmc_altivec.c
  59. +4
    -4
      libavcodec/ppc/idct_altivec.c
  60. +2
    -2
      libavcodec/ppc/mpegvideo_ppc.c
  61. +1
    -1
      libavcodec/ps2/dsputil_mmi.c
  62. +2
    -2
      libavcodec/ps2/idct_mmi.c
  63. +2
    -2
      libavcodec/ps2/mpegvideo_mmi.c
  64. +2
    -2
      libavcodec/resample.c
  65. +10
    -10
      libavcodec/rv10.c
  66. +14
    -14
      libavcodec/simple_idct.c
  67. +7
    -7
      libavcodec/simple_idct.h
  68. +1
    -1
      libavcodec/svq1.c
  69. +6
    -6
      libavcodec/utils.c
  70. +1
    -1
      libavcodec/wmadec.c
  71. +7
    -8
      libavcodec/wmv2.c
  72. +29
    -29
      libavformat/asf.c
  73. +5
    -5
      libavformat/au.c
  74. +2
    -2
      libavformat/audio.c
  75. +15
    -15
      libavformat/avformat.h
  76. +3
    -3
      libavformat/avidec.c
  77. +4
    -4
      libavformat/avienc.c
  78. +11
    -11
      libavformat/avio.h
  79. +30
    -30
      libavformat/aviobuf.c
  80. +2
    -2
      libavformat/crc.c
  81. +1
    -1
      libavformat/dv1394.c
  82. +22
    -22
      libavformat/ffm.c
  83. +1
    -1
      libavformat/framehook.c
  84. +1
    -1
      libavformat/framehook.h
  85. +7
    -7
      libavformat/gif.c
  86. +13
    -13
      libavformat/grab.c
  87. +3
    -3
      libavformat/http.c
  88. +6
    -6
      libavformat/img.c
  89. +2
    -2
      libavformat/jpeg.c
  90. +37
    -37
      libavformat/mov.c
  91. +21
    -21
      libavformat/mpeg.c
  92. +1
    -1
      libavformat/mpegts.c
  93. +4
    -4
      libavformat/mpjpeg.c
  94. +1
    -1
      libavformat/pnm.c
  95. +1
    -1
      libavformat/raw.c
  96. +7
    -7
      libavformat/rm.c
  97. +23
    -23
      libavformat/rtp.c
  98. +2
    -2
      libavformat/rtpproto.c
  99. +2
    -2
      libavformat/rtsp.h
  100. +7
    -7
      libavformat/swf.c

+ 26
- 26
ffmpeg.c View File

@@ -40,7 +40,7 @@
#define INFINITY HUGE_VAL #define INFINITY HUGE_VAL
#endif #endif


#define MAXINT64 INT64_C(0x7fffffffffffffff)
#define MAXINT64 int64_t_C(0x7fffffffffffffff)


typedef struct { typedef struct {
const char *name; const char *name;
@@ -142,7 +142,7 @@ static int audio_disable = 0;
static int audio_channels = 1; static int audio_channels = 1;
static int audio_codec_id = CODEC_ID_NONE; static int audio_codec_id = CODEC_ID_NONE;


static INT64 recording_time = 0;
static int64_t recording_time = 0;
static int file_overwrite = 0; static int file_overwrite = 0;
static char *str_title = NULL; static char *str_title = NULL;
static char *str_author = NULL; static char *str_author = NULL;
@@ -178,7 +178,7 @@ typedef struct AVOutputStream {
for A/V sync */ for A/V sync */
double sync_ipts; double sync_ipts;
double sync_ipts_offset; double sync_ipts_offset;
INT64 sync_opts;
int64_t sync_opts;
/* video only */ /* video only */
int video_resample; /* video_resample and video_crop are mutually exclusive */ int video_resample; /* video_resample and video_crop are mutually exclusive */
AVPicture pict_tmp; /* temporary image for resampling */ AVPicture pict_tmp; /* temporary image for resampling */
@@ -201,7 +201,7 @@ typedef struct AVInputStream {
AVStream *st; AVStream *st;
int discard; /* true if stream data should be discarded */ int discard; /* true if stream data should be discarded */
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */ int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
INT64 sample_index; /* current sample */
int64_t sample_index; /* current sample */
int frame_decoded; /* true if a video or audio frame has been decoded */ int frame_decoded; /* true if a video or audio frame has been decoded */
} AVInputStream; } AVInputStream;


@@ -320,9 +320,9 @@ static void do_audio_out(AVFormatContext *s,
AVInputStream *ist, AVInputStream *ist,
unsigned char *buf, int size) unsigned char *buf, int size)
{ {
UINT8 *buftmp;
UINT8 audio_buf[2*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it */
UINT8 audio_out[4*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it - yep really WMA */
uint8_t *buftmp;
uint8_t audio_buf[2*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it */
uint8_t audio_out[4*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it - yep really WMA */
int size_out, frame_bytes, ret; int size_out, frame_bytes, ret;
AVCodecContext *enc; AVCodecContext *enc;


@@ -376,7 +376,7 @@ static void do_audio_out(AVFormatContext *s,
static void write_picture(AVFormatContext *s, int index, AVPicture *picture, static void write_picture(AVFormatContext *s, int index, AVPicture *picture,
int pix_fmt, int w, int h) int pix_fmt, int w, int h)
{ {
UINT8 *buf, *src, *dest;
uint8_t *buf, *src, *dest;
int size, j, i; int size, j, i;


/* XXX: not efficient, should add test if we can take /* XXX: not efficient, should add test if we can take
@@ -473,7 +473,7 @@ static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void
AVCodecContext *dec; AVCodecContext *dec;
AVPicture *picture2; AVPicture *picture2;
AVPicture picture_tmp; AVPicture picture_tmp;
UINT8 *buf = 0;
uint8_t *buf = 0;


dec = &ist->st->codec; dec = &ist->st->codec;


@@ -520,8 +520,8 @@ static void do_video_out(AVFormatContext *s,
int nb_frames, i, ret; int nb_frames, i, ret;
AVPicture *final_picture, *formatted_picture; AVPicture *final_picture, *formatted_picture;
AVPicture picture_format_temp, picture_crop_temp; AVPicture picture_format_temp, picture_crop_temp;
static UINT8 *video_buffer;
UINT8 *buf = NULL, *buf1 = NULL;
static uint8_t *video_buffer;
uint8_t *buf = NULL, *buf1 = NULL;
AVCodecContext *enc, *dec; AVCodecContext *enc, *dec;


#define VIDEO_BUFFER_SIZE (1024*1024) #define VIDEO_BUFFER_SIZE (1024*1024)
@@ -675,7 +675,7 @@ static void do_video_out(AVFormatContext *s,
avoid any copies. We support temorarily the older avoid any copies. We support temorarily the older
method. */ method. */
av_write_frame(s, ost->index, av_write_frame(s, ost->index,
(UINT8 *)final_picture, sizeof(AVPicture));
(uint8_t *)final_picture, sizeof(AVPicture));
} else { } else {
write_picture(s, ost->index, final_picture, enc->pix_fmt, write_picture(s, ost->index, final_picture, enc->pix_fmt,
enc->width, enc->height); enc->width, enc->height);
@@ -697,13 +697,13 @@ static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
int frame_size) int frame_size)
{ {
static FILE *fvstats=NULL; static FILE *fvstats=NULL;
static INT64 total_size = 0;
static int64_t total_size = 0;
char filename[40]; char filename[40];
time_t today2; time_t today2;
struct tm *today; struct tm *today;
AVCodecContext *enc; AVCodecContext *enc;
int frame_number; int frame_number;
INT64 ti;
int64_t ti;
double ti1, bitrate, avg_bitrate; double ti1, bitrate, avg_bitrate;
if (!fvstats) { if (!fvstats) {
@@ -749,14 +749,14 @@ static void print_report(AVFormatContext **output_files,
char buf[1024]; char buf[1024];
AVOutputStream *ost; AVOutputStream *ost;
AVFormatContext *oc, *os; AVFormatContext *oc, *os;
INT64 total_size;
int64_t total_size;
AVCodecContext *enc; AVCodecContext *enc;
int frame_number, vid, i; int frame_number, vid, i;
double bitrate, ti1, pts; double bitrate, ti1, pts;
static INT64 last_time = -1;
static int64_t last_time = -1;
if (!is_last_report) { if (!is_last_report) {
INT64 cur_time;
int64_t cur_time;
/* display the report every 0.5 seconds */ /* display the report every 0.5 seconds */
cur_time = av_gettime(); cur_time = av_gettime();
if (last_time == -1) { if (last_time == -1) {
@@ -1019,7 +1019,7 @@ static int av_encode(AVFormatContext **output_files,
ost->topBand = frame_topBand; ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand; ost->leftBand = frame_leftBand;
} else { } else {
UINT8 *buf;
uint8_t *buf;
ost->video_resample = 1; ost->video_resample = 1;
ost->video_crop = 0; // cropping is handled as part of resample ost->video_crop = 0; // cropping is handled as part of resample
buf = av_malloc((codec->width * codec->height * 3) / 2); buf = av_malloc((codec->width * codec->height * 3) / 2);
@@ -1179,9 +1179,9 @@ static int av_encode(AVFormatContext **output_files,
for(;;) { for(;;) {
int file_index, ist_index; int file_index, ist_index;
AVPacket pkt; AVPacket pkt;
UINT8 *ptr;
uint8_t *ptr;
int len; int len;
UINT8 *data_buf;
uint8_t *data_buf;
int data_size, got_picture; int data_size, got_picture;
AVPicture picture; AVPicture picture;
short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2];
@@ -1252,7 +1252,7 @@ static int av_encode(AVFormatContext **output_files,
ptr = pkt.data; ptr = pkt.data;
pts_set = 0; pts_set = 0;
while (len > 0) { while (len > 0) {
INT64 ipts;
int64_t ipts;


ipts = AV_NOPTS_VALUE; ipts = AV_NOPTS_VALUE;


@@ -1288,7 +1288,7 @@ static int av_encode(AVFormatContext **output_files,
len -= ret; len -= ret;
continue; continue;
} }
data_buf = (UINT8 *)samples;
data_buf = (uint8_t *)samples;
break; break;
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
if (ist->st->codec.codec_id == CODEC_ID_RAWVIDEO) { if (ist->st->codec.codec_id == CODEC_ID_RAWVIDEO) {
@@ -1348,7 +1348,7 @@ static int av_encode(AVFormatContext **output_files,
/* XXX: add mpeg4 too ? */ /* XXX: add mpeg4 too ? */
if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) { if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) {
if (ist->st->codec.pict_type != B_TYPE) { if (ist->st->codec.pict_type != B_TYPE) {
INT64 tmp;
int64_t tmp;
tmp = ist->last_ip_pts; tmp = ist->last_ip_pts;
ist->last_ip_pts = ist->frac_pts.val; ist->last_ip_pts = ist->frac_pts.val;
ist->frac_pts.val = tmp; ist->frac_pts.val = tmp;
@@ -2539,12 +2539,12 @@ static void opt_pass(const char *pass_str)
} }


#if defined(CONFIG_WIN32) || defined(CONFIG_OS2) #if defined(CONFIG_WIN32) || defined(CONFIG_OS2)
static INT64 getutime(void)
static int64_t getutime(void)
{ {
return av_gettime(); return av_gettime();
} }
#else #else
static INT64 getutime(void)
static int64_t getutime(void)
{ {
struct rusage rusage; struct rusage rusage;


@@ -2770,7 +2770,7 @@ int main(int argc, char **argv)
int optindex, i; int optindex, i;
const char *opt, *arg; const char *opt, *arg;
const OptionDef *po; const OptionDef *po;
INT64 ti;
int64_t ti;


av_register_all(); av_register_all();




+ 40
- 40
ffserver.c View File

@@ -90,7 +90,7 @@ const char *http_state[] = {
#define SYNC_TIMEOUT (10 * 1000) #define SYNC_TIMEOUT (10 * 1000)


typedef struct { typedef struct {
INT64 count1, count2;
int64_t count1, count2;
long time1, time2; long time1, time2;
} DataRateData; } DataRateData;


@@ -101,17 +101,17 @@ typedef struct HTTPContext {
struct sockaddr_in from_addr; /* origin */ struct sockaddr_in from_addr; /* origin */
struct pollfd *poll_entry; /* used when polling */ struct pollfd *poll_entry; /* used when polling */
long timeout; long timeout;
UINT8 *buffer_ptr, *buffer_end;
uint8_t *buffer_ptr, *buffer_end;
int http_error; int http_error;
struct HTTPContext *next; struct HTTPContext *next;
int got_key_frame; /* stream 0 => 1, stream 1 => 2, stream 2=> 4 */ int got_key_frame; /* stream 0 => 1, stream 1 => 2, stream 2=> 4 */
INT64 data_count;
int64_t data_count;
/* feed input */ /* feed input */
int feed_fd; int feed_fd;
/* input format handling */ /* input format handling */
AVFormatContext *fmt_in; AVFormatContext *fmt_in;
long start_time; /* In milliseconds - this wraps fairly often */ long start_time; /* In milliseconds - this wraps fairly often */
INT64 first_pts; /* initial pts value */
int64_t first_pts; /* initial pts value */
int pts_stream_index; /* stream we choose as clock reference */ int pts_stream_index; /* stream we choose as clock reference */
/* output format handling */ /* output format handling */
struct FFStream *stream; struct FFStream *stream;
@@ -128,12 +128,12 @@ typedef struct HTTPContext {
char method[16]; char method[16];
char url[128]; char url[128];
int buffer_size; int buffer_size;
UINT8 *buffer;
uint8_t *buffer;
int is_packetized; /* if true, the stream is packetized */ int is_packetized; /* if true, the stream is packetized */
int packet_stream_index; /* current stream for output in state machine */ int packet_stream_index; /* current stream for output in state machine */
/* RTSP state specific */ /* RTSP state specific */
UINT8 *pb_buffer; /* XXX: use that in all the code */
uint8_t *pb_buffer; /* XXX: use that in all the code */
ByteIOContext *pb; ByteIOContext *pb;
int seq; /* RTSP sequence number */ int seq; /* RTSP sequence number */


@@ -207,10 +207,10 @@ typedef struct FFStream {
int feed_opened; /* true if someone is writing to the feed */ int feed_opened; /* true if someone is writing to the feed */
int is_feed; /* true if it is a feed */ int is_feed; /* true if it is a feed */
int conns_served; int conns_served;
INT64 bytes_served;
INT64 feed_max_size; /* maximum storage size */
INT64 feed_write_index; /* current write position in feed (it wraps round) */
INT64 feed_size; /* current size of feed */
int64_t bytes_served;
int64_t feed_max_size; /* maximum storage size */
int64_t feed_write_index; /* current write position in feed (it wraps round) */
int64_t feed_size; /* current size of feed */
struct FFStream *next_feed; struct FFStream *next_feed;
} FFStream; } FFStream;


@@ -249,7 +249,7 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h);
static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h); static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h);


/* SDP handling */ /* SDP handling */
static int prepare_sdp_description(FFStream *stream, UINT8 **pbuffer,
static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
struct in_addr my_ip); struct in_addr my_ip);


/* RTP handling */ /* RTP handling */
@@ -323,7 +323,7 @@ static void log_connection(HTTPContext *c)
c->protocol, (c->http_error ? c->http_error : 200), c->data_count); c->protocol, (c->http_error ? c->http_error : 200), c->data_count);
} }


static void update_datarate(DataRateData *drd, INT64 count)
static void update_datarate(DataRateData *drd, int64_t count)
{ {
if (!drd->time1 && !drd->count1) { if (!drd->time1 && !drd->count1) {
drd->time1 = drd->time2 = cur_time; drd->time1 = drd->time2 = cur_time;
@@ -339,7 +339,7 @@ static void update_datarate(DataRateData *drd, INT64 count)
} }


/* In bytes per second */ /* In bytes per second */
static int compute_datarate(DataRateData *drd, INT64 count)
static int compute_datarate(DataRateData *drd, int64_t count)
{ {
if (cur_time == drd->time1) if (cur_time == drd->time1)
return 0; return 0;
@@ -347,7 +347,7 @@ static int compute_datarate(DataRateData *drd, INT64 count)
return ((count - drd->count1) * 1000) / (cur_time - drd->time1); return ((count - drd->count1) * 1000) / (cur_time - drd->time1);
} }


static int get_longterm_datarate(DataRateData *drd, INT64 count)
static int get_longterm_datarate(DataRateData *drd, int64_t count)
{ {
/* You get the first 3 seconds flat out */ /* You get the first 3 seconds flat out */
if (cur_time - drd->time1 < 3000) if (cur_time - drd->time1 < 3000)
@@ -775,7 +775,7 @@ static int handle_connection(HTTPContext *c)
return -1; return -1;
} else { } else {
/* search for end of request. XXX: not fully correct since garbage could come after the end */ /* search for end of request. XXX: not fully correct since garbage could come after the end */
UINT8 *ptr;
uint8_t *ptr;
c->buffer_ptr += len; c->buffer_ptr += len;
ptr = c->buffer_ptr; ptr = c->buffer_ptr;
if ((ptr >= c->buffer + 2 && !memcmp(ptr-2, "\n\n", 2)) || if ((ptr >= c->buffer + 2 && !memcmp(ptr-2, "\n\n", 2)) ||
@@ -1351,7 +1351,7 @@ static int http_parse_request(HTTPContext *c)
break; break;
case REDIR_SDP: case REDIR_SDP:
{ {
UINT8 *sdp_data;
uint8_t *sdp_data;
int sdp_data_size, len; int sdp_data_size, len;
struct sockaddr_in my_addr; struct sockaddr_in my_addr;


@@ -1529,7 +1529,7 @@ static int http_parse_request(HTTPContext *c)
return 0; return 0;
} }


static void fmt_bytecount(ByteIOContext *pb, INT64 count)
static void fmt_bytecount(ByteIOContext *pb, int64_t count)
{ {
static const char *suffix = " kMGTP"; static const char *suffix = " kMGTP";
const char *s; const char *s;
@@ -1837,7 +1837,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
char input_filename[1024]; char input_filename[1024];
AVFormatContext *s; AVFormatContext *s;
int buf_size, i; int buf_size, i;
INT64 stream_pos;
int64_t stream_pos;


/* find file name */ /* find file name */
if (c->stream->feed) { if (c->stream->feed) {
@@ -1848,9 +1848,9 @@ static int open_input_stream(HTTPContext *c, const char *info)
stream_pos = parse_date(buf, 0); stream_pos = parse_date(buf, 0);
} else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
int prebuffer = strtol(buf, 0, 10); int prebuffer = strtol(buf, 0, 10);
stream_pos = av_gettime() - prebuffer * (INT64)1000000;
stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
} else { } else {
stream_pos = av_gettime() - c->stream->prebuffer * (INT64)1000;
stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000;
} }
} else { } else {
strcpy(input_filename, c->stream->feed_filename); strcpy(input_filename, c->stream->feed_filename);
@@ -1930,14 +1930,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
if (st->pts.den == 0) { if (st->pts.den == 0) {
switch(st->codec.codec_type) { switch(st->codec.codec_type) {
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
st->pts_incr = (INT64)s->pts_den;
st->pts_incr = (int64_t)s->pts_den;
av_frac_init(&st->pts, st->pts.val, 0, av_frac_init(&st->pts, st->pts.val, 0,
(INT64)s->pts_num * st->codec.sample_rate);
(int64_t)s->pts_num * st->codec.sample_rate);
break; break;
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
st->pts_incr = (INT64)s->pts_den * FRAME_RATE_BASE;
st->pts_incr = (int64_t)s->pts_den * FRAME_RATE_BASE;
av_frac_init(&st->pts, st->pts.val, 0, av_frac_init(&st->pts, st->pts.val, 0,
(INT64)s->pts_num * st->codec.frame_rate);
(int64_t)s->pts_num * st->codec.frame_rate);
break; break;
default: default:
av_abort(); av_abort();
@@ -1998,14 +1998,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
if (st->pts.den == 0) { if (st->pts.den == 0) {
switch(st->codec.codec_type) { switch(st->codec.codec_type) {
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
st->pts_incr = (INT64)s->pts_den * st->codec.frame_size;
st->pts_incr = (int64_t)s->pts_den * st->codec.frame_size;
av_frac_init(&st->pts, st->pts.val, 0, av_frac_init(&st->pts, st->pts.val, 0,
(INT64)s->pts_num * st->codec.sample_rate);
(int64_t)s->pts_num * st->codec.sample_rate);
break; break;
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
st->pts_incr = (INT64)s->pts_den * FRAME_RATE_BASE;
st->pts_incr = (int64_t)s->pts_den * FRAME_RATE_BASE;
av_frac_init(&st->pts, st->pts.val, 0, av_frac_init(&st->pts, st->pts.val, 0,
(INT64)s->pts_num * st->codec.frame_rate);
(int64_t)s->pts_num * st->codec.frame_rate);
break; break;
default: default:
av_abort(); av_abort();
@@ -2023,11 +2023,11 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)


static int compute_send_delay(HTTPContext *c) static int compute_send_delay(HTTPContext *c)
{ {
INT64 cur_pts, delta_pts, next_pts;
int64_t cur_pts, delta_pts, next_pts;
int delay1; int delay1;
/* compute current pts value from system time */ /* compute current pts value from system time */
cur_pts = ((INT64)(cur_time - c->start_time) * c->fmt_in->pts_den) /
cur_pts = ((int64_t)(cur_time - c->start_time) * c->fmt_in->pts_den) /
(c->fmt_in->pts_num * 1000LL); (c->fmt_in->pts_num * 1000LL);
/* compute the delta from the stream we choose as /* compute the delta from the stream we choose as
main clock (we do that to avoid using explicit main clock (we do that to avoid using explicit
@@ -2328,8 +2328,8 @@ static int http_send_data(HTTPContext *c)
if (dt < 1) if (dt < 1)
dt = 1; dt = 1;


if ((c->packet_byte_count + len) * (INT64)1000000 >=
(SHORT_TERM_BANDWIDTH / 8) * (INT64)dt) {
if ((c->packet_byte_count + len) * (int64_t)1000000 >=
(SHORT_TERM_BANDWIDTH / 8) * (int64_t)dt) {
/* bandwidth overflow : wait at most one tick and retry */ /* bandwidth overflow : wait at most one tick and retry */
c->state = HTTPSTATE_WAIT_SHORT; c->state = HTTPSTATE_WAIT_SHORT;
return 0; return 0;
@@ -2620,7 +2620,7 @@ static int rtsp_parse_request(HTTPContext *c)


/* XXX: move that to rtsp.c, but would need to replace FFStream by /* XXX: move that to rtsp.c, but would need to replace FFStream by
AVFormatContext */ AVFormatContext */
static int prepare_sdp_description(FFStream *stream, UINT8 **pbuffer,
static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
struct in_addr my_ip) struct in_addr my_ip)
{ {
ByteIOContext pb1, *pb = &pb1; ByteIOContext pb1, *pb = &pb1;
@@ -2710,7 +2710,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
FFStream *stream; FFStream *stream;
char path1[1024]; char path1[1024];
const char *path; const char *path;
UINT8 *content;
uint8_t *content;
int content_length, len; int content_length, len;
struct sockaddr_in my_addr; struct sockaddr_in my_addr;
@@ -3087,7 +3087,7 @@ static int rtp_new_av_stream(HTTPContext *c,
AVStream *st; AVStream *st;
char *ipaddr; char *ipaddr;
URLContext *h; URLContext *h;
UINT8 *dummy_buf;
uint8_t *dummy_buf;
char buf2[32]; char buf2[32];
/* now we can open the relevant output stream */ /* now we can open the relevant output stream */
@@ -3240,7 +3240,7 @@ static void extract_mpeg4_header(AVFormatContext *infile)
int mpeg4_count, i, size; int mpeg4_count, i, size;
AVPacket pkt; AVPacket pkt;
AVStream *st; AVStream *st;
const UINT8 *p;
const uint8_t *p;


mpeg4_count = 0; mpeg4_count = 0;
for(i=0;i<infile->nb_streams;i++) { for(i=0;i<infile->nb_streams;i++) {
@@ -3805,7 +3805,7 @@ static int parse_ffconfig(const char *filename)
fsize *= 1024 * 1024 * 1024; fsize *= 1024 * 1024 * 1024;
break; break;
} }
feed->feed_max_size = (INT64)fsize;
feed->feed_max_size = (int64_t)fsize;
} }
} else if (!strcasecmp(cmd, "</Feed>")) { } else if (!strcasecmp(cmd, "</Feed>")) {
if (!feed) { if (!feed) {
@@ -4251,14 +4251,14 @@ static int parse_ffconfig(const char *filename)


#if 0 #if 0
static void write_packet(FFCodec *ffenc, static void write_packet(FFCodec *ffenc,
UINT8 *buf, int size)
uint8_t *buf, int size)
{ {
PacketHeader hdr; PacketHeader hdr;
AVCodecContext *enc = &ffenc->enc; AVCodecContext *enc = &ffenc->enc;
UINT8 *wptr;
uint8_t *wptr;
mk_header(&hdr, enc, size); mk_header(&hdr, enc, size);
wptr = http_fifo.wptr; wptr = http_fifo.wptr;
fifo_write(&http_fifo, (UINT8 *)&hdr, sizeof(hdr), &wptr);
fifo_write(&http_fifo, (uint8_t *)&hdr, sizeof(hdr), &wptr);
fifo_write(&http_fifo, buf, size, &wptr); fifo_write(&http_fifo, buf, size, &wptr);
/* atomic modification of wptr */ /* atomic modification of wptr */
http_fifo.wptr = wptr; http_fifo.wptr = wptr;


+ 6
- 6
libavcodec/a52dec.c View File

@@ -29,8 +29,8 @@ static const char* liba52name = "liba52.so.0";
* released under the GPL license. * released under the GPL license.
*/ */
typedef struct AC3DecodeState { typedef struct AC3DecodeState {
UINT8 inbuf[4096]; /* input buffer */
UINT8 *inbuf_ptr;
uint8_t inbuf[4096]; /* input buffer */
uint8_t *inbuf_ptr;
int frame_size; int frame_size;
int flags; int flags;
int channels; int channels;
@@ -123,7 +123,7 @@ static inline int blah (int32_t i)
return i - 0x43c00000; return i - 0x43c00000;
} }


static inline void float_to_int (float * _f, INT16 * s16, int nchannels)
static inline void float_to_int (float * _f, int16_t * s16, int nchannels)
{ {
int i, j, c; int i, j, c;
int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format
@@ -142,10 +142,10 @@ static inline void float_to_int (float * _f, INT16 * s16, int nchannels)


static int a52_decode_frame(AVCodecContext *avctx, static int a52_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
AC3DecodeState *s = avctx->priv_data; AC3DecodeState *s = avctx->priv_data;
UINT8 *buf_ptr;
uint8_t *buf_ptr;
int flags, i, len; int flags, i, len;
int sample_rate, bit_rate; int sample_rate, bit_rate;
short *out_samples = data; short *out_samples = data;
@@ -221,7 +221,7 @@ static int a52_decode_frame(AVCodecContext *avctx,
} }
s->inbuf_ptr = s->inbuf; s->inbuf_ptr = s->inbuf;
s->frame_size = 0; s->frame_size = 0;
*data_size = 6 * avctx->channels * 256 * sizeof(INT16);
*data_size = 6 * avctx->channels * 256 * sizeof(int16_t);
break; break;
} }
} }


+ 12
- 12
libavcodec/ac3.h View File

@@ -38,19 +38,19 @@ typedef struct AC3BitAllocParameters {
int cplfleak, cplsleak; int cplfleak, cplsleak;
} AC3BitAllocParameters; } AC3BitAllocParameters;


extern const UINT16 ac3_freqs[3];
extern const UINT16 ac3_bitratetab[19];
extern const INT16 ac3_window[256];
extern const UINT8 sdecaytab[4];
extern const UINT8 fdecaytab[4];
extern const UINT16 sgaintab[4];
extern const UINT16 dbkneetab[4];
extern const UINT16 floortab[8];
extern const UINT16 fgaintab[8];
extern const uint16_t ac3_freqs[3];
extern const uint16_t ac3_bitratetab[19];
extern const int16_t ac3_window[256];
extern const uint8_t sdecaytab[4];
extern const uint8_t fdecaytab[4];
extern const uint16_t sgaintab[4];
extern const uint16_t dbkneetab[4];
extern const uint16_t floortab[8];
extern const uint16_t fgaintab[8];


void ac3_common_init(void); void ac3_common_init(void);
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, UINT8 *bap,
INT8 *exp, int start, int end,
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
int8_t *exp, int start, int end,
int snroffset, int fgain, int is_lfe, int snroffset, int fgain, int is_lfe,
int deltbae,int deltnseg, int deltbae,int deltnseg,
UINT8 *deltoffst, UINT8 *deltlen, UINT8 *deltba);
uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba);

+ 6
- 6
libavcodec/ac3dec.c View File

@@ -22,8 +22,8 @@
/* currently, I use libac3 which is Copyright (C) Aaron Holtzman and /* currently, I use libac3 which is Copyright (C) Aaron Holtzman and
released under the GPL license. I may reimplement it someday... */ released under the GPL license. I may reimplement it someday... */
typedef struct AC3DecodeState { typedef struct AC3DecodeState {
UINT8 inbuf[4096]; /* input buffer */
UINT8 *inbuf_ptr;
uint8_t inbuf[4096]; /* input buffer */
uint8_t *inbuf_ptr;
int frame_size; int frame_size;
int flags; int flags;
int channels; int channels;
@@ -53,7 +53,7 @@ static inline int blah (int32_t i)
return i - 0x43c00000; return i - 0x43c00000;
} }


static inline void float_to_int (float * _f, INT16 * s16, int nchannels)
static inline void float_to_int (float * _f, int16_t * s16, int nchannels)
{ {
int i, j, c; int i, j, c;
int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format
@@ -72,10 +72,10 @@ static inline void float_to_int (float * _f, INT16 * s16, int nchannels)


static int ac3_decode_frame(AVCodecContext *avctx, static int ac3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
AC3DecodeState *s = avctx->priv_data; AC3DecodeState *s = avctx->priv_data;
UINT8 *buf_ptr;
uint8_t *buf_ptr;
int flags, i, len; int flags, i, len;
int sample_rate, bit_rate; int sample_rate, bit_rate;
short *out_samples = data; short *out_samples = data;
@@ -151,7 +151,7 @@ static int ac3_decode_frame(AVCodecContext *avctx,
} }
s->inbuf_ptr = s->inbuf; s->inbuf_ptr = s->inbuf;
s->frame_size = 0; s->frame_size = 0;
*data_size = 6 * avctx->channels * 256 * sizeof(INT16);
*data_size = 6 * avctx->channels * 256 * sizeof(int16_t);
break; break;
} }
} }


+ 51
- 51
libavcodec/ac3enc.c View File

@@ -63,7 +63,7 @@ typedef struct AC3EncodeContext {
static void fft_init(int ln); static void fft_init(int ln);
static void ac3_crc_init(void); static void ac3_crc_init(void);


static inline INT16 fix15(float a)
static inline int16_t fix15(float a)
{ {
int v; int v;
v = (int)(a * (float)(1 << 15)); v = (int)(a * (float)(1 << 15));
@@ -110,18 +110,18 @@ static inline int calc_lowcomp(int a, int b0, int b1, int bin)


/* AC3 bit allocation. The algorithm is the one described in the AC3 /* AC3 bit allocation. The algorithm is the one described in the AC3
spec. */ spec. */
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, UINT8 *bap,
INT8 *exp, int start, int end,
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
int8_t *exp, int start, int end,
int snroffset, int fgain, int is_lfe, int snroffset, int fgain, int is_lfe,
int deltbae,int deltnseg, int deltbae,int deltnseg,
UINT8 *deltoffst, UINT8 *deltlen, UINT8 *deltba)
uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba)
{ {
int bin,i,j,k,end1,v,v1,bndstrt,bndend,lowcomp,begin; int bin,i,j,k,end1,v,v1,bndstrt,bndend,lowcomp,begin;
int fastleak,slowleak,address,tmp; int fastleak,slowleak,address,tmp;
INT16 psd[256]; /* scaled exponents */
INT16 bndpsd[50]; /* interpolated exponents */
INT16 excite[50]; /* excitation */
INT16 mask[50]; /* masking value */
int16_t psd[256]; /* scaled exponents */
int16_t bndpsd[50]; /* interpolated exponents */
int16_t excite[50]; /* excitation */
int16_t mask[50]; /* masking value */


/* exponent mapping to PSD */ /* exponent mapping to PSD */
for(bin=start;bin<end;bin++) { for(bin=start;bin<end;bin++) {
@@ -404,10 +404,10 @@ static void fft(IComplex *z, int ln)
} }


/* do a 512 point mdct */ /* do a 512 point mdct */
static void mdct512(INT32 *out, INT16 *in)
static void mdct512(int32_t *out, int16_t *in)
{ {
int i, re, im, re1, im1; int i, re, im, re1, im1;
INT16 rot[N];
int16_t rot[N];
IComplex x[N/4]; IComplex x[N/4];


/* shift to simplify computations */ /* shift to simplify computations */
@@ -436,7 +436,7 @@ static void mdct512(INT32 *out, INT16 *in)
} }


/* XXX: use another norm ? */ /* XXX: use another norm ? */
static int calc_exp_diff(UINT8 *exp1, UINT8 *exp2, int n)
static int calc_exp_diff(uint8_t *exp1, uint8_t *exp2, int n)
{ {
int sum, i; int sum, i;
sum = 0; sum = 0;
@@ -446,8 +446,8 @@ static int calc_exp_diff(UINT8 *exp1, UINT8 *exp2, int n)
return sum; return sum;
} }


static void compute_exp_strategy(UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
UINT8 exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
int ch, int is_lfe) int ch, int is_lfe)
{ {
int i, j; int i, j;
@@ -493,7 +493,7 @@ static void compute_exp_strategy(UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS]
} }


/* set exp[i] to min(exp[i], exp1[i]) */ /* set exp[i] to min(exp[i], exp1[i]) */
static void exponent_min(UINT8 exp[N/2], UINT8 exp1[N/2], int n)
static void exponent_min(uint8_t exp[N/2], uint8_t exp1[N/2], int n)
{ {
int i; int i;


@@ -505,13 +505,13 @@ static void exponent_min(UINT8 exp[N/2], UINT8 exp1[N/2], int n)
/* update the exponents so that they are the ones the decoder will /* update the exponents so that they are the ones the decoder will
decode. Return the number of bits used to code the exponents */ decode. Return the number of bits used to code the exponents */
static int encode_exp(UINT8 encoded_exp[N/2],
UINT8 exp[N/2],
static int encode_exp(uint8_t encoded_exp[N/2],
uint8_t exp[N/2],
int nb_exps, int nb_exps,
int exp_strategy) int exp_strategy)
{ {
int group_size, nb_groups, i, j, k, recurse, exp_min, delta; int group_size, nb_groups, i, j, k, recurse, exp_min, delta;
UINT8 exp1[N/2];
uint8_t exp1[N/2];


switch(exp_strategy) { switch(exp_strategy) {
case EXP_D15: case EXP_D15:
@@ -586,7 +586,7 @@ static int encode_exp(UINT8 encoded_exp[N/2],
} }


/* return the size in bits taken by the mantissa */ /* return the size in bits taken by the mantissa */
static int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs)
static int compute_mantissa_size(AC3EncodeContext *s, uint8_t *m, int nb_coefs)
{ {
int bits, mant, i; int bits, mant, i;


@@ -637,9 +637,9 @@ static int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs)




static int bit_alloc(AC3EncodeContext *s, static int bit_alloc(AC3EncodeContext *s,
UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
int frame_bits, int csnroffst, int fsnroffst) int frame_bits, int csnroffst, int fsnroffst)
{ {
int i, ch; int i, ch;
@@ -651,7 +651,7 @@ static int bit_alloc(AC3EncodeContext *s,
s->mant4_cnt = 0; s->mant4_cnt = 0;
for(ch=0;ch<s->nb_all_channels;ch++) { for(ch=0;ch<s->nb_all_channels;ch++) {
ac3_parametric_bit_allocation(&s->bit_alloc, ac3_parametric_bit_allocation(&s->bit_alloc,
bap[i][ch], (INT8 *)encoded_exp[i][ch],
bap[i][ch], (int8_t *)encoded_exp[i][ch],
0, s->nb_coefs[ch], 0, s->nb_coefs[ch],
(((csnroffst-15) << 4) + (((csnroffst-15) << 4) +
fsnroffst) << 2, fsnroffst) << 2,
@@ -673,14 +673,14 @@ static int bit_alloc(AC3EncodeContext *s,
#define SNR_INC1 4 #define SNR_INC1 4


static int compute_bit_allocation(AC3EncodeContext *s, static int compute_bit_allocation(AC3EncodeContext *s,
UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
int frame_bits) int frame_bits)
{ {
int i, ch; int i, ch;
int csnroffst, fsnroffst; int csnroffst, fsnroffst;
UINT8 bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };


/* init default parameters */ /* init default parameters */
@@ -816,7 +816,7 @@ static int AC3_encode_init(AVCodecContext *avctx)
AC3EncodeContext *s = avctx->priv_data; AC3EncodeContext *s = avctx->priv_data;
int i, j, ch; int i, j, ch;
float alpha; float alpha;
static const UINT8 acmod_defs[6] = {
static const uint8_t acmod_defs[6] = {
0x01, /* C */ 0x01, /* C */
0x02, /* L R */ 0x02, /* L R */
0x03, /* L C R */ 0x03, /* L C R */
@@ -966,19 +966,19 @@ static inline int asym_quant(int c, int e, int qbits)
/* Output one audio block. There are NB_BLOCKS audio blocks in one AC3 /* Output one audio block. There are NB_BLOCKS audio blocks in one AC3
frame */ frame */
static void output_audio_block(AC3EncodeContext *s, static void output_audio_block(AC3EncodeContext *s,
UINT8 exp_strategy[AC3_MAX_CHANNELS],
UINT8 encoded_exp[AC3_MAX_CHANNELS][N/2],
UINT8 bap[AC3_MAX_CHANNELS][N/2],
INT32 mdct_coefs[AC3_MAX_CHANNELS][N/2],
INT8 global_exp[AC3_MAX_CHANNELS],
uint8_t exp_strategy[AC3_MAX_CHANNELS],
uint8_t encoded_exp[AC3_MAX_CHANNELS][N/2],
uint8_t bap[AC3_MAX_CHANNELS][N/2],
int32_t mdct_coefs[AC3_MAX_CHANNELS][N/2],
int8_t global_exp[AC3_MAX_CHANNELS],
int block_num) int block_num)
{ {
int ch, nb_groups, group_size, i, baie; int ch, nb_groups, group_size, i, baie;
UINT8 *p;
UINT16 qmant[AC3_MAX_CHANNELS][N/2];
uint8_t *p;
uint16_t qmant[AC3_MAX_CHANNELS][N/2];
int exp0, exp1; int exp0, exp1;
int mant1_cnt, mant2_cnt, mant4_cnt; int mant1_cnt, mant2_cnt, mant4_cnt;
UINT16 *qmant1_ptr, *qmant2_ptr, *qmant4_ptr;
uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr;
int delta0, delta1, delta2; int delta0, delta1, delta2;


for(ch=0;ch<s->nb_channels;ch++) for(ch=0;ch<s->nb_channels;ch++)
@@ -1244,7 +1244,7 @@ static void ac3_crc_init(void)
} }
} }


static unsigned int ac3_crc(UINT8 *data, int n, unsigned int crc)
static unsigned int ac3_crc(uint8_t *data, int n, unsigned int crc)
{ {
int i; int i;
for(i=0;i<n;i++) { for(i=0;i<n;i++) {
@@ -1284,7 +1284,7 @@ static unsigned int pow_poly(unsigned int a, unsigned int n, unsigned int poly)




/* compute log2(max(abs(tab[]))) */ /* compute log2(max(abs(tab[]))) */
static int log2_tab(INT16 *tab, int n)
static int log2_tab(int16_t *tab, int n)
{ {
int i, v; int i, v;


@@ -1295,7 +1295,7 @@ static int log2_tab(INT16 *tab, int n)
return av_log2(v); return av_log2(v);
} }


static void lshift_tab(INT16 *tab, int n, int lshift)
static void lshift_tab(int16_t *tab, int n, int lshift)
{ {
int i; int i;


@@ -1315,7 +1315,7 @@ static void lshift_tab(INT16 *tab, int n, int lshift)
static int output_frame_end(AC3EncodeContext *s) static int output_frame_end(AC3EncodeContext *s)
{ {
int frame_size, frame_size_58, n, crc1, crc2, crc_inv; int frame_size, frame_size_58, n, crc1, crc2, crc_inv;
UINT8 *frame;
uint8_t *frame;


frame_size = s->frame_size; /* frame size in words */ frame_size = s->frame_size; /* frame size in words */
/* align to 8 bits */ /* align to 8 bits */
@@ -1350,24 +1350,24 @@ static int AC3_encode_frame(AVCodecContext *avctx,
AC3EncodeContext *s = avctx->priv_data; AC3EncodeContext *s = avctx->priv_data;
short *samples = data; short *samples = data;
int i, j, k, v, ch; int i, j, k, v, ch;
INT16 input_samples[N];
INT32 mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
UINT8 exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS];
UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
INT8 exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS];
int16_t input_samples[N];
int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS];
uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
int8_t exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS];
int frame_bits; int frame_bits;


frame_bits = 0; frame_bits = 0;
for(ch=0;ch<s->nb_all_channels;ch++) { for(ch=0;ch<s->nb_all_channels;ch++) {
/* fixed mdct to the six sub blocks & exponent computation */ /* fixed mdct to the six sub blocks & exponent computation */
for(i=0;i<NB_BLOCKS;i++) { for(i=0;i<NB_BLOCKS;i++) {
INT16 *sptr;
int16_t *sptr;
int sinc; int sinc;


/* compute input samples */ /* compute input samples */
memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(INT16));
memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(int16_t));
sinc = s->nb_all_channels; sinc = s->nb_all_channels;
sptr = samples + (sinc * (N/2) * i) + ch; sptr = samples + (sinc * (N/2) * i) + ch;
for(j=0;j<N/2;j++) { for(j=0;j<N/2;j++) {
@@ -1432,7 +1432,7 @@ static int AC3_encode_frame(AVCodecContext *avctx,
/* copy encoded exponents for reuse case */ /* copy encoded exponents for reuse case */
for(k=i+1;k<j;k++) { for(k=i+1;k<j;k++) {
memcpy(encoded_exp[k][ch], encoded_exp[i][ch], memcpy(encoded_exp[k][ch], encoded_exp[i][ch],
s->nb_coefs[ch] * sizeof(UINT8));
s->nb_coefs[ch] * sizeof(uint8_t));
} }
i = j; i = j;
} }
@@ -1492,8 +1492,8 @@ void fft_test(void)


void mdct_test(void) void mdct_test(void)
{ {
INT16 input[N];
INT32 output[N/2];
int16_t input[N];
int32_t output[N/2];
float input1[N]; float input1[N];
float output1[N/2]; float output1[N/2];
float s, a, err, e, emax; float s, a, err, e, emax;


+ 21
- 21
libavcodec/ac3tab.h View File

@@ -1,10 +1,10 @@
/* tables taken directly from AC3 spec */ /* tables taken directly from AC3 spec */


/* possible frequencies */ /* possible frequencies */
const UINT16 ac3_freqs[3] = { 48000, 44100, 32000 };
const uint16_t ac3_freqs[3] = { 48000, 44100, 32000 };


/* possible bitrates */ /* possible bitrates */
const UINT16 ac3_bitratetab[19] = {
const uint16_t ac3_bitratetab[19] = {
32, 40, 48, 56, 64, 80, 96, 112, 128, 32, 40, 48, 56, 64, 80, 96, 112, 128,
160, 192, 224, 256, 320, 384, 448, 512, 576, 640 160, 192, 224, 256, 320, 384, 448, 512, 576, 640
}; };
@@ -12,7 +12,7 @@ const UINT16 ac3_bitratetab[19] = {
/* AC3 MDCT window */ /* AC3 MDCT window */


/* MDCT window */ /* MDCT window */
const INT16 ac3_window[256] = {
const int16_t ac3_window[256] = {
4, 7, 12, 16, 21, 28, 34, 42, 4, 7, 12, 16, 21, 28, 34, 42,
51, 61, 72, 84, 97, 111, 127, 145, 51, 61, 72, 84, 97, 111, 127, 145,
164, 184, 207, 231, 257, 285, 315, 347, 164, 184, 207, 231, 257, 285, 315, 347,
@@ -47,9 +47,9 @@ const INT16 ac3_window[256] = {
32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,
}; };


static UINT8 masktab[253];
static uint8_t masktab[253];


static const UINT8 latab[260]= {
static const uint8_t latab[260]= {
0x0040,0x003f,0x003e,0x003d,0x003c,0x003b,0x003a,0x0039,0x0038,0x0037, 0x0040,0x003f,0x003e,0x003d,0x003c,0x003b,0x003a,0x0039,0x0038,0x0037,
0x0036,0x0035,0x0034,0x0034,0x0033,0x0032,0x0031,0x0030,0x002f,0x002f, 0x0036,0x0035,0x0034,0x0034,0x0033,0x0032,0x0031,0x0030,0x002f,0x002f,
0x002e,0x002d,0x002c,0x002c,0x002b,0x002a,0x0029,0x0029,0x0028,0x0027, 0x002e,0x002d,0x002c,0x002c,0x002b,0x002a,0x0029,0x0029,0x0028,0x0027,
@@ -78,7 +78,7 @@ static const UINT8 latab[260]= {
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
}; };


static const UINT16 hth[50][3]= {
static const uint16_t hth[50][3]= {
{ 0x04d0,0x04f0,0x0580 }, { 0x04d0,0x04f0,0x0580 },
{ 0x04d0,0x04f0,0x0580 }, { 0x04d0,0x04f0,0x0580 },
{ 0x0440,0x0460,0x04b0 }, { 0x0440,0x0460,0x04b0 },
@@ -131,7 +131,7 @@ static const UINT16 hth[50][3]= {
{ 0x0840,0x0840,0x04e0 }, { 0x0840,0x0840,0x04e0 },
}; };


static const UINT8 baptab[64]= {
static const uint8_t baptab[64]= {
0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
@@ -141,43 +141,43 @@ static const UINT8 baptab[64]= {
15, 15, 15, 15, 15, 15, 15, 15,
}; };


const UINT8 sdecaytab[4]={
const uint8_t sdecaytab[4]={
0x0f, 0x11, 0x13, 0x15, 0x0f, 0x11, 0x13, 0x15,
}; };


const UINT8 fdecaytab[4]={
const uint8_t fdecaytab[4]={
0x3f, 0x53, 0x67, 0x7b, 0x3f, 0x53, 0x67, 0x7b,
}; };


const UINT16 sgaintab[4]= {
const uint16_t sgaintab[4]= {
0x540, 0x4d8, 0x478, 0x410, 0x540, 0x4d8, 0x478, 0x410,
}; };


const UINT16 dbkneetab[4]= {
const uint16_t dbkneetab[4]= {
0x000, 0x700, 0x900, 0xb00, 0x000, 0x700, 0x900, 0xb00,
}; };


const UINT16 floortab[8]= {
const uint16_t floortab[8]= {
0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800, 0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800,
}; };


const UINT16 fgaintab[8]= {
const uint16_t fgaintab[8]= {
0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
}; };


static const UINT8 bndsz[50]={
static const uint8_t bndsz[50]={
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
}; };


static UINT8 bndtab[51];
static uint8_t bndtab[51];


/* fft & mdct sin cos tables */ /* fft & mdct sin cos tables */
static INT16 costab[64];
static INT16 sintab[64];
static INT16 fft_rev[512];
static INT16 xcos1[128];
static INT16 xsin1[128];
static int16_t costab[64];
static int16_t sintab[64];
static int16_t fft_rev[512];
static int16_t xcos1[128];
static int16_t xsin1[128];


static UINT16 crc_table[256];
static uint16_t crc_table[256];

+ 3
- 3
libavcodec/adpcm.c View File

@@ -329,14 +329,14 @@ static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)


static int adpcm_decode_frame(AVCodecContext *avctx, static int adpcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
ADPCMContext *c = avctx->priv_data; ADPCMContext *c = avctx->priv_data;
ADPCMChannelStatus *cs; ADPCMChannelStatus *cs;
int n, m, channel; int n, m, channel;
int block_predictor[2]; int block_predictor[2];
short *samples; short *samples;
UINT8 *src;
uint8_t *src;
int st; /* stereo */ int st; /* stereo */


samples = data; samples = data;
@@ -500,7 +500,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
*data_size = 0; *data_size = 0;
return -1; return -1;
} }
*data_size = (UINT8 *)samples - (UINT8 *)data;
*data_size = (uint8_t *)samples - (uint8_t *)data;
return src - buf; return src - buf;
} }




+ 5
- 5
libavcodec/apiexample.c View File

@@ -28,7 +28,7 @@ void audio_encode_example(const char *filename)
FILE *f; FILE *f;
short *samples; short *samples;
float t, tincr; float t, tincr;
UINT8 *outbuf;
uint8_t *outbuf;


printf("Audio encoding\n"); printf("Audio encoding\n");


@@ -94,8 +94,8 @@ void audio_decode_example(const char *outfilename, const char *filename)
AVCodecContext *c= NULL; AVCodecContext *c= NULL;
int out_size, size, len; int out_size, size, len;
FILE *f, *outfile; FILE *f, *outfile;
UINT8 *outbuf;
UINT8 inbuf[INBUF_SIZE], *inbuf_ptr;
uint8_t *outbuf;
uint8_t inbuf[INBUF_SIZE], *inbuf_ptr;


printf("Audio decoding\n"); printf("Audio decoding\n");


@@ -169,7 +169,7 @@ void video_encode_example(const char *filename)
int i, out_size, size, x, y, outbuf_size; int i, out_size, size, x, y, outbuf_size;
FILE *f; FILE *f;
AVFrame *picture; AVFrame *picture;
UINT8 *outbuf, *picture_buf;
uint8_t *outbuf, *picture_buf;


printf("Video encoding\n"); printf("Video encoding\n");


@@ -283,7 +283,7 @@ void video_decode_example(const char *outfilename, const char *filename)
int frame, size, got_picture, len; int frame, size, got_picture, len;
FILE *f; FILE *f;
AVFrame *picture; AVFrame *picture;
UINT8 inbuf[INBUF_SIZE], *inbuf_ptr;
uint8_t inbuf[INBUF_SIZE], *inbuf_ptr;
char buf[1024]; char buf[1024];


printf("Video decoding\n"); printf("Video decoding\n");


+ 4
- 4
libavcodec/armv4l/mpegvideo_arm.c View File

@@ -23,17 +23,17 @@


extern void j_rev_dct_ARM(DCTELEM *data); extern void j_rev_dct_ARM(DCTELEM *data);
/* XXX: local hack */ /* XXX: local hack */
static void (*ff_put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);


/* XXX: those functions should be suppressed ASAP when all IDCTs are /* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */ converted */
static void arm_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
static void arm_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
j_rev_dct_ARM (block); j_rev_dct_ARM (block);
ff_put_pixels_clamped(block, dest, line_size); ff_put_pixels_clamped(block, dest, line_size);
} }
static void arm_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
static void arm_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
j_rev_dct_ARM (block); j_rev_dct_ARM (block);
ff_add_pixels_clamped(block, dest, line_size); ff_add_pixels_clamped(block, dest, line_size);


+ 12
- 12
libavcodec/avcodec.h View File

@@ -393,7 +393,7 @@ typedef struct AVCodecContext {
* decoding: set by user. * decoding: set by user.
*/ */
void (*draw_horiz_band)(struct AVCodecContext *s, void (*draw_horiz_band)(struct AVCodecContext *s,
UINT8 **src_ptr, int linesize,
uint8_t **src_ptr, int linesize,
int y, int width, int height); int y, int width, int height);


/* audio only */ /* audio only */
@@ -992,10 +992,10 @@ typedef struct AVCodec {
int id; int id;
int priv_data_size; int priv_data_size;
int (*init)(AVCodecContext *); int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data);
int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
int (*close)(AVCodecContext *); int (*close)(AVCodecContext *);
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
UINT8 *buf, int buf_size);
uint8_t *buf, int buf_size);
int capabilities; int capabilities;
const AVOption *options; const AVOption *options;
struct AVCodec *next; struct AVCodec *next;
@@ -1006,7 +1006,7 @@ typedef struct AVCodec {
* the last component is alpha * the last component is alpha
*/ */
typedef struct AVPicture { typedef struct AVPicture {
UINT8 *data[4];
uint8_t *data[4];
int linesize[4]; int linesize[4];
} AVPicture; } AVPicture;


@@ -1110,7 +1110,7 @@ void img_resample(ImgReSampleContext *s,


void img_resample_close(ImgReSampleContext *s); void img_resample_close(ImgReSampleContext *s);


int avpicture_fill(AVPicture *picture, UINT8 *ptr,
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
int pix_fmt, int width, int height); int pix_fmt, int width, int height);
int avpicture_get_size(int pix_fmt, int width, int height); int avpicture_get_size(int pix_fmt, int width, int height);
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
@@ -1152,18 +1152,18 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);


int avcodec_open(AVCodecContext *avctx, AVCodec *codec); int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr, int *frame_size_ptr,
UINT8 *buf, int buf_size);
uint8_t *buf, int buf_size);
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr, int *got_picture_ptr,
UINT8 *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, UINT8 **pdata,
uint8_t *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
int *data_size_ptr, int *data_size_ptr,
UINT8 *buf, int buf_size);
int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
uint8_t *buf, int buf_size);
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const short *samples); const short *samples);
int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVFrame *pict); const AVFrame *pict);


int avcodec_close(AVCodecContext *avctx); int avcodec_close(AVCodecContext *avctx);


+ 12
- 12
libavcodec/common.c View File

@@ -20,7 +20,7 @@
*/ */
#include "avcodec.h" #include "avcodec.h"


const UINT8 ff_sqrt_tab[128]={
const uint8_t ff_sqrt_tab[128]={
0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
@@ -39,9 +39,9 @@ const uint8_t ff_log2_tab[256]={
}; };


void init_put_bits(PutBitContext *s, void init_put_bits(PutBitContext *s,
UINT8 *buffer, int buffer_size,
uint8_t *buffer, int buffer_size,
void *opaque, void *opaque,
void (*write_data)(void *, UINT8 *, int))
void (*write_data)(void *, uint8_t *, int))
{ {
s->buf = buffer; s->buf = buffer;
s->buf_end = s->buf + buffer_size; s->buf_end = s->buf + buffer_size;
@@ -62,12 +62,12 @@ void init_put_bits(PutBitContext *s,
} }


/* return the number of bits output */ /* return the number of bits output */
INT64 get_bit_count(PutBitContext *s)
int64_t get_bit_count(PutBitContext *s)
{ {
#ifdef ALT_BITSTREAM_WRITER #ifdef ALT_BITSTREAM_WRITER
return s->data_out_size * 8 + s->index; return s->data_out_size * 8 + s->index;
#else #else
return (s->buf_ptr - s->buf + s->data_out_size) * 8 + 32 - (INT64)s->bit_left;
return (s->buf_ptr - s->buf + s->data_out_size) * 8 + 32 - (int64_t)s->bit_left;
#endif #endif
} }


@@ -110,7 +110,7 @@ void put_string(PutBitContext * pbc, char *s)
/* bit input functions */ /* bit input functions */


void init_get_bits(GetBitContext *s, void init_get_bits(GetBitContext *s,
UINT8 *buffer, int bit_size)
uint8_t *buffer, int bit_size)
{ {
const int buffer_size= (bit_size+7)>>3; const int buffer_size= (bit_size+7)>>3;


@@ -160,16 +160,16 @@ int check_marker(GetBitContext *s, const char *msg)


#define GET_DATA(v, table, i, wrap, size) \ #define GET_DATA(v, table, i, wrap, size) \
{\ {\
const UINT8 *ptr = (const UINT8 *)table + i * wrap;\
const uint8_t *ptr = (const uint8_t *)table + i * wrap;\
switch(size) {\ switch(size) {\
case 1:\ case 1:\
v = *(const UINT8 *)ptr;\
v = *(const uint8_t *)ptr;\
break;\ break;\
case 2:\ case 2:\
v = *(const UINT16 *)ptr;\
v = *(const uint16_t *)ptr;\
break;\ break;\
default:\ default:\
v = *(const UINT32 *)ptr;\
v = *(const uint32_t *)ptr;\
break;\ break;\
}\ }\
} }
@@ -194,10 +194,10 @@ static int build_table(VLC *vlc, int table_nb_bits,
int nb_codes, int nb_codes,
const void *bits, int bits_wrap, int bits_size, const void *bits, int bits_wrap, int bits_size,
const void *codes, int codes_wrap, int codes_size, const void *codes, int codes_wrap, int codes_size,
UINT32 code_prefix, int n_prefix)
uint32_t code_prefix, int n_prefix)
{ {
int i, j, k, n, table_size, table_index, nb, n1, index; int i, j, k, n, table_size, table_index, nb, n1, index;
UINT32 code;
uint32_t code;
VLC_TYPE (*table)[2]; VLC_TYPE (*table)[2];


table_size = 1 << table_nb_bits; table_size = 1 << table_nb_bits;


+ 36
- 67
libavcodec/common.h View File

@@ -72,33 +72,24 @@


/* windows */ /* windows */


typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned __int64 UINT64;
typedef signed char INT8;
typedef signed int INT32;
typedef signed __int64 INT64;

typedef UINT8 uint8_t;
typedef INT8 int8_t;
typedef UINT16 uint16_t;
typedef INT16 int16_t;
typedef UINT32 uint32_t;
typedef INT32 int32_t;
typedef UINT64 uint64_t;
typedef INT64 int64_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
typedef signed char int8_t;
typedef signed int int32_t;
typedef signed __int64 int64_t;


# ifndef __MINGW32__ # ifndef __MINGW32__
# define INT64_C(c) (c ## i64)
# define UINT64_C(c) (c ## i64)
# define int64_t_C(c) (c ## i64)
# define uint64_t_C(c) (c ## i64)


# define inline __inline # define inline __inline


# else # else
# define INT64_C(c) (c ## LL)
# define UINT64_C(c) (c ## ULL)
# define int64_t_C(c) (c ## LL)
# define uint64_t_C(c) (c ## ULL)
# endif /* __MINGW32__ */ # endif /* __MINGW32__ */


# ifdef _DEBUG # ifdef _DEBUG
@@ -114,20 +105,11 @@ typedef INT64 int64_t;


#include <inttypes.h> #include <inttypes.h>


typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef signed long long INT64;

#ifdef HAVE_AV_CONFIG_H #ifdef HAVE_AV_CONFIG_H


#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#ifndef int64_t_C
#define int64_t_C(c) (c ## LL)
#define uint64_t_C(c) (c ## ULL)
#endif #endif


#ifdef USE_FASTMEMCPY #ifdef USE_FASTMEMCPY
@@ -145,23 +127,10 @@ typedef signed long long INT64;


# include <inttypes.h> # include <inttypes.h>


# ifndef __WINE_WINDEF16_H
/* workaround for typedef conflict in MPlayer (wine typedefs) */
typedef unsigned short UINT16;
typedef signed short INT16;
# endif

typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef signed char INT8;
typedef signed int INT32;
typedef signed long long INT64;

# ifdef HAVE_AV_CONFIG_H # ifdef HAVE_AV_CONFIG_H
# ifndef INT64_C
# define INT64_C(c) (c ## LL)
# define UINT64_C(c) (c ## ULL)
# ifndef int64_t_C
# define int64_t_C(c) (c ## LL)
# define uint64_t_C(c) (c ## ULL)
# endif # endif


# ifdef USE_FASTMEMCPY # ifdef USE_FASTMEMCPY
@@ -240,26 +209,26 @@ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){


struct PutBitContext; struct PutBitContext;


typedef void (*WriteDataFunc)(void *, UINT8 *, int);
typedef void (*WriteDataFunc)(void *, uint8_t *, int);


typedef struct PutBitContext { typedef struct PutBitContext {
#ifdef ALT_BITSTREAM_WRITER #ifdef ALT_BITSTREAM_WRITER
UINT8 *buf, *buf_end;
uint8_t *buf, *buf_end;
int index; int index;
#else #else
UINT32 bit_buf;
uint32_t bit_buf;
int bit_left; int bit_left;
UINT8 *buf, *buf_ptr, *buf_end;
uint8_t *buf, *buf_ptr, *buf_end;
#endif #endif
INT64 data_out_size; /* in bytes */
int64_t data_out_size; /* in bytes */
} PutBitContext; } PutBitContext;


void init_put_bits(PutBitContext *s, void init_put_bits(PutBitContext *s,
UINT8 *buffer, int buffer_size,
uint8_t *buffer, int buffer_size,
void *opaque, void *opaque,
void (*write_data)(void *, UINT8 *, int));
void (*write_data)(void *, uint8_t *, int));


INT64 get_bit_count(PutBitContext *s); /* XXX: change function name */
int64_t get_bit_count(PutBitContext *s); /* XXX: change function name */
void align_put_bits(PutBitContext *s); void align_put_bits(PutBitContext *s);
void flush_put_bits(PutBitContext *s); void flush_put_bits(PutBitContext *s);
void put_string(PutBitContext * pbc, char *s); void put_string(PutBitContext * pbc, char *s);
@@ -267,17 +236,17 @@ void put_string(PutBitContext * pbc, char *s);
/* bit input */ /* bit input */


typedef struct GetBitContext { typedef struct GetBitContext {
UINT8 *buffer, *buffer_end;
uint8_t *buffer, *buffer_end;
#ifdef ALT_BITSTREAM_READER #ifdef ALT_BITSTREAM_READER
int index; int index;
#elif defined LIBMPEG2_BITSTREAM_READER #elif defined LIBMPEG2_BITSTREAM_READER
UINT8 *buffer_ptr;
UINT32 cache;
uint8_t *buffer_ptr;
uint32_t cache;
int bit_count; int bit_count;
#elif defined A32_BITSTREAM_READER #elif defined A32_BITSTREAM_READER
UINT32 *buffer_ptr;
UINT32 cache0;
UINT32 cache1;
uint32_t *buffer_ptr;
uint32_t cache0;
uint32_t cache1;
int bit_count; int bit_count;
#endif #endif
int size_in_bits; int size_in_bits;
@@ -285,7 +254,7 @@ typedef struct GetBitContext {


static inline int get_bits_count(GetBitContext *s); static inline int get_bits_count(GetBitContext *s);


#define VLC_TYPE INT16
#define VLC_TYPE int16_t


typedef struct VLC { typedef struct VLC {
int bits; int bits;
@@ -305,7 +274,7 @@ typedef struct RL_VLC_ELEM {


/* used to avoid missaligned exceptions on some archs (alpha, ...) */ /* used to avoid missaligned exceptions on some archs (alpha, ...) */
#ifdef ARCH_X86 #ifdef ARCH_X86
# define unaligned32(a) (*(UINT32*)(a))
# define unaligned32(a) (*(uint32_t*)(a))
#else #else
# ifdef __GNUC__ # ifdef __GNUC__
static inline uint32_t unaligned32(const void *v) { static inline uint32_t unaligned32(const void *v) {
@@ -357,7 +326,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
s->buf_ptr[3] = bit_buf ; s->buf_ptr[3] = bit_buf ;
} else } else
#endif #endif
*(UINT32 *)s->buf_ptr = be2me_32(bit_buf);
*(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
//printf("bitbuf = %08x\n", bit_buf); //printf("bitbuf = %08x\n", bit_buf);
s->buf_ptr+=4; s->buf_ptr+=4;
bit_left+=32 - n; bit_left+=32 - n;
@@ -700,7 +669,7 @@ static inline void skip_bits1(GetBitContext *s){
} }


void init_get_bits(GetBitContext *s, void init_get_bits(GetBitContext *s,
UINT8 *buffer, int buffer_size);
uint8_t *buffer, int buffer_size);


int check_marker(GetBitContext *s, const char *msg); int check_marker(GetBitContext *s, const char *msg);
void align_get_bits(GetBitContext *s); void align_get_bits(GetBitContext *s);


+ 1
- 1
libavcodec/cyuv.c View File

@@ -56,7 +56,7 @@ static int cyuv_decode_init(AVCodecContext *avctx)


static int cyuv_decode_frame(AVCodecContext *avctx, static int cyuv_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
CyuvDecodeContext *s=avctx->priv_data; CyuvDecodeContext *s=avctx->priv_data;




+ 9
- 9
libavcodec/dct-test.c View File

@@ -40,13 +40,13 @@ static const unsigned short aanscales[64] = {
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
}; };


UINT8 cropTbl[256 + 2 * MAX_NEG_CROP];
uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];


INT64 gettime(void)
int64_t gettime(void)
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
return (INT64)tv.tv_sec * 1000000 + tv.tv_usec;
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
} }


#define NB_ITS 20000 #define NB_ITS 20000
@@ -86,8 +86,8 @@ void dct_error(const char *name, int is_idct,
{ {
int it, i, scale; int it, i, scale;
int err_inf, v; int err_inf, v;
INT64 err2, ti, ti1, it1;
INT64 sysErr[64], sysErrMax=0;
int64_t err2, ti, ti1, it1;
int64_t sysErr[64], sysErrMax=0;
int maxout=0; int maxout=0;
int blockSumErrMax=0, blockSumErr; int blockSumErrMax=0, blockSumErr;


@@ -261,10 +261,10 @@ void dct_error(const char *name, int is_idct,
#endif #endif
} }


static UINT8 img_dest[64] __attribute__ ((aligned (8)));
static UINT8 img_dest1[64] __attribute__ ((aligned (8)));
static uint8_t img_dest[64] __attribute__ ((aligned (8)));
static uint8_t img_dest1[64] __attribute__ ((aligned (8)));


void idct248_ref(UINT8 *dest, int linesize, INT16 *block)
void idct248_ref(uint8_t *dest, int linesize, int16_t *block)
{ {
static int init; static int init;
static double c8[8][8]; static double c8[8][8];
@@ -345,7 +345,7 @@ void idct248_ref(UINT8 *dest, int linesize, INT16 *block)
} }


void idct248_error(const char *name, void idct248_error(const char *name,
void (*idct248_put)(UINT8 *dest, int line_size, INT16 *block))
void (*idct248_put)(uint8_t *dest, int line_size, int16_t *block))
{ {
int it, i, it1, ti, ti1, err_max, v; int it, i, it1, ti, ti1, err_max, v;




+ 194
- 194
libavcodec/dsputil.c View File

@@ -24,10 +24,10 @@


int ff_bit_exact=0; int ff_bit_exact=0;


UINT8 cropTbl[256 + 2 * MAX_NEG_CROP];
UINT32 squareTbl[512];
uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
uint32_t squareTbl[512];


const UINT8 ff_zigzag_direct[64] = {
const uint8_t ff_zigzag_direct[64] = {
0, 1, 8, 16, 9, 2, 3, 10, 0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 12, 19, 26, 33, 40, 48, 41, 34,
@@ -39,9 +39,9 @@ const UINT8 ff_zigzag_direct[64] = {
}; };


/* not permutated inverse zigzag_direct + 1 for MMX quantizer */ /* not permutated inverse zigzag_direct + 1 for MMX quantizer */
UINT16 __align8 inv_zigzag_direct16[64];
uint16_t __align8 inv_zigzag_direct16[64];


const UINT8 ff_alternate_horizontal_scan[64] = {
const uint8_t ff_alternate_horizontal_scan[64] = {
0, 1, 2, 3, 8, 9, 16, 17, 0, 1, 2, 3, 8, 9, 16, 17,
10, 11, 4, 5, 6, 7, 15, 14, 10, 11, 4, 5, 6, 7, 15, 14,
13, 12, 19, 18, 24, 25, 32, 33, 13, 12, 19, 18, 24, 25, 32, 33,
@@ -52,7 +52,7 @@ const UINT8 ff_alternate_horizontal_scan[64] = {
52, 53, 54, 55, 60, 61, 62, 63, 52, 53, 54, 55, 60, 61, 62, 63,
}; };


const UINT8 ff_alternate_vertical_scan[64] = {
const uint8_t ff_alternate_vertical_scan[64] = {
0, 8, 16, 24, 1, 9, 2, 10, 0, 8, 16, 24, 1, 9, 2, 10,
17, 25, 32, 40, 48, 56, 57, 49, 17, 25, 32, 40, 48, 56, 57, 49,
41, 33, 26, 18, 3, 11, 4, 12, 41, 33, 26, 18, 3, 11, 4, 12,
@@ -64,7 +64,7 @@ const UINT8 ff_alternate_vertical_scan[64] = {
}; };


/* a*inverse[b]>>32 == a/b for all 0<=a<=65536 && 2<=b<=255 */ /* a*inverse[b]>>32 == a/b for all 0<=a<=65536 && 2<=b<=255 */
const UINT32 inverse[256]={
const uint32_t inverse[256]={
0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757, 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757,
536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154, 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154,
268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709, 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709,
@@ -99,7 +99,7 @@ const UINT32 inverse[256]={
17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010, 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010,
}; };


static int pix_sum_c(UINT8 * pix, int line_size)
static int pix_sum_c(uint8_t * pix, int line_size)
{ {
int s, i, j; int s, i, j;


@@ -121,10 +121,10 @@ static int pix_sum_c(UINT8 * pix, int line_size)
return s; return s;
} }


static int pix_norm1_c(UINT8 * pix, int line_size)
static int pix_norm1_c(uint8_t * pix, int line_size)
{ {
int s, i, j; int s, i, j;
UINT32 *sq = squareTbl + 256;
uint32_t *sq = squareTbl + 256;


s = 0; s = 0;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
@@ -170,10 +170,10 @@ static int pix_norm1_c(UINT8 * pix, int line_size)
} }




static int sse8_c(void *v, UINT8 * pix1, UINT8 * pix2, int line_size)
static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size)
{ {
int s, i; int s, i;
UINT32 *sq = squareTbl + 256;
uint32_t *sq = squareTbl + 256;


s = 0; s = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@@ -221,7 +221,7 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size)
return s; return s;
} }


static void get_pixels_c(DCTELEM *restrict block, const UINT8 *pixels, int line_size)
static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
{ {
int i; int i;


@@ -240,8 +240,8 @@ static void get_pixels_c(DCTELEM *restrict block, const UINT8 *pixels, int line_
} }
} }


static void diff_pixels_c(DCTELEM *restrict block, const UINT8 *s1,
const UINT8 *s2, int stride){
static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
const uint8_t *s2, int stride){
int i; int i;


/* read the pixels */ /* read the pixels */
@@ -261,11 +261,11 @@ static void diff_pixels_c(DCTELEM *restrict block, const UINT8 *s1,
} }




static void put_pixels_clamped_c(const DCTELEM *block, UINT8 *restrict pixels,
static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size) int line_size)
{ {
int i; int i;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
/* read the pixels */ /* read the pixels */
for(i=0;i<8;i++) { for(i=0;i<8;i++) {
@@ -283,11 +283,11 @@ static void put_pixels_clamped_c(const DCTELEM *block, UINT8 *restrict pixels,
} }
} }


static void add_pixels_clamped_c(const DCTELEM *block, UINT8 *restrict pixels,
static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size) int line_size)
{ {
int i; int i;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
/* read the pixels */ /* read the pixels */
for(i=0;i<8;i++) { for(i=0;i<8;i++) {
@@ -702,7 +702,7 @@ PIXOP2(put, op_put)
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2) #define avg4(a,b,c,d) ((a+b+c+d+2)>>2)




static void gmc1_c(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder)
static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
{ {
const int A=(16-x16)*(16-y16); const int A=(16-x16)*(16-y16);
const int B=( x16)*(16-y16); const int B=( x16)*(16-y16);
@@ -725,7 +725,7 @@ static void gmc1_c(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16,
} }
} }


static void gmc_c(UINT8 *dst, UINT8 *src, int stride, int h, int ox, int oy,
static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
{ {
int y, vx, vy; int y, vx, vy;
@@ -783,7 +783,7 @@ static void gmc_c(UINT8 *dst, UINT8 *src, int stride, int h, int ox, int oy,
} }
} }


static inline void copy_block17(UINT8 *dst, UINT8 *src, int dstStride, int srcStride, int h)
static inline void copy_block17(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
{ {
int i; int i;
for(i=0; i<h; i++) for(i=0; i<h; i++)
@@ -798,7 +798,7 @@ static inline void copy_block17(UINT8 *dst, UINT8 *src, int dstStride, int srcSt
} }
} }


static inline void copy_block9(UINT8 *dst, UINT8 *src, int dstStride, int srcStride, int h)
static inline void copy_block9(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
{ {
int i; int i;
for(i=0; i<h; i++) for(i=0; i<h; i++)
@@ -813,8 +813,8 @@ static inline void copy_block9(UINT8 *dst, UINT8 *src, int dstStride, int srcStr




#define QPEL_MC(r, OPNAME, RND, OP) \ #define QPEL_MC(r, OPNAME, RND, OP) \
static void OPNAME ## mpeg4_qpel8_h_lowpass(UINT8 *dst, UINT8 *src, int dstStride, int srcStride, int h){\
UINT8 *cm = cropTbl + MAX_NEG_CROP;\
static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\ int i;\
for(i=0; i<h; i++)\ for(i=0; i<h; i++)\
{\ {\
@@ -831,9 +831,9 @@ static void OPNAME ## mpeg4_qpel8_h_lowpass(UINT8 *dst, UINT8 *src, int dstStrid
}\ }\
}\ }\
\ \
static void OPNAME ## mpeg4_qpel8_v_lowpass(UINT8 *dst, UINT8 *src, int dstStride, int srcStride){\
static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
const int w=8;\ const int w=8;\
UINT8 *cm = cropTbl + MAX_NEG_CROP;\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\ int i;\
for(i=0; i<w; i++)\ for(i=0; i<w; i++)\
{\ {\
@@ -859,8 +859,8 @@ static void OPNAME ## mpeg4_qpel8_v_lowpass(UINT8 *dst, UINT8 *src, int dstStrid
}\ }\
}\ }\
\ \
static void OPNAME ## mpeg4_qpel16_h_lowpass(UINT8 *dst, UINT8 *src, int dstStride, int srcStride, int h){\
UINT8 *cm = cropTbl + MAX_NEG_CROP;\
static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\ int i;\
\ \
for(i=0; i<h; i++)\ for(i=0; i<h; i++)\
@@ -886,8 +886,8 @@ static void OPNAME ## mpeg4_qpel16_h_lowpass(UINT8 *dst, UINT8 *src, int dstStri
}\ }\
}\ }\
\ \
static void OPNAME ## mpeg4_qpel16_v_lowpass(UINT8 *dst, UINT8 *src, int dstStride, int srcStride){\
UINT8 *cm = cropTbl + MAX_NEG_CROP;\
static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\ int i;\
const int w=16;\ const int w=16;\
for(i=0; i<w; i++)\ for(i=0; i<w; i++)\
@@ -930,367 +930,367 @@ static void OPNAME ## mpeg4_qpel16_v_lowpass(UINT8 *dst, UINT8 *src, int dstStri
}\ }\
}\ }\
\ \
static void OPNAME ## qpel8_mc00_c (UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels8_c(dst, src, stride, 8);\ OPNAME ## pixels8_c(dst, src, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc10_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 half[64];\
static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[64];\
put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\ put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
OPNAME ## pixels8_l2(dst, src, half, stride, stride, 8, 8);\ OPNAME ## pixels8_l2(dst, src, half, stride, stride, 8, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc20_c(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);\ OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc30_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 half[64];\
static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[64];\
put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\ put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
OPNAME ## pixels8_l2(dst, src+1, half, stride, stride, 8, 8);\ OPNAME ## pixels8_l2(dst, src+1, half, stride, stride, 8, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc01_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 half[64];\
static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t half[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
OPNAME ## pixels8_l2(dst, full, half, stride, 16, 8, 8);\ OPNAME ## pixels8_l2(dst, full, half, stride, 16, 8, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc02_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel8_mc03_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 half[64];\
static void OPNAME ## qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t half[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
OPNAME ## pixels8_l2(dst, full+16, half, stride, 16, 8, 8);\ OPNAME ## pixels8_l2(dst, full+16, half, stride, 16, 8, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc11_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l4(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ OPNAME ## pixels8_l4(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc11_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc31_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l4(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ OPNAME ## pixels8_l4(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc31_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc13_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l4(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ OPNAME ## pixels8_l4(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc13_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc33_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full , 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full , 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l4(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ OPNAME ## pixels8_l4(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc33_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc21_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[72];\
uint8_t halfHV[64];\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc23_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[72];\
UINT8 halfHV[64];\
static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[72];\
uint8_t halfHV[64];\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc12_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc12_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
}\ }\
void ff_ ## OPNAME ## qpel8_mc32_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
UINT8 halfV[64];\
UINT8 halfHV[64];\
void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
uint8_t halfV[64];\
uint8_t halfHV[64];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\ OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc32_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[16*9];\
UINT8 halfH[72];\
static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[16*9];\
uint8_t halfH[72];\
copy_block9(full, src, 16, stride, 9);\ copy_block9(full, src, 16, stride, 9);\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
}\ }\
static void OPNAME ## qpel8_mc22_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[72];\
static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[72];\
put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
}\ }\
static void OPNAME ## qpel16_mc00_c (UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc00_c (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels16_c(dst, src, stride, 16);\ OPNAME ## pixels16_c(dst, src, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc10_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 half[256];\
static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[256];\
put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\ put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
OPNAME ## pixels16_l2(dst, src, half, stride, stride, 16, 16);\ OPNAME ## pixels16_l2(dst, src, half, stride, stride, 16, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc20_c(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);\ OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc30_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 half[256];\
static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[256];\
put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\ put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
OPNAME ## pixels16_l2(dst, src+1, half, stride, stride, 16, 16);\ OPNAME ## pixels16_l2(dst, src+1, half, stride, stride, 16, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc01_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 half[256];\
static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t half[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
OPNAME ## pixels16_l2(dst, full, half, stride, 24, 16, 16);\ OPNAME ## pixels16_l2(dst, full, half, stride, 24, 16, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc02_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);\ OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);\
}\ }\
\ \
static void OPNAME ## qpel16_mc03_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 half[256];\
static void OPNAME ## qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t half[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
OPNAME ## pixels16_l2(dst, full+24, half, stride, 24, 16, 16);\ OPNAME ## pixels16_l2(dst, full+24, half, stride, 24, 16, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc11_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l4(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ OPNAME ## pixels16_l4(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc11_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc31_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l4(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ OPNAME ## pixels16_l4(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc31_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc13_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l4(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ OPNAME ## pixels16_l4(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc13_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc33_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full , 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full , 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l4(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ OPNAME ## pixels16_l4(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc33_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc21_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[272];\
uint8_t halfHV[256];\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc23_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[272];\
UINT8 halfHV[256];\
static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[272];\
uint8_t halfHV[256];\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc12_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc12_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
}\ }\
void ff_ ## OPNAME ## qpel16_mc32_old_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
UINT8 halfV[256];\
UINT8 halfHV[256];\
void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
uint8_t halfV[256];\
uint8_t halfHV[256];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\ OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc32_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 full[24*17];\
UINT8 halfH[272];\
static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[24*17];\
uint8_t halfH[272];\
copy_block17(full, src, 24, stride, 17);\ copy_block17(full, src, 24, stride, 17);\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
}\ }\
static void OPNAME ## qpel16_mc22_c(UINT8 *dst, UINT8 *src, int stride){\
UINT8 halfH[272];\
static void OPNAME ## qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
uint8_t halfH[272];\
put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
} }
@@ -1405,7 +1405,7 @@ static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){
} }




static inline int pix_abs16x16_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static inline int pix_abs16x16_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;


@@ -1433,7 +1433,7 @@ static inline int pix_abs16x16_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs16x16_x2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs16x16_x2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;


@@ -1461,10 +1461,10 @@ static int pix_abs16x16_x2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs16x16_y2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs16x16_y2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;
UINT8 *pix3 = pix2 + line_size;
uint8_t *pix3 = pix2 + line_size;


s = 0; s = 0;
for(i=0;i<16;i++) { for(i=0;i<16;i++) {
@@ -1491,10 +1491,10 @@ static int pix_abs16x16_y2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs16x16_xy2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs16x16_xy2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;
UINT8 *pix3 = pix2 + line_size;
uint8_t *pix3 = pix2 + line_size;


s = 0; s = 0;
for(i=0;i<16;i++) { for(i=0;i<16;i++) {
@@ -1521,7 +1521,7 @@ static int pix_abs16x16_xy2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static inline int pix_abs8x8_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static inline int pix_abs8x8_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;


@@ -1541,7 +1541,7 @@ static inline int pix_abs8x8_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs8x8_x2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs8x8_x2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;


@@ -1561,10 +1561,10 @@ static int pix_abs8x8_x2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs8x8_y2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs8x8_y2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;
UINT8 *pix3 = pix2 + line_size;
uint8_t *pix3 = pix2 + line_size;


s = 0; s = 0;
for(i=0;i<8;i++) { for(i=0;i<8;i++) {
@@ -1583,10 +1583,10 @@ static int pix_abs8x8_y2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
return s; return s;
} }


static int pix_abs8x8_xy2_c(UINT8 *pix1, UINT8 *pix2, int line_size)
static int pix_abs8x8_xy2_c(uint8_t *pix1, uint8_t *pix2, int line_size)
{ {
int s, i; int s, i;
UINT8 *pix3 = pix2 + line_size;
uint8_t *pix3 = pix2 + line_size;


s = 0; s = 0;
for(i=0;i<8;i++) { for(i=0;i<8;i++) {
@@ -1613,7 +1613,7 @@ static int sad8x8_c(void *s, uint8_t *a, uint8_t *b, int stride){
return pix_abs8x8_c(a,b,stride); return pix_abs8x8_c(a,b,stride);
} }


void ff_block_permute(DCTELEM *block, UINT8 *permutation, const UINT8 *scantable, int last)
void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last)
{ {
int i; int i;
DCTELEM temp[64]; DCTELEM temp[64];
@@ -1822,7 +1822,7 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s


static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
const UINT8 *scantable= s->intra_scantable.permutated;
const uint8_t *scantable= s->intra_scantable.permutated;
uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8]; uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8];
uint64_t __align8 aligned_bak[stride]; uint64_t __align8 aligned_bak[stride];
DCTELEM * const temp= (DCTELEM*)aligned_temp; DCTELEM * const temp= (DCTELEM*)aligned_temp;
@@ -1896,7 +1896,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int


static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
const UINT8 *scantable= s->intra_scantable.permutated;
const uint8_t *scantable= s->intra_scantable.permutated;
uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8]; uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8];
DCTELEM * const temp= (DCTELEM*)aligned_temp; DCTELEM * const temp= (DCTELEM*)aligned_temp;
int i, last, run, bits, level, start_i; int i, last, run, bits, level, start_i;


+ 28
- 28
libavcodec/dsputil.h View File

@@ -35,16 +35,16 @@ void j_rev_dct (DCTELEM *data);
void ff_fdct_mmx(DCTELEM *block); void ff_fdct_mmx(DCTELEM *block);


/* encoding scans */ /* encoding scans */
extern const UINT8 ff_alternate_horizontal_scan[64];
extern const UINT8 ff_alternate_vertical_scan[64];
extern const UINT8 ff_zigzag_direct[64];
extern const uint8_t ff_alternate_horizontal_scan[64];
extern const uint8_t ff_alternate_vertical_scan[64];
extern const uint8_t ff_zigzag_direct[64];


/* pixel operations */ /* pixel operations */
#define MAX_NEG_CROP 384 #define MAX_NEG_CROP 384


/* temporary */ /* temporary */
extern UINT32 squareTbl[512];
extern UINT8 cropTbl[256 + 2 * MAX_NEG_CROP];
extern uint32_t squareTbl[512];
extern uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];




/* minimum alignment rules ;) /* minimum alignment rules ;)
@@ -58,22 +58,22 @@ i (michael) didnt check them, these are just the alignents which i think could b
*/ */


/* /*
void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
void diff_pixels_c(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride);
void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void get_pixels_c(DCTELEM *block, const uint8_t *pixels, int line_size);
void diff_pixels_c(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride);
void put_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
void add_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
void clear_blocks_c(DCTELEM *blocks); void clear_blocks_c(DCTELEM *blocks);
*/ */


/* add and put pixel (decoding) */ /* add and put pixel (decoding) */
// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16 // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
typedef void (*op_pixels_func)(UINT8 *block/*align width (8 or 16)*/, const UINT8 *pixels/*align 1*/, int line_size, int h);
typedef void (*qpel_mc_func)(UINT8 *dst/*align width (8 or 16)*/, UINT8 *src/*align 1*/, int stride);
typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);


#define DEF_OLD_QPEL(name)\ #define DEF_OLD_QPEL(name)\
void ff_put_ ## name (UINT8 *dst/*align width (8 or 16)*/, UINT8 *src/*align 1*/, int stride);\
void ff_put_no_rnd_ ## name (UINT8 *dst/*align width (8 or 16)*/, UINT8 *src/*align 1*/, int stride);\
void ff_avg_ ## name (UINT8 *dst/*align width (8 or 16)*/, UINT8 *src/*align 1*/, int stride);
void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);


DEF_OLD_QPEL(qpel16_mc11_old_c) DEF_OLD_QPEL(qpel16_mc11_old_c)
DEF_OLD_QPEL(qpel16_mc31_old_c) DEF_OLD_QPEL(qpel16_mc31_old_c)
@@ -96,22 +96,22 @@ static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\


/* motion estimation */ /* motion estimation */


typedef int (*op_pixels_abs_func)(UINT8 *blk1/*align width (8 or 16)*/, UINT8 *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
typedef int (*op_pixels_abs_func)(uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;


typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, UINT8 *blk1/*align width (8 or 16)*/, UINT8 *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;


typedef struct DSPContext { typedef struct DSPContext {
/* pixel ops : interface with DCT */ /* pixel ops : interface with DCT */
void (*get_pixels)(DCTELEM *block/*align 16*/, const UINT8 *pixels/*align 8*/, int line_size);
void (*diff_pixels)(DCTELEM *block/*align 16*/, const UINT8 *s1/*align 8*/, const UINT8 *s2/*align 8*/, int stride);
void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
void (*gmc1)(UINT8 *dst/*align 8*/, UINT8 *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
void (*gmc )(UINT8 *dst/*align 8*/, UINT8 *src/*align 1*/, int stride, int h, int ox, int oy,
void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
void (*clear_blocks)(DCTELEM *blocks/*align 16*/); void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
int (*pix_sum)(UINT8 * pix, int line_size);
int (*pix_norm1)(UINT8 * pix, int line_size);
int (*pix_sum)(uint8_t * pix, int line_size);
int (*pix_norm1)(uint8_t * pix, int line_size);
me_cmp_func sad[2]; /* identical to pix_absAxA except additional void * */ me_cmp_func sad[2]; /* identical to pix_absAxA except additional void * */
me_cmp_func sse[2]; me_cmp_func sse[2];
me_cmp_func hadamard8_diff[2]; me_cmp_func hadamard8_diff[2];
@@ -157,7 +157,7 @@ void dsputil_init(DSPContext* p, unsigned mask);
* permute block according to permuatation. * permute block according to permuatation.
* @param last last non zero element in scantable order * @param last last non zero element in scantable order
*/ */
void ff_block_permute(DCTELEM *block, UINT8 *permutation, const UINT8 *scantable, int last);
void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);


#define emms_c() #define emms_c()


@@ -177,8 +177,8 @@ int mm_support(void);


extern int mm_flags; extern int mm_flags;


void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size);
void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size);
void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);


static inline void emms(void) static inline void emms(void)
{ {
@@ -264,7 +264,7 @@ struct unaligned_32 { uint32_t l; } __attribute__((packed));
#endif /* !__GNUC__ */ #endif /* !__GNUC__ */


/* PSNR */ /* PSNR */
void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3],
void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
int orig_linesize[3], int coded_linesize, int orig_linesize[3], int coded_linesize,
AVCodecContext *avctx); AVCodecContext *avctx);




+ 37
- 37
libavcodec/dv.c View File

@@ -32,15 +32,15 @@ typedef struct DVVideoDecodeContext {
VLC *vlc; VLC *vlc;
int sampling_411; /* 0 = 420, 1 = 411 */ int sampling_411; /* 0 = 420, 1 = 411 */
int width, height; int width, height;
UINT8 *current_picture[3]; /* picture structure */
uint8_t *current_picture[3]; /* picture structure */
AVFrame picture; AVFrame picture;
int linesize[3]; int linesize[3];
DCTELEM block[5*6][64] __align8; DCTELEM block[5*6][64] __align8;
UINT8 dv_zigzag[2][64];
UINT8 idct_permutation[64];
uint8_t dv_zigzag[2][64];
uint8_t idct_permutation[64];
/* XXX: move it to static storage ? */ /* XXX: move it to static storage ? */
UINT8 dv_shift[2][22][64];
void (*idct_put[2])(UINT8 *dest, int line_size, DCTELEM *block);
uint8_t dv_shift[2][22][64];
void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
} DVVideoDecodeContext; } DVVideoDecodeContext;


#include "dvdata.h" #include "dvdata.h"
@@ -136,18 +136,18 @@ static int dvvideo_decode_init(AVCodecContext *avctx)
//#define VLC_DEBUG //#define VLC_DEBUG


typedef struct BlockInfo { typedef struct BlockInfo {
const UINT8 *shift_table;
const UINT8 *scan_table;
UINT8 pos; /* position in block */
UINT8 eob_reached; /* true if EOB has been reached */
UINT8 dct_mode;
UINT8 partial_bit_count;
UINT16 partial_bit_buffer;
const uint8_t *shift_table;
const uint8_t *scan_table;
uint8_t pos; /* position in block */
uint8_t eob_reached; /* true if EOB has been reached */
uint8_t dct_mode;
uint8_t partial_bit_count;
uint16_t partial_bit_buffer;
int shift_offset; int shift_offset;
} BlockInfo; } BlockInfo;


/* block size in bits */ /* block size in bits */
static const UINT16 block_sizes[6] = {
static const uint16_t block_sizes[6] = {
112, 112, 112, 112, 80, 80 112, 112, 112, 112, 80, 80
}; };


@@ -161,8 +161,8 @@ static void dv_decode_ac(DVVideoDecodeContext *s,
{ {
int last_re_index; int last_re_index;
int shift_offset = mb->shift_offset; int shift_offset = mb->shift_offset;
const UINT8 *scan_table = mb->scan_table;
const UINT8 *shift_table = mb->shift_table;
const uint8_t *scan_table = mb->scan_table;
const uint8_t *shift_table = mb->shift_table;
int pos = mb->pos; int pos = mb->pos;
int level, pos1, sign, run; int level, pos1, sign, run;
int partial_bit_count; int partial_bit_count;
@@ -176,8 +176,8 @@ static void dv_decode_ac(DVVideoDecodeContext *s,
/* if we must parse a partial vlc, we do it here */ /* if we must parse a partial vlc, we do it here */
partial_bit_count = mb->partial_bit_count; partial_bit_count = mb->partial_bit_count;
if (partial_bit_count > 0) { if (partial_bit_count > 0) {
UINT8 buf[4];
UINT32 v;
uint8_t buf[4];
uint32_t v;
int l, l1; int l, l1;
GetBitContext gb1; GetBitContext gb1;


@@ -298,21 +298,21 @@ static inline void bit_copy(PutBitContext *pb, GetBitContext *gb, int bits_left)


/* mb_x and mb_y are in units of 8 pixels */ /* mb_x and mb_y are in units of 8 pixels */
static inline void dv_decode_video_segment(DVVideoDecodeContext *s, static inline void dv_decode_video_segment(DVVideoDecodeContext *s,
UINT8 *buf_ptr1,
const UINT16 *mb_pos_ptr)
uint8_t *buf_ptr1,
const uint16_t *mb_pos_ptr)
{ {
int quant, dc, dct_mode, class1, j; int quant, dc, dct_mode, class1, j;
int mb_index, mb_x, mb_y, v, last_index; int mb_index, mb_x, mb_y, v, last_index;
DCTELEM *block, *block1; DCTELEM *block, *block1;
int c_offset, bits_left; int c_offset, bits_left;
UINT8 *y_ptr;
uint8_t *y_ptr;
BlockInfo mb_data[5 * 6], *mb, *mb1; BlockInfo mb_data[5 * 6], *mb, *mb1;
void (*idct_put)(UINT8 *dest, int line_size, DCTELEM *block);
UINT8 *buf_ptr;
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
uint8_t *buf_ptr;
PutBitContext pb, vs_pb; PutBitContext pb, vs_pb;
UINT8 mb_bit_buffer[80 + 4]; /* allow some slack */
uint8_t mb_bit_buffer[80 + 4]; /* allow some slack */
int mb_bit_count; int mb_bit_count;
UINT8 vs_bit_buffer[5 * 80 + 4]; /* allow some slack */
uint8_t vs_bit_buffer[5 * 80 + 4]; /* allow some slack */
int vs_bit_count; int vs_bit_count;
memset(s->block, 0, sizeof(s->block)); memset(s->block, 0, sizeof(s->block));
@@ -493,12 +493,12 @@ static inline void dv_decode_video_segment(DVVideoDecodeContext *s,
144000 bytes for PAL) */ 144000 bytes for PAL) */
static int dvvideo_decode_frame(AVCodecContext *avctx, static int dvvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
DVVideoDecodeContext *s = avctx->priv_data; DVVideoDecodeContext *s = avctx->priv_data;
int sct, dsf, apt, ds, nb_dif_segs, vs, width, height, i, packet_size; int sct, dsf, apt, ds, nb_dif_segs, vs, width, height, i, packet_size;
UINT8 *buf_ptr;
const UINT16 *mb_pos_ptr;
uint8_t *buf_ptr;
const uint16_t *mb_pos_ptr;
/* parse id */ /* parse id */
init_get_bits(&s->gb, buf, buf_size*8); init_get_bits(&s->gb, buf, buf_size*8);
@@ -642,9 +642,9 @@ static int dvaudio_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }


static UINT16 dv_audio_12to16(UINT16 sample)
static uint16_t dv_audio_12to16(uint16_t sample)
{ {
UINT16 shift, result;
uint16_t shift, result;
sample = (sample < 0x800) ? sample : sample | 0xf000; sample = (sample < 0x800) ? sample : sample | 0xf000;
shift = (sample & 0xf00) >> 8; shift = (sample & 0xf00) >> 8;
@@ -676,13 +676,13 @@ static UINT16 dv_audio_12to16(UINT16 sample)
*/ */
static int dvaudio_decode_frame(AVCodecContext *avctx, static int dvaudio_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
DVVideoDecodeContext *s = avctx->priv_data; DVVideoDecodeContext *s = avctx->priv_data;
const UINT16 (*unshuffle)[9];
const uint16_t (*unshuffle)[9];
int smpls, freq, quant, sys, stride, difseg, ad, dp, nb_dif_segs, i; int smpls, freq, quant, sys, stride, difseg, ad, dp, nb_dif_segs, i;
UINT16 lc, rc;
UINT8 *buf_ptr;
uint16_t lc, rc;
uint8_t *buf_ptr;
/* parse id */ /* parse id */
init_get_bits(&s->gb, &buf[AAUX_OFFSET], 5*8); init_get_bits(&s->gb, &buf[AAUX_OFFSET], 5*8);
@@ -742,10 +742,10 @@ static int dvaudio_decode_frame(AVCodecContext *avctx,
if (difseg >= nb_dif_segs/2) if (difseg >= nb_dif_segs/2)
goto out; /* We're not doing 4ch at this time */ goto out; /* We're not doing 4ch at this time */
lc = ((UINT16)buf_ptr[dp] << 4) |
((UINT16)buf_ptr[dp+2] >> 4);
rc = ((UINT16)buf_ptr[dp+1] << 4) |
((UINT16)buf_ptr[dp+2] & 0x0f);
lc = ((uint16_t)buf_ptr[dp] << 4) |
((uint16_t)buf_ptr[dp+2] >> 4);
rc = ((uint16_t)buf_ptr[dp+1] << 4) |
((uint16_t)buf_ptr[dp+2] & 0x0f);
lc = dv_audio_12to16(lc); lc = dv_audio_12to16(lc);
rc = dv_audio_12to16(rc); rc = dv_audio_12to16(rc);




+ 13
- 13
libavcodec/dvdata.h View File

@@ -20,7 +20,7 @@
#define NB_DV_VLC 409 #define NB_DV_VLC 409
#define AAUX_OFFSET (80*6 + 80*16*3 + 3) #define AAUX_OFFSET (80*6 + 80*16*3 + 3)


static const UINT16 dv_vlc_bits[409] = {
static const uint16_t dv_vlc_bits[409] = {
0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016, 0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a, 0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a,
0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00e0, 0x00e1, 0x00e2, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00e0, 0x00e1, 0x00e2,
@@ -75,7 +75,7 @@ static const UINT16 dv_vlc_bits[409] = {
0x0006, 0x0006,
}; };


static const UINT8 dv_vlc_len[409] = {
static const uint8_t dv_vlc_len[409] = {
2, 3, 4, 4, 4, 5, 5, 5, 2, 3, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 5, 6, 6, 6, 6, 7, 7, 7,
7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8,
@@ -130,7 +130,7 @@ static const UINT8 dv_vlc_len[409] = {
4, 4,
}; };


static const UINT8 dv_vlc_run[409] = {
static const uint8_t dv_vlc_run[409] = {
0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0,
0, 3, 4, 0, 0, 5, 6, 2, 0, 3, 4, 0, 0, 5, 6, 2,
1, 1, 0, 0, 0, 7, 8, 9, 1, 1, 0, 0, 0, 7, 8, 9,
@@ -185,7 +185,7 @@ static const UINT8 dv_vlc_run[409] = {
0, 0,
}; };


static const UINT8 dv_vlc_level[409] = {
static const uint8_t dv_vlc_level[409] = {
1, 2, 1, 3, 4, 1, 2, 5, 1, 2, 1, 3, 4, 1, 2, 5,
6, 1, 1, 7, 8, 1, 1, 2, 6, 1, 1, 7, 8, 1, 1, 2,
3, 4, 9, 10, 11, 1, 1, 1, 3, 4, 9, 10, 11, 1, 1, 1,
@@ -242,7 +242,7 @@ static const UINT8 dv_vlc_level[409] = {


/* Specific zigzag scan for 248 idct. NOTE that unlike the /* Specific zigzag scan for 248 idct. NOTE that unlike the
specification, we interleave the fields */ specification, we interleave the fields */
static const UINT8 dv_248_zigzag[64] = {
static const uint8_t dv_248_zigzag[64] = {
0, 8, 1, 9, 16, 24, 2, 10, 0, 8, 1, 9, 16, 24, 2, 10,
17, 25, 32, 40, 48, 56, 33, 41, 17, 25, 32, 40, 48, 56, 33, 41,
18, 26, 3, 11, 4, 12, 19, 27, 18, 26, 3, 11, 4, 12, 19, 27,
@@ -254,7 +254,7 @@ static const UINT8 dv_248_zigzag[64] = {
}; };


/* unquant tables (not used directly) */ /* unquant tables (not used directly) */
static const UINT8 dv_88_areas[64] = {
static const uint8_t dv_88_areas[64] = {
0,0,0,1,1,1,2,2, 0,0,0,1,1,1,2,2,
0,0,1,1,1,2,2,2, 0,0,1,1,1,2,2,2,
0,1,1,1,2,2,2,3, 0,1,1,1,2,2,2,3,
@@ -265,7 +265,7 @@ static const UINT8 dv_88_areas[64] = {
2,2,3,3,3,3,3,3, 2,2,3,3,3,3,3,3,
}; };


static const UINT8 dv_248_areas[64] = {
static const uint8_t dv_248_areas[64] = {
0,0,1,1,1,2,2,3, 0,0,1,1,1,2,2,3,
0,0,1,1,2,2,2,3, 0,0,1,1,2,2,2,3,
0,1,1,2,2,2,3,3, 0,1,1,2,2,2,3,3,
@@ -276,7 +276,7 @@ static const UINT8 dv_248_areas[64] = {
1,2,2,3,3,3,3,3, 1,2,2,3,3,3,3,3,
}; };


static UINT8 dv_quant_shifts[22][4] = {
static uint8_t dv_quant_shifts[22][4] = {
{ 3,3,4,4 }, { 3,3,4,4 },
{ 3,3,4,4 }, { 3,3,4,4 },
{ 2,3,3,4 }, { 2,3,3,4 },
@@ -301,12 +301,12 @@ static UINT8 dv_quant_shifts[22][4] = {
{ 0,0,0,0 }, { 0,0,0,0 },
}; };


static const UINT8 dv_quant_offset[4] = { 6, 3, 0, 1 };
static const uint8_t dv_quant_offset[4] = { 6, 3, 0, 1 };


/* NOTE: I prefer hardcoding the positionning of dv blocks, it is /* NOTE: I prefer hardcoding the positionning of dv blocks, it is
simpler :-) */ simpler :-) */


static const UINT16 dv_place_420[1620] = {
static const uint16_t dv_place_420[1620] = {
0x0c24, 0x2412, 0x3036, 0x0000, 0x1848, 0x0c24, 0x2412, 0x3036, 0x0000, 0x1848,
0x0e24, 0x2612, 0x3236, 0x0200, 0x1a48, 0x0e24, 0x2612, 0x3236, 0x0200, 0x1a48,
0x1024, 0x2812, 0x3436, 0x0400, 0x1c48, 0x1024, 0x2812, 0x3436, 0x0400, 0x1c48,
@@ -633,7 +633,7 @@ static const UINT16 dv_place_420[1620] = {
0x0a34, 0x2222, 0x2e46, 0x4610, 0x1658, 0x0a34, 0x2222, 0x2e46, 0x4610, 0x1658,
}; };


static const UINT16 dv_place_411[1350] = {
static const uint16_t dv_place_411[1350] = {
0x0c24, 0x2710, 0x3334, 0x0000, 0x1848, 0x0c24, 0x2710, 0x3334, 0x0000, 0x1848,
0x0d24, 0x2810, 0x3434, 0x0100, 0x1948, 0x0d24, 0x2810, 0x3434, 0x0100, 0x1948,
0x0e24, 0x2910, 0x3534, 0x0200, 0x1a48, 0x0e24, 0x2910, 0x3534, 0x0200, 0x1a48,
@@ -906,7 +906,7 @@ static const UINT16 dv_place_411[1350] = {
0x0834, 0x2320, 0x2f44, 0x3810, 0x1658, 0x0834, 0x2320, 0x2f44, 0x3810, 0x1658,
}; };


static const UINT16 dv_place_audio60[10][9] = {
static const uint16_t dv_place_audio60[10][9] = {
{ 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */ { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */
{ 6, 36, 66, 26, 56, 86, 16, 46, 76 }, { 6, 36, 66, 26, 56, 86, 16, 46, 76 },
{ 12, 42, 72, 2, 32, 62, 22, 52, 82 }, { 12, 42, 72, 2, 32, 62, 22, 52, 82 },
@@ -920,7 +920,7 @@ static const UINT16 dv_place_audio60[10][9] = {
{ 25, 55, 85, 15, 45, 75, 5, 35, 65 }, { 25, 55, 85, 15, 45, 75, 5, 35, 65 },
}; };


static const UINT16 dv_place_audio50[12][9] = {
static const uint16_t dv_place_audio50[12][9] = {
{ 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */ { 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */
{ 6, 42, 78, 32, 68, 104, 22, 58, 94}, { 6, 42, 78, 32, 68, 104, 22, 58, 94},
{ 12, 48, 84, 2, 38, 74, 28, 64, 100}, { 12, 48, 84, 2, 38, 74, 28, 64, 100},


+ 20
- 20
libavcodec/error_resilience.c View File

@@ -54,7 +54,7 @@ static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
} }
} }


static void filter181(INT16 *data, int width, int height, int stride){
static void filter181(int16_t *data, int width, int height, int stride){
int x,y; int x,y;


/* horizontal filter */ /* horizontal filter */
@@ -95,7 +95,7 @@ static void filter181(INT16 *data, int width, int height, int stride){
* @param w width in 8 pixel blocks * @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks * @param h height in 8 pixel blocks
*/ */
static void guess_dc(MpegEncContext *s, INT16 *dc, int w, int h, int stride, int is_luma){
static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, int is_luma){
int b_x, b_y; int b_x, b_y;


for(b_y=0; b_y<h; b_y++){ for(b_y=0; b_y<h; b_y++){
@@ -103,7 +103,7 @@ static void guess_dc(MpegEncContext *s, INT16 *dc, int w, int h, int stride, int
int color[4]={1024,1024,1024,1024}; int color[4]={1024,1024,1024,1024};
int distance[4]={9999,9999,9999,9999}; int distance[4]={9999,9999,9999,9999};
int mb_index, error, j; int mb_index, error, j;
INT64 guess, weight_sum;
int64_t guess, weight_sum;
mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_width; mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_width;
@@ -163,8 +163,8 @@ static void guess_dc(MpegEncContext *s, INT16 *dc, int w, int h, int stride, int
weight_sum=0; weight_sum=0;
guess=0; guess=0;
for(j=0; j<4; j++){ for(j=0; j<4; j++){
INT64 weight= 256*256*256*16/distance[j];
guess+= weight*(INT64)color[j];
int64_t weight= 256*256*256*16/distance[j];
guess+= weight*(int64_t)color[j];
weight_sum+= weight; weight_sum+= weight;
} }
guess= (guess + weight_sum/2) / weight_sum; guess= (guess + weight_sum/2) / weight_sum;
@@ -179,9 +179,9 @@ static void guess_dc(MpegEncContext *s, INT16 *dc, int w, int h, int stride, int
* @param w width in 8 pixel blocks * @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks * @param h height in 8 pixel blocks
*/ */
static void h_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stride, int is_luma){
static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
int b_x, b_y; int b_x, b_y;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;


for(b_y=0; b_y<h; b_y++){ for(b_y=0; b_y<h; b_y++){
for(b_x=0; b_x<w-1; b_x++){ for(b_x=0; b_x<w-1; b_x++){
@@ -193,8 +193,8 @@ static void h_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stri
int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR); int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR); int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
INT16 *left_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ( b_x <<(1-is_luma))];
INT16 *right_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ((b_x+1)<<(1-is_luma))];
int16_t *left_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ( b_x <<(1-is_luma))];
int16_t *right_mv= s->motion_val[s->block_wrap[0]*((b_y<<(1-is_luma)) + 1) + ((b_x+1)<<(1-is_luma))];
if(!(left_damage||right_damage)) continue; // both undamaged if(!(left_damage||right_damage)) continue; // both undamaged
@@ -239,9 +239,9 @@ static void h_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stri
* @param w width in 8 pixel blocks * @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks * @param h height in 8 pixel blocks
*/ */
static void v_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stride, int is_luma){
static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
int b_x, b_y; int b_x, b_y;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;


for(b_y=0; b_y<h-1; b_y++){ for(b_y=0; b_y<h-1; b_y++){
for(b_x=0; b_x<w; b_x++){ for(b_x=0; b_x<w; b_x++){
@@ -253,8 +253,8 @@ static void v_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stri
int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR); int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR); int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR);
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
INT16 *top_mv= s->motion_val[s->block_wrap[0]*(( b_y <<(1-is_luma)) + 1) + (b_x<<(1-is_luma))];
INT16 *bottom_mv= s->motion_val[s->block_wrap[0]*(((b_y+1)<<(1-is_luma)) + 1) + (b_x<<(1-is_luma))];
int16_t *top_mv= s->motion_val[s->block_wrap[0]*(( b_y <<(1-is_luma)) + 1) + (b_x<<(1-is_luma))];
int16_t *bottom_mv= s->motion_val[s->block_wrap[0]*(((b_y+1)<<(1-is_luma)) + 1) + (b_x<<(1-is_luma))];
if(!(top_damage||bottom_damage)) continue; // both undamaged if(!(top_damage||bottom_damage)) continue; // both undamaged
@@ -295,7 +295,7 @@ static void v_block_filter(MpegEncContext *s, UINT8 *dst, int w, int h, int stri
} }


static void guess_mv(MpegEncContext *s){ static void guess_mv(MpegEncContext *s){
UINT8 fixed[s->mb_num];
uint8_t fixed[s->mb_num];
#define MV_FROZEN 3 #define MV_FROZEN 3
#define MV_CHANGED 2 #define MV_CHANGED 2
#define MV_UNCHANGED 1 #define MV_UNCHANGED 1
@@ -464,7 +464,7 @@ int score_sum=0;
s->mb_y= mb_y; s->mb_y= mb_y;
for(j=0; j<pred_count; j++){ for(j=0; j<pred_count; j++){
int score=0; int score=0;
UINT8 *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;


s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; s->motion_val[mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0];
s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; s->motion_val[mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1];
@@ -558,8 +558,8 @@ static int is_intra_more_likely(MpegEncContext *s){
if((j%skip_amount) != 0) continue; //skip a few to speed things up if((j%skip_amount) != 0) continue; //skip a few to speed things up
if(s->pict_type==I_TYPE){ if(s->pict_type==I_TYPE){
UINT8 *mb_ptr = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
UINT8 *last_mb_ptr= s->last_picture.data [0] + mb_x*16 + mb_y*16*s->linesize;
uint8_t *mb_ptr = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
uint8_t *last_mb_ptr= s->last_picture.data [0] + mb_x*16 + mb_y*16*s->linesize;
is_intra_likely += s->dsp.pix_abs16x16(last_mb_ptr, mb_ptr , s->linesize); is_intra_likely += s->dsp.pix_abs16x16(last_mb_ptr, mb_ptr , s->linesize);
is_intra_likely -= s->dsp.pix_abs16x16(last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize); is_intra_likely -= s->dsp.pix_abs16x16(last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize);
@@ -795,8 +795,8 @@ void ff_error_resilience(MpegEncContext *s){
for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_y=0; mb_y<s->mb_height; mb_y++){
for(mb_x=0; mb_x<s->mb_width; mb_x++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){
int dc, dcu, dcv, y, n; int dc, dcu, dcv, y, n;
INT16 *dc_ptr;
UINT8 *dest_y, *dest_cb, *dest_cr;
int16_t *dc_ptr;
uint8_t *dest_y, *dest_cb, *dest_cr;
i++; i++;
error= s->error_status_table[i]; error= s->error_status_table[i];
@@ -846,7 +846,7 @@ void ff_error_resilience(MpegEncContext *s){
i= -1; i= -1;
for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_y=0; mb_y<s->mb_height; mb_y++){
for(mb_x=0; mb_x<s->mb_width; mb_x++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){
UINT8 *dest_y, *dest_cb, *dest_cr;
uint8_t *dest_y, *dest_cb, *dest_cr;
i++; i++;
error= s->error_status_table[i]; error= s->error_status_table[i];


+ 3
- 3
libavcodec/fft-test.c View File

@@ -105,11 +105,11 @@ float frandom(void)
return (float)((random() & 0xffff) - 32768) / 32768.0; return (float)((random() & 0xffff) - 32768) / 32768.0;
} }


INT64 gettime(void)
int64_t gettime(void)
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
return (INT64)tv.tv_sec * 1000000 + tv.tv_usec;
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
} }


void check_diff(float *tab1, float *tab2, int n) void check_diff(float *tab1, float *tab2, int n)
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
/* do a speed test */ /* do a speed test */


if (do_speed) { if (do_speed) {
INT64 time_start, duration;
int64_t time_start, duration;
int nb_its; int nb_its;


printf("Speed test...\n"); printf("Speed test...\n");


+ 53
- 54
libavcodec/h263.c View File

@@ -61,7 +61,7 @@ static void h263_encode_block(MpegEncContext * s, DCTELEM * block,
static void h263_encode_motion(MpegEncContext * s, int val, int fcode); static void h263_encode_motion(MpegEncContext * s, int val, int fcode);
static void h263p_encode_umotion(MpegEncContext * s, int val); static void h263p_encode_umotion(MpegEncContext * s, int val);
static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block,
int n, int dc, UINT8 *scan_table,
int n, int dc, uint8_t *scan_table,
PutBitContext *dc_pb, PutBitContext *ac_pb); PutBitContext *dc_pb, PutBitContext *ac_pb);
#endif #endif


@@ -72,23 +72,23 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded, int intra); int n, int coded, int intra);
static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr);
static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr);
static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n, static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir); int dir);
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s); static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr, int *dir_ptr);
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr);


extern UINT32 inverse[256];
extern uint32_t inverse[256];


static UINT8 uni_DCtab_lum_len[512];
static UINT8 uni_DCtab_chrom_len[512];
static UINT16 uni_DCtab_lum_bits[512];
static UINT16 uni_DCtab_chrom_bits[512];
static uint8_t uni_DCtab_lum_len[512];
static uint8_t uni_DCtab_chrom_len[512];
static uint16_t uni_DCtab_lum_bits[512];
static uint16_t uni_DCtab_chrom_bits[512];


#ifdef CONFIG_ENCODERS #ifdef CONFIG_ENCODERS
static UINT16 (*mv_penalty)[MAX_MV*2+1]= NULL;
static UINT8 fcode_tab[MAX_MV*2+1];
static UINT8 umv_fcode_tab[MAX_MV*2+1];
static uint16_t (*mv_penalty)[MAX_MV*2+1]= NULL;
static uint8_t fcode_tab[MAX_MV*2+1];
static uint8_t umv_fcode_tab[MAX_MV*2+1];


static uint32_t uni_mpeg4_intra_rl_bits[64*64*2*2]; static uint32_t uni_mpeg4_intra_rl_bits[64*64*2*2];
static uint8_t uni_mpeg4_intra_rl_len [64*64*2*2]; static uint8_t uni_mpeg4_intra_rl_len [64*64*2*2];
@@ -161,7 +161,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number)
s->gob_number = 0; s->gob_number = 0;


put_bits(&s->pb, 22, 0x20); /* PSC */ put_bits(&s->pb, 22, 0x20); /* PSC */
put_bits(&s->pb, 8, (((INT64)s->picture_number * 30 * FRAME_RATE_BASE) /
put_bits(&s->pb, 8, (((int64_t)s->picture_number * 30 * FRAME_RATE_BASE) /
s->frame_rate) & 0xff); s->frame_rate) & 0xff);


put_bits(&s->pb, 1, 1); /* marker */ put_bits(&s->pb, 1, 1); /* marker */
@@ -280,7 +280,7 @@ static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], int d
int8_t * const qscale_table= s->current_picture.qscale_table; int8_t * const qscale_table= s->current_picture.qscale_table;


for(n=0; n<6; n++){ for(n=0; n<6; n++){
INT16 *ac_val, *ac_val1;
int16_t *ac_val, *ac_val1;


ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
ac_val1= ac_val; ac_val1= ac_val;
@@ -728,12 +728,12 @@ void mpeg4_encode_mb(MpegEncContext * s,
int dc_diff[6]; //dc values with the dc prediction subtracted int dc_diff[6]; //dc values with the dc prediction subtracted
int dir[6]; //prediction direction int dir[6]; //prediction direction
int zigzag_last_index[6]; int zigzag_last_index[6];
UINT8 *scan_table[6];
uint8_t *scan_table[6];
int i; int i;


for(i=0; i<6; i++){ for(i=0; i<6; i++){
const int level= block[i][0]; const int level= block[i][0];
UINT16 *dc_ptr;
uint16_t *dc_ptr;


dc_diff[i]= level - ff_mpeg4_pred_dc(s, i, &dc_ptr, &dir[i]); dc_diff[i]= level - ff_mpeg4_pred_dc(s, i, &dc_ptr, &dir[i]);
if (i < 4) { if (i < 4) {
@@ -747,7 +747,7 @@ void mpeg4_encode_mb(MpegEncContext * s,


if(s->ac_pred){ if(s->ac_pred){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
UINT8 *st;
uint8_t *st;
int last_index; int last_index;


mpeg4_inv_pred_ac(s, block[i], i, dir[i]); mpeg4_inv_pred_ac(s, block[i], i, dir[i]);
@@ -817,7 +817,7 @@ void mpeg4_encode_mb(MpegEncContext * s,
if(s->ac_pred){ if(s->ac_pred){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
int j; int j;
INT16 *ac_val;
int16_t *ac_val;


ac_val = s->ac_val[0][0] + s->block_index[i] * 16; ac_val = s->ac_val[0][0] + s->block_index[i] * 16;


@@ -839,9 +839,9 @@ void h263_encode_mb(MpegEncContext * s,
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y; int cbpc, cbpy, i, cbp, pred_x, pred_y;
INT16 pred_dc;
INT16 rec_intradc[6];
UINT16 *dc_ptr[6];
int16_t pred_dc;
int16_t rec_intradc[6];
uint16_t *dc_ptr[6];
const int dquant_code[5]= {1,0,9,2,3}; const int dquant_code[5]= {1,0,9,2,3};
//printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); //printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
@@ -890,7 +890,7 @@ void h263_encode_mb(MpegEncContext * s,
for(i=0; i<6; i++) { for(i=0; i<6; i++) {
/* Predict DC */ /* Predict DC */
if (s->h263_aic && s->mb_intra) { if (s->h263_aic && s->mb_intra) {
INT16 level = block[i][0];
int16_t level = block[i][0];
pred_dc = h263_pred_dc(s, i, &dc_ptr[i]); pred_dc = h263_pred_dc(s, i, &dc_ptr[i]);
level -= pred_dc; level -= pred_dc;
@@ -965,10 +965,10 @@ void h263_encode_mb(MpegEncContext * s,
} }
#endif #endif


static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr)
static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr)
{ {
int x, y, wrap, a, c, pred_dc, scale; int x, y, wrap, a, c, pred_dc, scale;
INT16 *dc_val, *ac_val;
int16_t *dc_val, *ac_val;


/* find prediction */ /* find prediction */
if (n < 4) { if (n < 4) {
@@ -1014,7 +1014,7 @@ static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr)
static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
{ {
int x, y, wrap, a, c, pred_dc, scale, i; int x, y, wrap, a, c, pred_dc, scale, i;
INT16 *dc_val, *ac_val, *ac_val1;
int16_t *dc_val, *ac_val, *ac_val1;


/* find prediction */ /* find prediction */
if (n < 4) { if (n < 4) {
@@ -1095,11 +1095,11 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
ac_val1[8 + i] = block[s->idct_permutation[i ]]; ac_val1[8 + i] = block[s->idct_permutation[i ]];
} }


INT16 *h263_pred_motion(MpegEncContext * s, int block,
int16_t *h263_pred_motion(MpegEncContext * s, int block,
int *px, int *py) int *px, int *py)
{ {
int xy, wrap; int xy, wrap;
INT16 *A, *B, *C, *mot_val;
int16_t *A, *B, *C, *mot_val;
static const int off[4]= {2, 1, 1, -1}; static const int off[4]= {2, 1, 1, -1};


wrap = s->block_wrap[0]; wrap = s->block_wrap[0];
@@ -1249,7 +1249,7 @@ static void init_mv_penalty_and_fcode(MpegEncContext *s)
int mv; int mv;
if(mv_penalty==NULL) if(mv_penalty==NULL)
mv_penalty= av_mallocz( sizeof(UINT16)*(MAX_FCODE+1)*(2*MAX_MV+1) );
mv_penalty= av_mallocz( sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1) );
for(f_code=1; f_code<=MAX_FCODE; f_code++){ for(f_code=1; f_code<=MAX_FCODE; f_code++){
for(mv=-MAX_MV; mv<=MAX_MV; mv++){ for(mv=-MAX_MV; mv<=MAX_MV; mv++){
@@ -1343,7 +1343,7 @@ static void init_uni_dc_tab(void)
} }


#ifdef CONFIG_ENCODERS #ifdef CONFIG_ENCODERS
static void init_uni_mpeg4_rl_tab(RLTable *rl, UINT32 *bits_tab, UINT8 *len_tab){
static void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
int slevel, run, last; int slevel, run, last;
assert(MAX_LEVEL >= 64); assert(MAX_LEVEL >= 64);
@@ -1575,7 +1575,7 @@ void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){
if(s->current_picture.pts) if(s->current_picture.pts)
s->time= (s->current_picture.pts*s->time_increment_resolution + 500*1000)/(1000*1000); s->time= (s->current_picture.pts*s->time_increment_resolution + 500*1000)/(1000*1000);
else else
s->time= picture_number*(INT64)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate;
s->time= picture_number*(int64_t)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate;
time_div= s->time/s->time_increment_resolution; time_div= s->time/s->time_increment_resolution;
time_mod= s->time%s->time_increment_resolution; time_mod= s->time%s->time_increment_resolution;


@@ -1821,10 +1821,10 @@ static void change_qscale(MpegEncContext * s, int dquant)
* @param dir_ptr pointer to an integer where the prediction direction will be stored * @param dir_ptr pointer to an integer where the prediction direction will be stored
* @return the quantized predicted dc * @return the quantized predicted dc
*/ */
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr, int *dir_ptr)
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr)
{ {
int a, b, c, wrap, pred, scale; int a, b, c, wrap, pred, scale;
UINT16 *dc_val;
uint16_t *dc_val;
int dummy; int dummy;


/* find prediction */ /* find prediction */
@@ -1887,7 +1887,7 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir) int dir)
{ {
int i; int i;
INT16 *ac_val, *ac_val1;
int16_t *ac_val, *ac_val1;
int8_t * const qscale_table= s->current_picture.qscale_table; int8_t * const qscale_table= s->current_picture.qscale_table;


/* find prediction */ /* find prediction */
@@ -1942,7 +1942,7 @@ static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir) int dir)
{ {
int i; int i;
INT16 *ac_val;
int16_t *ac_val;
int8_t * const qscale_table= s->current_picture.qscale_table; int8_t * const qscale_table= s->current_picture.qscale_table;


/* find prediction */ /* find prediction */
@@ -2031,15 +2031,15 @@ static inline void mpeg4_encode_dc(PutBitContext * s, int level, int n)
* @param n block index (0-3 are luma, 4-5 are chroma) * @param n block index (0-3 are luma, 4-5 are chroma)
*/ */
static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,
UINT8 *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
{ {
int i, last_non_zero; int i, last_non_zero;
#if 0 //variables for the outcommented version #if 0 //variables for the outcommented version
int code, sign, last; int code, sign, last;
#endif #endif
const RLTable *rl; const RLTable *rl;
UINT32 *bits_tab;
UINT8 *len_tab;
uint32_t *bits_tab;
uint8_t *len_tab;
const int last_index = s->block_last_index[n]; const int last_index = s->block_last_index[n];


if (s->mb_intra) { //Note gcc (3.2.1 at least) will optimize this away if (s->mb_intra) { //Note gcc (3.2.1 at least) will optimize this away
@@ -2147,11 +2147,11 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
} }


static inline int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, static inline int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,
UINT8 *scan_table)
uint8_t *scan_table)
{ {
int i, last_non_zero; int i, last_non_zero;
const RLTable *rl; const RLTable *rl;
UINT8 *len_tab;
uint8_t *len_tab;
const int last_index = s->block_last_index[n]; const int last_index = s->block_last_index[n];
int len=0; int len=0;


@@ -2564,14 +2564,14 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
#endif #endif


/* clean AC */ /* clean AC */
memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(INT16));
memset(s->ac_val[1] + c_xy, 0, (c_wrap +1)*16*sizeof(INT16));
memset(s->ac_val[2] + c_xy, 0, (c_wrap +1)*16*sizeof(INT16));
memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
memset(s->ac_val[1] + c_xy, 0, (c_wrap +1)*16*sizeof(int16_t));
memset(s->ac_val[2] + c_xy, 0, (c_wrap +1)*16*sizeof(int16_t));


/* clean MV */ /* clean MV */
// we cant clear the MVs as they might be needed by a b frame // we cant clear the MVs as they might be needed by a b frame
// memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(INT16));
// memset(s->motion_val, 0, 2*sizeof(INT16)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
// memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
// memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
s->last_mv[0][0][0]= s->last_mv[0][0][0]=
s->last_mv[0][0][1]= s->last_mv[0][0][1]=
s->last_mv[1][0][0]= s->last_mv[1][0][0]=
@@ -2671,7 +2671,7 @@ static inline int get_amv(MpegEncContext *s, int n){
*/ */
static int mpeg4_decode_partition_a(MpegEncContext *s){ static int mpeg4_decode_partition_a(MpegEncContext *s){
int mb_num; int mb_num;
static const INT8 quant_tab[4] = { -1, -2, 1, 2 };
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
/* decode first partition */ /* decode first partition */
mb_num=0; mb_num=0;
@@ -2729,7 +2729,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
s->error_status_table[xy]= AC_ERROR; s->error_status_table[xy]= AC_ERROR;
}else{ /* P/S_TYPE */ }else{ /* P/S_TYPE */
int mx, my, pred_x, pred_y, bits; int mx, my, pred_x, pred_y, bits;
INT16 * const mot_val= s->motion_val[s->block_index[0]];
int16_t * const mot_val= s->motion_val[s->block_index[0]];
const int stride= s->block_wrap[0]*2; const int stride= s->block_wrap[0]*2;


bits= show_bits(&s->gb, 17); bits= show_bits(&s->gb, 17);
@@ -2817,7 +2817,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
PRINT_MB_TYPE("4"); PRINT_MB_TYPE("4");
s->mb_type[xy]= MB_TYPE_INTER4V; s->mb_type[xy]= MB_TYPE_INTER4V;
for(i=0;i<4;i++) { for(i=0;i<4;i++) {
INT16 *mot_val= h263_pred_motion(s, i, &pred_x, &pred_y);
int16_t *mot_val= h263_pred_motion(s, i, &pred_x, &pred_y);
mx = h263_decode_motion(s, pred_x, s->f_code); mx = h263_decode_motion(s, pred_x, s->f_code);
if (mx >= 0xffff) if (mx >= 0xffff)
return -1; return -1;
@@ -2845,7 +2845,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
*/ */
static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
int mb_num=0; int mb_num=0;
static const INT8 quant_tab[4] = { -1, -2, 1, 2 };
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };


s->mb_x= s->resync_mb_x; s->mb_x= s->resync_mb_x;
s->first_slice_line=1; s->first_slice_line=1;
@@ -3073,8 +3073,8 @@ int ff_h263_decode_mb(MpegEncContext *s,
DCTELEM block[6][64]) DCTELEM block[6][64])
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
INT16 *mot_val;
static INT8 quant_tab[4] = { -1, -2, 1, 2 };
int16_t *mot_val;
static int8_t quant_tab[4] = { -1, -2, 1, 2 };


s->error_status_table[s->mb_x + s->mb_y*s->mb_width]= 0; s->error_status_table[s->mb_x + s->mb_y*s->mb_width]= 0;


@@ -3216,7 +3216,6 @@ int ff_h263_decode_mb(MpegEncContext *s,
int modb1; // first bit of modb int modb1; // first bit of modb
int modb2; // second bit of modb int modb2; // second bit of modb
int mb_type; int mb_type;
int xy;


s->mb_intra = 0; //B-frames never contain intra blocks s->mb_intra = 0; //B-frames never contain intra blocks
s->mcsel=0; // ... true gmc blocks s->mcsel=0; // ... true gmc blocks
@@ -3501,7 +3500,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
{ {
int code, level, i, j, last, run; int code, level, i, j, last, run;
RLTable *rl = &rl_inter; RLTable *rl = &rl_inter;
const UINT8 *scan_table;
const uint8_t *scan_table;


scan_table = s->intra_scantable.permutated; scan_table = s->intra_scantable.permutated;
if (s->h263_aic && s->mb_intra) { if (s->h263_aic && s->mb_intra) {
@@ -3556,7 +3555,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
/* escape */ /* escape */
last = get_bits1(&s->gb); last = get_bits1(&s->gb);
run = get_bits(&s->gb, 6); run = get_bits(&s->gb, 6);
level = (INT8)get_bits(&s->gb, 8);
level = (int8_t)get_bits(&s->gb, 8);
if (s->h263_rv10 && level == -128) { if (s->h263_rv10 && level == -128) {
/* XXX: should patch encoder too */ /* XXX: should patch encoder too */
level = get_bits(&s->gb, 12); level = get_bits(&s->gb, 12);
@@ -3598,7 +3597,7 @@ not_coded:
static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
{ {
int level, pred, code; int level, pred, code;
UINT16 *dc_val;
uint16_t *dc_val;


if (n < 4) if (n < 4)
code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1); code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);
@@ -3657,7 +3656,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int dc_pred_dir; int dc_pred_dir;
RLTable * rl; RLTable * rl;
RL_VLC_ELEM * rl_vlc; RL_VLC_ELEM * rl_vlc;
const UINT8 * scan_table;
const uint8_t * scan_table;
int qmul, qadd; int qmul, qadd;


if(intra) { if(intra) {


+ 16
- 16
libavcodec/h263data.h View File

@@ -1,11 +1,11 @@


/* intra MCBPC, mb_type = (intra), then (intraq) */ /* intra MCBPC, mb_type = (intra), then (intraq) */
const UINT8 intra_MCBPC_code[8] = { 1, 1, 2, 3, 1, 1, 2, 3 };
const UINT8 intra_MCBPC_bits[8] = { 1, 3, 3, 3, 4, 6, 6, 6 };
const uint8_t intra_MCBPC_code[8] = { 1, 1, 2, 3, 1, 1, 2, 3 };
const uint8_t intra_MCBPC_bits[8] = { 1, 3, 3, 3, 4, 6, 6, 6 };


/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */ /* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */ /* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
const UINT8 inter_MCBPC_code[25] = {
const uint8_t inter_MCBPC_code[25] = {
1, 3, 2, 5, 1, 3, 2, 5,
3, 4, 3, 3, 3, 4, 3, 3,
3, 7, 6, 5, 3, 7, 6, 5,
@@ -14,7 +14,7 @@ const UINT8 inter_MCBPC_code[25] = {
1, /* Stuffing */ 1, /* Stuffing */
2, 12, 14, 15, 2, 12, 14, 15,
}; };
const UINT8 inter_MCBPC_bits[25] = {
const uint8_t inter_MCBPC_bits[25] = {
1, 4, 4, 6, 1, 4, 4, 6,
5, 8, 8, 7, 5, 8, 8, 7,
3, 7, 7, 9, 3, 7, 7, 9,
@@ -25,14 +25,14 @@ const UINT8 inter_MCBPC_bits[25] = {
}; };


/* This is the old table /* This is the old table
static const UINT8 inter_MCBPC_code[20] = {
static const uint8_t inter_MCBPC_code[20] = {
1, 3, 2, 5, 1, 3, 2, 5,
3, 4, 3, 3, 3, 4, 3, 3,
0, 1, 2, 3, 0, 1, 2, 3,
4, 4, 3, 2, 4, 4, 3, 2,
2, 5, 4, 5, 2, 5, 4, 5,
}; };
static const UINT8 inter_MCBPC_bits[20] = {
static const uint8_t inter_MCBPC_bits[20] = {
1, 4, 4, 6, 1, 4, 4, 6,
5, 8, 8, 7, 5, 8, 8, 7,
12, 12, 12, 12, 12, 12, 12, 12,
@@ -40,13 +40,13 @@ static const UINT8 inter_MCBPC_bits[20] = {
3, 7, 7, 8, 3, 7, 7, 8,
};*/ };*/


const UINT8 cbpy_tab[16][2] =
const uint8_t cbpy_tab[16][2] =
{ {
{3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4}, {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
{2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2} {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
}; };


const UINT8 mvtab[33][2] =
const uint8_t mvtab[33][2] =
{ {
{1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7}, {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
{11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10},
@@ -56,7 +56,7 @@ const UINT8 mvtab[33][2] =
}; };


/* third non intra table */ /* third non intra table */
const UINT16 inter_vlc[103][2] = {
const uint16_t inter_vlc[103][2] = {
{ 0x2, 2 },{ 0xf, 4 },{ 0x15, 6 },{ 0x17, 7 }, { 0x2, 2 },{ 0xf, 4 },{ 0x15, 6 },{ 0x17, 7 },
{ 0x1f, 8 },{ 0x25, 9 },{ 0x24, 9 },{ 0x21, 10 }, { 0x1f, 8 },{ 0x25, 9 },{ 0x24, 9 },{ 0x21, 10 },
{ 0x20, 10 },{ 0x7, 11 },{ 0x6, 11 },{ 0x20, 11 }, { 0x20, 10 },{ 0x7, 11 },{ 0x6, 11 },{ 0x20, 11 },
@@ -85,7 +85,7 @@ const UINT16 inter_vlc[103][2] = {
{ 0x5e, 12 },{ 0x5f, 12 },{ 0x3, 7 }, { 0x5e, 12 },{ 0x5f, 12 },{ 0x3, 7 },
}; };


const INT8 inter_level[102] = {
const int8_t inter_level[102] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 1, 2, 3, 4, 9, 10, 11, 12, 1, 2, 3, 4,
5, 6, 1, 2, 3, 4, 1, 2, 5, 6, 1, 2, 3, 4, 1, 2,
@@ -101,7 +101,7 @@ const INT8 inter_level[102] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };


const INT8 inter_run[102] = {
const int8_t inter_run[102] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 3, 3, 1, 1, 2, 2, 2, 2, 3, 3,
@@ -125,7 +125,7 @@ static RLTable rl_inter = {
inter_level, inter_level,
}; };


const UINT16 intra_vlc_aic[103][2] = {
const uint16_t intra_vlc_aic[103][2] = {
{ 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 }, { 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 },
{ 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 }, { 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 },
{ 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 }, { 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 },
@@ -154,7 +154,7 @@ const UINT16 intra_vlc_aic[103][2] = {
{ 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 }, { 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 },
}; };


const INT8 intra_run_aic[102] = {
const int8_t intra_run_aic[102] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -170,7 +170,7 @@ const INT8 intra_run_aic[102] = {
18, 19, 20, 21, 22, 23, 18, 19, 20, 21, 22, 23,
}; };


const INT8 intra_level_aic[102] = {
const int8_t intra_level_aic[102] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24,
@@ -194,7 +194,7 @@ static RLTable rl_intra_aic = {
intra_level_aic, intra_level_aic,
}; };


static const UINT16 h263_format[8][2] = {
static const uint16_t h263_format[8][2] = {
{ 0, 0 }, { 0, 0 },
{ 128, 96 }, { 128, 96 },
{ 176, 144 }, { 176, 144 },
@@ -203,7 +203,7 @@ static const UINT16 h263_format[8][2] = {
{ 1408, 1152 }, { 1408, 1152 },
}; };


static UINT8 h263_aic_dc_scale_table[32]={
static uint8_t h263_aic_dc_scale_table[32]={
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62 0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
}; };


+ 3
- 3
libavcodec/h263dec.c View File

@@ -299,7 +299,7 @@ static int decode_slice(MpegEncContext *s){
* finds the end of the current frame in the bitstream. * finds the end of the current frame in the bitstream.
* @return the position of the first byte of the next frame, or -1 * @return the position of the first byte of the next frame, or -1
*/ */
static int mpeg4_find_frame_end(MpegEncContext *s, UINT8 *buf, int buf_size){
static int mpeg4_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
ParseContext *pc= &s->parse_context; ParseContext *pc= &s->parse_context;
int vop_found, i; int vop_found, i;
uint32_t state; uint32_t state;
@@ -403,7 +403,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int


int ff_h263_decode_frame(AVCodecContext *avctx, int ff_h263_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MpegEncContext *s = avctx->priv_data; MpegEncContext *s = avctx->priv_data;
int ret,i; int ret,i;
@@ -629,7 +629,7 @@ retry:
#endif #endif


if(s->error_resilience) if(s->error_resilience)
memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_num*sizeof(UINT8));
memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_num*sizeof(uint8_t));
/* decode each macroblock */ /* decode each macroblock */
s->block_wrap[0]= s->block_wrap[0]=


+ 1
- 1
libavcodec/huffyuv.c View File

@@ -638,7 +638,7 @@ static void decode_bgr_bitstream(HYuvContext *s, int count){


static void draw_slice(HYuvContext *s, int y){ static void draw_slice(HYuvContext *s, int y){
int h, cy; int h, cy;
UINT8 *src_ptr[3];
uint8_t *src_ptr[3];
if(s->avctx->draw_horiz_band==NULL) if(s->avctx->draw_horiz_band==NULL)
return; return;


+ 42
- 42
libavcodec/i386/dsputil_mmx.c View File

@@ -172,7 +172,7 @@ static const uint64_t ff_pw_15 __attribute__ ((aligned(8))) = 0x000F000F000F000F
/***********************************/ /***********************************/
/* standard MMX */ /* standard MMX */


static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size)
static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
{ {
asm volatile( asm volatile(
"movl $-128, %%eax \n\t" "movl $-128, %%eax \n\t"
@@ -200,7 +200,7 @@ static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size)
); );
} }


static inline void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride)
static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride)
{ {
asm volatile( asm volatile(
"pxor %%mm7, %%mm7 \n\t" "pxor %%mm7, %%mm7 \n\t"
@@ -229,10 +229,10 @@ static inline void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8
); );
} }


void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
{ {
const DCTELEM *p; const DCTELEM *p;
UINT8 *pix;
uint8_t *pix;


/* read the pixels */ /* read the pixels */
p = block; p = block;
@@ -284,10 +284,10 @@ void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
:"memory"); :"memory");
} }


void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
{ {
const DCTELEM *p; const DCTELEM *p;
UINT8 *pix;
uint8_t *pix;
int i; int i;


/* read the pixels */ /* read the pixels */
@@ -325,7 +325,7 @@ void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
} while (--i); } while (--i);
} }


static void put_pixels8_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -351,7 +351,7 @@ static void put_pixels8_mmx(UINT8 *block, const UINT8 *pixels, int line_size, in
); );
} }


static void put_pixels16_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -402,7 +402,7 @@ static void clear_blocks_mmx(DCTELEM *blocks)
); );
} }


static int pix_sum16_mmx(UINT8 * pix, int line_size){
static int pix_sum16_mmx(uint8_t * pix, int line_size){
const int h=16; const int h=16;
int sum; int sum;
int index= -line_size*h; int index= -line_size*h;
@@ -505,7 +505,7 @@ static int pix_norm1_mmx(uint8_t *pix, int line_size) {
return tmp; return tmp;
} }


static int sse16_mmx(void *v, UINT8 * pix1, UINT8 * pix2, int line_size) {
static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size) {
int tmp; int tmp;
asm volatile ( asm volatile (
"movl $16,%%ecx\n" "movl $16,%%ecx\n"
@@ -1158,46 +1158,46 @@ static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src,
);\ );\
}\ }\
\ \
static void OPNAME ## qpel8_mc00_ ## MMX (UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels8_mmx(dst, src, stride, 8);\ OPNAME ## pixels8_mmx(dst, src, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc10_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[8];\ uint64_t temp[8];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\ OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc20_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\ OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc30_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[8];\ uint64_t temp[8];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
OPNAME ## pixels8_l2_mmx(dst, src+1, half, stride, stride, 8);\ OPNAME ## pixels8_l2_mmx(dst, src+1, half, stride, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc01_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[8];\ uint64_t temp[8];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\ OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\
}\ }\
\ \
static void OPNAME ## qpel8_mc02_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\
}\ }\
\ \
static void OPNAME ## qpel8_mc03_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[8];\ uint64_t temp[8];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
OPNAME ## pixels8_l2_mmx(dst, src+stride, half, stride, stride, 8);\ OPNAME ## pixels8_l2_mmx(dst, src+stride, half, stride, stride, 8);\
}\ }\
static void OPNAME ## qpel8_mc11_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1206,7 +1206,7 @@ static void OPNAME ## qpel8_mc11_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc31_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1215,7 +1215,7 @@ static void OPNAME ## qpel8_mc31_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc13_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1224,7 +1224,7 @@ static void OPNAME ## qpel8_mc13_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc33_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1233,7 +1233,7 @@ static void OPNAME ## qpel8_mc33_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc21_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1241,7 +1241,7 @@ static void OPNAME ## qpel8_mc21_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc23_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfH= ((uint8_t*)half) + 64;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1249,66 +1249,66 @@ static void OPNAME ## qpel8_mc23_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\
}\ }\
static void OPNAME ## qpel8_mc12_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
put ## RND ## pixels8_l2_mmx(halfH, src, halfH, 8, stride, 9);\ put ## RND ## pixels8_l2_mmx(halfH, src, halfH, 8, stride, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
}\ }\
static void OPNAME ## qpel8_mc32_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[8 + 9];\ uint64_t half[8 + 9];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
put ## RND ## pixels8_l2_mmx(halfH, src+1, halfH, 8, stride, 9);\ put ## RND ## pixels8_l2_mmx(halfH, src+1, halfH, 8, stride, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
}\ }\
static void OPNAME ## qpel8_mc22_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[9];\ uint64_t half[9];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
}\ }\
static void OPNAME ## qpel16_mc00_ ## MMX (UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels16_mmx(dst, src, stride, 16);\ OPNAME ## pixels16_mmx(dst, src, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc10_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[32];\ uint64_t temp[32];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\ OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc20_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\ OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc30_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[32];\ uint64_t temp[32];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
OPNAME ## pixels16_l2_mmx(dst, src+1, half, stride, stride, 16);\ OPNAME ## pixels16_l2_mmx(dst, src+1, half, stride, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc01_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[32];\ uint64_t temp[32];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\ OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\
}\ }\
\ \
static void OPNAME ## qpel16_mc02_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\
}\ }\
\ \
static void OPNAME ## qpel16_mc03_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t temp[32];\ uint64_t temp[32];\
uint8_t * const half= (uint8_t*)temp;\ uint8_t * const half= (uint8_t*)temp;\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
OPNAME ## pixels16_l2_mmx(dst, src+stride, half, stride, stride, 16);\ OPNAME ## pixels16_l2_mmx(dst, src+stride, half, stride, stride, 16);\
}\ }\
static void OPNAME ## qpel16_mc11_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1317,7 +1317,7 @@ static void OPNAME ## qpel16_mc11_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc31_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1326,7 +1326,7 @@ static void OPNAME ## qpel16_mc31_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc13_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1335,7 +1335,7 @@ static void OPNAME ## qpel16_mc13_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc33_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1344,7 +1344,7 @@ static void OPNAME ## qpel16_mc33_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc21_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1352,7 +1352,7 @@ static void OPNAME ## qpel16_mc21_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc23_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[16*2 + 17*2];\ uint64_t half[16*2 + 17*2];\
uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfH= ((uint8_t*)half) + 256;\
uint8_t * const halfHV= ((uint8_t*)half);\ uint8_t * const halfHV= ((uint8_t*)half);\
@@ -1360,21 +1360,21 @@ static void OPNAME ## qpel16_mc23_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\
}\ }\
static void OPNAME ## qpel16_mc12_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[17*2];\ uint64_t half[17*2];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
put ## RND ## pixels16_l2_mmx(halfH, src, halfH, 16, stride, 17);\ put ## RND ## pixels16_l2_mmx(halfH, src, halfH, 16, stride, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
}\ }\
static void OPNAME ## qpel16_mc32_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[17*2];\ uint64_t half[17*2];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
put ## RND ## pixels16_l2_mmx(halfH, src+1, halfH, 16, stride, 17);\ put ## RND ## pixels16_l2_mmx(halfH, src+1, halfH, 16, stride, 17);\
OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
}\ }\
static void OPNAME ## qpel16_mc22_ ## MMX(UINT8 *dst, UINT8 *src, int stride){\
static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
uint64_t half[17*2];\ uint64_t half[17*2];\
uint8_t * const halfH= ((uint8_t*)half);\ uint8_t * const halfH= ((uint8_t*)half);\
put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\


+ 16
- 16
libavcodec/i386/dsputil_mmx_avg.h View File

@@ -25,7 +25,7 @@
/* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm /* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
clobber bug - now it will work with 2.95.2 and also with -fPIC clobber bug - now it will work with 2.95.2 and also with -fPIC
*/ */
static void DEF(put_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -85,7 +85,7 @@ static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"memory"); :"memory");
} }


static void DEF(put_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -154,7 +154,7 @@ static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
} }
/* GL: this function does incorrect rounding if overflow */ /* GL: this function does incorrect rounding if overflow */
static void DEF(put_no_rnd_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BONE(mm6); MOVQ_BONE(mm6);
__asm __volatile( __asm __volatile(
@@ -191,7 +191,7 @@ static void DEF(put_no_rnd_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int li
:"%eax", "memory"); :"%eax", "memory");
} }


static void DEF(put_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -222,7 +222,7 @@ static void DEF(put_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size
} }


/* GL: this function does incorrect rounding if overflow */ /* GL: this function does incorrect rounding if overflow */
static void DEF(put_no_rnd_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BONE(mm6); MOVQ_BONE(mm6);
__asm __volatile( __asm __volatile(
@@ -255,7 +255,7 @@ static void DEF(put_no_rnd_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int li
:"%eax", "memory"); :"%eax", "memory");
} }


static void DEF(avg_pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -283,7 +283,7 @@ static void DEF(avg_pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, i
:"%eax", "memory"); :"%eax", "memory");
} }


static void DEF(avg_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -315,7 +315,7 @@ static void DEF(avg_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size
:"%eax", "memory"); :"%eax", "memory");
} }


static void DEF(avg_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
__asm __volatile( __asm __volatile(
"lea (%3, %3), %%eax \n\t" "lea (%3, %3), %%eax \n\t"
@@ -354,7 +354,7 @@ static void DEF(avg_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size
} }


// Note this is not correctly rounded, but this function is only used for b frames so it doesnt matter // Note this is not correctly rounded, but this function is only used for b frames so it doesnt matter
static void DEF(avg_pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BONE(mm6); MOVQ_BONE(mm6);
__asm __volatile( __asm __volatile(
@@ -396,31 +396,31 @@ static void DEF(avg_pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_siz
} }


//FIXME the following could be optimized too ... //FIXME the following could be optimized too ...
static void DEF(put_no_rnd_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(put_no_rnd_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put_no_rnd_pixels8_x2)(block , pixels , line_size, h); DEF(put_no_rnd_pixels8_x2)(block , pixels , line_size, h);
DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h); DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h);
} }
static void DEF(put_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(put_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put_pixels8_y2)(block , pixels , line_size, h); DEF(put_pixels8_y2)(block , pixels , line_size, h);
DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h); DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h);
} }
static void DEF(put_no_rnd_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(put_no_rnd_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put_no_rnd_pixels8_y2)(block , pixels , line_size, h); DEF(put_no_rnd_pixels8_y2)(block , pixels , line_size, h);
DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h); DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h);
} }
static void DEF(avg_pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg_pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg_pixels8)(block , pixels , line_size, h); DEF(avg_pixels8)(block , pixels , line_size, h);
DEF(avg_pixels8)(block+8, pixels+8, line_size, h); DEF(avg_pixels8)(block+8, pixels+8, line_size, h);
} }
static void DEF(avg_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg_pixels8_x2)(block , pixels , line_size, h); DEF(avg_pixels8_x2)(block , pixels , line_size, h);
DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h); DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h);
} }
static void DEF(avg_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg_pixels8_y2)(block , pixels , line_size, h); DEF(avg_pixels8_y2)(block , pixels , line_size, h);
DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h); DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h);
} }
static void DEF(avg_pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg_pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg_pixels8_xy2)(block , pixels , line_size, h); DEF(avg_pixels8_xy2)(block , pixels , line_size, h);
DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h); DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
} }


+ 14
- 14
libavcodec/i386/dsputil_mmx_rnd.h View File

@@ -22,7 +22,7 @@
*/ */


// put_pixels // put_pixels
static void DEF(put, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
__asm __volatile( __asm __volatile(
@@ -104,7 +104,7 @@ static void DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"memory"); :"memory");
} }


static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
__asm __volatile( __asm __volatile(
@@ -199,7 +199,7 @@ static void DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, in
:"memory"); :"memory");
} }


static void DEF(put, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
__asm __volatile( __asm __volatile(
@@ -228,7 +228,7 @@ static void DEF(put, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_siz
:"eax", "memory"); :"eax", "memory");
} }


static void DEF(put, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_ZERO(mm7); MOVQ_ZERO(mm7);
SET_RND(mm6); // =2 for rnd and =1 for no_rnd version SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
@@ -296,7 +296,7 @@ static void DEF(put, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_si


// avg_pixels // avg_pixels
// in case more speed is needed - unroling would certainly help // in case more speed is needed - unroling would certainly help
static void DEF(avg, pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
JUMPALIGN(); JUMPALIGN();
@@ -315,7 +315,7 @@ static void DEF(avg, pixels8)(UINT8 *block, const UINT8 *pixels, int line_size,
while (--h); while (--h);
} }


static void DEF(avg, pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
JUMPALIGN(); JUMPALIGN();
@@ -338,7 +338,7 @@ static void DEF(avg, pixels16)(UINT8 *block, const UINT8 *pixels, int line_size,
while (--h); while (--h);
} }


static void DEF(avg, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
JUMPALIGN(); JUMPALIGN();
@@ -379,7 +379,7 @@ static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
} while (--h); } while (--h);
} }


static void DEF(avg, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
JUMPALIGN(); JUMPALIGN();
@@ -432,7 +432,7 @@ static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, in
} while (--h); } while (--h);
} }


static void DEF(avg, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_BFE(mm6); MOVQ_BFE(mm6);
__asm __volatile( __asm __volatile(
@@ -472,7 +472,7 @@ static void DEF(avg, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_siz
} }


// this routine is 'slightly' suboptimal but mostly unused // this routine is 'slightly' suboptimal but mostly unused
static void DEF(avg, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{ {
MOVQ_ZERO(mm7); MOVQ_ZERO(mm7);
SET_RND(mm6); // =2 for rnd and =1 for no_rnd version SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
@@ -547,22 +547,22 @@ static void DEF(avg, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_si
} }


//FIXME optimize //FIXME optimize
static void DEF(put, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put, pixels8_y2)(block , pixels , line_size, h); DEF(put, pixels8_y2)(block , pixels , line_size, h);
DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h); DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
} }


static void DEF(put, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put, pixels8_xy2)(block , pixels , line_size, h); DEF(put, pixels8_xy2)(block , pixels , line_size, h);
DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h); DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
} }


static void DEF(avg, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg, pixels8_y2)(block , pixels , line_size, h); DEF(avg, pixels8_y2)(block , pixels , line_size, h);
DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h); DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
} }


static void DEF(avg, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
static void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(avg, pixels8_xy2)(block , pixels , line_size, h); DEF(avg, pixels8_xy2)(block , pixels , line_size, h);
DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h); DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
} }


+ 17
- 17
libavcodec/i386/motion_est_mmx.c View File

@@ -23,7 +23,7 @@
void dsputil_init_pix_mmx(DSPContext* c, unsigned mask); void dsputil_init_pix_mmx(DSPContext* c, unsigned mask);
void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask); void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask);


static const __attribute__ ((aligned(8))) UINT64 round_tab[3]={
static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={
0x0000000000000000, 0x0000000000000000,
0x0001000100010001, 0x0001000100010001,
0x0002000200020002, 0x0002000200020002,
@@ -31,7 +31,7 @@ static const __attribute__ ((aligned(8))) UINT64 round_tab[3]={


static __attribute__ ((aligned(8))) uint64_t bone= 0x0101010101010101LL; static __attribute__ ((aligned(8))) uint64_t bone= 0x0101010101010101LL;


static inline void sad8_mmx(UINT8 *blk1, UINT8 *blk2, int stride, int h)
static inline void sad8_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
{ {
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -67,7 +67,7 @@ static inline void sad8_mmx(UINT8 *blk1, UINT8 *blk2, int stride, int h)
); );
} }


static inline void sad8_mmx2(UINT8 *blk1, UINT8 *blk2, int stride, int h)
static inline void sad8_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
{ {
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -89,7 +89,7 @@ static inline void sad8_mmx2(UINT8 *blk1, UINT8 *blk2, int stride, int h)
); );
} }


static inline void sad8_2_mmx2(UINT8 *blk1a, UINT8 *blk1b, UINT8 *blk2, int stride, int h)
static inline void sad8_2_mmx2(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
{ {
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -115,7 +115,7 @@ static inline void sad8_2_mmx2(UINT8 *blk1a, UINT8 *blk1b, UINT8 *blk2, int stri
); );
} }


static inline void sad8_4_mmx2(UINT8 *blk1, UINT8 *blk2, int stride, int h)
static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
{ //FIXME reuse src { //FIXME reuse src
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -152,7 +152,7 @@ static inline void sad8_4_mmx2(UINT8 *blk1, UINT8 *blk2, int stride, int h)
); );
} }


static inline void sad8_2_mmx(UINT8 *blk1a, UINT8 *blk1b, UINT8 *blk2, int stride, int h)
static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
{ {
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -190,7 +190,7 @@ static inline void sad8_2_mmx(UINT8 *blk1a, UINT8 *blk1b, UINT8 *blk2, int strid
); );
} }


static inline void sad8_4_mmx(UINT8 *blk1, UINT8 *blk2, int stride, int h)
static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
{ {
int len= -(stride<<h); int len= -(stride<<h);
asm volatile( asm volatile(
@@ -268,7 +268,7 @@ static inline int sum_mmx2(void)




#define PIX_SAD(suf)\ #define PIX_SAD(suf)\
static int pix_abs8x8_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs8x8_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t":);\ "pxor %%mm6, %%mm6 \n\t":);\
@@ -277,7 +277,7 @@ static int pix_abs8x8_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
\ \
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
static int sad8x8_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\
static int sad8x8_ ## suf(void *s, uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t":);\ "pxor %%mm6, %%mm6 \n\t":);\
@@ -287,7 +287,7 @@ static int sad8x8_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
\ \
static int pix_abs8x8_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs8x8_x2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\
@@ -300,7 +300,7 @@ static int pix_abs8x8_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
\ \
static int pix_abs8x8_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs8x8_y2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\
@@ -313,7 +313,7 @@ static int pix_abs8x8_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
\ \
static int pix_abs8x8_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs8x8_xy2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\
@@ -326,7 +326,7 @@ static int pix_abs8x8_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
\ \
static int pix_abs16x16_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs16x16_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t":);\ "pxor %%mm6, %%mm6 \n\t":);\
@@ -336,7 +336,7 @@ static int pix_abs16x16_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
\ \
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
static int sad16x16_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\
static int sad16x16_ ## suf(void *s, uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t":);\ "pxor %%mm6, %%mm6 \n\t":);\
@@ -346,7 +346,7 @@ static int sad16x16_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\
\ \
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
static int pix_abs16x16_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs16x16_x2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\
@@ -359,7 +359,7 @@ static int pix_abs16x16_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
\ \
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
static int pix_abs16x16_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs16x16_y2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\
@@ -372,7 +372,7 @@ static int pix_abs16x16_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
\ \
return sum_ ## suf();\ return sum_ ## suf();\
}\ }\
static int pix_abs16x16_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\
static int pix_abs16x16_xy2_ ## suf(uint8_t *blk2, uint8_t *blk1, int stride)\
{\ {\
asm volatile("pxor %%mm7, %%mm7 \n\t"\ asm volatile("pxor %%mm7, %%mm7 \n\t"\
"pxor %%mm6, %%mm6 \n\t"\ "pxor %%mm6, %%mm6 \n\t"\


+ 11
- 11
libavcodec/i386/mpegvideo_mmx.c View File

@@ -25,9 +25,9 @@
#include "../avcodec.h" #include "../avcodec.h"
#include "../simple_idct.h" #include "../simple_idct.h"


extern UINT8 zigzag_direct_noperm[64];
extern UINT16 inv_zigzag_direct16[64];
extern UINT32 inverse[256];
extern uint8_t zigzag_direct_noperm[64];
extern uint16_t inv_zigzag_direct16[64];
extern uint32_t inverse[256];


static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL; static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL;
static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL; static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL;
@@ -144,7 +144,7 @@ static void dct_unquantize_mpeg1_mmx(MpegEncContext *s,
DCTELEM *block, int n, int qscale) DCTELEM *block, int n, int qscale)
{ {
int nCoeffs; int nCoeffs;
const UINT16 *quant_matrix;
const uint16_t *quant_matrix;


assert(s->block_last_index[n]>=0); assert(s->block_last_index[n]>=0);


@@ -272,7 +272,7 @@ static void dct_unquantize_mpeg2_mmx(MpegEncContext *s,
DCTELEM *block, int n, int qscale) DCTELEM *block, int n, int qscale)
{ {
int nCoeffs; int nCoeffs;
const UINT16 *quant_matrix;
const uint16_t *quant_matrix;
assert(s->block_last_index[n]>=0); assert(s->block_last_index[n]>=0);


@@ -404,9 +404,9 @@ asm volatile(


/* draw the edges of width 'w' of an image of size width, height /* draw the edges of width 'w' of an image of size width, height
this mmx version can only handle w==8 || w==16 */ this mmx version can only handle w==8 || w==16 */
static void draw_edges_mmx(UINT8 *buf, int wrap, int width, int height, int w)
static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
{ {
UINT8 *ptr, *last_line;
uint8_t *ptr, *last_line;
int i; int i;


last_line = buf + (height - 1) * wrap; last_line = buf + (height - 1) * wrap;
@@ -505,22 +505,22 @@ void ff_mmxext_idct(DCTELEM *block);


/* XXX: those functions should be suppressed ASAP when all IDCTs are /* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */ converted */
static void ff_libmpeg2mmx_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
ff_mmx_idct (block); ff_mmx_idct (block);
put_pixels_clamped_mmx(block, dest, line_size); put_pixels_clamped_mmx(block, dest, line_size);
} }
static void ff_libmpeg2mmx_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
ff_mmx_idct (block); ff_mmx_idct (block);
add_pixels_clamped_mmx(block, dest, line_size); add_pixels_clamped_mmx(block, dest, line_size);
} }
static void ff_libmpeg2mmx2_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
ff_mmxext_idct (block); ff_mmxext_idct (block);
put_pixels_clamped_mmx(block, dest, line_size); put_pixels_clamped_mmx(block, dest, line_size);
} }
static void ff_libmpeg2mmx2_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
ff_mmxext_idct (block); ff_mmxext_idct (block);
add_pixels_clamped_mmx(block, dest, line_size); add_pixels_clamped_mmx(block, dest, line_size);


+ 2
- 2
libavcodec/i386/mpegvideo_mmx_template.c View File

@@ -37,8 +37,8 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
int qscale, int *overflow) int qscale, int *overflow)
{ {
int level=0, last_non_zero_p1, q; //=0 is cuz gcc says uninitalized ... int level=0, last_non_zero_p1, q; //=0 is cuz gcc says uninitalized ...
const UINT16 *qmat, *bias;
static __align8 INT16 temp_block[64];
const uint16_t *qmat, *bias;
static __align8 int16_t temp_block[64];


//s->fdct (block); //s->fdct (block);
ff_fdct_mmx (block); //cant be anything else ... ff_fdct_mmx (block); //cant be anything else ...


+ 2
- 2
libavcodec/i386/simple_idct_mmx.c View File

@@ -1298,12 +1298,12 @@ void ff_simple_idct_mmx(int16_t *block)


//FIXME merge add/put into the idct //FIXME merge add/put into the idct


void ff_simple_idct_put_mmx(UINT8 *dest, int line_size, DCTELEM *block)
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
{ {
idct(block); idct(block);
put_pixels_clamped_mmx(block, dest, line_size); put_pixels_clamped_mmx(block, dest, line_size);
} }
void ff_simple_idct_add_mmx(UINT8 *dest, int line_size, DCTELEM *block)
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
{ {
idct(block); idct(block);
add_pixels_clamped_mmx(block, dest, line_size); add_pixels_clamped_mmx(block, dest, line_size);


+ 53
- 53
libavcodec/imgconvert.c View File

@@ -29,14 +29,14 @@


typedef struct PixFmtInfo { typedef struct PixFmtInfo {
const char *name; const char *name;
UINT8 nb_components; /* number of components in AVPicture array */
UINT8 is_yuv : 1; /* true if YUV instead of RGB color space */
UINT8 is_packed : 1; /* true if multiple components in same word */
UINT8 is_paletted : 1; /* true if paletted */
UINT8 is_alpha : 1; /* true if alpha can be specified */
UINT8 is_gray : 1; /* true if gray or monochrome format */
UINT8 x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
UINT8 y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
uint8_t nb_components; /* number of components in AVPicture array */
uint8_t is_yuv : 1; /* true if YUV instead of RGB color space */
uint8_t is_packed : 1; /* true if multiple components in same word */
uint8_t is_paletted : 1; /* true if paletted */
uint8_t is_alpha : 1; /* true if alpha can be specified */
uint8_t is_gray : 1; /* true if gray or monochrome format */
uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
} PixFmtInfo; } PixFmtInfo;


/* this table gives more information about formats */ /* this table gives more information about formats */
@@ -136,7 +136,7 @@ const char *avcodec_get_pix_fmt_name(int pix_fmt)
} }


/* Picture field are filled with 'ptr' addresses. Also return size */ /* Picture field are filled with 'ptr' addresses. Also return size */
int avpicture_fill(AVPicture *picture, UINT8 *ptr,
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
int pix_fmt, int width, int height) int pix_fmt, int width, int height)
{ {
int size, w2, h2, size2; int size, w2, h2, size2;
@@ -223,9 +223,9 @@ int avpicture_get_size(int pix_fmt, int width, int height)
static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src, static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src,
int width, int height) int width, int height)
{ {
UINT8 *lum, *cb, *cr;
uint8_t *lum, *cb, *cr;
int x, y; int x, y;
const UINT8 *p;
const uint8_t *p;
lum = dst->data[0]; lum = dst->data[0];
cb = dst->data[1]; cb = dst->data[1];
@@ -258,12 +258,12 @@ static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src,


/* XXX: use generic filter ? */ /* XXX: use generic filter ? */
/* 1x2 -> 1x1 */ /* 1x2 -> 1x1 */
static void shrink2(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void shrink2(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
int w; int w;
UINT8 *s1, *s2, *d;
uint8_t *s1, *s2, *d;


for(;height > 0; height--) { for(;height > 0; height--) {
s1 = src; s1 = src;
@@ -290,12 +290,12 @@ static void shrink2(UINT8 *dst, int dst_wrap,
} }


/* 2x2 -> 1x1 */ /* 2x2 -> 1x1 */
static void shrink22(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void shrink22(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
int w; int w;
UINT8 *s1, *s2, *d;
uint8_t *s1, *s2, *d;


for(;height > 0; height--) { for(;height > 0; height--) {
s1 = src; s1 = src;
@@ -322,12 +322,12 @@ static void shrink22(UINT8 *dst, int dst_wrap,
} }


/* 1x1 -> 2x2 */ /* 1x1 -> 2x2 */
static void grow22(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void grow22(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
int w; int w;
UINT8 *s1, *d;
uint8_t *s1, *d;


for(;height > 0; height--) { for(;height > 0; height--) {
s1 = src; s1 = src;
@@ -350,12 +350,12 @@ static void grow22(UINT8 *dst, int dst_wrap,
} }


/* 1x2 -> 2x1 */ /* 1x2 -> 2x1 */
static void conv411(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void conv411(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
int w, c; int w, c;
UINT8 *s1, *s2, *d;
uint8_t *s1, *s2, *d;


for(;height > 0; height--) { for(;height > 0; height--) {
s1 = src; s1 = src;
@@ -374,8 +374,8 @@ static void conv411(UINT8 *dst, int dst_wrap,
} }
} }


static void img_copy(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void img_copy(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
for(;height > 0; height--) { for(;height > 0; height--) {
@@ -407,9 +407,9 @@ static void img_copy(UINT8 *dst, int dst_wrap,
static void yuv420p_to_ ## rgb_name (AVPicture *dst, AVPicture *src, \ static void yuv420p_to_ ## rgb_name (AVPicture *dst, AVPicture *src, \
int width, int height) \ int width, int height) \
{ \ { \
UINT8 *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *d, *d1, *d2; \
uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *d, *d1, *d2; \
int w, y, cb, cr, r_add, g_add, b_add, width2; \ int w, y, cb, cr, r_add, g_add, b_add, width2; \
UINT8 *cm = cropTbl + MAX_NEG_CROP; \
uint8_t *cm = cropTbl + MAX_NEG_CROP; \
unsigned int r, g, b; \ unsigned int r, g, b; \
\ \
d = dst->data[0]; \ d = dst->data[0]; \
@@ -521,9 +521,9 @@ static void yuv420p_to_ ## rgb_name (AVPicture *dst, AVPicture *src, \
static void yuv422p_to_ ## rgb_name (AVPicture *dst, AVPicture *src, \ static void yuv422p_to_ ## rgb_name (AVPicture *dst, AVPicture *src, \
int width, int height) \ int width, int height) \
{ \ { \
UINT8 *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1; \
uint8_t *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1; \
int w, y, cb, cr, r_add, g_add, b_add, width2; \ int w, y, cb, cr, r_add, g_add, b_add, width2; \
UINT8 *cm = cropTbl + MAX_NEG_CROP; \
uint8_t *cm = cropTbl + MAX_NEG_CROP; \
unsigned int r, g, b; \ unsigned int r, g, b; \
\ \
d = dst->data[0]; \ d = dst->data[0]; \
@@ -582,8 +582,8 @@ static void rgb_name ## _to_yuv420p(AVPicture *dst, AVPicture *src, \
{ \ { \
int wrap, wrap3, x, y; \ int wrap, wrap3, x, y; \
int r, g, b, r1, g1, b1; \ int r, g, b, r1, g1, b1; \
UINT8 *lum, *cb, *cr; \
const UINT8 *p; \
uint8_t *lum, *cb, *cr; \
const uint8_t *p; \
\ \
lum = dst->data[0]; \ lum = dst->data[0]; \
cb = dst->data[1]; \ cb = dst->data[1]; \
@@ -739,7 +739,7 @@ static inline unsigned int bitcopy_n(unsigned int a, int n)


#define RGB_IN(r, g, b, s)\ #define RGB_IN(r, g, b, s)\
{\ {\
unsigned int v = ((const UINT16 *)(s))[0];\
unsigned int v = ((const uint16_t *)(s))[0];\
r = bitcopy_n(v >> (10 - 3), 3);\ r = bitcopy_n(v >> (10 - 3), 3);\
g = bitcopy_n(v >> (5 - 3), 3);\ g = bitcopy_n(v >> (5 - 3), 3);\
b = bitcopy_n(v << 3, 3);\ b = bitcopy_n(v << 3, 3);\
@@ -747,7 +747,7 @@ static inline unsigned int bitcopy_n(unsigned int a, int n)


#define RGB_OUT(d, r, g, b)\ #define RGB_OUT(d, r, g, b)\
{\ {\
((UINT16 *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | 0x8000;\
((uint16_t *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | 0x8000;\
} }


#define BPP 2 #define BPP 2
@@ -762,7 +762,7 @@ RGB_FUNCTIONS(rgb555)


#define RGB_IN(r, g, b, s)\ #define RGB_IN(r, g, b, s)\
{\ {\
unsigned int v = ((const UINT16 *)(s))[0];\
unsigned int v = ((const uint16_t *)(s))[0];\
r = bitcopy_n(v >> (11 - 3), 3);\ r = bitcopy_n(v >> (11 - 3), 3);\
g = bitcopy_n(v >> (5 - 2), 2);\ g = bitcopy_n(v >> (5 - 2), 2);\
b = bitcopy_n(v << 3, 3);\ b = bitcopy_n(v << 3, 3);\
@@ -770,7 +770,7 @@ RGB_FUNCTIONS(rgb555)


#define RGB_OUT(d, r, g, b)\ #define RGB_OUT(d, r, g, b)\
{\ {\
((UINT16 *)(d))[0] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);\
((uint16_t *)(d))[0] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);\
} }


#define BPP 2 #define BPP 2
@@ -833,7 +833,7 @@ RGB_FUNCTIONS(rgb24)


#define RGB_IN(r, g, b, s)\ #define RGB_IN(r, g, b, s)\
{\ {\
unsigned int v = ((const UINT32 *)(s))[0];\
unsigned int v = ((const uint32_t *)(s))[0];\
r = (v >> 16) & 0xff;\ r = (v >> 16) & 0xff;\
g = (v >> 8) & 0xff;\ g = (v >> 8) & 0xff;\
b = v & 0xff;\ b = v & 0xff;\
@@ -841,7 +841,7 @@ RGB_FUNCTIONS(rgb24)


#define RGB_OUT(d, r, g, b)\ #define RGB_OUT(d, r, g, b)\
{\ {\
((UINT32 *)(d))[0] = (0xff << 24) | (r << 16) | (g << 8) | b;\
((uint32_t *)(d))[0] = (0xff << 24) | (r << 16) | (g << 8) | b;\
} }


#define BPP 4 #define BPP 4
@@ -971,8 +971,8 @@ static void gray_to_mono(AVPicture *dst, AVPicture *src,
int width, int height, int xor_mask) int width, int height, int xor_mask)
{ {
int n; int n;
const UINT8 *s;
UINT8 *d;
const uint8_t *s;
uint8_t *d;
int j, b, v, n1, src_wrap, dst_wrap, y; int j, b, v, n1, src_wrap, dst_wrap, y;


s = src->data[0]; s = src->data[0];
@@ -1025,7 +1025,7 @@ static void gray_to_monoblack(AVPicture *dst, AVPicture *src,
} }


/* this is maybe slow, but allows for extensions */ /* this is maybe slow, but allows for extensions */
static inline unsigned char gif_clut_index(UINT8 r, UINT8 g, UINT8 b)
static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
{ {
return ((((r)/47)%6)*6*6+(((g)/47)%6)*6+(((b)/47)%6)); return ((((r)/47)%6)*6*6+(((g)/47)%6)*6+(((b)/47)%6));
} }
@@ -1330,8 +1330,8 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
/* YUV to YUV */ /* YUV to YUV */
if (dst_pix->is_yuv && src_pix->is_yuv) { if (dst_pix->is_yuv && src_pix->is_yuv) {
int x_shift, y_shift, w, h; int x_shift, y_shift, w, h;
void (*resize_func)(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
void (*resize_func)(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height); int width, int height);


/* compute chroma size of the smallest dimensions */ /* compute chroma size of the smallest dimensions */
@@ -1447,11 +1447,11 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
#endif #endif


/* filter parameters: [-1 4 2 4 -1] // 8 */ /* filter parameters: [-1 4 2 4 -1] // 8 */
static void deinterlace_line(UINT8 *dst, UINT8 *lum_m4, UINT8 *lum_m3, UINT8 *lum_m2, UINT8 *lum_m1, UINT8 *lum,
static void deinterlace_line(uint8_t *dst, uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum,
int size) int size)
{ {
#ifndef HAVE_MMX #ifndef HAVE_MMX
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
int sum; int sum;


for(;size > 0;size--) { for(;size > 0;size--) {
@@ -1490,11 +1490,11 @@ static void deinterlace_line(UINT8 *dst, UINT8 *lum_m4, UINT8 *lum_m3, UINT8 *lu
} }
#endif #endif
} }
static void deinterlace_line_inplace(UINT8 *lum_m4, UINT8 *lum_m3, UINT8 *lum_m2, UINT8 *lum_m1, UINT8 *lum,
static void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum,
int size) int size)
{ {
#ifndef HAVE_MMX #ifndef HAVE_MMX
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
int sum; int sum;


for(;size > 0;size--) { for(;size > 0;size--) {
@@ -1536,11 +1536,11 @@ static void deinterlace_line_inplace(UINT8 *lum_m4, UINT8 *lum_m3, UINT8 *lum_m2
/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
top field is copied as is, but the bottom field is deinterlaced top field is copied as is, but the bottom field is deinterlaced
against the top field. */ against the top field. */
static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap,
UINT8 *src1, int src_wrap,
static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap,
uint8_t *src1, int src_wrap,
int width, int height) int width, int height)
{ {
UINT8 *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
int y; int y;


src_m2 = src1; src_m2 = src1;
@@ -1565,13 +1565,13 @@ static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap,
deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width); deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width);
} }


static void deinterlace_bottom_field_inplace(UINT8 *src1, int src_wrap,
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
int width, int height) int width, int height)
{ {
UINT8 *src_m1, *src_0, *src_p1, *src_p2;
uint8_t *src_m1, *src_0, *src_p1, *src_p2;
int y; int y;
UINT8 *buf;
buf = (UINT8*)av_malloc(width);
uint8_t *buf;
buf = (uint8_t*)av_malloc(width);


src_m1 = src1; src_m1 = src1;
memcpy(buf,src_m1,width); memcpy(buf,src_m1,width);


+ 36
- 36
libavcodec/imgresample.c View File

@@ -41,9 +41,9 @@
struct ImgReSampleContext { struct ImgReSampleContext {
int iwidth, iheight, owidth, oheight, topBand, bottomBand, leftBand, rightBand; int iwidth, iheight, owidth, oheight, topBand, bottomBand, leftBand, rightBand;
int h_incr, v_incr; int h_incr, v_incr;
INT16 h_filters[NB_PHASES][NB_TAPS] __align8; /* horizontal filters */
INT16 v_filters[NB_PHASES][NB_TAPS] __align8; /* vertical filters */
UINT8 *line_buf;
int16_t h_filters[NB_PHASES][NB_TAPS] __align8; /* horizontal filters */
int16_t v_filters[NB_PHASES][NB_TAPS] __align8; /* vertical filters */
uint8_t *line_buf;
}; };


static inline int get_phase(int pos) static inline int get_phase(int pos)
@@ -52,12 +52,12 @@ static inline int get_phase(int pos)
} }


/* This function must be optimized */ /* This function must be optimized */
static void h_resample_fast(UINT8 *dst, int dst_width, UINT8 *src, int src_width,
int src_start, int src_incr, INT16 *filters)
static void h_resample_fast(uint8_t *dst, int dst_width, uint8_t *src, int src_width,
int src_start, int src_incr, int16_t *filters)
{ {
int src_pos, phase, sum, i; int src_pos, phase, sum, i;
UINT8 *s;
INT16 *filter;
uint8_t *s;
int16_t *filter;


src_pos = src_start; src_pos = src_start;
for(i=0;i<dst_width;i++) { for(i=0;i<dst_width;i++) {
@@ -95,11 +95,11 @@ static void h_resample_fast(UINT8 *dst, int dst_width, UINT8 *src, int src_width
} }


/* This function must be optimized */ /* This function must be optimized */
static void v_resample(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
INT16 *filter)
static void v_resample(uint8_t *dst, int dst_width, uint8_t *src, int wrap,
int16_t *filter)
{ {
int sum, i; int sum, i;
UINT8 *s;
uint8_t *s;


s = src; s = src;
for(i=0;i<dst_width;i++) { for(i=0;i<dst_width;i++) {
@@ -111,7 +111,7 @@ static void v_resample(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
#else #else
{ {
int j; int j;
UINT8 *s1 = s;
uint8_t *s1 = s;


sum = 0; sum = 0;
for(j=0;j<NB_TAPS;j++) { for(j=0;j<NB_TAPS;j++) {
@@ -154,12 +154,12 @@ static void v_resample(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
#define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016Lx\n", tmp.uq); #define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016Lx\n", tmp.uq);


/* XXX: do four pixels at a time */ /* XXX: do four pixels at a time */
static void h_resample_fast4_mmx(UINT8 *dst, int dst_width, UINT8 *src, int src_width,
int src_start, int src_incr, INT16 *filters)
static void h_resample_fast4_mmx(uint8_t *dst, int dst_width, uint8_t *src, int src_width,
int src_start, int src_incr, int16_t *filters)
{ {
int src_pos, phase; int src_pos, phase;
UINT8 *s;
INT16 *filter;
uint8_t *s;
int16_t *filter;
mmx_t tmp; mmx_t tmp;
src_pos = src_start; src_pos = src_start;
@@ -198,11 +198,11 @@ static void h_resample_fast4_mmx(UINT8 *dst, int dst_width, UINT8 *src, int src_
emms(); emms();
} }


static void v_resample4_mmx(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
INT16 *filter)
static void v_resample4_mmx(uint8_t *dst, int dst_width, uint8_t *src, int wrap,
int16_t *filter)
{ {
int sum, i, v; int sum, i, v;
UINT8 *s;
uint8_t *s;
mmx_t tmp; mmx_t tmp;
mmx_t coefs[4]; mmx_t coefs[4];
@@ -239,7 +239,7 @@ static void v_resample4_mmx(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
packuswb_r2r(mm7, mm0); packuswb_r2r(mm7, mm0);
movq_r2m(mm0, tmp); movq_r2m(mm0, tmp);


*(UINT32 *)dst = tmp.ud[0];
*(uint32_t *)dst = tmp.ud[0];
dst += 4; dst += 4;
s += 4; s += 4;
dst_width -= 4; dst_width -= 4;
@@ -274,8 +274,8 @@ typedef union {
signed short s[8]; signed short s[8];
} vec_ss_t; } vec_ss_t;


void v_resample16_altivec(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
INT16 *filter)
void v_resample16_altivec(uint8_t *dst, int dst_width, uint8_t *src, int wrap,
int16_t *filter)
{ {
int sum, i; int sum, i;
uint8_t *s; uint8_t *s;
@@ -391,12 +391,12 @@ void v_resample16_altivec(UINT8 *dst, int dst_width, UINT8 *src, int wrap,
#endif #endif


/* slow version to handle limit cases. Does not need optimisation */ /* slow version to handle limit cases. Does not need optimisation */
static void h_resample_slow(UINT8 *dst, int dst_width, UINT8 *src, int src_width,
int src_start, int src_incr, INT16 *filters)
static void h_resample_slow(uint8_t *dst, int dst_width, uint8_t *src, int src_width,
int src_start, int src_incr, int16_t *filters)
{ {
int src_pos, phase, sum, j, v, i; int src_pos, phase, sum, j, v, i;
UINT8 *s, *src_end;
INT16 *filter;
uint8_t *s, *src_end;
int16_t *filter;


src_end = src + src_width; src_end = src + src_width;
src_pos = src_start; src_pos = src_start;
@@ -426,8 +426,8 @@ static void h_resample_slow(UINT8 *dst, int dst_width, UINT8 *src, int src_width
} }
} }


static void h_resample(UINT8 *dst, int dst_width, UINT8 *src, int src_width,
int src_start, int src_incr, INT16 *filters)
static void h_resample(uint8_t *dst, int dst_width, uint8_t *src, int src_width,
int src_start, int src_incr, int16_t *filters)
{ {
int n, src_end; int n, src_end;


@@ -463,11 +463,11 @@ static void h_resample(UINT8 *dst, int dst_width, UINT8 *src, int src_width,
} }


static void component_resample(ImgReSampleContext *s, static void component_resample(ImgReSampleContext *s,
UINT8 *output, int owrap, int owidth, int oheight,
UINT8 *input, int iwrap, int iwidth, int iheight)
uint8_t *output, int owrap, int owidth, int oheight,
uint8_t *input, int iwrap, int iwidth, int iheight)
{ {
int src_y, src_y1, last_src_y, ring_y, phase_y, y1, y; int src_y, src_y1, last_src_y, ring_y, phase_y, y1, y;
UINT8 *new_line, *src_line;
uint8_t *new_line, *src_line;


last_src_y = - FCENTER - 1; last_src_y = - FCENTER - 1;
/* position of the bottom of the filter in the source image */ /* position of the bottom of the filter in the source image */
@@ -528,7 +528,7 @@ static void component_resample(ImgReSampleContext *s,


/* XXX: the following filter is quite naive, but it seems to suffice /* XXX: the following filter is quite naive, but it seems to suffice
for 4 taps */ for 4 taps */
static void build_filter(INT16 *filter, float factor)
static void build_filter(int16_t *filter, float factor)
{ {
int ph, i, v; int ph, i, v;
float x, y, tab[NB_TAPS], norm, mult; float x, y, tab[NB_TAPS], norm, mult;
@@ -641,15 +641,15 @@ void av_free(void *ptr)
/* input */ /* input */
#define XSIZE 256 #define XSIZE 256
#define YSIZE 256 #define YSIZE 256
UINT8 img[XSIZE * YSIZE];
uint8_t img[XSIZE * YSIZE];


/* output */ /* output */
#define XSIZE1 512 #define XSIZE1 512
#define YSIZE1 512 #define YSIZE1 512
UINT8 img1[XSIZE1 * YSIZE1];
UINT8 img2[XSIZE1 * YSIZE1];
uint8_t img1[XSIZE1 * YSIZE1];
uint8_t img2[XSIZE1 * YSIZE1];


void save_pgm(const char *filename, UINT8 *img, int xsize, int ysize)
void save_pgm(const char *filename, uint8_t *img, int xsize, int ysize)
{ {
FILE *f; FILE *f;
f=fopen(filename,"w"); f=fopen(filename,"w");
@@ -658,7 +658,7 @@ void save_pgm(const char *filename, UINT8 *img, int xsize, int ysize)
fclose(f); fclose(f);
} }


static void dump_filter(INT16 *filter)
static void dump_filter(int16_t *filter)
{ {
int i, ph; int i, ph;




+ 5
- 5
libavcodec/jfdctfst.c View File

@@ -78,10 +78,10 @@
*/ */


#if CONST_BITS == 8 #if CONST_BITS == 8
#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */
#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */
#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */
#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */
#define FIX_0_382683433 ((int32_t) 98) /* FIX(0.382683433) */
#define FIX_0_541196100 ((int32_t) 139) /* FIX(0.541196100) */
#define FIX_0_707106781 ((int32_t) 181) /* FIX(0.707106781) */
#define FIX_1_306562965 ((int32_t) 334) /* FIX(1.306562965) */
#else #else
#define FIX_0_382683433 FIX(0.382683433) #define FIX_0_382683433 FIX(0.382683433)
#define FIX_0_541196100 FIX(0.541196100) #define FIX_0_541196100 FIX(0.541196100)
@@ -101,7 +101,7 @@
#endif #endif




/* Multiply a DCTELEM variable by an INT32 constant, and immediately
/* Multiply a DCTELEM variable by an int32_t constant, and immediately
* descale to yield a DCTELEM result. * descale to yield a DCTELEM result.
*/ */




+ 17
- 17
libavcodec/jfdctint.c View File

@@ -78,7 +78,7 @@
* they are represented to better-than-integral precision. These outputs * they are represented to better-than-integral precision. These outputs
* require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
* with the recommended scaling. (For 12-bit sample data, the intermediate * with the recommended scaling. (For 12-bit sample data, the intermediate
* array is INT32 anyway.)
* array is int32_t anyway.)
* *
* To avoid overflow of the 32-bit intermediate results in pass 2, we must * To avoid overflow of the 32-bit intermediate results in pass 2, we must
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
@@ -101,18 +101,18 @@
*/ */


#if CONST_BITS == 13 #if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
#define FIX_0_298631336 ((int32_t) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((int32_t) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((int32_t) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((int32_t) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((int32_t) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((int32_t) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((int32_t) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((int32_t) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((int32_t) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((int32_t) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((int32_t) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((int32_t) 25172) /* FIX(3.072711026) */
#else #else
#define FIX_0_298631336 FIX(0.298631336) #define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644) #define FIX_0_390180644 FIX(0.390180644)
@@ -129,7 +129,7 @@
#endif #endif




/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
/* Multiply an int32_t variable by an int32_t constant to yield an int32_t result.
* For 8-bit samples with the recommended scaling, all the variable * For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a * and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
@@ -150,9 +150,9 @@
GLOBAL(void) GLOBAL(void)
ff_jpeg_fdct_islow (DCTELEM * data) ff_jpeg_fdct_islow (DCTELEM * data)
{ {
INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
INT32 tmp10, tmp11, tmp12, tmp13;
INT32 z1, z2, z3, z4, z5;
int32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int32_t tmp10, tmp11, tmp12, tmp13;
int32_t z1, z2, z3, z4, z5;
DCTELEM *dataptr; DCTELEM *dataptr;
int ctr; int ctr;
SHIFT_TEMPS SHIFT_TEMPS


+ 10
- 10
libavcodec/jrevdct.c View File

@@ -92,7 +92,7 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif #endif


#define ONE ((INT32) 1)
#define ONE ((int32_t) 1)


#define CONST_SCALE (ONE << CONST_BITS) #define CONST_SCALE (ONE << CONST_BITS)


@@ -103,16 +103,16 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];
*/ */


/* Actually FIX is no longer used, we precomputed them all */ /* Actually FIX is no longer used, we precomputed them all */
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
#define FIX(x) ((int32_t) ((x) * CONST_SCALE + 0.5))


/* Descale and correctly round an INT32 value that's scaled by N bits.
/* Descale and correctly round an int32_t value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
* the fudge factor is correct for either sign of X. * the fudge factor is correct for either sign of X.
*/ */


#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)


/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
/* Multiply an int32_t variable by an int32_t constant to yield an int32_t result.
* For 8-bit samples with the recommended scaling, all the variable * For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a * and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply; * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
@@ -125,10 +125,10 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];


#ifdef EIGHT_BIT_SAMPLES #ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
#define MULTIPLY(var,const) (((int16_t) (var)) * ((int16_t) (const)))
#endif #endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
#define MULTIPLY(var,const) (((int16_t) (var)) * ((int32_t) (const)))
#endif #endif
#endif #endif


@@ -172,10 +172,10 @@ ones here or successive P-frames will drift too much with Reference frame coding


void j_rev_dct(DCTBLOCK data) void j_rev_dct(DCTBLOCK data)
{ {
INT32 tmp0, tmp1, tmp2, tmp3;
INT32 tmp10, tmp11, tmp12, tmp13;
INT32 z1, z2, z3, z4, z5;
INT32 d0, d1, d2, d3, d4, d5, d6, d7;
int32_t tmp0, tmp1, tmp2, tmp3;
int32_t tmp10, tmp11, tmp12, tmp13;
int32_t z1, z2, z3, z4, z5;
int32_t d0, d1, d2, d3, d4, d5, d6, d7;
register DCTELEM *dataptr; register DCTELEM *dataptr;
int rowctr; int rowctr;


+ 21
- 21
libavcodec/mace.c View File

@@ -24,11 +24,11 @@
* libavcodec api, context stuff, interlaced stereo out). * libavcodec api, context stuff, interlaced stereo out).
*/ */


static const UINT16 MACEtab1[] = { 0xfff3, 0x0008, 0x004c, 0x00de, 0x00de, 0x004c, 0x0008, 0xfff3 };
static const uint16_t MACEtab1[] = { 0xfff3, 0x0008, 0x004c, 0x00de, 0x00de, 0x004c, 0x0008, 0xfff3 };


static const UINT16 MACEtab3[] = { 0xffee, 0x008c, 0x008c, 0xffee };
static const uint16_t MACEtab3[] = { 0xffee, 0x008c, 0x008c, 0xffee };


static const UINT16 MACEtab2[][8] = {
static const uint16_t MACEtab2[][8] = {
{ 0x0025, 0x0074, 0x00CE, 0x014A, 0xFEB5, 0xFF31, 0xFF8B, 0xFFDA }, { 0x0025, 0x0074, 0x00CE, 0x014A, 0xFEB5, 0xFF31, 0xFF8B, 0xFFDA },
{ 0x0027, 0x0079, 0x00D8, 0x015A, 0xFEA5, 0xFF27, 0xFF86, 0xFFD8 }, { 0x0027, 0x0079, 0x00D8, 0x015A, 0xFEA5, 0xFF27, 0xFF86, 0xFFD8 },
{ 0x0029, 0x007F, 0x00E1, 0x0169, 0xFE96, 0xFF1E, 0xFF80, 0xFFD6 }, { 0x0029, 0x007F, 0x00E1, 0x0169, 0xFE96, 0xFF1E, 0xFF80, 0xFFD6 },
@@ -159,7 +159,7 @@ static const UINT16 MACEtab2[][8] = {
{ 0x25A7, 0x741F, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x8BE0, 0xDA58 }, { 0x25A7, 0x741F, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x8BE0, 0xDA58 },
}; };


static const UINT16 MACEtab4[][8] = {
static const uint16_t MACEtab4[][8] = {
{ 0x0040, 0x00D8, 0xFF27, 0xFFBF, 0, 0, 0, 0 }, { 0x0043, 0x00E2, 0xFF1D, 0xFFBC, 0, 0, 0, 0 }, { 0x0040, 0x00D8, 0xFF27, 0xFFBF, 0, 0, 0, 0 }, { 0x0043, 0x00E2, 0xFF1D, 0xFFBC, 0, 0, 0, 0 },
{ 0x0046, 0x00EC, 0xFF13, 0xFFB9, 0, 0, 0, 0 }, { 0x004A, 0x00F6, 0xFF09, 0xFFB5, 0, 0, 0, 0 }, { 0x0046, 0x00EC, 0xFF13, 0xFFB9, 0, 0, 0, 0 }, { 0x004A, 0x00F6, 0xFF09, 0xFFB5, 0, 0, 0, 0 },
{ 0x004D, 0x0101, 0xFEFE, 0xFFB2, 0, 0, 0, 0 }, { 0x0050, 0x010C, 0xFEF3, 0xFFAF, 0, 0, 0, 0 }, { 0x004D, 0x0101, 0xFEFE, 0xFFB2, 0, 0, 0, 0 }, { 0x0050, 0x010C, 0xFEF3, 0xFFAF, 0, 0, 0, 0 },
@@ -234,9 +234,9 @@ typedef struct MACEContext {


/* /// "chomp3()" */ /* /// "chomp3()" */
static void chomp3(MACEContext *ctx, static void chomp3(MACEContext *ctx,
UINT8 val,
const UINT16 tab1[],
const UINT16 tab2[][8])
uint8_t val,
const uint16_t tab1[],
const uint16_t tab2[][8])
{ {
short current; short current;


@@ -253,13 +253,13 @@ static void chomp3(MACEContext *ctx,


/* /// "Exp1to3()" */ /* /// "Exp1to3()" */
static void Exp1to3(MACEContext *ctx, static void Exp1to3(MACEContext *ctx,
UINT8 *inBuffer,
uint8_t *inBuffer,
void *outBuffer, void *outBuffer,
UINT32 cnt,
UINT32 numChannels,
UINT32 whichChannel)
uint32_t cnt,
uint32_t numChannels,
uint32_t whichChannel)
{ {
UINT8 pkt;
uint8_t pkt;


/* /*
if (inState) { if (inState) {
@@ -298,9 +298,9 @@ static void Exp1to3(MACEContext *ctx,


/* /// "chomp6()" */ /* /// "chomp6()" */
static void chomp6(MACEContext *ctx, static void chomp6(MACEContext *ctx,
UINT8 val,
const UINT16 tab1[],
const UINT16 tab2[][8])
uint8_t val,
const uint16_t tab1[],
const uint16_t tab2[][8])
{ {
short current; short current;


@@ -335,13 +335,13 @@ static void chomp6(MACEContext *ctx,


/* /// "Exp1to6()" */ /* /// "Exp1to6()" */
static void Exp1to6(MACEContext *ctx, static void Exp1to6(MACEContext *ctx,
UINT8 *inBuffer,
uint8_t *inBuffer,
void *outBuffer, void *outBuffer,
UINT32 cnt,
UINT32 numChannels,
UINT32 whichChannel)
uint32_t cnt,
uint32_t numChannels,
uint32_t whichChannel)
{ {
UINT8 pkt;
uint8_t pkt;


/* /*
if (inState) { if (inState) {
@@ -389,7 +389,7 @@ static int mace_decode_init(AVCodecContext * avctx)


static int mace_decode_frame(AVCodecContext *avctx, static int mace_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
short *samples; short *samples;
MACEContext *c = avctx->priv_data; MACEContext *c = avctx->priv_data;


+ 46
- 46
libavcodec/mjpeg.c View File

@@ -30,15 +30,15 @@
#undef TWOMATRIXES #undef TWOMATRIXES


typedef struct MJpegContext { typedef struct MJpegContext {
UINT8 huff_size_dc_luminance[12];
UINT16 huff_code_dc_luminance[12];
UINT8 huff_size_dc_chrominance[12];
UINT16 huff_code_dc_chrominance[12];
UINT8 huff_size_ac_luminance[256];
UINT16 huff_code_ac_luminance[256];
UINT8 huff_size_ac_chrominance[256];
UINT16 huff_code_ac_chrominance[256];
uint8_t huff_size_dc_luminance[12];
uint16_t huff_code_dc_luminance[12];
uint8_t huff_size_dc_chrominance[12];
uint16_t huff_code_dc_chrominance[12];
uint8_t huff_size_ac_luminance[256];
uint16_t huff_code_ac_luminance[256];
uint8_t huff_size_ac_chrominance[256];
uint16_t huff_code_ac_chrominance[256];
} MJpegContext; } MJpegContext;


/* JPEG marker codes */ /* JPEG marker codes */
@@ -152,19 +152,19 @@ static const unsigned char std_chrominance_quant_tbl[64] = {


/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
/* IMPORTANT: these are only valid for 8-bit data precision! */ /* IMPORTANT: these are only valid for 8-bit data precision! */
static const UINT8 bits_dc_luminance[17] =
static const uint8_t bits_dc_luminance[17] =
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
static const UINT8 val_dc_luminance[] =
static const uint8_t val_dc_luminance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };


static const UINT8 bits_dc_chrominance[17] =
static const uint8_t bits_dc_chrominance[17] =
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
static const UINT8 val_dc_chrominance[] =
static const uint8_t val_dc_chrominance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };


static const UINT8 bits_ac_luminance[17] =
static const uint8_t bits_ac_luminance[17] =
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
static const UINT8 val_ac_luminance[] =
static const uint8_t val_ac_luminance[] =
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
@@ -188,10 +188,10 @@ static const UINT8 val_ac_luminance[] =
0xf9, 0xfa 0xf9, 0xfa
}; };


static const UINT8 bits_ac_chrominance[17] =
static const uint8_t bits_ac_chrominance[17] =
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };


static const UINT8 val_ac_chrominance[] =
static const uint8_t val_ac_chrominance[] =
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
@@ -216,8 +216,8 @@ static const UINT8 val_ac_chrominance[] =
}; };


/* isn't this function nicer than the one in the libjpeg ? */ /* isn't this function nicer than the one in the libjpeg ? */
static void build_huffman_codes(UINT8 *huff_size, UINT16 *huff_code,
const UINT8 *bits_table, const UINT8 *val_table)
static void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
const uint8_t *bits_table, const uint8_t *val_table)
{ {
int i, j, k,nb, code, sym; int i, j, k,nb, code, sym;


@@ -282,7 +282,7 @@ static inline void put_marker(PutBitContext *p, int code)


/* table_class: 0 = DC coef, 1 = AC coefs */ /* table_class: 0 = DC coef, 1 = AC coefs */
static int put_huffman_table(MpegEncContext *s, int table_class, int table_id, static int put_huffman_table(MpegEncContext *s, int table_class, int table_id,
const UINT8 *bits_table, const UINT8 *value_table)
const uint8_t *bits_table, const uint8_t *value_table)
{ {
PutBitContext *p = &s->pb; PutBitContext *p = &s->pb;
int n, i; int n, i;
@@ -306,7 +306,7 @@ static void jpeg_table_header(MpegEncContext *s)
{ {
PutBitContext *p = &s->pb; PutBitContext *p = &s->pb;
int i, j, size; int i, j, size;
UINT8 *ptr;
uint8_t *ptr;


/* quant matrixes */ /* quant matrixes */
put_marker(p, DQT); put_marker(p, DQT);
@@ -349,7 +349,7 @@ static void jpeg_put_comments(MpegEncContext *s)
{ {
PutBitContext *p = &s->pb; PutBitContext *p = &s->pb;
int size; int size;
UINT8 *ptr;
uint8_t *ptr;


if (s->aspect_ratio_info) if (s->aspect_ratio_info)
{ {
@@ -541,7 +541,7 @@ void mjpeg_picture_trailer(MpegEncContext *s)
} }


static inline void mjpeg_encode_dc(MpegEncContext *s, int val, static inline void mjpeg_encode_dc(MpegEncContext *s, int val,
UINT8 *huff_size, UINT16 *huff_code)
uint8_t *huff_size, uint16_t *huff_code)
{ {
int mant, nbits; int mant, nbits;


@@ -572,8 +572,8 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
int mant, nbits, code, i, j; int mant, nbits, code, i, j;
int component, dc, run, last_index, val; int component, dc, run, last_index, val;
MJpegContext *m = s->mjpeg_ctx; MJpegContext *m = s->mjpeg_ctx;
UINT8 *huff_size_ac;
UINT16 *huff_code_ac;
uint8_t *huff_size_ac;
uint16_t *huff_code_ac;
/* DC coef */ /* DC coef */
component = (n <= 3 ? 0 : n - 4 + 1); component = (n <= 3 ? 0 : n - 4 + 1);
@@ -651,9 +651,9 @@ typedef struct MJpegDecodeContext {


int start_code; /* current start code */ int start_code; /* current start code */
int buffer_size; int buffer_size;
UINT8 *buffer;
uint8_t *buffer;


INT16 quant_matrixes[4][64];
int16_t quant_matrixes[4][64];
VLC vlcs[2][4]; VLC vlcs[2][4];


int org_width, org_height; /* size given at codec init */ int org_width, org_height; /* size given at codec init */
@@ -669,11 +669,11 @@ typedef struct MJpegDecodeContext {
int h_max, v_max; /* maximum h and v counts */ int h_max, v_max; /* maximum h and v counts */
int quant_index[4]; /* quant table index for each component */ int quant_index[4]; /* quant table index for each component */
int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */ int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
UINT8 *current_picture[MAX_COMPONENTS]; /* picture structure */
uint8_t *current_picture[MAX_COMPONENTS]; /* picture structure */
int linesize[MAX_COMPONENTS]; int linesize[MAX_COMPONENTS];
DCTELEM block[64] __align8; DCTELEM block[64] __align8;
ScanTable scantable; ScanTable scantable;
void (*idct_put)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);


int restart_interval; int restart_interval;
int restart_count; int restart_count;
@@ -684,11 +684,11 @@ typedef struct MJpegDecodeContext {


static int mjpeg_decode_dht(MJpegDecodeContext *s); static int mjpeg_decode_dht(MJpegDecodeContext *s);


static void build_vlc(VLC *vlc, const UINT8 *bits_table, const UINT8 *val_table,
static void build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table,
int nb_codes) int nb_codes)
{ {
UINT8 huff_size[256];
UINT16 huff_code[256];
uint8_t huff_size[256];
uint16_t huff_code[256];


memset(huff_size, 0, sizeof(huff_size)); memset(huff_size, 0, sizeof(huff_size));
build_huffman_codes(huff_size, huff_code, bits_table, val_table); build_huffman_codes(huff_size, huff_code, bits_table, val_table);
@@ -776,8 +776,8 @@ static int mjpeg_decode_dqt(MJpegDecodeContext *s)
static int mjpeg_decode_dht(MJpegDecodeContext *s) static int mjpeg_decode_dht(MJpegDecodeContext *s)
{ {
int len, index, i, class, n, v, code_max; int len, index, i, class, n, v, code_max;
UINT8 bits_table[17];
UINT8 val_table[256];
uint8_t bits_table[17];
uint8_t val_table[256];
len = get_bits(&s->gb, 16) - 2; len = get_bits(&s->gb, 16) - 2;


@@ -928,7 +928,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
int nbits, code, i, j, level; int nbits, code, i, j, level;
int run, val; int run, val;
VLC *ac_vlc; VLC *ac_vlc;
INT16 *quant_matrix;
int16_t *quant_matrix;


/* DC coef */ /* DC coef */
val = mjpeg_decode_dc(s, dc_index); val = mjpeg_decode_dc(s, dc_index);
@@ -1071,7 +1071,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
for(mb_y = 0; mb_y < mb_height; mb_y++) { for(mb_y = 0; mb_y < mb_height; mb_y++) {
for(mb_x = 0; mb_x < mb_width; mb_x++) { for(mb_x = 0; mb_x < mb_width; mb_x++) {
for(i=0;i<nb_components;i++) { for(i=0;i<nb_components;i++) {
UINT8 *ptr;
uint8_t *ptr;
int x, y, c; int x, y, c;
n = nb_blocks[i]; n = nb_blocks[i];
c = comp_index[i]; c = comp_index[i];
@@ -1266,7 +1266,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
unsigned int len = get_bits(&s->gb, 16); unsigned int len = get_bits(&s->gb, 16);
if (len >= 2 && len < 32768) { if (len >= 2 && len < 32768) {
/* XXX: any better upper bound */ /* XXX: any better upper bound */
UINT8 *cbuf = av_malloc(len - 1);
uint8_t *cbuf = av_malloc(len - 1);
if (cbuf) { if (cbuf) {
int i; int i;
for (i = 0; i < len - 2; i++) for (i = 0; i < len - 2; i++)
@@ -1318,9 +1318,9 @@ static int valid_marker_list[] =


/* return the 8 bit start code value and update the search /* return the 8 bit start code value and update the search
state. Return -1 if no start code found */ state. Return -1 if no start code found */
static int find_marker(UINT8 **pbuf_ptr, UINT8 *buf_end)
static int find_marker(uint8_t **pbuf_ptr, uint8_t *buf_end)
{ {
UINT8 *buf_ptr;
uint8_t *buf_ptr;
unsigned int v, v2; unsigned int v, v2;
int val; int val;
#ifdef DEBUG #ifdef DEBUG
@@ -1350,10 +1350,10 @@ found:


static int mjpeg_decode_frame(AVCodecContext *avctx, static int mjpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MJpegDecodeContext *s = avctx->priv_data; MJpegDecodeContext *s = avctx->priv_data;
UINT8 *buf_end, *buf_ptr;
uint8_t *buf_end, *buf_ptr;
int i, start_code; int i, start_code;
AVPicture *picture = data; AVPicture *picture = data;


@@ -1387,12 +1387,12 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
/* unescape buffer of SOS */ /* unescape buffer of SOS */
if (start_code == SOS) if (start_code == SOS)
{ {
UINT8 *src = buf_ptr;
UINT8 *dst = s->buffer;
uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;


while (src<buf_end) while (src<buf_end)
{ {
UINT8 x = *(src++);
uint8_t x = *(src++);


*(dst++) = x; *(dst++) = x;
if (x == 0xff) if (x == 0xff)
@@ -1527,10 +1527,10 @@ the_end:


static int mjpegb_decode_frame(AVCodecContext *avctx, static int mjpegb_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MJpegDecodeContext *s = avctx->priv_data; MJpegDecodeContext *s = avctx->priv_data;
UINT8 *buf_end, *buf_ptr;
uint8_t *buf_end, *buf_ptr;
int i; int i;
AVPicture *picture = data; AVPicture *picture = data;
GetBitContext hgb; /* for the header */ GetBitContext hgb; /* for the header */


+ 4
- 4
libavcodec/mlib/dsputil_mlib.c View File

@@ -198,10 +198,10 @@ static void avg_pixels8_xy2_mlib (uint8_t * dest, const uint8_t * ref,
} }




static void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
static void (*put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);




static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int line_size)
static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
{ {
mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size); mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
} }
@@ -209,13 +209,13 @@ static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int lin


/* XXX: those functions should be suppressed ASAP when all IDCTs are /* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */ converted */
static void ff_idct_put_mlib(UINT8 *dest, int line_size, DCTELEM *data)
static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
{ {
mlib_VideoIDCT8x8_S16_S16 (data, data); mlib_VideoIDCT8x8_S16_S16 (data, data);
put_pixels_clamped(data, dest, line_size); put_pixels_clamped(data, dest, line_size);
} }


static void ff_idct_add_mlib(UINT8 *dest, int line_size, DCTELEM *data)
static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
{ {
mlib_VideoIDCT8x8_S16_S16 (data, data); mlib_VideoIDCT8x8_S16_S16 (data, data);
mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size); mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);


+ 10
- 10
libavcodec/motion_est.c View File

@@ -387,7 +387,7 @@ void ff_init_me(MpegEncContext *s){
} }
} }
static int pix_dev(UINT8 * pix, int line_size, int mean)
static int pix_dev(uint8_t * pix, int line_size, int mean)
{ {
int s, i, j; int s, i, j;


@@ -422,7 +422,7 @@ static int full_motion_search(MpegEncContext * s,
{ {
int x1, y1, x2, y2, xx, yy, x, y; int x1, y1, x2, y2, xx, yy, x, y;
int mx, my, dmin, d; int mx, my, dmin, d;
UINT8 *pix;
uint8_t *pix;


xx = 16 * s->mb_x; xx = 16 * s->mb_x;
yy = 16 * s->mb_y; yy = 16 * s->mb_y;
@@ -476,7 +476,7 @@ static int log_motion_search(MpegEncContext * s,
{ {
int x1, y1, x2, y2, xx, yy, x, y; int x1, y1, x2, y2, xx, yy, x, y;
int mx, my, dmin, d; int mx, my, dmin, d;
UINT8 *pix;
uint8_t *pix;


xx = s->mb_x << 4; xx = s->mb_x << 4;
yy = s->mb_y << 4; yy = s->mb_y << 4;
@@ -552,7 +552,7 @@ static int phods_motion_search(MpegEncContext * s,
{ {
int x1, y1, x2, y2, xx, yy, x, y, lastx, d; int x1, y1, x2, y2, xx, yy, x, y, lastx, d;
int mx, my, dminx, dminy; int mx, my, dminx, dminy;
UINT8 *pix;
uint8_t *pix;


xx = s->mb_x << 4; xx = s->mb_x << 4;
yy = s->mb_y << 4; yy = s->mb_y << 4;
@@ -657,7 +657,7 @@ static inline int sad_hpel_motion_search(MpegEncContext * s,
uint32_t *score_map= s->me.score_map; uint32_t *score_map= s->me.score_map;
const int penalty_factor= s->me.sub_penalty_factor; const int penalty_factor= s->me.sub_penalty_factor;
int mx, my, xx, yy, dminh; int mx, my, xx, yy, dminh;
UINT8 *pix, *ptr;
uint8_t *pix, *ptr;
op_pixels_abs_func pix_abs_x2; op_pixels_abs_func pix_abs_x2;
op_pixels_abs_func pix_abs_y2; op_pixels_abs_func pix_abs_y2;
op_pixels_abs_func pix_abs_xy2; op_pixels_abs_func pix_abs_xy2;
@@ -964,7 +964,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int xmin, int ymin, int xma
void ff_estimate_p_frame_motion(MpegEncContext * s, void ff_estimate_p_frame_motion(MpegEncContext * s,
int mb_x, int mb_y) int mb_x, int mb_y)
{ {
UINT8 *pix, *ppix;
uint8_t *pix, *ppix;
int sum, varc, vard, mx, my, range, dmin, xx, yy; int sum, varc, vard, mx, my, range, dmin, xx, yy;
int xmin, ymin, xmax, ymax; int xmin, ymin, xmax, ymax;
int rel_xmin, rel_ymin, rel_xmax, rel_ymax; int rel_xmin, rel_ymin, rel_xmax, rel_ymax;
@@ -1302,7 +1302,7 @@ static inline int check_bidir_mv(MpegEncContext * s,
//FIXME optimize? //FIXME optimize?
//FIXME move into template? //FIXME move into template?
//FIXME better f_code prediction (max mv & distance) //FIXME better f_code prediction (max mv & distance)
UINT16 *mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
uint16_t *mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
uint8_t *dest_y = s->me.scratchpad; uint8_t *dest_y = s->me.scratchpad;
uint8_t *ptr; uint8_t *ptr;
int dxy; int dxy;
@@ -1535,7 +1535,7 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
if(s->me_method>=ME_EPZS){ if(s->me_method>=ME_EPZS){
int score[8]; int score[8];
int i, y; int i, y;
UINT8 * fcode_tab= s->fcode_tab;
uint8_t * fcode_tab= s->fcode_tab;
int best_fcode=-1; int best_fcode=-1;
int best_score=-10000000; int best_score=-10000000;


@@ -1584,7 +1584,7 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
{ {
const int f_code= s->f_code; const int f_code= s->f_code;
int y; int y;
UINT8 * fcode_tab= s->fcode_tab;
uint8_t * fcode_tab= s->fcode_tab;
//int clip=0; //int clip=0;
//int noclip=0; //int noclip=0;
/* clip / convert to intra 16x16 type MVs */ /* clip / convert to intra 16x16 type MVs */
@@ -1648,7 +1648,7 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type) void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type)
{ {
int y; int y;
UINT8 * fcode_tab= s->fcode_tab;
uint8_t * fcode_tab= s->fcode_tab;


// RAL: 8 in MPEG-1, 16 in MPEG-4 // RAL: 8 in MPEG-1, 16 in MPEG-4
int range = (((s->codec_id == CODEC_ID_MPEG1VIDEO) ? 8 : 16) << f_code); int range = (((s->codec_id == CODEC_ID_MPEG1VIDEO) ? 8 : 16) << f_code);


+ 20
- 20
libavcodec/motion_test.c View File

@@ -9,27 +9,27 @@


#include "i386/mmx.h" #include "i386/mmx.h"


int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_mmx1(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_mmx1(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_mmx1(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_xy2_mmx1(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx);
typedef int motion_func(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_mmx(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_mmx1(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_x2_mmx(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_x2_mmx1(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_x2_c(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_y2_mmx(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_y2_mmx1(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_y2_c(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_xy2_mmx(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_xy2_mmx1(uint8_t *blk1, uint8_t *blk2, int lx);
int pix_abs16x16_xy2_c(uint8_t *blk1, uint8_t *blk2, int lx);
typedef int motion_func(uint8_t *blk1, uint8_t *blk2, int lx);


#define WIDTH 64 #define WIDTH 64
#define HEIGHT 64 #define HEIGHT 64


UINT8 img1[WIDTH * HEIGHT];
UINT8 img2[WIDTH * HEIGHT];
uint8_t img1[WIDTH * HEIGHT];
uint8_t img2[WIDTH * HEIGHT];


void fill_random(UINT8 *tab, int size)
void fill_random(uint8_t *tab, int size)
{ {
int i; int i;
for(i=0;i<size;i++) { for(i=0;i<size;i++) {
@@ -48,11 +48,11 @@ void help(void)
exit(1); exit(1);
} }


INT64 gettime(void)
int64_t gettime(void)
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
return (INT64)tv.tv_sec * 1000000 + tv.tv_usec;
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
} }


#define NB_ITS 500 #define NB_ITS 500
@@ -63,8 +63,8 @@ void test_motion(const char *name,
motion_func *test_func, motion_func *ref_func) motion_func *test_func, motion_func *ref_func)
{ {
int x, y, d1, d2, it; int x, y, d1, d2, it;
UINT8 *ptr;
INT64 ti;
uint8_t *ptr;
int64_t ti;
printf("testing '%s'\n", name); printf("testing '%s'\n", name);


/* test correctness */ /* test correctness */


+ 30
- 30
libavcodec/mpeg12.c View File

@@ -67,8 +67,8 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred); static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred);


#ifdef CONFIG_ENCODERS #ifdef CONFIG_ENCODERS
static UINT16 mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
static UINT8 fcode_tab[MAX_MV*2+1];
static uint16_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
static uint8_t fcode_tab[MAX_MV*2+1];


static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2]; static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2];
static uint8_t uni_mpeg1_ac_vlc_len [64*64*2]; static uint8_t uni_mpeg1_ac_vlc_len [64*64*2];
@@ -182,7 +182,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
unsigned int vbv_buffer_size; unsigned int vbv_buffer_size;
unsigned int fps, v; unsigned int fps, v;
int n, i; int n, i;
UINT64 time_code;
uint64_t time_code;
float best_aspect_error= 1E10; float best_aspect_error= 1E10;
float aspect_ratio= s->avctx->aspect_ratio; float aspect_ratio= s->avctx->aspect_ratio;
@@ -242,13 +242,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
/* time code : we must convert from the real frame rate to a /* time code : we must convert from the real frame rate to a
fake mpeg frame rate in case of low frame rate */ fake mpeg frame rate in case of low frame rate */
fps = frame_rate_tab[s->frame_rate_index]; fps = frame_rate_tab[s->frame_rate_index];
time_code = (INT64)s->fake_picture_number * FRAME_RATE_BASE;
time_code = (int64_t)s->fake_picture_number * FRAME_RATE_BASE;
s->gop_picture_number = s->fake_picture_number; s->gop_picture_number = s->fake_picture_number;
put_bits(&s->pb, 5, (UINT32)((time_code / (fps * 3600)) % 24));
put_bits(&s->pb, 6, (UINT32)((time_code / (fps * 60)) % 60));
put_bits(&s->pb, 5, (uint32_t)((time_code / (fps * 3600)) % 24));
put_bits(&s->pb, 6, (uint32_t)((time_code / (fps * 60)) % 60));
put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, (UINT32)((time_code / fps) % 60));
put_bits(&s->pb, 6, (UINT32)((time_code % fps) / FRAME_RATE_BASE));
put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60));
put_bits(&s->pb, 6, (uint32_t)((time_code % fps) / FRAME_RATE_BASE));
put_bits(&s->pb, 1, 1); /* closed gop */ put_bits(&s->pb, 1, 1); /* closed gop */
put_bits(&s->pb, 1, 0); /* broken link */ put_bits(&s->pb, 1, 0); /* broken link */
} }
@@ -257,7 +257,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
/* insert empty P pictures to slow down to the desired /* insert empty P pictures to slow down to the desired
frame rate. Each fake pictures takes about 20 bytes */ frame rate. Each fake pictures takes about 20 bytes */
fps = frame_rate_tab[s->frame_rate_index]; fps = frame_rate_tab[s->frame_rate_index];
n = (((INT64)s->picture_number * fps) / s->frame_rate) - 1;
n = (((int64_t)s->picture_number * fps) / s->frame_rate) - 1;
while (s->fake_picture_number < n) { while (s->fake_picture_number < n) {
mpeg1_skip_picture(s, s->fake_picture_number - mpeg1_skip_picture(s, s->fake_picture_number -
s->gop_picture_number); s->gop_picture_number);
@@ -737,7 +737,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
it is handled slightly differently */ it is handled slightly differently */
level = block[0]; level = block[0];
if (abs(level) == 1) { if (abs(level) == 1) {
code = ((UINT32)level >> 31); /* the sign bit */
code = ((uint32_t)level >> 31); /* the sign bit */
put_bits(&s->pb, 2, code | 0x02); put_bits(&s->pb, 2, code | 0x02);
i = 1; i = 1;
} else { } else {
@@ -1208,8 +1208,8 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
int level, dc, diff, i, j, run; int level, dc, diff, i, j, run;
int component; int component;
RLTable *rl = &rl_mpeg1; RLTable *rl = &rl_mpeg1;
UINT8 * const scantable= s->intra_scantable.permutated;
const UINT16 *quant_matrix= s->intra_matrix;
uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix= s->intra_matrix;
const int qscale= s->qscale; const int qscale= s->qscale;


/* DC coef */ /* DC coef */
@@ -1280,8 +1280,8 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &rl_mpeg1; RLTable *rl = &rl_mpeg1;
UINT8 * const scantable= s->intra_scantable.permutated;
const UINT16 *quant_matrix= s->inter_matrix;
uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix= s->inter_matrix;
const int qscale= s->qscale; const int qscale= s->qscale;


{ {
@@ -1358,8 +1358,8 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &rl_mpeg1; RLTable *rl = &rl_mpeg1;
UINT8 * const scantable= s->intra_scantable.permutated;
const UINT16 *quant_matrix;
uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix;
const int qscale= s->qscale; const int qscale= s->qscale;
int mismatch; int mismatch;


@@ -1438,8 +1438,8 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
int level, dc, diff, i, j, run; int level, dc, diff, i, j, run;
int component; int component;
RLTable *rl; RLTable *rl;
UINT8 * const scantable= s->intra_scantable.permutated;
const UINT16 *quant_matrix;
uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix;
const int qscale= s->qscale; const int qscale= s->qscale;
int mismatch; int mismatch;


@@ -1516,10 +1516,10 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,


typedef struct Mpeg1Context { typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx; MpegEncContext mpeg_enc_ctx;
UINT32 header_state;
uint32_t header_state;
int start_code; /* current start code */ int start_code; /* current start code */
UINT8 buffer[PICTURE_BUFFER_SIZE];
UINT8 *buf_ptr;
uint8_t buffer[PICTURE_BUFFER_SIZE];
uint8_t *buf_ptr;
int buffer_size; int buffer_size;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */ int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int repeat_field; /* true if we must repeat the field */ int repeat_field; /* true if we must repeat the field */
@@ -1546,10 +1546,10 @@ static int mpeg_decode_init(AVCodecContext *avctx)


/* return the 8 bit start code value and update the search /* return the 8 bit start code value and update the search
state. Return -1 if no start code found */ state. Return -1 if no start code found */
static int find_start_code(UINT8 **pbuf_ptr, UINT8 *buf_end,
UINT32 *header_state)
static int find_start_code(uint8_t **pbuf_ptr, uint8_t *buf_end,
uint32_t *header_state)
{ {
UINT8 *buf_ptr;
uint8_t *buf_ptr;
unsigned int state, v; unsigned int state, v;
int val; int val;


@@ -1572,7 +1572,7 @@ static int find_start_code(UINT8 **pbuf_ptr, UINT8 *buf_end,
} }


static int mpeg1_decode_picture(AVCodecContext *avctx, static int mpeg1_decode_picture(AVCodecContext *avctx,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
Mpeg1Context *s1 = avctx->priv_data; Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx; MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -1724,7 +1724,7 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s)
} }


static void mpeg_decode_extension(AVCodecContext *avctx, static void mpeg_decode_extension(AVCodecContext *avctx,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
Mpeg1Context *s1 = avctx->priv_data; Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx; MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -1764,7 +1764,7 @@ static void mpeg_decode_extension(AVCodecContext *avctx,
static int mpeg_decode_slice(AVCodecContext *avctx, static int mpeg_decode_slice(AVCodecContext *avctx,
AVFrame *pict, AVFrame *pict,
int start_code, int start_code,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
Mpeg1Context *s1 = avctx->priv_data; Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx; MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -1897,7 +1897,7 @@ eos: //end of slice
} }


static int mpeg1_decode_sequence(AVCodecContext *avctx, static int mpeg1_decode_sequence(AVCodecContext *avctx,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
Mpeg1Context *s1 = avctx->priv_data; Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx; MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -2010,10 +2010,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
/* handle buffering and image synchronisation */ /* handle buffering and image synchronisation */
static int mpeg_decode_frame(AVCodecContext *avctx, static int mpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
Mpeg1Context *s = avctx->priv_data; Mpeg1Context *s = avctx->priv_data;
UINT8 *buf_end, *buf_ptr, *buf_start;
uint8_t *buf_end, *buf_ptr, *buf_start;
int len, start_code_found, ret, code, start_code, input_size; int len, start_code_found, ret, code, start_code, input_size;
AVFrame *picture = data; AVFrame *picture = data;
MpegEncContext *s2 = &s->mpeg_enc_ctx; MpegEncContext *s2 = &s->mpeg_enc_ctx;


+ 19
- 19
libavcodec/mpeg12data.h View File

@@ -2,7 +2,7 @@
* MPEG1/2 tables * MPEG1/2 tables
*/ */


const INT16 ff_mpeg1_default_intra_matrix[64] = {
const int16_t ff_mpeg1_default_intra_matrix[64] = {
8, 16, 19, 22, 26, 27, 29, 34, 8, 16, 19, 22, 26, 27, 29, 34,
16, 16, 22, 24, 27, 29, 34, 37, 16, 16, 22, 24, 27, 29, 34, 37,
19, 22, 26, 27, 29, 34, 34, 38, 19, 22, 26, 27, 29, 34, 34, 38,
@@ -13,7 +13,7 @@ const INT16 ff_mpeg1_default_intra_matrix[64] = {
27, 29, 35, 38, 46, 56, 69, 83 27, 29, 35, 38, 46, 56, 69, 83
}; };


const INT16 ff_mpeg1_default_non_intra_matrix[64] = {
const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
@@ -47,14 +47,14 @@ const unsigned char vlc_dc_table[256] = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
}; };


const UINT16 vlc_dc_lum_code[12] = {
const uint16_t vlc_dc_lum_code[12] = {
0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
}; };
const unsigned char vlc_dc_lum_bits[12] = { const unsigned char vlc_dc_lum_bits[12] = {
3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
}; };


const UINT16 vlc_dc_chroma_code[12] = {
const uint16_t vlc_dc_chroma_code[12] = {
0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
}; };
const unsigned char vlc_dc_chroma_bits[12] = { const unsigned char vlc_dc_chroma_bits[12] = {
@@ -62,10 +62,10 @@ const unsigned char vlc_dc_chroma_bits[12] = {
}; };


/* simple include everything table for dc, first byte is bits number next 3 are code*/ /* simple include everything table for dc, first byte is bits number next 3 are code*/
static UINT32 mpeg1_lum_dc_uni[512];
static UINT32 mpeg1_chr_dc_uni[512];
static uint32_t mpeg1_lum_dc_uni[512];
static uint32_t mpeg1_chr_dc_uni[512];


static const UINT16 mpeg1_vlc[113][2] = {
static const uint16_t mpeg1_vlc[113][2] = {
{ 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
{ 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
{ 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 }, { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
@@ -98,7 +98,7 @@ static const UINT16 mpeg1_vlc[113][2] = {
{ 0x2, 2 }, /* EOB */ { 0x2, 2 }, /* EOB */
}; };


static const UINT16 mpeg2_vlc[113][2] = {
static const uint16_t mpeg2_vlc[113][2] = {
{0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
{0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
{0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
@@ -131,7 +131,7 @@ static const UINT16 mpeg2_vlc[113][2] = {
{0x06,4}, /* EOB */ {0x06,4}, /* EOB */
}; };


static const INT8 mpeg1_level[111] = {
static const int8_t mpeg1_level[111] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24,
@@ -148,7 +148,7 @@ static const INT8 mpeg1_level[111] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };


static const INT8 mpeg1_run[111] = {
static const int8_t mpeg1_run[111] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -165,8 +165,8 @@ static const INT8 mpeg1_run[111] = {
25, 26, 27, 28, 29, 30, 31, 25, 26, 27, 28, 29, 30, 31,
}; };


static UINT8 mpeg1_index_run[2][64];
static INT8 mpeg1_max_level[2][64];
static uint8_t mpeg1_index_run[2][64];
static int8_t mpeg1_max_level[2][64];


static RLTable rl_mpeg1 = { static RLTable rl_mpeg1 = {
111, 111,
@@ -184,7 +184,7 @@ static RLTable rl_mpeg2 = {
mpeg1_level, mpeg1_level,
}; };


static const UINT8 mbAddrIncrTable[35][2] = {
static const uint8_t mbAddrIncrTable[35][2] = {
{0x1, 1}, {0x1, 1},
{0x3, 3}, {0x3, 3},
{0x2, 3}, {0x2, 3},
@@ -222,7 +222,7 @@ static const UINT8 mbAddrIncrTable[35][2] = {
{0xf, 11}, /* stuffing */ {0xf, 11}, /* stuffing */
}; };


static const UINT8 mbPatTable[63][2] = {
static const uint8_t mbPatTable[63][2] = {
{0xb, 5}, {0xb, 5},
{0x9, 5}, {0x9, 5},
{0xd, 6}, {0xd, 6},
@@ -294,7 +294,7 @@ static const UINT8 mbPatTable[63][2] = {
#define MB_FOR 0x08 #define MB_FOR 0x08
#define MB_QUANT 0x10 #define MB_QUANT 0x10


static const UINT8 table_mb_ptype[32][2] = {
static const uint8_t table_mb_ptype[32][2] = {
{ 0, 0 }, // 0x00 { 0, 0 }, // 0x00
{ 3, 5 }, // 0x01 MB_INTRA { 3, 5 }, // 0x01 MB_INTRA
{ 1, 2 }, // 0x02 MB_PAT { 1, 2 }, // 0x02 MB_PAT
@@ -329,7 +329,7 @@ static const UINT8 table_mb_ptype[32][2] = {
{ 0, 0 }, // 0x1F { 0, 0 }, // 0x1F
}; };


static const UINT8 table_mb_btype[32][2] = {
static const uint8_t table_mb_btype[32][2] = {
{ 0, 0 }, // 0x00 { 0, 0 }, // 0x00
{ 3, 5 }, // 0x01 MB_INTRA { 3, 5 }, // 0x01 MB_INTRA
{ 0, 0 }, // 0x02 { 0, 0 }, // 0x02
@@ -364,7 +364,7 @@ static const UINT8 table_mb_btype[32][2] = {
{ 0, 0 }, // 0x1F { 0, 0 }, // 0x1F
}; };


static const UINT8 mbMotionVectorTable[17][2] = {
static const uint8_t mbMotionVectorTable[17][2] = {
{ 0x1, 1 }, { 0x1, 1 },
{ 0x1, 2 }, { 0x1, 2 },
{ 0x1, 3 }, { 0x1, 3 },
@@ -396,14 +396,14 @@ static const int frame_rate_tab[9] = {
(int)(60 * FRAME_RATE_BASE), (int)(60 * FRAME_RATE_BASE),
}; };


static const UINT8 non_linear_qscale[32] = {
static const uint8_t non_linear_qscale[32] = {
0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7,
8,10,12,14,16,18,20,22, 8,10,12,14,16,18,20,22,
24,28,32,36,40,44,48,52, 24,28,32,36,40,44,48,52,
56,64,72,80,88,96,104,112, 56,64,72,80,88,96,104,112,
}; };


UINT8 ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales?
uint8_t ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales?
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,


+ 13
- 13
libavcodec/mpeg4data.h View File

@@ -34,19 +34,19 @@
#define VOP_STARTCODE 0x1B6 #define VOP_STARTCODE 0x1B6


/* dc encoding for mpeg4 */ /* dc encoding for mpeg4 */
const UINT8 DCtab_lum[13][2] =
const uint8_t DCtab_lum[13][2] =
{ {
{3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7},
{1,8}, {1,9}, {1,10}, {1,11}, {1,8}, {1,9}, {1,10}, {1,11},
}; };


const UINT8 DCtab_chrom[13][2] =
const uint8_t DCtab_chrom[13][2] =
{ {
{3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8}, {3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8},
{1,9}, {1,10}, {1,11}, {1,12}, {1,9}, {1,10}, {1,11}, {1,12},
}; };


const UINT16 intra_vlc[103][2] = {
const uint16_t intra_vlc[103][2] = {
{ 0x2, 2 }, { 0x2, 2 },
{ 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 }, { 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 },
{ 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 }, { 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 },
@@ -76,7 +76,7 @@ const UINT16 intra_vlc[103][2] = {
{ 0x5f, 12 },{ 0x3, 7 }, { 0x5f, 12 },{ 0x3, 7 },
}; };


const INT8 intra_level[102] = {
const int8_t intra_level[102] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24,
@@ -92,7 +92,7 @@ const INT8 intra_level[102] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };


const INT8 intra_run[102] = {
const int8_t intra_run[102] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -116,17 +116,17 @@ static RLTable rl_intra = {
intra_level, intra_level,
}; };


static const UINT16 sprite_trajectory_tab[15][2] = {
static const uint16_t sprite_trajectory_tab[15][2] = {
{0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3},
{0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8},
{0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12}, {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12},
}; };


static const UINT8 mb_type_b_tab[4][2] = {
static const uint8_t mb_type_b_tab[4][2] = {
{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 1}, {1, 2}, {1, 3}, {1, 4},
}; };


static const UINT16 pixel_aspect[16][2]={
static const uint16_t pixel_aspect[16][2]={
{0, 0}, {0, 0},
{1, 1}, {1, 1},
{12, 11}, {12, 11},
@@ -146,7 +146,7 @@ static const UINT16 pixel_aspect[16][2]={
}; };


/* these matrixes will be permuted for the idct */ /* these matrixes will be permuted for the idct */
const INT16 ff_mpeg4_default_intra_matrix[64] = {
const int16_t ff_mpeg4_default_intra_matrix[64] = {
8, 17, 18, 19, 21, 23, 25, 27, 8, 17, 18, 19, 21, 23, 25, 27,
17, 18, 19, 21, 23, 25, 27, 28, 17, 18, 19, 21, 23, 25, 27, 28,
20, 21, 22, 23, 24, 26, 28, 30, 20, 21, 22, 23, 24, 26, 28, 30,
@@ -157,7 +157,7 @@ const INT16 ff_mpeg4_default_intra_matrix[64] = {
27, 28, 30, 32, 35, 38, 41, 45, 27, 28, 30, 32, 35, 38, 41, 45,
}; };


const INT16 ff_mpeg4_default_non_intra_matrix[64] = {
const int16_t ff_mpeg4_default_non_intra_matrix[64] = {
16, 17, 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, 20, 21, 22, 23,
17, 18, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24,
18, 19, 20, 21, 22, 23, 24, 25, 18, 19, 20, 21, 22, 23, 24, 25,
@@ -168,15 +168,15 @@ const INT16 ff_mpeg4_default_non_intra_matrix[64] = {
23, 24, 25, 27, 28, 30, 31, 33, 23, 24, 25, 27, 28, 30, 31, 33,
}; };


UINT8 ff_mpeg4_y_dc_scale_table[32]={
uint8_t ff_mpeg4_y_dc_scale_table[32]={
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,40,42,44,46 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,40,42,44,46
}; };
UINT8 ff_mpeg4_c_dc_scale_table[32]={
uint8_t ff_mpeg4_c_dc_scale_table[32]={
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,20,21,22,23,24,25 0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,20,21,22,23,24,25
}; };


const UINT16 ff_mpeg4_resync_prefix[8]={
const uint16_t ff_mpeg4_resync_prefix[8]={
0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000 0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000
}; };

+ 2
- 2
libavcodec/mpegaudio.c View File

@@ -23,7 +23,7 @@
quantization stage) */ quantization stage) */
#define FRAC_BITS 15 #define FRAC_BITS 15
#define WFRAC_BITS 14 #define WFRAC_BITS 14
#define MUL(a,b) (((INT64)(a) * (INT64)(b)) >> FRAC_BITS)
#define MUL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
#define FIX(a) ((int)((a) * (1 << FRAC_BITS))) #define FIX(a) ((int)((a) * (1 << FRAC_BITS)))


#define SAMPLES_BUF_SIZE 4096 #define SAMPLES_BUF_SIZE 4096
@@ -36,7 +36,7 @@ typedef struct MpegAudioContext {
int bitrate_index; /* bit rate */ int bitrate_index; /* bit rate */
int freq_index; int freq_index;
int frame_size; /* frame size, in bits, without padding */ int frame_size; /* frame size, in bits, without padding */
INT64 nb_samples; /* total number of samples encoded */
int64_t nb_samples; /* total number of samples encoded */
/* padding computation */ /* padding computation */
int frame_frac, frame_frac_incr, do_padding; int frame_frac, frame_frac_incr, do_padding;
short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */ short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */


+ 3
- 3
libavcodec/mpegaudio.h View File

@@ -17,11 +17,11 @@


int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); int l2_select_table(int bitrate, int nb_channels, int freq, int lsf);


extern const UINT16 mpa_bitrate_tab[2][3][15];
extern const UINT16 mpa_freq_tab[3];
extern const uint16_t mpa_bitrate_tab[2][3][15];
extern const uint16_t mpa_freq_tab[3];
extern const unsigned char *alloc_tables[5]; extern const unsigned char *alloc_tables[5];
extern const double enwindow[512]; extern const double enwindow[512];
extern const int sblimit_table[5]; extern const int sblimit_table[5];
extern const int quant_steps[17]; extern const int quant_steps[17];
extern const int quant_bits[17]; extern const int quant_bits[17];
extern const INT32 mpa_enwindow[257];
extern const int32_t mpa_enwindow[257];

+ 78
- 78
libavcodec/mpegaudiodec.c View File

@@ -42,17 +42,17 @@


#define FRAC_ONE (1 << FRAC_BITS) #define FRAC_ONE (1 << FRAC_BITS)


#define MULL(a,b) (((INT64)(a) * (INT64)(b)) >> FRAC_BITS)
#define MUL64(a,b) ((INT64)(a) * (INT64)(b))
#define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
#define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
#define FIX(a) ((int)((a) * FRAC_ONE)) #define FIX(a) ((int)((a) * FRAC_ONE))
/* WARNING: only correct for posititive numbers */ /* WARNING: only correct for posititive numbers */
#define FIXR(a) ((int)((a) * FRAC_ONE + 0.5)) #define FIXR(a) ((int)((a) * FRAC_ONE + 0.5))
#define FRAC_RND(a) (((a) + (FRAC_ONE/2)) >> FRAC_BITS) #define FRAC_RND(a) (((a) + (FRAC_ONE/2)) >> FRAC_BITS)


#if FRAC_BITS <= 15 #if FRAC_BITS <= 15
typedef INT16 MPA_INT;
typedef int16_t MPA_INT;
#else #else
typedef INT32 MPA_INT;
typedef int32_t MPA_INT;
#endif #endif


/****************/ /****************/
@@ -61,14 +61,14 @@ typedef INT32 MPA_INT;
#define BACKSTEP_SIZE 512 #define BACKSTEP_SIZE 512


typedef struct MPADecodeContext { typedef struct MPADecodeContext {
UINT8 inbuf1[2][MPA_MAX_CODED_FRAME_SIZE + BACKSTEP_SIZE]; /* input buffer */
uint8_t inbuf1[2][MPA_MAX_CODED_FRAME_SIZE + BACKSTEP_SIZE]; /* input buffer */
int inbuf_index; int inbuf_index;
UINT8 *inbuf_ptr, *inbuf;
uint8_t *inbuf_ptr, *inbuf;
int frame_size; int frame_size;
int free_format_frame_size; /* frame size in case of free format int free_format_frame_size; /* frame size in case of free format
(zero if currently unknown) */ (zero if currently unknown) */
/* next header (used in free format parsing) */ /* next header (used in free format parsing) */
UINT32 free_format_next_header;
uint32_t free_format_next_header;
int error_protection; int error_protection;
int layer; int layer;
int sample_rate; int sample_rate;
@@ -82,8 +82,8 @@ typedef struct MPADecodeContext {
int lsf; int lsf;
MPA_INT synth_buf[MPA_MAX_CHANNELS][512 * 2]; MPA_INT synth_buf[MPA_MAX_CHANNELS][512 * 2];
int synth_buf_offset[MPA_MAX_CHANNELS]; int synth_buf_offset[MPA_MAX_CHANNELS];
INT32 sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT];
INT32 mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
int32_t sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT];
int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
#ifdef DEBUG #ifdef DEBUG
int frame_count; int frame_count;
#endif #endif
@@ -91,22 +91,22 @@ typedef struct MPADecodeContext {


/* layer 3 "granule" */ /* layer 3 "granule" */
typedef struct GranuleDef { typedef struct GranuleDef {
UINT8 scfsi;
uint8_t scfsi;
int part2_3_length; int part2_3_length;
int big_values; int big_values;
int global_gain; int global_gain;
int scalefac_compress; int scalefac_compress;
UINT8 block_type;
UINT8 switch_point;
uint8_t block_type;
uint8_t switch_point;
int table_select[3]; int table_select[3];
int subblock_gain[3]; int subblock_gain[3];
UINT8 scalefac_scale;
UINT8 count1table_select;
uint8_t scalefac_scale;
uint8_t count1table_select;
int region_size[3]; /* number of huffman codes in each region */ int region_size[3]; /* number of huffman codes in each region */
int preflag; int preflag;
int short_start, long_end; /* long/short band indexes */ int short_start, long_end; /* long/short band indexes */
UINT8 scale_factors[40];
INT32 sb_hybrid[SBLIMIT * 18]; /* 576 samples */
uint8_t scale_factors[40];
int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */
} GranuleDef; } GranuleDef;


#define MODE_EXT_MS_STEREO 2 #define MODE_EXT_MS_STEREO 2
@@ -115,49 +115,49 @@ typedef struct GranuleDef {
/* layer 3 huffman tables */ /* layer 3 huffman tables */
typedef struct HuffTable { typedef struct HuffTable {
int xsize; int xsize;
const UINT8 *bits;
const UINT16 *codes;
const uint8_t *bits;
const uint16_t *codes;
} HuffTable; } HuffTable;


#include "mpegaudiodectab.h" #include "mpegaudiodectab.h"


/* vlc structure for decoding layer 3 huffman tables */ /* vlc structure for decoding layer 3 huffman tables */
static VLC huff_vlc[16]; static VLC huff_vlc[16];
static UINT8 *huff_code_table[16];
static uint8_t *huff_code_table[16];
static VLC huff_quad_vlc[2]; static VLC huff_quad_vlc[2];
/* computed from band_size_long */ /* computed from band_size_long */
static UINT16 band_index_long[9][23];
static uint16_t band_index_long[9][23];
/* XXX: free when all decoders are closed */ /* XXX: free when all decoders are closed */
#define TABLE_4_3_SIZE (8191 + 16) #define TABLE_4_3_SIZE (8191 + 16)
static INT8 *table_4_3_exp;
static int8_t *table_4_3_exp;
#if FRAC_BITS <= 15 #if FRAC_BITS <= 15
static UINT16 *table_4_3_value;
static uint16_t *table_4_3_value;
#else #else
static UINT32 *table_4_3_value;
static uint32_t *table_4_3_value;
#endif #endif
/* intensity stereo coef table */ /* intensity stereo coef table */
static INT32 is_table[2][16];
static INT32 is_table_lsf[2][2][16];
static INT32 csa_table[8][2];
static INT32 mdct_win[8][36];
static int32_t is_table[2][16];
static int32_t is_table_lsf[2][2][16];
static int32_t csa_table[8][2];
static int32_t mdct_win[8][36];


/* lower 2 bits: modulo 3, higher bits: shift */ /* lower 2 bits: modulo 3, higher bits: shift */
static UINT16 scale_factor_modshift[64];
static uint16_t scale_factor_modshift[64];
/* [i][j]: 2^(-j/3) * FRAC_ONE * 2^(i+2) / (2^(i+2) - 1) */ /* [i][j]: 2^(-j/3) * FRAC_ONE * 2^(i+2) / (2^(i+2) - 1) */
static INT32 scale_factor_mult[15][3];
static int32_t scale_factor_mult[15][3];
/* mult table for layer 2 group quantization */ /* mult table for layer 2 group quantization */


#define SCALE_GEN(v) \ #define SCALE_GEN(v) \
{ FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) } { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) }


static INT32 scale_factor_mult2[3][3] = {
static int32_t scale_factor_mult2[3][3] = {
SCALE_GEN(4.0 / 3.0), /* 3 steps */ SCALE_GEN(4.0 / 3.0), /* 3 steps */
SCALE_GEN(4.0 / 5.0), /* 5 steps */ SCALE_GEN(4.0 / 5.0), /* 5 steps */
SCALE_GEN(4.0 / 9.0), /* 9 steps */ SCALE_GEN(4.0 / 9.0), /* 9 steps */
}; };


/* 2^(n/4) */ /* 2^(n/4) */
static UINT32 scale_factor_mult3[4] = {
static uint32_t scale_factor_mult3[4] = {
FIXR(1.0), FIXR(1.0),
FIXR(1.18920711500272106671), FIXR(1.18920711500272106671),
FIXR(1.41421356237309504880), FIXR(1.41421356237309504880),
@@ -171,7 +171,7 @@ static MPA_INT window[512];
static inline int l1_unscale(int n, int mant, int scale_factor) static inline int l1_unscale(int n, int mant, int scale_factor)
{ {
int shift, mod; int shift, mod;
INT64 val;
int64_t val;


shift = scale_factor_modshift[scale_factor]; shift = scale_factor_modshift[scale_factor];
mod = shift & 3; mod = shift & 3;
@@ -203,7 +203,7 @@ static inline int l3_unscale(int value, int exponent)
#if FRAC_BITS <= 15 #if FRAC_BITS <= 15
unsigned int m; unsigned int m;
#else #else
UINT64 m;
uint64_t m;
#endif #endif
int e; int e;


@@ -221,7 +221,7 @@ static inline int l3_unscale(int value, int exponent)
return m; return m;
#else #else
m = MUL64(m, scale_factor_mult3[exponent & 3]); m = MUL64(m, scale_factor_mult3[exponent & 3]);
m = (m + (UINT64_C(1) << (e-1))) >> e;
m = (m + (uint64_t_C(1) << (e-1))) >> e;
return m; return m;
#endif #endif
} }
@@ -232,7 +232,7 @@ static inline int l3_unscale(int value, int exponent)
#define POW_FRAC_BITS 24 #define POW_FRAC_BITS 24
#define POW_FRAC_ONE (1 << POW_FRAC_BITS) #define POW_FRAC_ONE (1 << POW_FRAC_BITS)
#define POW_FIX(a) ((int)((a) * POW_FRAC_ONE)) #define POW_FIX(a) ((int)((a) * POW_FRAC_ONE))
#define POW_MULL(a,b) (((INT64)(a) * (INT64)(b)) >> POW_FRAC_BITS)
#define POW_MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> POW_FRAC_BITS)


static int dev_4_3_coefs[DEV_ORDER]; static int dev_4_3_coefs[DEV_ORDER];


@@ -318,7 +318,7 @@ static int decode_init(AVCodecContext * avctx)
for(i=0;i<15;i++) { for(i=0;i<15;i++) {
int n, norm; int n, norm;
n = i + 2; n = i + 2;
norm = ((INT64_C(1) << n) * FRAC_ONE) / ((1 << n) - 1);
norm = ((int64_t_C(1) << n) * FRAC_ONE) / ((1 << n) - 1);
scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm); scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm);
scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm); scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm);
scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm); scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm);
@@ -350,7 +350,7 @@ static int decode_init(AVCodecContext * avctx)
const HuffTable *h = &mpa_huff_tables[i]; const HuffTable *h = &mpa_huff_tables[i];
int xsize, x, y; int xsize, x, y;
unsigned int n; unsigned int n;
UINT8 *code_table;
uint8_t *code_table;


xsize = h->xsize; xsize = h->xsize;
n = xsize * xsize; n = xsize * xsize;
@@ -577,7 +577,7 @@ static int decode_init(AVCodecContext * avctx)
#define ADD(a, b) tab[a] += tab[b] #define ADD(a, b) tab[a] += tab[b]


/* DCT32 without 1/sqrt(2) coef zero scaling. */ /* DCT32 without 1/sqrt(2) coef zero scaling. */
static void dct32(INT32 *out, INT32 *tab)
static void dct32(int32_t *out, int32_t *tab)
{ {
int tmp0, tmp1; int tmp0, tmp1;


@@ -760,7 +760,7 @@ static void dct32(INT32 *out, INT32 *tab)
#define OUT_SAMPLE(sum)\ #define OUT_SAMPLE(sum)\
{\ {\
int sum1;\ int sum1;\
sum1 = (int)((sum + (INT64_C(1) << (OUT_SHIFT - 1))) >> OUT_SHIFT);\
sum1 = (int)((sum + (int64_t_C(1) << (OUT_SHIFT - 1))) >> OUT_SHIFT);\
if (sum1 < -32768)\ if (sum1 < -32768)\
sum1 = -32768;\ sum1 = -32768;\
else if (sum1 > 32767)\ else if (sum1 > 32767)\
@@ -787,17 +787,17 @@ static void dct32(INT32 *out, INT32 *tab)
32 samples. */ 32 samples. */
/* XXX: optimize by avoiding ring buffer usage */ /* XXX: optimize by avoiding ring buffer usage */
static void synth_filter(MPADecodeContext *s1, static void synth_filter(MPADecodeContext *s1,
int ch, INT16 *samples, int incr,
INT32 sb_samples[SBLIMIT])
int ch, int16_t *samples, int incr,
int32_t sb_samples[SBLIMIT])
{ {
INT32 tmp[32];
int32_t tmp[32];
register MPA_INT *synth_buf, *p; register MPA_INT *synth_buf, *p;
register MPA_INT *w; register MPA_INT *w;
int j, offset, v; int j, offset, v;
#if FRAC_BITS <= 15 #if FRAC_BITS <= 15
int sum; int sum;
#else #else
INT64 sum;
int64_t sum;
#endif #endif


dct32(tmp, sb_samples); dct32(tmp, sb_samples);
@@ -863,7 +863,7 @@ static void synth_filter(MPADecodeContext *s1,
static void imdct12(int *out, int *in) static void imdct12(int *out, int *in)
{ {
int tmp; int tmp;
INT64 in1_3, in1_9, in4_3, in4_9;
int64_t in1_3, in1_9, in4_3, in4_9;


in1_3 = MUL64(in[1], C3); in1_3 = MUL64(in[1], C3);
in1_9 = MUL64(in[1], C9); in1_9 = MUL64(in[1], C9);
@@ -955,7 +955,7 @@ static void imdct36(int *out, int *in)
{ {
int i, j, t0, t1, t2, t3, s0, s1, s2, s3; int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
int tmp[18], *tmp1, *in1; int tmp[18], *tmp1, *in1;
INT64 in3_3, in6_6;
int64_t in3_3, in6_6;


for(i=17;i>=1;i--) for(i=17;i>=1;i--)
in[i] += in[i-1]; in[i] += in[i-1];
@@ -1030,7 +1030,7 @@ static void imdct36(int *out, int *in)
} }


/* fast header check for resync */ /* fast header check for resync */
static int check_header(UINT32 header)
static int check_header(uint32_t header)
{ {
/* header */ /* header */
if ((header & 0xffe00000) != 0xffe00000) if ((header & 0xffe00000) != 0xffe00000)
@@ -1054,7 +1054,7 @@ static int check_header(UINT32 header)
/* header decoding. MUST check the header before because no /* header decoding. MUST check the header before because no
consistency check is done there. Return 1 if free format found and consistency check is done there. Return 1 if free format found and
that the frame size must be computed externally */ that the frame size must be computed externally */
static int decode_header(MPADecodeContext *s, UINT32 header)
static int decode_header(MPADecodeContext *s, uint32_t header)
{ {
int sample_rate, frame_size, mpeg25, padding; int sample_rate, frame_size, mpeg25, padding;
int sample_rate_index, bitrate_index; int sample_rate_index, bitrate_index;
@@ -1155,8 +1155,8 @@ static int decode_header(MPADecodeContext *s, UINT32 header)
static int mp_decode_layer1(MPADecodeContext *s) static int mp_decode_layer1(MPADecodeContext *s)
{ {
int bound, i, v, n, ch, j, mant; int bound, i, v, n, ch, j, mant;
UINT8 allocation[MPA_MAX_CHANNELS][SBLIMIT];
UINT8 scale_factors[MPA_MAX_CHANNELS][SBLIMIT];
uint8_t allocation[MPA_MAX_CHANNELS][SBLIMIT];
uint8_t scale_factors[MPA_MAX_CHANNELS][SBLIMIT];


if (s->mode == MPA_JSTEREO) if (s->mode == MPA_JSTEREO)
bound = (s->mode_ext + 1) * 4; bound = (s->mode_ext + 1) * 4;
@@ -1451,7 +1451,7 @@ static int mp_decode_layer2(MPADecodeContext *s)
*/ */
static void seek_to_maindata(MPADecodeContext *s, unsigned int backstep) static void seek_to_maindata(MPADecodeContext *s, unsigned int backstep)
{ {
UINT8 *ptr;
uint8_t *ptr;


/* compute current position in stream */ /* compute current position in stream */
ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3); ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
@@ -1491,11 +1491,11 @@ static inline void lsf_sf_expand(int *slen,


static void exponents_from_scale_factors(MPADecodeContext *s, static void exponents_from_scale_factors(MPADecodeContext *s,
GranuleDef *g, GranuleDef *g,
INT16 *exponents)
int16_t *exponents)
{ {
const UINT8 *bstab, *pretab;
const uint8_t *bstab, *pretab;
int len, i, j, k, l, v0, shift, gain, gains[3]; int len, i, j, k, l, v0, shift, gain, gains[3];
INT16 *exp_ptr;
int16_t *exp_ptr;


exp_ptr = exponents; exp_ptr = exponents;
gain = g->global_gain - 210; gain = g->global_gain - 210;
@@ -1537,13 +1537,13 @@ static inline int get_bitsz(GetBitContext *s, int n)
} }


static int huffman_decode(MPADecodeContext *s, GranuleDef *g, static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
INT16 *exponents, int end_pos)
int16_t *exponents, int end_pos)
{ {
int s_index; int s_index;
int linbits, code, x, y, l, v, i, j, k, pos; int linbits, code, x, y, l, v, i, j, k, pos;
GetBitContext last_gb; GetBitContext last_gb;
VLC *vlc; VLC *vlc;
UINT8 *code_table;
uint8_t *code_table;


/* low frequencies (called big values) */ /* low frequencies (called big values) */
s_index = 0; s_index = 0;
@@ -1642,8 +1642,8 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
static void reorder_block(MPADecodeContext *s, GranuleDef *g) static void reorder_block(MPADecodeContext *s, GranuleDef *g)
{ {
int i, j, k, len; int i, j, k, len;
INT32 *ptr, *dst, *ptr1;
INT32 tmp[576];
int32_t *ptr, *dst, *ptr1;
int32_t tmp[576];


if (g->block_type != 2) if (g->block_type != 2)
return; return;
@@ -1668,7 +1668,7 @@ static void reorder_block(MPADecodeContext *s, GranuleDef *g)
dst += 3; dst += 3;
} }
} }
memcpy(ptr1, tmp, len * 3 * sizeof(INT32));
memcpy(ptr1, tmp, len * 3 * sizeof(int32_t));
} }
} }


@@ -1678,10 +1678,10 @@ static void compute_stereo(MPADecodeContext *s,
GranuleDef *g0, GranuleDef *g1) GranuleDef *g0, GranuleDef *g1)
{ {
int i, j, k, l; int i, j, k, l;
INT32 v1, v2;
int32_t v1, v2;
int sf_max, tmp0, tmp1, sf, len, non_zero_found; int sf_max, tmp0, tmp1, sf, len, non_zero_found;
INT32 (*is_tab)[16];
INT32 *tab0, *tab1;
int32_t (*is_tab)[16];
int32_t *tab0, *tab1;
int non_zero_found_short[3]; int non_zero_found_short[3];


/* intensity stereo */ /* intensity stereo */
@@ -1804,7 +1804,7 @@ static void compute_stereo(MPADecodeContext *s,
static void compute_antialias(MPADecodeContext *s, static void compute_antialias(MPADecodeContext *s,
GranuleDef *g) GranuleDef *g)
{ {
INT32 *ptr, *p0, *p1, *csa;
int32_t *ptr, *p0, *p1, *csa;
int n, tmp0, tmp1, i, j; int n, tmp0, tmp1, i, j;


/* we antialias only "long" bands */ /* we antialias only "long" bands */
@@ -1837,13 +1837,13 @@ static void compute_antialias(MPADecodeContext *s,


static void compute_imdct(MPADecodeContext *s, static void compute_imdct(MPADecodeContext *s,
GranuleDef *g, GranuleDef *g,
INT32 *sb_samples,
INT32 *mdct_buf)
int32_t *sb_samples,
int32_t *mdct_buf)
{ {
INT32 *ptr, *win, *win1, *buf, *buf2, *out_ptr, *ptr1;
INT32 in[6];
INT32 out[36];
INT32 out2[12];
int32_t *ptr, *win, *win1, *buf, *buf2, *out_ptr, *ptr1;
int32_t in[6];
int32_t out[36];
int32_t out2[12];
int i, j, k, mdct_long_end, v, sblimit; int i, j, k, mdct_long_end, v, sblimit;


/* find last non zero block */ /* find last non zero block */
@@ -1936,12 +1936,12 @@ static void compute_imdct(MPADecodeContext *s,
} }


#if defined(DEBUG) #if defined(DEBUG)
void sample_dump(int fnum, INT32 *tab, int n)
void sample_dump(int fnum, int32_t *tab, int n)
{ {
static FILE *files[16], *f; static FILE *files[16], *f;
char buf[512]; char buf[512];
int i; int i;
INT32 v;
int32_t v;
f = files[fnum]; f = files[fnum];
if (!f) { if (!f) {
@@ -1972,7 +1972,7 @@ void sample_dump(int fnum, INT32 *tab, int n)
for(i=0;i<n;i++) { for(i=0;i<n;i++) {
/* normalize to 23 frac bits */ /* normalize to 23 frac bits */
v = tab[i] << (23 - FRAC_BITS); v = tab[i] << (23 - FRAC_BITS);
fwrite(&v, 1, sizeof(INT32), f);
fwrite(&v, 1, sizeof(int32_t), f);
} }
} }
#endif #endif
@@ -1984,7 +1984,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
int nb_granules, main_data_begin, private_bits; int nb_granules, main_data_begin, private_bits;
int gr, ch, blocksplit_flag, i, j, k, n, bits_pos, bits_left; int gr, ch, blocksplit_flag, i, j, k, n, bits_pos, bits_left;
GranuleDef granules[2][2], *g; GranuleDef granules[2][2], *g;
INT16 exponents[576];
int16_t exponents[576];


/* read side info */ /* read side info */
if (s->lsf) { if (s->lsf) {
@@ -2124,7 +2124,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
bits_pos = get_bits_count(&s->gb); bits_pos = get_bits_count(&s->gb);
if (!s->lsf) { if (!s->lsf) {
UINT8 *sc;
uint8_t *sc;
int slen, slen1, slen2; int slen, slen1, slen2;


/* MPEG1 scale factors */ /* MPEG1 scale factors */
@@ -2328,11 +2328,11 @@ static int mp_decode_frame(MPADecodeContext *s,


static int decode_frame(AVCodecContext * avctx, static int decode_frame(AVCodecContext * avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 * buf, int buf_size)
uint8_t * buf, int buf_size)
{ {
MPADecodeContext *s = avctx->priv_data; MPADecodeContext *s = avctx->priv_data;
UINT32 header;
UINT8 *buf_ptr;
uint32_t header;
uint8_t *buf_ptr;
int len, out_size; int len, out_size;
short *out_samples = data; short *out_samples = data;


@@ -2399,8 +2399,8 @@ static int decode_frame(AVCodecContext * avctx,
memcpy(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); memcpy(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1);
s->inbuf_ptr--; s->inbuf_ptr--;
} else { } else {
UINT8 *p, *pend;
UINT32 header1;
uint8_t *p, *pend;
uint32_t header1;
int padding; int padding;


memcpy(s->inbuf_ptr, buf_ptr, len); memcpy(s->inbuf_ptr, buf_ptr, len);


+ 41
- 41
libavcodec/mpegaudiodectab.h View File

@@ -1,5 +1,5 @@


const UINT16 mpa_bitrate_tab[2][3][15] = {
const uint16_t mpa_bitrate_tab[2][3][15] = {
{ {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
@@ -9,11 +9,11 @@ const UINT16 mpa_bitrate_tab[2][3][15] = {
} }
}; };


const UINT16 mpa_freq_tab[3] = { 44100, 48000, 32000 };
const uint16_t mpa_freq_tab[3] = { 44100, 48000, 32000 };


/*******************************************************/ /*******************************************************/
/* half mpeg encoding window (full precision) */ /* half mpeg encoding window (full precision) */
const INT32 mpa_enwindow[257] = {
const int32_t mpa_enwindow[257] = {
0, -1, -1, -1, -1, -1, -1, -2, 0, -1, -1, -1, -1, -1, -1, -2,
-2, -2, -2, -3, -3, -4, -4, -5, -2, -2, -2, -3, -3, -4, -4, -5,
-5, -6, -7, -7, -8, -9, -10, -11, -5, -6, -7, -7, -8, -9, -10, -11,
@@ -200,13 +200,13 @@ const unsigned char *alloc_tables[5] =
/* layer 3 tables */ /* layer 3 tables */


/* layer3 scale factor size */ /* layer3 scale factor size */
static const UINT8 slen_table[2][16] = {
static const uint8_t slen_table[2][16] = {
{ 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
{ 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 }, { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 },
}; };


/* number of lsf scale factors for a given size */ /* number of lsf scale factors for a given size */
static const UINT8 lsf_nsf_table[6][3][4] = {
static const uint8_t lsf_nsf_table[6][3][4] = {
{ { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } }, { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },
{ { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } }, { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },
{ { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } }, { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },
@@ -217,55 +217,55 @@ static const UINT8 lsf_nsf_table[6][3][4] = {


/* mpegaudio layer 3 huffman tables */ /* mpegaudio layer 3 huffman tables */


const UINT16 mpa_huffcodes_1[4] = {
const uint16_t mpa_huffcodes_1[4] = {
0x0001, 0x0001, 0x0001, 0x0000, 0x0001, 0x0001, 0x0001, 0x0000,
}; };


const UINT8 mpa_huffbits_1[4] = {
const uint8_t mpa_huffbits_1[4] = {
1, 3, 2, 3, 1, 3, 2, 3,
}; };


const UINT16 mpa_huffcodes_2[9] = {
const uint16_t mpa_huffcodes_2[9] = {
0x0001, 0x0002, 0x0001, 0x0003, 0x0001, 0x0001, 0x0003, 0x0002, 0x0001, 0x0002, 0x0001, 0x0003, 0x0001, 0x0001, 0x0003, 0x0002,
0x0000, 0x0000,
}; };


const UINT8 mpa_huffbits_2[9] = {
const uint8_t mpa_huffbits_2[9] = {
1, 3, 6, 3, 3, 5, 5, 5, 1, 3, 6, 3, 3, 5, 5, 5,
6, 6,
}; };


const UINT16 mpa_huffcodes_3[9] = {
const uint16_t mpa_huffcodes_3[9] = {
0x0003, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002, 0x0003, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002,
0x0000, 0x0000,
}; };


const UINT8 mpa_huffbits_3[9] = {
const uint8_t mpa_huffbits_3[9] = {
2, 2, 6, 3, 2, 5, 5, 5, 2, 2, 6, 3, 2, 5, 5, 5,
6, 6,
}; };


const UINT16 mpa_huffcodes_5[16] = {
const uint16_t mpa_huffcodes_5[16] = {
0x0001, 0x0002, 0x0006, 0x0005, 0x0003, 0x0001, 0x0004, 0x0004, 0x0001, 0x0002, 0x0006, 0x0005, 0x0003, 0x0001, 0x0004, 0x0004,
0x0007, 0x0005, 0x0007, 0x0001, 0x0006, 0x0001, 0x0001, 0x0000, 0x0007, 0x0005, 0x0007, 0x0001, 0x0006, 0x0001, 0x0001, 0x0000,
}; };


const UINT8 mpa_huffbits_5[16] = {
const uint8_t mpa_huffbits_5[16] = {
1, 3, 6, 7, 3, 3, 6, 7, 1, 3, 6, 7, 3, 3, 6, 7,
6, 6, 7, 8, 7, 6, 7, 8, 6, 6, 7, 8, 7, 6, 7, 8,
}; };


const UINT16 mpa_huffcodes_6[16] = {
const uint16_t mpa_huffcodes_6[16] = {
0x0007, 0x0003, 0x0005, 0x0001, 0x0006, 0x0002, 0x0003, 0x0002, 0x0007, 0x0003, 0x0005, 0x0001, 0x0006, 0x0002, 0x0003, 0x0002,
0x0005, 0x0004, 0x0004, 0x0001, 0x0003, 0x0003, 0x0002, 0x0000, 0x0005, 0x0004, 0x0004, 0x0001, 0x0003, 0x0003, 0x0002, 0x0000,
}; };


const UINT8 mpa_huffbits_6[16] = {
const uint8_t mpa_huffbits_6[16] = {
3, 3, 5, 7, 3, 2, 4, 5, 3, 3, 5, 7, 3, 2, 4, 5,
4, 4, 5, 6, 6, 5, 6, 7, 4, 4, 5, 6, 6, 5, 6, 7,
}; };


const UINT16 mpa_huffcodes_7[36] = {
const uint16_t mpa_huffcodes_7[36] = {
0x0001, 0x0002, 0x000a, 0x0013, 0x0010, 0x000a, 0x0003, 0x0003, 0x0001, 0x0002, 0x000a, 0x0013, 0x0010, 0x000a, 0x0003, 0x0003,
0x0007, 0x000a, 0x0005, 0x0003, 0x000b, 0x0004, 0x000d, 0x0011, 0x0007, 0x000a, 0x0005, 0x0003, 0x000b, 0x0004, 0x000d, 0x0011,
0x0008, 0x0004, 0x000c, 0x000b, 0x0012, 0x000f, 0x000b, 0x0002, 0x0008, 0x0004, 0x000c, 0x000b, 0x0012, 0x000f, 0x000b, 0x0002,
@@ -273,7 +273,7 @@ const UINT16 mpa_huffcodes_7[36] = {
0x0005, 0x0003, 0x0002, 0x0000, 0x0005, 0x0003, 0x0002, 0x0000,
}; };


const UINT8 mpa_huffbits_7[36] = {
const uint8_t mpa_huffbits_7[36] = {
1, 3, 6, 8, 8, 9, 3, 4, 1, 3, 6, 8, 8, 9, 3, 4,
6, 7, 7, 8, 6, 5, 7, 8, 6, 7, 7, 8, 6, 5, 7, 8,
8, 9, 7, 7, 8, 9, 9, 9, 8, 9, 7, 7, 8, 9, 9, 9,
@@ -281,7 +281,7 @@ const UINT8 mpa_huffbits_7[36] = {
9, 10, 10, 10, 9, 10, 10, 10,
}; };


const UINT16 mpa_huffcodes_8[36] = {
const uint16_t mpa_huffcodes_8[36] = {
0x0003, 0x0004, 0x0006, 0x0012, 0x000c, 0x0005, 0x0005, 0x0001, 0x0003, 0x0004, 0x0006, 0x0012, 0x000c, 0x0005, 0x0005, 0x0001,
0x0002, 0x0010, 0x0009, 0x0003, 0x0007, 0x0003, 0x0005, 0x000e, 0x0002, 0x0010, 0x0009, 0x0003, 0x0007, 0x0003, 0x0005, 0x000e,
0x0007, 0x0003, 0x0013, 0x0011, 0x000f, 0x000d, 0x000a, 0x0004, 0x0007, 0x0003, 0x0013, 0x0011, 0x000f, 0x000d, 0x000a, 0x0004,
@@ -289,7 +289,7 @@ const UINT16 mpa_huffcodes_8[36] = {
0x0004, 0x0001, 0x0001, 0x0000, 0x0004, 0x0001, 0x0001, 0x0000,
}; };


const UINT8 mpa_huffbits_8[36] = {
const uint8_t mpa_huffbits_8[36] = {
2, 3, 6, 8, 8, 9, 3, 2, 2, 3, 6, 8, 8, 9, 3, 2,
4, 8, 8, 8, 6, 4, 6, 8, 4, 8, 8, 8, 6, 4, 6, 8,
8, 9, 8, 8, 8, 9, 9, 10, 8, 9, 8, 8, 8, 9, 9, 10,
@@ -297,7 +297,7 @@ const UINT8 mpa_huffbits_8[36] = {
9, 9, 11, 11, 9, 9, 11, 11,
}; };


const UINT16 mpa_huffcodes_9[36] = {
const uint16_t mpa_huffcodes_9[36] = {
0x0007, 0x0005, 0x0009, 0x000e, 0x000f, 0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0009, 0x000e, 0x000f, 0x0007, 0x0006, 0x0004,
0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0006, 0x0008, 0x0008, 0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0006, 0x0008, 0x0008,
0x0008, 0x0005, 0x000f, 0x0006, 0x0009, 0x000a, 0x0005, 0x0001, 0x0008, 0x0005, 0x000f, 0x0006, 0x0009, 0x000a, 0x0005, 0x0001,
@@ -305,7 +305,7 @@ const UINT16 mpa_huffcodes_9[36] = {
0x0006, 0x0002, 0x0006, 0x0000, 0x0006, 0x0002, 0x0006, 0x0000,
}; };


const UINT8 mpa_huffbits_9[36] = {
const uint8_t mpa_huffbits_9[36] = {
3, 3, 5, 6, 8, 9, 3, 3, 3, 3, 5, 6, 8, 9, 3, 3,
4, 5, 6, 8, 4, 4, 5, 6, 4, 5, 6, 8, 4, 4, 5, 6,
7, 8, 6, 5, 6, 7, 7, 8, 7, 8, 6, 5, 6, 7, 7, 8,
@@ -313,7 +313,7 @@ const UINT8 mpa_huffbits_9[36] = {
8, 8, 9, 9, 8, 8, 9, 9,
}; };


const UINT16 mpa_huffcodes_10[64] = {
const uint16_t mpa_huffcodes_10[64] = {
0x0001, 0x0002, 0x000a, 0x0017, 0x0023, 0x001e, 0x000c, 0x0011, 0x0001, 0x0002, 0x000a, 0x0017, 0x0023, 0x001e, 0x000c, 0x0011,
0x0003, 0x0003, 0x0008, 0x000c, 0x0012, 0x0015, 0x000c, 0x0007, 0x0003, 0x0003, 0x0008, 0x000c, 0x0012, 0x0015, 0x000c, 0x0007,
0x000b, 0x0009, 0x000f, 0x0015, 0x0020, 0x0028, 0x0013, 0x0006, 0x000b, 0x0009, 0x000f, 0x0015, 0x0020, 0x0028, 0x0013, 0x0006,
@@ -324,7 +324,7 @@ const UINT16 mpa_huffcodes_10[64] = {
0x0009, 0x0008, 0x0007, 0x0008, 0x0004, 0x0004, 0x0002, 0x0000, 0x0009, 0x0008, 0x0007, 0x0008, 0x0004, 0x0004, 0x0002, 0x0000,
}; };


const UINT8 mpa_huffbits_10[64] = {
const uint8_t mpa_huffbits_10[64] = {
1, 3, 6, 8, 9, 9, 9, 10, 1, 3, 6, 8, 9, 9, 9, 10,
3, 4, 6, 7, 8, 9, 8, 8, 3, 4, 6, 7, 8, 9, 8, 8,
6, 6, 7, 8, 9, 10, 9, 9, 6, 6, 7, 8, 9, 10, 9, 9,
@@ -335,7 +335,7 @@ const UINT8 mpa_huffbits_10[64] = {
9, 8, 9, 10, 10, 11, 11, 11, 9, 8, 9, 10, 10, 11, 11, 11,
}; };


const UINT16 mpa_huffcodes_11[64] = {
const uint16_t mpa_huffcodes_11[64] = {
0x0003, 0x0004, 0x000a, 0x0018, 0x0022, 0x0021, 0x0015, 0x000f, 0x0003, 0x0004, 0x000a, 0x0018, 0x0022, 0x0021, 0x0015, 0x000f,
0x0005, 0x0003, 0x0004, 0x000a, 0x0020, 0x0011, 0x000b, 0x000a, 0x0005, 0x0003, 0x0004, 0x000a, 0x0020, 0x0011, 0x000b, 0x000a,
0x000b, 0x0007, 0x000d, 0x0012, 0x001e, 0x001f, 0x0014, 0x0005, 0x000b, 0x0007, 0x000d, 0x0012, 0x001e, 0x001f, 0x0014, 0x0005,
@@ -346,7 +346,7 @@ const UINT16 mpa_huffcodes_11[64] = {
0x000b, 0x0004, 0x0006, 0x0006, 0x0006, 0x0003, 0x0002, 0x0000, 0x000b, 0x0004, 0x0006, 0x0006, 0x0006, 0x0003, 0x0002, 0x0000,
}; };


const UINT8 mpa_huffbits_11[64] = {
const uint8_t mpa_huffbits_11[64] = {
2, 3, 5, 7, 8, 9, 8, 9, 2, 3, 5, 7, 8, 9, 8, 9,
3, 3, 4, 6, 8, 8, 7, 8, 3, 3, 4, 6, 8, 8, 7, 8,
5, 5, 6, 7, 8, 9, 8, 8, 5, 5, 6, 7, 8, 9, 8, 8,
@@ -357,7 +357,7 @@ const UINT8 mpa_huffbits_11[64] = {
8, 7, 8, 9, 10, 10, 10, 10, 8, 7, 8, 9, 10, 10, 10, 10,
}; };


const UINT16 mpa_huffcodes_12[64] = {
const uint16_t mpa_huffcodes_12[64] = {
0x0009, 0x0006, 0x0010, 0x0021, 0x0029, 0x0027, 0x0026, 0x001a, 0x0009, 0x0006, 0x0010, 0x0021, 0x0029, 0x0027, 0x0026, 0x001a,
0x0007, 0x0005, 0x0006, 0x0009, 0x0017, 0x0010, 0x001a, 0x000b, 0x0007, 0x0005, 0x0006, 0x0009, 0x0017, 0x0010, 0x001a, 0x000b,
0x0011, 0x0007, 0x000b, 0x000e, 0x0015, 0x001e, 0x000a, 0x0007, 0x0011, 0x0007, 0x000b, 0x000e, 0x0015, 0x001e, 0x000a, 0x0007,
@@ -368,7 +368,7 @@ const UINT16 mpa_huffcodes_12[64] = {
0x001b, 0x000c, 0x0008, 0x000c, 0x0006, 0x0003, 0x0001, 0x0000, 0x001b, 0x000c, 0x0008, 0x000c, 0x0006, 0x0003, 0x0001, 0x0000,
}; };


const UINT8 mpa_huffbits_12[64] = {
const uint8_t mpa_huffbits_12[64] = {
4, 3, 5, 7, 8, 9, 9, 9, 4, 3, 5, 7, 8, 9, 9, 9,
3, 3, 4, 5, 7, 7, 8, 8, 3, 3, 4, 5, 7, 7, 8, 8,
5, 4, 5, 6, 7, 8, 7, 8, 5, 4, 5, 6, 7, 8, 7, 8,
@@ -379,7 +379,7 @@ const UINT8 mpa_huffbits_12[64] = {
9, 8, 8, 9, 9, 9, 9, 10, 9, 8, 8, 9, 9, 9, 9, 10,
}; };


const UINT16 mpa_huffcodes_13[256] = {
const uint16_t mpa_huffcodes_13[256] = {
0x0001, 0x0005, 0x000e, 0x0015, 0x0022, 0x0033, 0x002e, 0x0047, 0x0001, 0x0005, 0x000e, 0x0015, 0x0022, 0x0033, 0x002e, 0x0047,
0x002a, 0x0034, 0x0044, 0x0034, 0x0043, 0x002c, 0x002b, 0x0013, 0x002a, 0x0034, 0x0044, 0x0034, 0x0043, 0x002c, 0x002b, 0x0013,
0x0003, 0x0004, 0x000c, 0x0013, 0x001f, 0x001a, 0x002c, 0x0021, 0x0003, 0x0004, 0x000c, 0x0013, 0x001f, 0x001a, 0x002c, 0x0021,
@@ -414,7 +414,7 @@ const UINT16 mpa_huffcodes_13[256] = {
0x0011, 0x000c, 0x0010, 0x0008, 0x0001, 0x0001, 0x0000, 0x0001, 0x0011, 0x000c, 0x0010, 0x0008, 0x0001, 0x0001, 0x0000, 0x0001,
}; };


const UINT8 mpa_huffbits_13[256] = {
const uint8_t mpa_huffbits_13[256] = {
1, 4, 6, 7, 8, 9, 9, 10, 1, 4, 6, 7, 8, 9, 9, 10,
9, 10, 11, 11, 12, 12, 13, 13, 9, 10, 11, 11, 12, 12, 13, 13,
3, 4, 6, 7, 8, 8, 9, 9, 3, 4, 6, 7, 8, 8, 9, 9,
@@ -449,7 +449,7 @@ const UINT8 mpa_huffbits_13[256] = {
15, 15, 16, 16, 19, 18, 19, 16, 15, 15, 16, 16, 19, 18, 19, 16,
}; };


const UINT16 mpa_huffcodes_15[256] = {
const uint16_t mpa_huffcodes_15[256] = {
0x0007, 0x000c, 0x0012, 0x0035, 0x002f, 0x004c, 0x007c, 0x006c, 0x0007, 0x000c, 0x0012, 0x0035, 0x002f, 0x004c, 0x007c, 0x006c,
0x0059, 0x007b, 0x006c, 0x0077, 0x006b, 0x0051, 0x007a, 0x003f, 0x0059, 0x007b, 0x006c, 0x0077, 0x006b, 0x0051, 0x007a, 0x003f,
0x000d, 0x0005, 0x0010, 0x001b, 0x002e, 0x0024, 0x003d, 0x0033, 0x000d, 0x0005, 0x0010, 0x001b, 0x002e, 0x0024, 0x003d, 0x0033,
@@ -484,7 +484,7 @@ const UINT16 mpa_huffcodes_15[256] = {
0x0015, 0x0010, 0x000a, 0x0006, 0x0008, 0x0006, 0x0002, 0x0000, 0x0015, 0x0010, 0x000a, 0x0006, 0x0008, 0x0006, 0x0002, 0x0000,
}; };


const UINT8 mpa_huffbits_15[256] = {
const uint8_t mpa_huffbits_15[256] = {
3, 4, 5, 7, 7, 8, 9, 9, 3, 4, 5, 7, 7, 8, 9, 9,
9, 10, 10, 11, 11, 11, 12, 13, 9, 10, 10, 11, 11, 11, 12, 13,
4, 3, 5, 6, 7, 7, 8, 8, 4, 3, 5, 6, 7, 7, 8, 8,
@@ -519,7 +519,7 @@ const UINT8 mpa_huffbits_15[256] = {
12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
}; };


const UINT16 mpa_huffcodes_16[256] = {
const uint16_t mpa_huffcodes_16[256] = {
0x0001, 0x0005, 0x000e, 0x002c, 0x004a, 0x003f, 0x006e, 0x005d, 0x0001, 0x0005, 0x000e, 0x002c, 0x004a, 0x003f, 0x006e, 0x005d,
0x00ac, 0x0095, 0x008a, 0x00f2, 0x00e1, 0x00c3, 0x0178, 0x0011, 0x00ac, 0x0095, 0x008a, 0x00f2, 0x00e1, 0x00c3, 0x0178, 0x0011,
0x0003, 0x0004, 0x000c, 0x0014, 0x0023, 0x003e, 0x0035, 0x002f, 0x0003, 0x0004, 0x000c, 0x0014, 0x0023, 0x003e, 0x0035, 0x002f,
@@ -554,7 +554,7 @@ const UINT16 mpa_huffcodes_16[256] = {
0x000d, 0x000c, 0x000a, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, 0x000d, 0x000c, 0x000a, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003,
}; };


const UINT8 mpa_huffbits_16[256] = {
const uint8_t mpa_huffbits_16[256] = {
1, 4, 6, 8, 9, 9, 10, 10, 1, 4, 6, 8, 9, 9, 10, 10,
11, 11, 11, 12, 12, 12, 13, 9, 11, 11, 11, 12, 12, 12, 13, 9,
3, 4, 6, 7, 8, 9, 9, 9, 3, 4, 6, 7, 8, 9, 9, 9,
@@ -589,7 +589,7 @@ const UINT8 mpa_huffbits_16[256] = {
11, 11, 11, 11, 11, 11, 11, 8, 11, 11, 11, 11, 11, 11, 11, 8,
}; };


const UINT16 mpa_huffcodes_24[256] = {
const uint16_t mpa_huffcodes_24[256] = {
0x000f, 0x000d, 0x002e, 0x0050, 0x0092, 0x0106, 0x00f8, 0x01b2, 0x000f, 0x000d, 0x002e, 0x0050, 0x0092, 0x0106, 0x00f8, 0x01b2,
0x01aa, 0x029d, 0x028d, 0x0289, 0x026d, 0x0205, 0x0408, 0x0058, 0x01aa, 0x029d, 0x028d, 0x0289, 0x026d, 0x0205, 0x0408, 0x0058,
0x000e, 0x000c, 0x0015, 0x0026, 0x0047, 0x0082, 0x007a, 0x00d8, 0x000e, 0x000c, 0x0015, 0x0026, 0x0047, 0x0082, 0x007a, 0x00d8,
@@ -624,7 +624,7 @@ const UINT16 mpa_huffcodes_24[256] = {
0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, 0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003,
}; };


const UINT8 mpa_huffbits_24[256] = {
const uint8_t mpa_huffbits_24[256] = {
4, 4, 6, 7, 8, 9, 9, 10, 4, 4, 6, 7, 8, 9, 9, 10,
10, 11, 11, 11, 11, 11, 12, 9, 10, 11, 11, 11, 11, 11, 12, 9,
4, 4, 5, 6, 7, 8, 8, 9, 4, 4, 5, 6, 7, 8, 8, 9,
@@ -678,7 +678,7 @@ const HuffTable mpa_huff_tables[16] = {
{ 16, mpa_huffbits_24, mpa_huffcodes_24 }, { 16, mpa_huffbits_24, mpa_huffcodes_24 },
}; };


const UINT8 mpa_huff_data[32][2] = {
const uint8_t mpa_huff_data[32][2] = {
{ 0, 0 }, { 0, 0 },
{ 1, 0 }, { 1, 0 },
{ 2, 0 }, { 2, 0 },
@@ -715,18 +715,18 @@ const UINT8 mpa_huff_data[32][2] = {




/* huffman tables for quadrules */ /* huffman tables for quadrules */
static UINT8 mpa_quad_codes[2][16] = {
static uint8_t mpa_quad_codes[2][16] = {
{ 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1, }, { 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1, },
{ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, }, { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, },
}; };


static UINT8 mpa_quad_bits[2][16] = {
static uint8_t mpa_quad_bits[2][16] = {
{ 1, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 6, 6, 6, }, { 1, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 6, 6, 6, },
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, },
}; };


/* band size tables */ /* band size tables */
const UINT8 band_size_long[9][22] = {
const uint8_t band_size_long[9][22] = {
{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */ 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */
{ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, { 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
@@ -747,7 +747,7 @@ const UINT8 band_size_long[9][22] = {
40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2, }, /* 8000 */ 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2, }, /* 8000 */
}; };


const UINT8 band_size_short[9][13] = {
const uint8_t band_size_short[9][13] = {
{ 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56, }, /* 44100 */ { 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56, }, /* 44100 */
{ 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66, }, /* 48000 */ { 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66, }, /* 48000 */
{ 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12, }, /* 32000 */ { 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12, }, /* 32000 */
@@ -759,7 +759,7 @@ const UINT8 band_size_short[9][13] = {
{ 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26, }, /* 8000 */ { 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26, }, /* 8000 */
}; };


const UINT8 mpa_pretab[2][22] = {
const uint8_t mpa_pretab[2][22] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 },
}; };


+ 2
- 2
libavcodec/mpegaudiotab.h View File

@@ -54,13 +54,13 @@ static const int bitinv32[32] = {
}; };




static INT16 filter_bank[512];
static int16_t filter_bank[512];


static int scale_factor_table[64]; static int scale_factor_table[64];
#ifdef USE_FLOATS #ifdef USE_FLOATS
static float scale_factor_inv_table[64]; static float scale_factor_inv_table[64];
#else #else
static INT8 scale_factor_shift[64];
static int8_t scale_factor_shift[64];
static unsigned short scale_factor_mult[64]; static unsigned short scale_factor_mult[64];
#endif #endif
static unsigned char scale_diff_table[128]; static unsigned char scale_diff_table[128];


+ 87
- 87
libavcodec/mpegvideo.c View File

@@ -40,11 +40,11 @@ static void dct_unquantize_mpeg2_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); DCTELEM *block, int n, int qscale);
static void dct_unquantize_h263_c(MpegEncContext *s, static void dct_unquantize_h263_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); DCTELEM *block, int n, int qscale);
static void draw_edges_c(UINT8 *buf, int wrap, int width, int height, int w);
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w);
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);


void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w)= draw_edges_c;
void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c;




/* enable all paranoid tests for rounding, overflows, etc... */ /* enable all paranoid tests for rounding, overflows, etc... */
@@ -85,13 +85,13 @@ static const uint8_t h263_chroma_roundtab[16] = {
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
}; };


static UINT16 (*default_mv_penalty)[MAX_MV*2+1]=NULL;
static UINT8 default_fcode_tab[MAX_MV*2+1];
static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL;
static uint8_t default_fcode_tab[MAX_MV*2+1];


enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, -1}; enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, -1};


static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64], static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64],
const UINT16 *quant_matrix, int bias, int qmin, int qmax)
const uint16_t *quant_matrix, int bias, int qmin, int qmax)
{ {
int qscale; int qscale;


@@ -105,7 +105,7 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
/* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */
/* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */
qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) /
qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) /
(qscale * quant_matrix[j])); (qscale * quant_matrix[j]));
} }
} else if (s->fdct == fdct_ifast) { } else if (s->fdct == fdct_ifast) {
@@ -116,7 +116,7 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
/* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */
/* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */
qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) /
qmat[qscale][i] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) /
(aanscales[i] * qscale * quant_matrix[j])); (aanscales[i] * qscale * quant_matrix[j]));
} }
} else { } else {
@@ -127,7 +127,7 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905
so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67
*/ */
qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j]));
qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j]));
// qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); // qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]);
qmat16[qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); qmat16[qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]);


@@ -147,7 +147,7 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
}\ }\
} }


void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable){
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const uint8_t *src_scantable){
int i; int i;
int end; int end;
@@ -174,14 +174,14 @@ void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scanta
/* XXX: those functions should be suppressed ASAP when all IDCTs are /* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */ converted */
// *FIXME* this is ugly hack using local static // *FIXME* this is ugly hack using local static
static void (*ff_put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
static void ff_jref_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
j_rev_dct (block); j_rev_dct (block);
ff_put_pixels_clamped(block, dest, line_size); ff_put_pixels_clamped(block, dest, line_size);
} }
static void ff_jref_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
j_rev_dct (block); j_rev_dct (block);
ff_add_pixels_clamped(block, dest, line_size); ff_add_pixels_clamped(block, dest, line_size);
@@ -312,14 +312,14 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
if(pic->qscale_table==NULL){ if(pic->qscale_table==NULL){
if (s->encoding) { if (s->encoding) {
CHECKED_ALLOCZ(pic->mb_var , s->mb_num * sizeof(INT16))
CHECKED_ALLOCZ(pic->mc_mb_var, s->mb_num * sizeof(INT16))
CHECKED_ALLOCZ(pic->mb_mean , s->mb_num * sizeof(INT8))
CHECKED_ALLOCZ(pic->mb_var , s->mb_num * sizeof(int16_t))
CHECKED_ALLOCZ(pic->mc_mb_var, s->mb_num * sizeof(int16_t))
CHECKED_ALLOCZ(pic->mb_mean , s->mb_num * sizeof(int8_t))
CHECKED_ALLOCZ(pic->mb_cmp_score, s->mb_num * sizeof(int32_t)) CHECKED_ALLOCZ(pic->mb_cmp_score, s->mb_num * sizeof(int32_t))
} }


CHECKED_ALLOCZ(pic->mbskip_table , s->mb_num * sizeof(UINT8)+1) //the +1 is for the slice end check
CHECKED_ALLOCZ(pic->qscale_table , s->mb_num * sizeof(UINT8))
CHECKED_ALLOCZ(pic->mbskip_table , s->mb_num * sizeof(uint8_t)+1) //the +1 is for the slice end check
CHECKED_ALLOCZ(pic->qscale_table , s->mb_num * sizeof(uint8_t))
pic->qstride= s->mb_width; pic->qstride= s->mb_width;
} }
@@ -405,12 +405,12 @@ int MPV_common_init(MpegEncContext *s)
int mv_table_size= (s->mb_width+2)*(s->mb_height+2); int mv_table_size= (s->mb_width+2)*(s->mb_height+2);


/* Allocate MV tables */ /* Allocate MV tables */
CHECKED_ALLOCZ(s->p_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->b_forw_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->b_back_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->b_bidir_forw_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->b_bidir_back_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->b_direct_mv_table , mv_table_size * 2 * sizeof(INT16))
CHECKED_ALLOCZ(s->p_mv_table , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_forw_mv_table , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_back_mv_table , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_bidir_forw_mv_table , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_bidir_back_mv_table , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_direct_mv_table , mv_table_size * 2 * sizeof(int16_t))


//FIXME should be linesize instead of s->width*2 but that isnt known before get_buffer() //FIXME should be linesize instead of s->width*2 but that isnt known before get_buffer()
CHECKED_ALLOCZ(s->me.scratchpad, s->width*2*16*3*sizeof(uint8_t)) CHECKED_ALLOCZ(s->me.scratchpad, s->width*2*16*3*sizeof(uint8_t))
@@ -429,29 +429,29 @@ int MPV_common_init(MpegEncContext *s)
CHECKED_ALLOCZ(s->avctx->stats_out, 256); CHECKED_ALLOCZ(s->avctx->stats_out, 256);
} }
CHECKED_ALLOCZ(s->error_status_table, s->mb_num*sizeof(UINT8))
CHECKED_ALLOCZ(s->error_status_table, s->mb_num*sizeof(uint8_t))
if (s->out_format == FMT_H263 || s->encoding) { if (s->out_format == FMT_H263 || s->encoding) {
int size; int size;
/* Allocate MB type table */ /* Allocate MB type table */
CHECKED_ALLOCZ(s->mb_type , s->mb_num * sizeof(UINT8))
CHECKED_ALLOCZ(s->mb_type , s->mb_num * sizeof(uint8_t))


/* MV prediction */ /* MV prediction */
size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
CHECKED_ALLOCZ(s->motion_val, size * 2 * sizeof(INT16));
CHECKED_ALLOCZ(s->motion_val, size * 2 * sizeof(int16_t));
} }


if(s->codec_id==CODEC_ID_MPEG4){ if(s->codec_id==CODEC_ID_MPEG4){
/* interlaced direct mode decoding tables */ /* interlaced direct mode decoding tables */
CHECKED_ALLOCZ(s->field_mv_table, s->mb_num*2*2 * sizeof(INT16))
CHECKED_ALLOCZ(s->field_select_table, s->mb_num*2* sizeof(INT8))
CHECKED_ALLOCZ(s->field_mv_table, s->mb_num*2*2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->field_select_table, s->mb_num*2* sizeof(int8_t))
} }
/* 4mv b frame decoding table */ /* 4mv b frame decoding table */
//note this is needed for h263 without b frames too (segfault on damaged streams otherwise) //note this is needed for h263 without b frames too (segfault on damaged streams otherwise)
CHECKED_ALLOCZ(s->co_located_type_table, s->mb_num * sizeof(UINT8))
CHECKED_ALLOCZ(s->co_located_type_table, s->mb_num * sizeof(uint8_t))
if (s->out_format == FMT_H263) { if (s->out_format == FMT_H263) {
/* ac values */ /* ac values */
CHECKED_ALLOCZ(s->ac_val[0], yc_size * sizeof(INT16) * 16);
CHECKED_ALLOCZ(s->ac_val[0], yc_size * sizeof(int16_t) * 16);
s->ac_val[1] = s->ac_val[0] + y_size; s->ac_val[1] = s->ac_val[0] + y_size;
s->ac_val[2] = s->ac_val[1] + c_size; s->ac_val[2] = s->ac_val[1] + c_size;
@@ -462,14 +462,14 @@ int MPV_common_init(MpegEncContext *s)
CHECKED_ALLOCZ(s->bitstream_buffer, BITSTREAM_BUFFER_SIZE); CHECKED_ALLOCZ(s->bitstream_buffer, BITSTREAM_BUFFER_SIZE);


/* cbp, ac_pred, pred_dir */ /* cbp, ac_pred, pred_dir */
CHECKED_ALLOCZ(s->cbp_table , s->mb_num * sizeof(UINT8))
CHECKED_ALLOCZ(s->pred_dir_table, s->mb_num * sizeof(UINT8))
CHECKED_ALLOCZ(s->cbp_table , s->mb_num * sizeof(uint8_t))
CHECKED_ALLOCZ(s->pred_dir_table, s->mb_num * sizeof(uint8_t))
} }
if (s->h263_pred || s->h263_plus || !s->encoding) { if (s->h263_pred || s->h263_plus || !s->encoding) {
/* dc values */ /* dc values */
//MN: we need these for error resilience of intra-frames //MN: we need these for error resilience of intra-frames
CHECKED_ALLOCZ(s->dc_val[0], yc_size * sizeof(INT16));
CHECKED_ALLOCZ(s->dc_val[0], yc_size * sizeof(int16_t));
s->dc_val[1] = s->dc_val[0] + y_size; s->dc_val[1] = s->dc_val[0] + y_size;
s->dc_val[2] = s->dc_val[1] + c_size; s->dc_val[2] = s->dc_val[1] + c_size;
for(i=0;i<yc_size;i++) for(i=0;i<yc_size;i++)
@@ -716,9 +716,9 @@ int MPV_encode_init(AVCodecContext *avctx)
int i; int i;
done=1; done=1;


default_mv_penalty= av_mallocz( sizeof(UINT16)*(MAX_FCODE+1)*(2*MAX_MV+1) );
memset(default_mv_penalty, 0, sizeof(UINT16)*(MAX_FCODE+1)*(2*MAX_MV+1));
memset(default_fcode_tab , 0, sizeof(UINT8)*(2*MAX_MV+1));
default_mv_penalty= av_mallocz( sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1) );
memset(default_mv_penalty, 0, sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1));
memset(default_fcode_tab , 0, sizeof(uint8_t)*(2*MAX_MV+1));


for(i=-16; i<16; i++){ for(i=-16; i<16; i++){
default_fcode_tab[i + MAX_MV]= 1; default_fcode_tab[i + MAX_MV]= 1;
@@ -812,8 +812,8 @@ int MPV_encode_end(AVCodecContext *avctx)


void init_rl(RLTable *rl) void init_rl(RLTable *rl)
{ {
INT8 max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
UINT8 index_run[MAX_RUN+1];
int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
uint8_t index_run[MAX_RUN+1];
int last, run, level, start, end, i; int last, run, level, start, end, i;


/* compute max_level[], max_run[] and index_run[] */ /* compute max_level[], max_run[] and index_run[] */
@@ -850,9 +850,9 @@ void init_rl(RLTable *rl)


/* draw the edges of width 'w' of an image of size width, height */ /* draw the edges of width 'w' of an image of size width, height */
//FIXME check that this is ok for mpeg4 interlaced //FIXME check that this is ok for mpeg4 interlaced
static void draw_edges_c(UINT8 *buf, int wrap, int width, int height, int w)
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
{ {
UINT8 *ptr, *last_line;
uint8_t *ptr, *last_line;
int i; int i;


last_line = buf + (height - 1) * wrap; last_line = buf + (height - 1) * wrap;
@@ -1324,11 +1324,11 @@ int MPV_encode_picture(AVCodecContext *avctx,
} }


static inline void gmc1_motion(MpegEncContext *s, static inline void gmc1_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int dest_offset, int dest_offset,
UINT8 **ref_picture, int src_offset)
uint8_t **ref_picture, int src_offset)
{ {
UINT8 *ptr;
uint8_t *ptr;
int offset, src_x, src_y, linesize, uvlinesize; int offset, src_x, src_y, linesize, uvlinesize;
int motion_x, motion_y; int motion_x, motion_y;
int emu=0; int emu=0;
@@ -1412,11 +1412,11 @@ static inline void gmc1_motion(MpegEncContext *s,
} }


static inline void gmc_motion(MpegEncContext *s, static inline void gmc_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int dest_offset, int dest_offset,
UINT8 **ref_picture, int src_offset)
uint8_t **ref_picture, int src_offset)
{ {
UINT8 *ptr;
uint8_t *ptr;
int linesize, uvlinesize; int linesize, uvlinesize;
const int a= s->sprite_warping_accuracy; const int a= s->sprite_warping_accuracy;
int ox, oy; int ox, oy;
@@ -1475,11 +1475,11 @@ static inline void gmc_motion(MpegEncContext *s,
} }




void ff_emulated_edge_mc(MpegEncContext *s, UINT8 *src, int linesize, int block_w, int block_h,
void ff_emulated_edge_mc(MpegEncContext *s, uint8_t *src, int linesize, int block_w, int block_h,
int src_x, int src_y, int w, int h){ int src_x, int src_y, int w, int h){
int x, y; int x, y;
int start_y, start_x, end_y, end_x; int start_y, start_x, end_y, end_x;
UINT8 *buf= s->edge_emu_buffer;
uint8_t *buf= s->edge_emu_buffer;


if(src_y>= h){ if(src_y>= h){
src+= (h-1-src_y)*linesize; src+= (h-1-src_y)*linesize;
@@ -1538,13 +1538,13 @@ void ff_emulated_edge_mc(MpegEncContext *s, UINT8 *src, int linesize, int block_


/* apply one mpeg motion vector to the three components */ /* apply one mpeg motion vector to the three components */
static inline void mpeg_motion(MpegEncContext *s, static inline void mpeg_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int dest_offset, int dest_offset,
UINT8 **ref_picture, int src_offset,
uint8_t **ref_picture, int src_offset,
int field_based, op_pixels_func (*pix_op)[4], int field_based, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h) int motion_x, int motion_y, int h)
{ {
UINT8 *ptr;
uint8_t *ptr;
int dxy, offset, mx, my, src_x, src_y, height, v_edge_pos, linesize, uvlinesize; int dxy, offset, mx, my, src_x, src_y, height, v_edge_pos, linesize, uvlinesize;
int emu=0; int emu=0;
#if 0 #if 0
@@ -1628,14 +1628,14 @@ if(s->quarter_sample)
} }


static inline void qpel_motion(MpegEncContext *s, static inline void qpel_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int dest_offset, int dest_offset,
UINT8 **ref_picture, int src_offset,
uint8_t **ref_picture, int src_offset,
int field_based, op_pixels_func (*pix_op)[4], int field_based, op_pixels_func (*pix_op)[4],
qpel_mc_func (*qpix_op)[16], qpel_mc_func (*qpix_op)[16],
int motion_x, int motion_y, int h) int motion_x, int motion_y, int h)
{ {
UINT8 *ptr;
uint8_t *ptr;
int dxy, offset, mx, my, src_x, src_y, height, v_edge_pos, linesize, uvlinesize; int dxy, offset, mx, my, src_x, src_y, height, v_edge_pos, linesize, uvlinesize;
int emu=0; int emu=0;


@@ -1735,13 +1735,13 @@ inline int ff_h263_round_chroma(int x){
} }


static inline void MPV_motion(MpegEncContext *s, static inline void MPV_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
int dir, UINT8 **ref_picture,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int dir, uint8_t **ref_picture,
op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16]) op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16])
{ {
int dxy, offset, mx, my, src_x, src_y, motion_x, motion_y; int dxy, offset, mx, my, src_x, src_y, motion_x, motion_y;
int mb_x, mb_y, i; int mb_x, mb_y, i;
UINT8 *ptr, *dest;
uint8_t *ptr, *dest;
int emu=0; int emu=0;


mb_x = s->mb_x; mb_x = s->mb_x;
@@ -1916,7 +1916,7 @@ static inline void MPV_motion(MpegEncContext *s,


/* put block[] to dest[] */ /* put block[] to dest[] */
static inline void put_dct(MpegEncContext *s, static inline void put_dct(MpegEncContext *s,
DCTELEM *block, int i, UINT8 *dest, int line_size)
DCTELEM *block, int i, uint8_t *dest, int line_size)
{ {
s->dct_unquantize(s, block, i, s->qscale); s->dct_unquantize(s, block, i, s->qscale);
s->idct_put (dest, line_size, block); s->idct_put (dest, line_size, block);
@@ -1924,7 +1924,7 @@ static inline void put_dct(MpegEncContext *s,


/* add block[] to dest[] */ /* add block[] to dest[] */
static inline void add_dct(MpegEncContext *s, static inline void add_dct(MpegEncContext *s,
DCTELEM *block, int i, UINT8 *dest, int line_size)
DCTELEM *block, int i, uint8_t *dest, int line_size)
{ {
if (s->block_last_index[i] >= 0) { if (s->block_last_index[i] >= 0) {
s->idct_add (dest, line_size, block); s->idct_add (dest, line_size, block);
@@ -1932,7 +1932,7 @@ static inline void add_dct(MpegEncContext *s,
} }


static inline void add_dequant_dct(MpegEncContext *s, static inline void add_dequant_dct(MpegEncContext *s,
DCTELEM *block, int i, UINT8 *dest, int line_size)
DCTELEM *block, int i, uint8_t *dest, int line_size)
{ {
if (s->block_last_index[i] >= 0) { if (s->block_last_index[i] >= 0) {
s->dct_unquantize(s, block, i, s->qscale); s->dct_unquantize(s, block, i, s->qscale);
@@ -1954,8 +1954,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
s->dc_val[0][xy + wrap] = s->dc_val[0][xy + wrap] =
s->dc_val[0][xy + 1 + wrap] = 1024; s->dc_val[0][xy + 1 + wrap] = 1024;
/* ac pred */ /* ac pred */
memset(s->ac_val[0][xy ], 0, 32 * sizeof(INT16));
memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(INT16));
memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t));
memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t));
if (s->msmpeg4_version>=3) { if (s->msmpeg4_version>=3) {
s->coded_block[xy ] = s->coded_block[xy ] =
s->coded_block[xy + 1 ] = s->coded_block[xy + 1 ] =
@@ -1968,8 +1968,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
s->dc_val[1][xy] = s->dc_val[1][xy] =
s->dc_val[2][xy] = 1024; s->dc_val[2][xy] = 1024;
/* ac pred */ /* ac pred */
memset(s->ac_val[1][xy], 0, 16 * sizeof(INT16));
memset(s->ac_val[2][xy], 0, 16 * sizeof(INT16));
memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));
s->mbintra_table[s->mb_x + s->mb_y*s->mb_width]= 0; s->mbintra_table[s->mb_x + s->mb_y*s->mb_width]= 0;
} }
@@ -2053,7 +2053,7 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
} }
if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE))) { //FIXME precalc if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE))) { //FIXME precalc
UINT8 *dest_y, *dest_cb, *dest_cr;
uint8_t *dest_y, *dest_cb, *dest_cr;
int dct_linesize, dct_offset; int dct_linesize, dct_offset;
op_pixels_func (*op_pix)[4]; op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16]; qpel_mc_func (*op_qpix)[16];
@@ -2065,7 +2065,7 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])


/* skip only during decoding as we might trash the buffers during encoding a bit */ /* skip only during decoding as we might trash the buffers during encoding a bit */
if(!s->encoding){ if(!s->encoding){
UINT8 *mbskip_ptr = &s->mbskip_table[mb_xy];
uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
const int age= s->current_picture.age; const int age= s->current_picture.age;


assert(age); assert(age);
@@ -2327,7 +2327,7 @@ static inline void auto_requantize_coeffs(MpegEncContext *s, DCTELEM block[6][64
s->qscale= newq; s->qscale= newq;
} }
#if 0 #if 0
static int pix_vcmp16x8(UINT8 *s, int stride){ //FIXME move to dsputil & optimize
static int pix_vcmp16x8(uint8_t *s, int stride){ //FIXME move to dsputil & optimize
int score=0; int score=0;
int x,y; int x,y;
@@ -2342,7 +2342,7 @@ static int pix_vcmp16x8(UINT8 *s, int stride){ //FIXME move to dsputil & optimiz
return score; return score;
} }


static int pix_diff_vcmp16x8(UINT8 *s1, UINT8*s2, int stride){ //FIXME move to dsputil & optimize
static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move to dsputil & optimize
int score=0; int score=0;
int x,y; int x,y;
@@ -2359,7 +2359,7 @@ static int pix_diff_vcmp16x8(UINT8 *s1, UINT8*s2, int stride){ //FIXME move to d
#else #else
#define SQ(a) ((a)*(a)) #define SQ(a) ((a)*(a))


static int pix_vcmp16x8(UINT8 *s, int stride){ //FIXME move to dsputil & optimize
static int pix_vcmp16x8(uint8_t *s, int stride){ //FIXME move to dsputil & optimize
int score=0; int score=0;
int x,y; int x,y;
@@ -2374,7 +2374,7 @@ static int pix_vcmp16x8(UINT8 *s, int stride){ //FIXME move to dsputil & optimiz
return score; return score;
} }


static int pix_diff_vcmp16x8(UINT8 *s1, UINT8*s2, int stride){ //FIXME move to dsputil & optimize
static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move to dsputil & optimize
int score=0; int score=0;
int x,y; int x,y;
@@ -2394,7 +2394,7 @@ static int pix_diff_vcmp16x8(UINT8 *s1, UINT8*s2, int stride){ //FIXME move to d
void ff_draw_horiz_band(MpegEncContext *s){ void ff_draw_horiz_band(MpegEncContext *s){
if ( s->avctx->draw_horiz_band if ( s->avctx->draw_horiz_band
&& (s->last_picture.data[0] || s->low_delay) ) { && (s->last_picture.data[0] || s->low_delay) ) {
UINT8 *src_ptr[3];
uint8_t *src_ptr[3];
int y, h, offset; int y, h, offset;
y = s->mb_y * 16; y = s->mb_y * 16;
h = s->height - y; h = s->height - y;
@@ -2454,7 +2454,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
} }


if (s->mb_intra) { if (s->mb_intra) {
UINT8 *ptr;
uint8_t *ptr;
int wrap_y; int wrap_y;
int emu=0; int emu=0;


@@ -2509,8 +2509,8 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
}else{ }else{
op_pixels_func (*op_pix)[4]; op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16]; qpel_mc_func (*op_qpix)[16];
UINT8 *dest_y, *dest_cb, *dest_cr;
UINT8 *ptr_y, *ptr_cb, *ptr_cr;
uint8_t *dest_y, *dest_cb, *dest_cr;
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int wrap_y, wrap_c; int wrap_y, wrap_c;
int emu=0; int emu=0;


@@ -2714,7 +2714,7 @@ int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size)
return 0; return 0;
} }


void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length)
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
{ {
int bytes= length>>4; int bytes= length>>4;
int bits= length&15; int bits= length&15;
@@ -2846,9 +2846,9 @@ static void encode_picture(MpegEncContext *s, int picture_number)
int i; int i;
int bits; int bits;
MpegEncContext best_s, backup_s; MpegEncContext best_s, backup_s;
UINT8 bit_buf[2][3000];
UINT8 bit_buf2[2][3000];
UINT8 bit_buf_tex[2][3000];
uint8_t bit_buf[2][3000];
uint8_t bit_buf2[2][3000];
uint8_t bit_buf_tex[2][3000];
PutBitContext pb[2], pb2[2], tex_pb[2]; PutBitContext pb[2], pb2[2], tex_pb[2];


for(i=0; i<2; i++){ for(i=0; i<2; i++){
@@ -2935,9 +2935,9 @@ static void encode_picture(MpegEncContext *s, int picture_number)
}else /* if(s->pict_type == I_TYPE) */{ }else /* if(s->pict_type == I_TYPE) */{
/* I-Frame */ /* I-Frame */
//FIXME do we need to zero them? //FIXME do we need to zero them?
memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2);
memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2);
memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
memset(s->motion_val[0], 0, sizeof(int16_t)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2);
memset(s->p_mv_table , 0, sizeof(int16_t)*(s->mb_width+2)*(s->mb_height+2)*2);
memset(s->mb_type , MB_TYPE_INTRA, sizeof(uint8_t)*s->mb_width*s->mb_height);
if(!s->fixed_qscale){ if(!s->fixed_qscale){
/* finding spatial complexity for I-frame rate control */ /* finding spatial complexity for I-frame rate control */
@@ -2962,7 +2962,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)


if(s->scene_change_score > 0 && s->pict_type == P_TYPE){ if(s->scene_change_score > 0 && s->pict_type == P_TYPE){
s->pict_type= I_TYPE; s->pict_type= I_TYPE;
memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
memset(s->mb_type , MB_TYPE_INTRA, sizeof(uint8_t)*s->mb_width*s->mb_height);
//printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
} }


@@ -3506,7 +3506,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
DCTELEM *block, int n, DCTELEM *block, int n,
int qscale, int *overflow){ int qscale, int *overflow){
const int *qmat; const int *qmat;
const UINT8 *scantable= s->intra_scantable.scantable;
const uint8_t *scantable= s->intra_scantable.scantable;
int max=0; int max=0;
unsigned int threshold1, threshold2; unsigned int threshold1, threshold2;
int bias=0; int bias=0;
@@ -3756,7 +3756,7 @@ static int dct_quantize_c(MpegEncContext *s,
{ {
int i, j, level, last_non_zero, q; int i, j, level, last_non_zero, q;
const int *qmat; const int *qmat;
const UINT8 *scantable= s->intra_scantable.scantable;
const uint8_t *scantable= s->intra_scantable.scantable;
int bias; int bias;
int max=0; int max=0;
unsigned int threshold1, threshold2; unsigned int threshold1, threshold2;
@@ -3823,7 +3823,7 @@ static void dct_unquantize_mpeg1_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) DCTELEM *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const UINT16 *quant_matrix;
const uint16_t *quant_matrix;


nCoeffs= s->block_last_index[n]; nCoeffs= s->block_last_index[n];
@@ -3886,7 +3886,7 @@ static void dct_unquantize_mpeg2_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) DCTELEM *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const UINT16 *quant_matrix;
const uint16_t *quant_matrix;


if(s->alternate_scan) nCoeffs= 63; if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n]; else nCoeffs= s->block_last_index[n];


+ 77
- 77
libavcodec/mpegvideo.h View File

@@ -68,7 +68,7 @@ typedef struct RateControlEntry{
int i_tex_bits; int i_tex_bits;
int p_tex_bits; int p_tex_bits;
int misc_bits; int misc_bits;
UINT64 expected_bits;
uint64_t expected_bits;
int new_pict_type; int new_pict_type;
float new_qscale; float new_qscale;
int mc_mb_var_sum; int mc_mb_var_sum;
@@ -92,21 +92,21 @@ typedef struct RateControlContext{
double last_qscale_for[5]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */ double last_qscale_for[5]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */
int last_mc_mb_var_sum; int last_mc_mb_var_sum;
int last_mb_var_sum; int last_mb_var_sum;
UINT64 i_cplx_sum[5];
UINT64 p_cplx_sum[5];
UINT64 mv_bits_sum[5];
UINT64 qscale_sum[5];
uint64_t i_cplx_sum[5];
uint64_t p_cplx_sum[5];
uint64_t mv_bits_sum[5];
uint64_t qscale_sum[5];
int frame_count[5]; int frame_count[5];
int last_non_b_pict_type; int last_non_b_pict_type;
}RateControlContext; }RateControlContext;


typedef struct ScanTable{ typedef struct ScanTable{
const UINT8 *scantable;
UINT8 permutated[64];
UINT8 raster_end[64];
const uint8_t *scantable;
uint8_t permutated[64];
uint8_t raster_end[64];
#ifdef ARCH_POWERPC #ifdef ARCH_POWERPC
/* Used by dct_quantise_alitvec to find last-non-zero */ /* Used by dct_quantise_alitvec to find last-non-zero */
UINT8 __align8 inverse[64];
uint8_t __align8 inverse[64];
#endif #endif
} ScanTable; } ScanTable;


@@ -123,7 +123,7 @@ typedef struct Picture{
} Picture; } Picture;


typedef struct ParseContext{ typedef struct ParseContext{
UINT8 *buffer;
uint8_t *buffer;
int index; int index;
int last_index; int last_index;
int buffer_size; int buffer_size;
@@ -147,7 +147,7 @@ typedef struct MotionEstContext{
int mb_penalty_factor; int mb_penalty_factor;
int pre_pass; /* = 1 for the pre pass */ int pre_pass; /* = 1 for the pre pass */
int dia_size; int dia_size;
UINT16 (*mv_penalty)[MAX_MV*2+1]; /* amount of bits needed to encode a MV */
uint16_t (*mv_penalty)[MAX_MV*2+1]; /* amount of bits needed to encode a MV */
int (*sub_motion_search)(struct MpegEncContext * s, int (*sub_motion_search)(struct MpegEncContext * s,
int *mx_ptr, int *my_ptr, int dmin, int *mx_ptr, int *my_ptr, int dmin,
int xmin, int ymin, int xmax, int ymax, int xmin, int ymin, int xmax, int ymax,
@@ -224,21 +224,21 @@ typedef struct MpegEncContext {
Picture new_picture; /* source picture for encoding */ Picture new_picture; /* source picture for encoding */
Picture current_picture; /* buffer to store the decompressed current picture */ Picture current_picture; /* buffer to store the decompressed current picture */
int last_dc[3]; /* last DC values for MPEG1 */ int last_dc[3]; /* last DC values for MPEG1 */
INT16 *dc_val[3]; /* used for mpeg4 DC prediction, all 3 arrays must be continuous */
int16_t *dc_val[3]; /* used for mpeg4 DC prediction, all 3 arrays must be continuous */
int y_dc_scale, c_dc_scale; int y_dc_scale, c_dc_scale;
UINT8 *y_dc_scale_table; /* qscale -> y_dc_scale table */
UINT8 *c_dc_scale_table; /* qscale -> c_dc_scale table */
UINT8 *coded_block; /* used for coded block pattern prediction (msmpeg4v3, wmv1)*/
INT16 (*ac_val[3])[16]; /* used for for mpeg4 AC prediction, all 3 arrays must be continuous */
uint8_t *y_dc_scale_table; /* qscale -> y_dc_scale table */
uint8_t *c_dc_scale_table; /* qscale -> c_dc_scale table */
uint8_t *coded_block; /* used for coded block pattern prediction (msmpeg4v3, wmv1)*/
int16_t (*ac_val[3])[16]; /* used for for mpeg4 AC prediction, all 3 arrays must be continuous */
int ac_pred; int ac_pred;
uint8_t *prev_pict_types; /* previous picture types in bitstream order, used for mb skip */ uint8_t *prev_pict_types; /* previous picture types in bitstream order, used for mb skip */
#define PREV_PICT_TYPES_BUFFER_SIZE 256 #define PREV_PICT_TYPES_BUFFER_SIZE 256
int mb_skiped; /* MUST BE SET only during DECODING */ int mb_skiped; /* MUST BE SET only during DECODING */
UINT8 *mbskip_table; /* used to avoid copy if macroblock skipped (for black regions for example)
uint8_t *mbskip_table; /* used to avoid copy if macroblock skipped (for black regions for example)
and used for b-frame encoding & decoding (contains skip table of next P Frame) */ and used for b-frame encoding & decoding (contains skip table of next P Frame) */
UINT8 *mbintra_table; /* used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding */
UINT8 *cbp_table; /* used to store cbp, ac_pred for partitioned decoding */
UINT8 *pred_dir_table; /* used to store pred_dir for partitioned decoding */
uint8_t *mbintra_table; /* used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding */
uint8_t *cbp_table; /* used to store cbp, ac_pred for partitioned decoding */
uint8_t *pred_dir_table; /* used to store pred_dir for partitioned decoding */
uint8_t *allocated_edge_emu_buffer; uint8_t *allocated_edge_emu_buffer;
uint8_t *edge_emu_buffer; /* points into the middle of allocated_edge_emu_buffer */ uint8_t *edge_emu_buffer; /* points into the middle of allocated_edge_emu_buffer */


@@ -257,13 +257,13 @@ typedef struct MpegEncContext {
DSPContext dsp; /* pointers for accelerated dsp fucntions */ DSPContext dsp; /* pointers for accelerated dsp fucntions */
int f_code; /* forward MV resolution */ int f_code; /* forward MV resolution */
int b_code; /* backward MV resolution for B Frames (mpeg4) */ int b_code; /* backward MV resolution for B Frames (mpeg4) */
INT16 (*motion_val)[2]; /* used for MV prediction (4MV per MB) */
INT16 (*p_mv_table)[2]; /* MV table (1MV per MB) p-frame encoding */
INT16 (*b_forw_mv_table)[2]; /* MV table (1MV per MB) forward mode b-frame encoding */
INT16 (*b_back_mv_table)[2]; /* MV table (1MV per MB) backward mode b-frame encoding */
INT16 (*b_bidir_forw_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
INT16 (*b_bidir_back_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
INT16 (*b_direct_mv_table)[2]; /* MV table (1MV per MB) direct mode b-frame encoding */
int16_t (*motion_val)[2]; /* used for MV prediction (4MV per MB) */
int16_t (*p_mv_table)[2]; /* MV table (1MV per MB) p-frame encoding */
int16_t (*b_forw_mv_table)[2]; /* MV table (1MV per MB) forward mode b-frame encoding */
int16_t (*b_back_mv_table)[2]; /* MV table (1MV per MB) backward mode b-frame encoding */
int16_t (*b_bidir_forw_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
int16_t (*b_bidir_back_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
int16_t (*b_direct_mv_table)[2]; /* MV table (1MV per MB) direct mode b-frame encoding */
int me_method; /* ME algorithm */ int me_method; /* ME algorithm */
int scene_change_score; int scene_change_score;
int mv_dir; int mv_dir;
@@ -284,7 +284,7 @@ typedef struct MpegEncContext {
int mv[2][4][2]; int mv[2][4][2];
int field_select[2][2]; int field_select[2][2];
int last_mv[2][2][2]; /* last MV, used for MV prediction in MPEG1 & B-frame MPEG4 */ int last_mv[2][2][2]; /* last MV, used for MV prediction in MPEG1 & B-frame MPEG4 */
UINT8 *fcode_tab; /* smallest fcode needed for each MV */
uint8_t *fcode_tab; /* smallest fcode needed for each MV */
MotionEstContext me; MotionEstContext me;


@@ -298,7 +298,7 @@ typedef struct MpegEncContext {
int mb_x, mb_y; int mb_x, mb_y;
int mb_incr; int mb_incr;
int mb_intra; int mb_intra;
UINT8 *mb_type; /* Table for MB type */
uint8_t *mb_type; /* Table for MB type */
#define MB_TYPE_INTRA 0x01 #define MB_TYPE_INTRA 0x01
#define MB_TYPE_INTER 0x02 #define MB_TYPE_INTER 0x02
#define MB_TYPE_INTER4V 0x04 #define MB_TYPE_INTER4V 0x04
@@ -314,10 +314,10 @@ typedef struct MpegEncContext {
int block_wrap[6]; int block_wrap[6];


/* matrix transmitted in the bitstream */ /* matrix transmitted in the bitstream */
UINT16 intra_matrix[64];
UINT16 chroma_intra_matrix[64];
UINT16 inter_matrix[64];
UINT16 chroma_inter_matrix[64];
uint16_t intra_matrix[64];
uint16_t chroma_intra_matrix[64];
uint16_t inter_matrix[64];
uint16_t chroma_inter_matrix[64];
#define QUANT_BIAS_SHIFT 4 #define QUANT_BIAS_SHIFT 4
int intra_quant_bias; /* bias for the quantizer */ int intra_quant_bias; /* bias for the quantizer */
int inter_quant_bias; /* bias for the quantizer */ int inter_quant_bias; /* bias for the quantizer */
@@ -336,17 +336,17 @@ typedef struct MpegEncContext {
int __align8 q_intra_matrix[32][64]; int __align8 q_intra_matrix[32][64];
int __align8 q_inter_matrix[32][64]; int __align8 q_inter_matrix[32][64];
/* identical to the above but for MMX & these are not permutated */ /* identical to the above but for MMX & these are not permutated */
UINT16 __align8 q_intra_matrix16[32][64];
UINT16 __align8 q_inter_matrix16[32][64];
UINT16 __align8 q_intra_matrix16_bias[32][64];
UINT16 __align8 q_inter_matrix16_bias[32][64];
uint16_t __align8 q_intra_matrix16[32][64];
uint16_t __align8 q_inter_matrix16[32][64];
uint16_t __align8 q_intra_matrix16_bias[32][64];
uint16_t __align8 q_inter_matrix16_bias[32][64];
int block_last_index[6]; /* last non zero coefficient in block */ int block_last_index[6]; /* last non zero coefficient in block */
/* scantables */ /* scantables */
ScanTable __align8 intra_scantable; ScanTable __align8 intra_scantable;
ScanTable intra_h_scantable; ScanTable intra_h_scantable;
ScanTable intra_v_scantable; ScanTable intra_v_scantable;
ScanTable inter_scantable; // if inter == intra then intra should be used to reduce tha cache usage ScanTable inter_scantable; // if inter == intra then intra should be used to reduce tha cache usage
UINT8 idct_permutation[64];
uint8_t idct_permutation[64];
int idct_permutation_type; int idct_permutation_type;
#define FF_NO_IDCT_PERM 1 #define FF_NO_IDCT_PERM 1
#define FF_LIBMPEG2_IDCT_PERM 2 #define FF_LIBMPEG2_IDCT_PERM 2
@@ -357,8 +357,8 @@ typedef struct MpegEncContext {


/* bit rate control */ /* bit rate control */
int I_frame_bits; //FIXME used in mpeg12 ... int I_frame_bits; //FIXME used in mpeg12 ...
INT64 wanted_bits;
INT64 total_bits;
int64_t wanted_bits;
int64_t total_bits;
int frame_bits; /* bits used for the current frame */ int frame_bits; /* bits used for the current frame */
RateControlContext rc_context; // contains stuff only accessed in ratecontrol.c RateControlContext rc_context; // contains stuff only accessed in ratecontrol.c


@@ -375,7 +375,7 @@ typedef struct MpegEncContext {
int last_bits; //temp var used for calculating the above vars int last_bits; //temp var used for calculating the above vars
/* error concealment / resync */ /* error concealment / resync */
UINT8 *error_status_table; /* table of the error status of each MB */
uint8_t *error_status_table; /* table of the error status of each MB */
#define VP_START 1 /* current MB is the first after a resync marker */ #define VP_START 1 /* current MB is the first after a resync marker */
#define AC_ERROR 2 #define AC_ERROR 2
#define DC_ERROR 4 #define DC_ERROR 4
@@ -409,12 +409,12 @@ typedef struct MpegEncContext {
int time_increment_bits; /* number of bits to represent the fractional part of time */ int time_increment_bits; /* number of bits to represent the fractional part of time */
int last_time_base; int last_time_base;
int time_base; /* time in seconds of last I,P,S Frame */ int time_base; /* time in seconds of last I,P,S Frame */
INT64 time; /* time of current frame */
INT64 last_non_b_time;
UINT16 pp_time; /* time distance between the last 2 p,s,i frames */
UINT16 pb_time; /* time distance between the last b and p,s,i frame */
UINT16 pp_field_time;
UINT16 pb_field_time; /* like above, just for interlaced */
int64_t time; /* time of current frame */
int64_t last_non_b_time;
uint16_t pp_time; /* time distance between the last 2 p,s,i frames */
uint16_t pb_time; /* time distance between the last b and p,s,i frame */
uint16_t pp_field_time;
uint16_t pb_field_time; /* like above, just for interlaced */
int shape; int shape;
int vol_sprite_usage; int vol_sprite_usage;
int sprite_width; int sprite_width;
@@ -455,9 +455,9 @@ typedef struct MpegEncContext {
int mpeg_quant; int mpeg_quant;
#define CO_LOCATED_TYPE_4MV 1 #define CO_LOCATED_TYPE_4MV 1
#define CO_LOCATED_TYPE_FIELDMV 2 #define CO_LOCATED_TYPE_FIELDMV 2
INT8 *co_located_type_table; /* 4mv & field_mv info for next b frame */
INT16 (*field_mv_table)[2][2]; /* used for interlaced b frame decoding */
INT8 (*field_select_table)[2]; /* wtf, no really another table for interlaced b frames */
int8_t *co_located_type_table; /* 4mv & field_mv info for next b frame */
int16_t (*field_mv_table)[2][2]; /* used for interlaced b frame decoding */
int8_t (*field_select_table)[2]; /* wtf, no really another table for interlaced b frames */
int t_frame; /* time distance of first I -> B, used for interlaced b frames */ int t_frame; /* time distance of first I -> B, used for interlaced b frames */
int padding_bug_score; /* used to detect the VERY common padding bug in MPEG4 */ int padding_bug_score; /* used to detect the VERY common padding bug in MPEG4 */


@@ -465,7 +465,7 @@ typedef struct MpegEncContext {
int divx_version; int divx_version;
int divx_build; int divx_build;
#define BITSTREAM_BUFFER_SIZE 1024*256 #define BITSTREAM_BUFFER_SIZE 1024*256
UINT8 *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
int bitstream_buffer_size; int bitstream_buffer_size;
int xvid_build; int xvid_build;
@@ -541,9 +541,9 @@ typedef struct MpegEncContext {
int rtp_mode; int rtp_mode;
int rtp_payload_size; int rtp_payload_size;
void (*rtp_callback)(void *data, int size, int packet_number); void (*rtp_callback)(void *data, int size, int packet_number);
UINT8 *ptr_lastgob;
UINT8 *ptr_last_mb_line;
UINT32 mb_line_avgsize;
uint8_t *ptr_lastgob;
uint8_t *ptr_last_mb_line;
uint32_t mb_line_avgsize;
DCTELEM (*block)[64]; /* points to one of the following blocks */ DCTELEM (*block)[64]; /* points to one of the following blocks */
DCTELEM blocks[2][6][64] __align8; // for HQ mode we need to keep the best block DCTELEM blocks[2][6][64] __align8; // for HQ mode we need to keep the best block
@@ -564,8 +564,8 @@ typedef struct MpegEncContext {
int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow); int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
int (*fast_dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow); int (*fast_dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
void (*fdct)(DCTELEM *block/* align 16*/); void (*fdct)(DCTELEM *block/* align 16*/);
void (*idct_put)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_add)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
//FIXME move above funcs into dspContext perhaps //FIXME move above funcs into dspContext perhaps
} MpegEncContext; } MpegEncContext;


@@ -597,14 +597,14 @@ void MPV_common_init_armv4l(MpegEncContext *s);
#ifdef ARCH_POWERPC #ifdef ARCH_POWERPC
void MPV_common_init_ppc(MpegEncContext *s); void MPV_common_init_ppc(MpegEncContext *s);
#endif #endif
extern void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w);
extern void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
void ff_conceal_past_errors(MpegEncContext *s, int conceal_all); void ff_conceal_past_errors(MpegEncContext *s, int conceal_all);
void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length);
void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length);
void ff_clean_intra_table_entries(MpegEncContext *s); void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const uint8_t *src_scantable);
void ff_error_resilience(MpegEncContext *s); void ff_error_resilience(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s); void ff_draw_horiz_band(MpegEncContext *s);
void ff_emulated_edge_mc(MpegEncContext *s, UINT8 *src, int linesize, int block_w, int block_h,
void ff_emulated_edge_mc(MpegEncContext *s, uint8_t *src, int linesize, int block_w, int block_h,
int src_x, int src_y, int w, int h); int src_x, int src_y, int w, int h);
char ff_get_pict_type_char(int pict_type); char ff_get_pict_type_char(int pict_type);
int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size); int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size);
@@ -645,9 +645,9 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y);




/* mpeg12.c */ /* mpeg12.c */
extern const INT16 ff_mpeg1_default_intra_matrix[64];
extern const INT16 ff_mpeg1_default_non_intra_matrix[64];
extern UINT8 ff_mpeg1_dc_scale_table[128];
extern const int16_t ff_mpeg1_default_intra_matrix[64];
extern const int16_t ff_mpeg1_default_non_intra_matrix[64];
extern uint8_t ff_mpeg1_dc_scale_table[128];


void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
void mpeg1_encode_mb(MpegEncContext *s, void mpeg1_encode_mb(MpegEncContext *s,
@@ -660,12 +660,12 @@ void ff_mpeg1_encode_init(MpegEncContext *s);
typedef struct RLTable { typedef struct RLTable {
int n; /* number of entries of table_vlc minus 1 */ int n; /* number of entries of table_vlc minus 1 */
int last; /* number of values for last = 0 */ int last; /* number of values for last = 0 */
const UINT16 (*table_vlc)[2];
const INT8 *table_run;
const INT8 *table_level;
UINT8 *index_run[2]; /* encoding only */
INT8 *max_level[2]; /* encoding & decoding */
INT8 *max_run[2]; /* encoding & decoding */
const uint16_t (*table_vlc)[2];
const int8_t *table_run;
const int8_t *table_level;
uint8_t *index_run[2]; /* encoding only */
int8_t *max_level[2]; /* encoding & decoding */
int8_t *max_run[2]; /* encoding & decoding */
VLC vlc; /* decoding only deprected FIXME remove*/ VLC vlc; /* decoding only deprected FIXME remove*/
RL_VLC_ELEM *rl_vlc[32]; /* decoding only */ RL_VLC_ELEM *rl_vlc[32]; /* decoding only */
} RLTable; } RLTable;
@@ -684,14 +684,14 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
return index + level - 1; return index + level - 1;
} }


extern UINT8 ff_mpeg4_y_dc_scale_table[32];
extern UINT8 ff_mpeg4_c_dc_scale_table[32];
extern const INT16 ff_mpeg4_default_intra_matrix[64];
extern const INT16 ff_mpeg4_default_non_intra_matrix[64];
extern uint8_t ff_mpeg4_y_dc_scale_table[32];
extern uint8_t ff_mpeg4_c_dc_scale_table[32];
extern const int16_t ff_mpeg4_default_intra_matrix[64];
extern const int16_t ff_mpeg4_default_non_intra_matrix[64];
int ff_h263_decode_init(AVCodecContext *avctx); int ff_h263_decode_init(AVCodecContext *avctx);
int ff_h263_decode_frame(AVCodecContext *avctx, int ff_h263_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size);
uint8_t *buf, int buf_size);
int ff_h263_decode_end(AVCodecContext *avctx); int ff_h263_decode_end(AVCodecContext *avctx);
void h263_encode_mb(MpegEncContext *s, void h263_encode_mb(MpegEncContext *s,
DCTELEM block[6][64], DCTELEM block[6][64],
@@ -701,7 +701,7 @@ void mpeg4_encode_mb(MpegEncContext *s,
int motion_x, int motion_y); int motion_x, int motion_y);
void h263_encode_picture_header(MpegEncContext *s, int picture_number); void h263_encode_picture_header(MpegEncContext *s, int picture_number);
int h263_encode_gob_header(MpegEncContext * s, int mb_line); int h263_encode_gob_header(MpegEncContext * s, int mb_line);
INT16 *h263_pred_motion(MpegEncContext * s, int block,
int16_t *h263_pred_motion(MpegEncContext * s, int block,
int *px, int *py); int *px, int *py);
void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir); int dir);
@@ -751,8 +751,8 @@ void ff_msmpeg4_encode_init(MpegEncContext *s);
int ff_wmv2_decode_picture_header(MpegEncContext * s); int ff_wmv2_decode_picture_header(MpegEncContext * s);
void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr); void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
void ff_mspel_motion(MpegEncContext *s, void ff_mspel_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
UINT8 **ref_picture, op_pixels_func (*pix_op)[4],
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h); int motion_x, int motion_y, int h);
int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number); int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_wmv2_encode_mb(MpegEncContext * s, void ff_wmv2_encode_mb(MpegEncContext * s,


+ 16
- 16
libavcodec/msmpeg4.c View File

@@ -50,8 +50,8 @@


#define DEFAULT_INTER_INDEX 3 #define DEFAULT_INTER_INDEX 3


static UINT32 v2_dc_lum_table[512][2];
static UINT32 v2_dc_chroma_table[512][2];
static uint32_t v2_dc_lum_table[512][2];
static uint32_t v2_dc_chroma_table[512][2];


static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n); static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
@@ -67,7 +67,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);


extern UINT32 inverse[256];
extern uint32_t inverse[256];




#ifdef DEBUG #ifdef DEBUG
@@ -77,7 +77,7 @@ int frame_count = 0;


#include "msmpeg4data.h" #include "msmpeg4data.h"


static UINT8 rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];


#ifdef STATS #ifdef STATS


@@ -190,7 +190,7 @@ static void init_mv_table(MVTable *tab)
{ {
int i, x, y; int i, x, y;


tab->table_mv_index = av_malloc(sizeof(UINT16) * 4096);
tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096);
/* mark all entries as not used */ /* mark all entries as not used */
for(i=0;i<4096;i++) for(i=0;i<4096;i++)
tab->table_mv_index[i] = tab->n; tab->table_mv_index[i] = tab->n;
@@ -434,7 +434,7 @@ void msmpeg4_encode_ext_header(MpegEncContext * s)
} }


/* predict coded block */ /* predict coded block */
static inline int coded_block_pred(MpegEncContext * s, int n, UINT8 **coded_block_ptr)
static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
{ {
int xy, wrap, pred, a, b, c; int xy, wrap, pred, a, b, c;


@@ -518,7 +518,7 @@ void msmpeg4_encode_mb(MpegEncContext * s,
{ {
int cbp, coded_cbp, i; int cbp, coded_cbp, i;
int pred_x, pred_y; int pred_x, pred_y;
UINT8 *coded_block;
uint8_t *coded_block;


handle_slices(s); handle_slices(s);
@@ -640,7 +640,7 @@ static void ff_old_msmpeg4_dc_scale(MpegEncContext * s)
} }


static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n, static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
INT32 **dc_val_ptr)
int32_t **dc_val_ptr)
{ {
int i; int i;


@@ -669,10 +669,10 @@ static int get_dc(uint8_t *src, int stride, int scale)


/* dir = 0: left, dir = 1: top prediction */ /* dir = 0: left, dir = 1: top prediction */
static inline int msmpeg4_pred_dc(MpegEncContext * s, int n, static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
UINT16 **dc_val_ptr, int *dir_ptr)
uint16_t **dc_val_ptr, int *dir_ptr)
{ {
int a, b, c, wrap, pred, scale; int a, b, c, wrap, pred, scale;
INT16 *dc_val;
int16_t *dc_val;


/* find prediction */ /* find prediction */
if (n < 4) { if (n < 4) {
@@ -823,13 +823,13 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
int pred; int pred;


if(s->msmpeg4_version==1){ if(s->msmpeg4_version==1){
INT32 *dc_val;
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(s, n, &dc_val); pred = msmpeg4v1_pred_dc(s, n, &dc_val);
/* update predictor */ /* update predictor */
*dc_val= level; *dc_val= level;
}else{ }else{
UINT16 *dc_val;
uint16_t *dc_val;
pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr); pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);


/* update predictor */ /* update predictor */
@@ -895,7 +895,7 @@ static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int
int last_non_zero, sign, slevel; int last_non_zero, sign, slevel;
int code, run_diff, dc_pred_dir; int code, run_diff, dc_pred_dir;
const RLTable *rl; const RLTable *rl;
const UINT8 *scantable;
const uint8_t *scantable;


if (s->mb_intra) { if (s->mb_intra) {
set_stat(ST_DC); set_stat(ST_DC);
@@ -1544,7 +1544,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
{ {
int cbp, code, i; int cbp, code, i;
UINT8 *coded_val;
uint8_t *coded_val;


#ifdef PRINT_MB #ifdef PRINT_MB
if(s->mb_x==0){ if(s->mb_x==0){
@@ -1939,14 +1939,14 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
} }


if(s->msmpeg4_version==1){ if(s->msmpeg4_version==1){
INT32 *dc_val;
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(s, n, &dc_val); pred = msmpeg4v1_pred_dc(s, n, &dc_val);
level += pred; level += pred;
/* update predictor */ /* update predictor */
*dc_val= level; *dc_val= level;
}else{ }else{
UINT16 *dc_val;
uint16_t *dc_val;
pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr); pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
level += pred; level += pred;




+ 1
- 1
libavcodec/oggvorbis.c View File

@@ -179,7 +179,7 @@ static inline int conv(int samples, float **pcm, char *buf, int channels) {
static int oggvorbis_decode_frame(AVCodecContext *avccontext, static int oggvorbis_decode_frame(AVCodecContext *avccontext,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
OggVorbisContext *context = avccontext->priv_data ; OggVorbisContext *context = avccontext->priv_data ;
ogg_packet *op = (ogg_packet*)buf ; ogg_packet *op = (ogg_packet*)buf ;


+ 6
- 6
libavcodec/pcm.c View File

@@ -73,13 +73,13 @@ static int ulaw2linear(unsigned char u_val)
} }


/* 16384 entries per table */ /* 16384 entries per table */
static UINT8 *linear_to_alaw = NULL;
static uint8_t *linear_to_alaw = NULL;
static int linear_to_alaw_ref = 0; static int linear_to_alaw_ref = 0;


static UINT8 *linear_to_ulaw = NULL;
static uint8_t *linear_to_ulaw = NULL;
static int linear_to_ulaw_ref = 0; static int linear_to_ulaw_ref = 0;


static void build_xlaw_table(UINT8 *linear_to_xlaw,
static void build_xlaw_table(uint8_t *linear_to_xlaw,
int (*xlaw2linear)(unsigned char), int (*xlaw2linear)(unsigned char),
int mask) int mask)
{ {
@@ -274,12 +274,12 @@ static int pcm_decode_init(AVCodecContext * avctx)


static int pcm_decode_frame(AVCodecContext *avctx, static int pcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
PCMDecode *s = avctx->priv_data; PCMDecode *s = avctx->priv_data;
int n; int n;
short *samples; short *samples;
UINT8 *src;
uint8_t *src;


samples = data; samples = data;
src = buf; src = buf;
@@ -339,7 +339,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
*data_size = 0; *data_size = 0;
return -1; return -1;
} }
*data_size = (UINT8 *)samples - (UINT8 *)data;
*data_size = (uint8_t *)samples - (uint8_t *)data;
return src - buf; return src - buf;
} }




+ 4
- 4
libavcodec/ppc/dsputil_altivec.c View File

@@ -480,7 +480,7 @@ int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size)
return s; return s;
} }


int pix_sum_altivec(UINT8 * pix, int line_size)
int pix_sum_altivec(uint8_t * pix, int line_size)
{ {
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0); const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
vector unsigned char perm, *pixv; vector unsigned char perm, *pixv;
@@ -513,7 +513,7 @@ int pix_sum_altivec(UINT8 * pix, int line_size)
return s; return s;
} }


void get_pixels_altivec(DCTELEM *restrict block, const UINT8 *pixels, int line_size)
void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
{ {
int i; int i;
vector unsigned char perm, bytes, *pixv; vector unsigned char perm, bytes, *pixv;
@@ -539,8 +539,8 @@ void get_pixels_altivec(DCTELEM *restrict block, const UINT8 *pixels, int line_s
} }
} }


void diff_pixels_altivec(DCTELEM *restrict block, const UINT8 *s1,
const UINT8 *s2, int stride)
void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
const uint8_t *s2, int stride)
{ {
int i; int i;
vector unsigned char perm, bytes, *pixv; vector unsigned char perm, bytes, *pixv;


+ 5
- 5
libavcodec/ppc/dsputil_altivec.h View File

@@ -34,12 +34,12 @@ extern int sad8x8_altivec(void *s, uint8_t *a, uint8_t *b, int stride);
extern int pix_norm1_altivec(uint8_t *pix, int line_size); extern int pix_norm1_altivec(uint8_t *pix, int line_size);
extern int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size); extern int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size);
extern int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size); extern int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size);
extern int pix_sum_altivec(UINT8 * pix, int line_size);
extern void diff_pixels_altivec(DCTELEM* block, const UINT8* s1, const UINT8* s2, int stride);
extern void get_pixels_altivec(DCTELEM* block, const UINT8 * pixels, int line_size);
extern int pix_sum_altivec(uint8_t * pix, int line_size);
extern void diff_pixels_altivec(DCTELEM* block, const uint8_t* s1, const uint8_t* s2, int stride);
extern void get_pixels_altivec(DCTELEM* block, const uint8_t * pixels, int line_size);


extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w); extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w);
extern void put_pixels_clamped_altivec(const DCTELEM *block, UINT8 *restrict pixels, int line_size);
extern void put_pixels_clamped_altivec(const DCTELEM *block, uint8_t *restrict pixels, int line_size);
extern void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); extern void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
extern void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); extern void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
extern void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); extern void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h);
@@ -48,7 +48,7 @@ extern void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels
extern void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); extern void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h);
extern void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); extern void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h);


extern void gmc1_altivec(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder);
extern void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder);


extern int has_altivec(void); extern int has_altivec(void);




+ 1
- 1
libavcodec/ppc/gmc_altivec.c View File

@@ -26,7 +26,7 @@
altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8, altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
to preserve proper dst alignement. to preserve proper dst alignement.
*/ */
void gmc1_altivec(UINT8 *dst /* align 8 */, UINT8 *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
{ {
POWERPC_TBL_DECLARE(altivec_gmc1_num, h == 8); POWERPC_TBL_DECLARE(altivec_gmc1_num, h == 8);
#ifdef ALTIVEC_USE_REFERENCE_C_CODE #ifdef ALTIVEC_USE_REFERENCE_C_CODE


+ 4
- 4
libavcodec/ppc/idct_altivec.c View File

@@ -176,8 +176,8 @@ void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block)
POWERPC_TBL_DECLARE(altivec_idct_put_num, 1); POWERPC_TBL_DECLARE(altivec_idct_put_num, 1);
#ifdef ALTIVEC_USE_REFERENCE_C_CODE #ifdef ALTIVEC_USE_REFERENCE_C_CODE
POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1); POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1);
void simple_idct_put(UINT8 *dest, int line_size, INT16 *block);
simple_idct_put(dest, stride, (INT16*)block);
void simple_idct_put(uint8_t *dest, int line_size, int16_t *block);
simple_idct_put(dest, stride, (int16_t*)block);
POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1); POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1);
#else /* ALTIVEC_USE_REFERENCE_C_CODE */ #else /* ALTIVEC_USE_REFERENCE_C_CODE */
vector_u8_t tmp; vector_u8_t tmp;
@@ -209,8 +209,8 @@ void idct_add_altivec(uint8_t* dest, int stride, vector_s16_t* block)
POWERPC_TBL_DECLARE(altivec_idct_add_num, 1); POWERPC_TBL_DECLARE(altivec_idct_add_num, 1);
#ifdef ALTIVEC_USE_REFERENCE_C_CODE #ifdef ALTIVEC_USE_REFERENCE_C_CODE
POWERPC_TBL_START_COUNT(altivec_idct_add_num, 1); POWERPC_TBL_START_COUNT(altivec_idct_add_num, 1);
void simple_idct_add(UINT8 *dest, int line_size, INT16 *block);
simple_idct_add(dest, stride, (INT16*)block);
void simple_idct_add(uint8_t *dest, int line_size, int16_t *block);
simple_idct_add(dest, stride, (int16_t*)block);
POWERPC_TBL_STOP_COUNT(altivec_idct_add_num, 1); POWERPC_TBL_STOP_COUNT(altivec_idct_add_num, 1);
#else /* ALTIVEC_USE_REFERENCE_C_CODE */ #else /* ALTIVEC_USE_REFERENCE_C_CODE */
vector_u8_t tmp; vector_u8_t tmp;


+ 2
- 2
libavcodec/ppc/mpegvideo_ppc.c View File

@@ -30,8 +30,8 @@ extern int dct_quantize_altivec(MpegEncContext *s,
extern void dct_unquantize_h263_altivec(MpegEncContext *s, extern void dct_unquantize_h263_altivec(MpegEncContext *s,
DCTELEM *block, int n, int qscale); DCTELEM *block, int n, int qscale);


extern void idct_put_altivec(UINT8 *dest, int line_size, INT16 *block);
extern void idct_add_altivec(UINT8 *dest, int line_size, INT16 *block);
extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);




void MPV_common_init_ppc(MpegEncContext *s) void MPV_common_init_ppc(MpegEncContext *s)


+ 1
- 1
libavcodec/ps2/dsputil_mmi.c View File

@@ -41,7 +41,7 @@ static void clear_blocks_mmi(DCTELEM * blocks)
} }




static void get_pixels_mmi(DCTELEM *block, const UINT8 *pixels, int line_size)
static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size)
{ {
int i; int i;
for(i=0;i<8;i++) { for(i=0;i<8;i++) {


+ 2
- 2
libavcodec/ps2/idct_mmi.c View File

@@ -299,7 +299,7 @@ void ff_mmi_idct(int16_t * block)
} }




void ff_mmi_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
/* $4 = dest, $5 = line_size, $6 = block */ /* $4 = dest, $5 = line_size, $6 = block */
__asm__ __volatile__("la $24, %0"::"m"(consttable[0])); __asm__ __volatile__("la $24, %0"::"m"(consttable[0]));
@@ -323,7 +323,7 @@ void ff_mmi_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
} }




void ff_mmi_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
/* $4 = dest, $5 = line_size, $6 = block */ /* $4 = dest, $5 = line_size, $6 = block */
__asm__ __volatile__("la $24, %0"::"m"(consttable[0])); __asm__ __volatile__("la $24, %0"::"m"(consttable[0]));


+ 2
- 2
libavcodec/ps2/mpegvideo_mmi.c View File

@@ -22,8 +22,8 @@
#include "../mpegvideo.h" #include "../mpegvideo.h"
#include "../avcodec.h" #include "../avcodec.h"


void ff_mmi_idct_put(UINT8 *dest, int line_size, DCTELEM *block);
void ff_mmi_idct_add(UINT8 *dest, int line_size, DCTELEM *block);
void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block);




static void dct_unquantize_h263_mmi(MpegEncContext *s, static void dct_unquantize_h263_mmi(MpegEncContext *s,


+ 2
- 2
libavcodec/resample.c View File

@@ -20,8 +20,8 @@


typedef struct { typedef struct {
/* fractional resampling */ /* fractional resampling */
UINT32 incr; /* fractional increment */
UINT32 frac;
uint32_t incr; /* fractional increment */
uint32_t frac;
int last_sample; int last_sample;
/* integer down sample */ /* integer down sample */
int iratio; /* integer divison ratio */ int iratio; /* integer divison ratio */


+ 10
- 10
libavcodec/rv10.c View File

@@ -24,7 +24,7 @@


#define DC_VLC_BITS 14 //FIXME find a better solution #define DC_VLC_BITS 14 //FIXME find a better solution


static const UINT16 rv_lum_code[256] =
static const uint16_t rv_lum_code[256] =
{ {
0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06, 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e, 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
@@ -60,7 +60,7 @@ static const UINT16 rv_lum_code[256] =
0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f, 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
}; };


static const UINT8 rv_lum_bits[256] =
static const uint8_t rv_lum_bits[256] =
{ {
14, 12, 12, 12, 12, 12, 12, 12, 14, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
@@ -96,7 +96,7 @@ static const UINT8 rv_lum_bits[256] =
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
}; };


static const UINT16 rv_chrom_code[256] =
static const uint16_t rv_chrom_code[256] =
{ {
0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06, 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e, 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
@@ -132,7 +132,7 @@ static const UINT16 rv_chrom_code[256] =
0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
}; };


static const UINT8 rv_chrom_bits[256] =
static const uint8_t rv_chrom_bits[256] =
{ {
16, 14, 14, 14, 14, 14, 14, 14, 16, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
@@ -182,14 +182,14 @@ int rv_decode_dc(MpegEncContext *s, int n)
if they had thought about it !!! */ if they had thought about it !!! */
code = get_bits(&s->gb, 7); code = get_bits(&s->gb, 7);
if (code == 0x7c) { if (code == 0x7c) {
code = (INT8)(get_bits(&s->gb, 7) + 1);
code = (int8_t)(get_bits(&s->gb, 7) + 1);
} else if (code == 0x7d) { } else if (code == 0x7d) {
code = -128 + get_bits(&s->gb, 7); code = -128 + get_bits(&s->gb, 7);
} else if (code == 0x7e) { } else if (code == 0x7e) {
if (get_bits(&s->gb, 1) == 0) if (get_bits(&s->gb, 1) == 0)
code = (INT8)(get_bits(&s->gb, 8) + 1);
code = (int8_t)(get_bits(&s->gb, 8) + 1);
else else
code = (INT8)(get_bits(&s->gb, 8));
code = (int8_t)(get_bits(&s->gb, 8));
} else if (code == 0x7f) { } else if (code == 0x7f) {
get_bits(&s->gb, 11); get_bits(&s->gb, 11);
code = 1; code = 1;
@@ -203,7 +203,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
if (code < 0) { if (code < 0) {
code = get_bits(&s->gb, 9); code = get_bits(&s->gb, 9);
if (code == 0x1fc) { if (code == 0x1fc) {
code = (INT8)(get_bits(&s->gb, 7) + 1);
code = (int8_t)(get_bits(&s->gb, 7) + 1);
} else if (code == 0x1fd) { } else if (code == 0x1fd) {
code = -128 + get_bits(&s->gb, 7); code = -128 + get_bits(&s->gb, 7);
} else if (code == 0x1fe) { } else if (code == 0x1fe) {
@@ -390,7 +390,7 @@ static int rv10_decode_end(AVCodecContext *avctx)
} }


static int rv10_decode_packet(AVCodecContext *avctx, static int rv10_decode_packet(AVCodecContext *avctx,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MpegEncContext *s = avctx->priv_data; MpegEncContext *s = avctx->priv_data;
int i, mb_count, mb_pos, left; int i, mb_count, mb_pos, left;
@@ -468,7 +468,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,


static int rv10_decode_frame(AVCodecContext *avctx, static int rv10_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MpegEncContext *s = avctx->priv_data; MpegEncContext *s = avctx->priv_data;
int i; int i;


+ 14
- 14
libavcodec/simple_idct.c View File

@@ -172,11 +172,11 @@ static inline void idctRowCondDC (DCTELEM * row)
row[4] = (a3 - b3) >> ROW_SHIFT; row[4] = (a3 - b3) >> ROW_SHIFT;
} }


static inline void idctSparseColPut (UINT8 *dest, int line_size,
static inline void idctSparseColPut (uint8_t *dest, int line_size,
DCTELEM * col) DCTELEM * col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;


/* XXX: I did that only to give same values as previous code */ /* XXX: I did that only to give same values as previous code */
a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
@@ -244,11 +244,11 @@ static inline void idctSparseColPut (UINT8 *dest, int line_size,
dest[0] = cm[(a0 - b0) >> COL_SHIFT]; dest[0] = cm[(a0 - b0) >> COL_SHIFT];
} }


static inline void idctSparseColAdd (UINT8 *dest, int line_size,
static inline void idctSparseColAdd (uint8_t *dest, int line_size,
DCTELEM * col) DCTELEM * col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;


/* XXX: I did that only to give same values as previous code */ /* XXX: I did that only to give same values as previous code */
a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
@@ -379,7 +379,7 @@ static inline void idctSparseCol (DCTELEM * col)
col[56] = ((a0 - b0) >> COL_SHIFT); col[56] = ((a0 - b0) >> COL_SHIFT);
} }


void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
void simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
@@ -389,7 +389,7 @@ void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
idctSparseColPut(dest + i, line_size, block + i); idctSparseColPut(dest + i, line_size, block + i);
} }


void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
void simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
@@ -420,10 +420,10 @@ void simple_idct(DCTELEM *block)
and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
#define C_SHIFT (4+1+12) #define C_SHIFT (4+1+12)


static inline void idct4col(UINT8 *dest, int line_size, const DCTELEM *col)
static inline void idct4col(uint8_t *dest, int line_size, const DCTELEM *col)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
const uint8_t *cm = cropTbl + MAX_NEG_CROP;


a0 = col[8*0]; a0 = col[8*0];
a1 = col[8*2]; a1 = col[8*2];
@@ -457,7 +457,7 @@ static inline void idct4col(UINT8 *dest, int line_size, const DCTELEM *col)
/* XXX: I think a 1.0/sqrt(2) normalization should be needed to /* XXX: I think a 1.0/sqrt(2) normalization should be needed to
compensate the extra butterfly stage - I don't have the full DV compensate the extra butterfly stage - I don't have the full DV
specification */ specification */
void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block)
void simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
DCTELEM *ptr; DCTELEM *ptr;
@@ -500,10 +500,10 @@ void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block)
#define C2 C_FIX(0.2705980501) #define C2 C_FIX(0.2705980501)
#define C3 C_FIX(0.5) #define C3 C_FIX(0.5)
#define C_SHIFT (4+1+12) #define C_SHIFT (4+1+12)
static inline void idct4col_add(UINT8 *dest, int line_size, const DCTELEM *col)
static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
const uint8_t *cm = cropTbl + MAX_NEG_CROP;


a0 = col[8*0]; a0 = col[8*0];
a1 = col[8*1]; a1 = col[8*1];
@@ -531,7 +531,7 @@ static inline void idct4col_add(UINT8 *dest, int line_size, const DCTELEM *col)
static inline void idct4row(DCTELEM *row) static inline void idct4row(DCTELEM *row)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
//const uint8_t *cm = cropTbl + MAX_NEG_CROP;


a0 = row[0]; a0 = row[0];
a1 = row[1]; a1 = row[1];
@@ -547,7 +547,7 @@ static inline void idct4row(DCTELEM *row)
row[3]= (c0 - c1) >> R_SHIFT; row[3]= (c0 - c1) >> R_SHIFT;
} }


void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block)
void simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
int i; int i;


@@ -562,7 +562,7 @@ void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block)
} }
} }


void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block)
void simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block)
{ {
int i; int i;




+ 7
- 7
libavcodec/simple_idct.h View File

@@ -18,14 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */


void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
void simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_mmx(int16_t *block); void ff_simple_idct_mmx(int16_t *block);
void ff_simple_idct_add_mmx(UINT8 *dest, int line_size, int16_t *block);
void ff_simple_idct_put_mmx(UINT8 *dest, int line_size, int16_t *block);
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block);
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block);
void simple_idct(DCTELEM *block); void simple_idct(DCTELEM *block);


void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block);


void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block);
void simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block);

+ 1
- 1
libavcodec/svq1.c View File

@@ -1083,7 +1083,7 @@ static int svq1_decode_frame_header (bit_buffer_t *bitbuf,MpegEncContext *s) {


static int svq1_decode_frame(AVCodecContext *avctx, static int svq1_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
MpegEncContext *s=avctx->priv_data; MpegEncContext *s=avctx->priv_data;
uint8_t *current, *previous; uint8_t *current, *previous;


+ 6
- 6
libavcodec/utils.c View File

@@ -285,7 +285,7 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
return 0; return 0;
} }


int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const short *samples) const short *samples)
{ {
int ret; int ret;
@@ -295,7 +295,7 @@ int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
return ret; return ret;
} }


int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVFrame *pict) const AVFrame *pict)
{ {
int ret; int ret;
@@ -313,7 +313,7 @@ int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
zero. Otherwise, it is non zero */ zero. Otherwise, it is non zero */
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr, int *got_picture_ptr,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
int ret; int ret;
@@ -331,9 +331,9 @@ int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
*number of bytes used. If no frame could be decompressed, *number of bytes used. If no frame could be decompressed,
*frame_size_ptr is zero. Otherwise, it is the decompressed frame *frame_size_ptr is zero. Otherwise, it is the decompressed frame
*size in BYTES. */ *size in BYTES. */
int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr, int *frame_size_ptr,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
int ret; int ret;


@@ -589,7 +589,7 @@ static int raw_encode_init(AVCodecContext *s)


static int raw_decode_frame(AVCodecContext *avctx, static int raw_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
return -1; return -1;
} }


+ 1
- 1
libavcodec/wmadec.c View File

@@ -1215,7 +1215,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)


static int wma_decode_superframe(AVCodecContext *avctx, static int wma_decode_superframe(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
UINT8 *buf, int buf_size)
uint8_t *buf, int buf_size)
{ {
WMADecodeContext *s = avctx->priv_data; WMADecodeContext *s = avctx->priv_data;
int nb_frames, bit_offset, i, pos, len; int nb_frames, bit_offset, i, pos, len;


+ 7
- 8
libavcodec/wmv2.c View File

@@ -192,7 +192,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
Wmv2Context * const w= (Wmv2Context*)s; Wmv2Context * const w= (Wmv2Context*)s;
int cbp, coded_cbp, i; int cbp, coded_cbp, i;
int pred_x, pred_y; int pred_x, pred_y;
UINT8 *coded_block;
uint8_t *coded_block;


handle_slices(s); handle_slices(s);
@@ -491,7 +491,7 @@ static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){
static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
MpegEncContext * const s= &w->s; MpegEncContext * const s= &w->s;
int xy, wrap, diff, type; int xy, wrap, diff, type;
INT16 *A, *B, *C, *mot_val;
int16_t *A, *B, *C, *mot_val;


wrap = s->block_wrap[0]; wrap = s->block_wrap[0];
xy = s->block_index[0]; xy = s->block_index[0];
@@ -576,8 +576,7 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n,
static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){ static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){
MpegEncContext * const s= &w->s; MpegEncContext * const s= &w->s;
uint8_t temp[2][64]; uint8_t temp[2][64];
int i;

switch(w->abt_type_table[n]){ switch(w->abt_type_table[n]){
case 0: case 0:
if (s->block_last_index[n] >= 0) { if (s->block_last_index[n] >= 0) {
@@ -614,12 +613,12 @@ void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block1[6][64], uint8_t *dest_y, u
} }


void ff_mspel_motion(MpegEncContext *s, void ff_mspel_motion(MpegEncContext *s,
UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
UINT8 **ref_picture, op_pixels_func (*pix_op)[4],
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h) int motion_x, int motion_y, int h)
{ {
Wmv2Context * const w= (Wmv2Context*)s; Wmv2Context * const w= (Wmv2Context*)s;
UINT8 *ptr;
uint8_t *ptr;
int dxy, offset, mx, my, src_x, src_y, v_edge_pos, linesize, uvlinesize; int dxy, offset, mx, my, src_x, src_y, v_edge_pos, linesize, uvlinesize;
int emu=0; int emu=0;
@@ -700,7 +699,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
{ {
Wmv2Context * const w= (Wmv2Context*)s; Wmv2Context * const w= (Wmv2Context*)s;
int cbp, code, i; int cbp, code, i;
UINT8 *coded_val;
uint8_t *coded_val;


if(w->j_type) return 0; if(w->j_type) return 0;


+ 29
- 29
libavformat/asf.c View File

@@ -31,7 +31,7 @@ typedef struct {
AVPacket pkt; AVPacket pkt;
int frag_offset; int frag_offset;
int timestamp; int timestamp;
INT64 duration;
int64_t duration;


int ds_span; /* descrambling */ int ds_span; /* descrambling */
int ds_packet_size; int ds_packet_size;
@@ -42,10 +42,10 @@ typedef struct {
} ASFStream; } ASFStream;


typedef struct { typedef struct {
UINT32 v1;
UINT16 v2;
UINT16 v3;
UINT8 v4[8];
uint32_t v1;
uint16_t v2;
uint16_t v3;
uint8_t v4[8];
} GUID; } GUID;


typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) {
@@ -83,14 +83,14 @@ typedef struct {
int asfid2avid[128]; /* conversion table from asf ID 2 AVStream ID */ int asfid2avid[128]; /* conversion table from asf ID 2 AVStream ID */
ASFStream streams[128]; /* it's max number and it's not that big */ ASFStream streams[128]; /* it's max number and it's not that big */
/* non streamed additonnal info */ /* non streamed additonnal info */
INT64 nb_packets;
INT64 duration; /* in 100ns units */
int64_t nb_packets;
int64_t duration; /* in 100ns units */
/* packet filling */ /* packet filling */
int packet_size_left; int packet_size_left;
int packet_timestamp_start; int packet_timestamp_start;
int packet_timestamp_end; int packet_timestamp_end;
int packet_nb_frames; int packet_nb_frames;
UINT8 packet_buf[PACKET_SIZE];
uint8_t packet_buf[PACKET_SIZE];
ByteIOContext pb; ByteIOContext pb;
/* only for reading */ /* only for reading */
uint64_t data_offset; /* begining of the first data packet */ uint64_t data_offset; /* begining of the first data packet */
@@ -199,7 +199,7 @@ static void put_str16(ByteIOContext *s, const char *tag)


put_le16(s,strlen(tag) + 1); put_le16(s,strlen(tag) + 1);
for(;;) { for(;;) {
c = (UINT8)*tag++;
c = (uint8_t)*tag++;
put_le16(s, c); put_le16(s, c);
if (c == '\0') if (c == '\0')
break; break;
@@ -211,16 +211,16 @@ static void put_str16_nolen(ByteIOContext *s, const char *tag)
int c; int c;


for(;;) { for(;;) {
c = (UINT8)*tag++;
c = (uint8_t)*tag++;
put_le16(s, c); put_le16(s, c);
if (c == '\0') if (c == '\0')
break; break;
} }
} }


static INT64 put_header(ByteIOContext *pb, const GUID *g)
static int64_t put_header(ByteIOContext *pb, const GUID *g)
{ {
INT64 pos;
int64_t pos;


pos = url_ftell(pb); pos = url_ftell(pb);
put_guid(pb, g); put_guid(pb, g);
@@ -229,9 +229,9 @@ static INT64 put_header(ByteIOContext *pb, const GUID *g)
} }


/* update header size */ /* update header size */
static void end_header(ByteIOContext *pb, INT64 pos)
static void end_header(ByteIOContext *pb, int64_t pos)
{ {
INT64 pos1;
int64_t pos1;


pos1 = url_ftell(pb); pos1 = url_ftell(pb);
url_fseek(pb, pos + 16, SEEK_SET); url_fseek(pb, pos + 16, SEEK_SET);
@@ -256,24 +256,24 @@ static void put_chunk(AVFormatContext *s, int type, int payload_length, int flag
} }


/* convert from unix to windows time */ /* convert from unix to windows time */
static INT64 unix_to_file_time(int ti)
static int64_t unix_to_file_time(int ti)
{ {
INT64 t;
int64_t t;


t = ti * INT64_C(10000000);
t += INT64_C(116444736000000000);
t = ti * int64_t_C(10000000);
t += int64_t_C(116444736000000000);
return t; return t;
} }


/* write the header (used two times if non streamed) */ /* write the header (used two times if non streamed) */
static int asf_write_header1(AVFormatContext *s, INT64 file_size, INT64 data_chunk_size)
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
int has_title; int has_title;
AVCodecContext *enc; AVCodecContext *enc;
INT64 header_offset, cur_pos, hpos;
int64_t header_offset, cur_pos, hpos;
int bit_rate; int bit_rate;


has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]); has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]);
@@ -337,7 +337,7 @@ static int asf_write_header1(AVFormatContext *s, INT64 file_size, INT64 data_chu


/* stream headers */ /* stream headers */
for(n=0;n<s->nb_streams;n++) { for(n=0;n<s->nb_streams;n++) {
INT64 es_pos;
int64_t es_pos;
// ASFStream *stream = &asf->streams[n]; // ASFStream *stream = &asf->streams[n];


enc = &s->streams[n]->codec; enc = &s->streams[n]->codec;
@@ -574,7 +574,7 @@ static void put_frame_header(AVFormatContext *s, ASFStream *stream, int timestam
crap. They have misread the MPEG Systems spec ! crap. They have misread the MPEG Systems spec !
*/ */
static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp, static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp,
UINT8 *buf, int payload_size)
uint8_t *buf, int payload_size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
int frag_pos, frag_len, frag_len1; int frag_pos, frag_len, frag_len1;
@@ -607,22 +607,22 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp,




static int asf_write_packet(AVFormatContext *s, int stream_index, static int asf_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int timestamp)
uint8_t *buf, int size, int timestamp)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ASFStream *stream; ASFStream *stream;
INT64 duration;
int64_t duration;
AVCodecContext *codec; AVCodecContext *codec;


codec = &s->streams[stream_index]->codec; codec = &s->streams[stream_index]->codec;
stream = &asf->streams[stream_index]; stream = &asf->streams[stream_index];


if (codec->codec_type == CODEC_TYPE_AUDIO) { if (codec->codec_type == CODEC_TYPE_AUDIO) {
duration = (codec->frame_number * codec->frame_size * INT64_C(10000000)) /
duration = (codec->frame_number * codec->frame_size * int64_t_C(10000000)) /
codec->sample_rate; codec->sample_rate;
} else { } else {
duration = codec->frame_number * duration = codec->frame_number *
((INT64_C(10000000) * FRAME_RATE_BASE) / codec->frame_rate);
((int64_t_C(10000000) * FRAME_RATE_BASE) / codec->frame_rate);
} }
if (duration > asf->duration) if (duration > asf->duration)
asf->duration = duration; asf->duration = duration;
@@ -634,7 +634,7 @@ static int asf_write_packet(AVFormatContext *s, int stream_index,
static int asf_write_trailer(AVFormatContext *s) static int asf_write_trailer(AVFormatContext *s)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
INT64 file_size;
int64_t file_size;


/* flush the current packet */ /* flush the current packet */
if (asf->pb.buf_ptr > asf->pb.buffer) if (asf->pb.buf_ptr > asf->pb.buffer)
@@ -746,7 +746,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st; AVStream *st;
ASFStream *asf_st; ASFStream *asf_st;
int size, i; int size, i;
INT64 gsize;
int64_t gsize;


av_set_pts_info(s, 32, 1, 1000); /* 32 bit pts in ms */ av_set_pts_info(s, 32, 1, 1000); /* 32 bit pts in ms */


@@ -786,7 +786,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else if (!memcmp(&g, &stream_header, sizeof(GUID))) { } else if (!memcmp(&g, &stream_header, sizeof(GUID))) {
int type, total_size; int type, total_size;
unsigned int tag1; unsigned int tag1;
INT64 pos1, pos2;
int64_t pos1, pos2;


pos1 = url_ftell(pb); pos1 = url_ftell(pb);




+ 5
- 5
libavformat/au.c View File

@@ -29,7 +29,7 @@
#include "avi.h" #include "avi.h"


/* if we don't know the size in advance */ /* if we don't know the size in advance */
#define AU_UNKOWN_SIZE ((UINT32)(~0))
#define AU_UNKOWN_SIZE ((uint32_t)(~0))


/* The ffmpeg codecs we support, and the IDs they have in the file */ /* The ffmpeg codecs we support, and the IDs they have in the file */
static const CodecTag codec_au_tags[] = { static const CodecTag codec_au_tags[] = {
@@ -50,9 +50,9 @@ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
put_tag(pb, ".snd"); /* magic number */ put_tag(pb, ".snd"); /* magic number */
put_be32(pb, 24); /* header size */ put_be32(pb, 24); /* header size */
put_be32(pb, AU_UNKOWN_SIZE); /* data size */ put_be32(pb, AU_UNKOWN_SIZE); /* data size */
put_be32(pb, (UINT32)tag); /* codec ID */
put_be32(pb, (uint32_t)tag); /* codec ID */
put_be32(pb, enc->sample_rate); put_be32(pb, enc->sample_rate);
put_be32(pb, (UINT32)enc->channels);
put_be32(pb, (uint32_t)enc->channels);
return 0; return 0;
} }


@@ -73,7 +73,7 @@ static int au_write_header(AVFormatContext *s)
} }


static int au_write_packet(AVFormatContext *s, int stream_index_ptr, static int au_write_packet(AVFormatContext *s, int stream_index_ptr,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
put_buffer(pb, buf, size); put_buffer(pb, buf, size);
@@ -90,7 +90,7 @@ static int au_write_trailer(AVFormatContext *s)
/* update file size */ /* update file size */
file_size = url_ftell(pb); file_size = url_ftell(pb);
url_fseek(pb, 8, SEEK_SET); url_fseek(pb, 8, SEEK_SET);
put_be32(pb, (UINT32)(file_size - 24));
put_be32(pb, (uint32_t)(file_size - 24));
url_fseek(pb, file_size, SEEK_SET); url_fseek(pb, file_size, SEEK_SET);


put_flush_packet(pb); put_flush_packet(pb);


+ 2
- 2
libavformat/audio.c View File

@@ -37,7 +37,7 @@ typedef struct {
int frame_size; /* in bytes ! */ int frame_size; /* in bytes ! */
int codec_id; int codec_id;
int flip_left : 1; int flip_left : 1;
UINT8 buffer[AUDIO_BLOCK_SIZE];
uint8_t buffer[AUDIO_BLOCK_SIZE];
int buffer_ptr; int buffer_ptr;
} AudioData; } AudioData;


@@ -165,7 +165,7 @@ static int audio_write_header(AVFormatContext *s1)
} }


static int audio_write_packet(AVFormatContext *s1, int stream_index, static int audio_write_packet(AVFormatContext *s1, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
AudioData *s = s1->priv_data; AudioData *s = s1->priv_data;
int len, ret; int len, ret;


+ 15
- 15
libavformat/avformat.h View File

@@ -18,8 +18,8 @@ extern "C" {
#define AV_NOPTS_VALUE 0 #define AV_NOPTS_VALUE 0


typedef struct AVPacket { typedef struct AVPacket {
INT64 pts; /* presentation time stamp in stream units (set av_set_pts_info) */
UINT8 *data;
int64_t pts; /* presentation time stamp in stream units (set av_set_pts_info) */
uint8_t *data;
int size; int size;
int stream_index; int stream_index;
int flags; int flags;
@@ -54,12 +54,12 @@ static inline void av_free_packet(AVPacket *pkt)
/* the exact value of the fractional number is: 'val + num / den'. num /* the exact value of the fractional number is: 'val + num / den'. num
is assumed to be such as 0 <= num < den */ is assumed to be such as 0 <= num < den */
typedef struct AVFrac { typedef struct AVFrac {
INT64 val, num, den;
int64_t val, num, den;
} AVFrac; } AVFrac;


void av_frac_init(AVFrac *f, INT64 val, INT64 num, INT64 den);
void av_frac_add(AVFrac *f, INT64 incr);
void av_frac_set(AVFrac *f, INT64 val);
void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den);
void av_frac_add(AVFrac *f, int64_t incr);
void av_frac_set(AVFrac *f, int64_t val);


/*************************************************/ /*************************************************/
/* input/output formats */ /* input/output formats */
@@ -141,7 +141,7 @@ typedef struct AVInputFormat {
int (*read_close)(struct AVFormatContext *); int (*read_close)(struct AVFormatContext *);
/* seek at or before a given pts (given in microsecond). The pts /* seek at or before a given pts (given in microsecond). The pts
origin is defined by the stream */ origin is defined by the stream */
int (*read_seek)(struct AVFormatContext *, INT64 pts);
int (*read_seek)(struct AVFormatContext *, int64_t pts);
/* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_NOHEADER */ /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_NOHEADER */
int flags; int flags;
/* if extensions are defined, then no probe is done. You should /* if extensions are defined, then no probe is done. You should
@@ -337,20 +337,20 @@ AVOutputFormat *guess_stream_format(const char *short_name,
AVOutputFormat *guess_format(const char *short_name, AVOutputFormat *guess_format(const char *short_name,
const char *filename, const char *mime_type); const char *filename, const char *mime_type);


void av_hex_dump(UINT8 *buf, int size);
void av_hex_dump(uint8_t *buf, int size);


void av_register_all(void); void av_register_all(void);


typedef struct FifoBuffer { typedef struct FifoBuffer {
UINT8 *buffer;
UINT8 *rptr, *wptr, *end;
uint8_t *buffer;
uint8_t *rptr, *wptr, *end;
} FifoBuffer; } FifoBuffer;


int fifo_init(FifoBuffer *f, int size); int fifo_init(FifoBuffer *f, int size);
void fifo_free(FifoBuffer *f); void fifo_free(FifoBuffer *f);
int fifo_size(FifoBuffer *f, UINT8 *rptr);
int fifo_read(FifoBuffer *f, UINT8 *buf, int buf_size, UINT8 **rptr_ptr);
void fifo_write(FifoBuffer *f, UINT8 *buf, int size, UINT8 **wptr_ptr);
int fifo_size(FifoBuffer *f, uint8_t *rptr);
int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);


/* media file input */ /* media file input */
AVInputFormat *av_find_input_format(const char *short_name); AVInputFormat *av_find_input_format(const char *short_name);
@@ -386,9 +386,9 @@ void dump_format(AVFormatContext *ic,
const char *url, const char *url,
int is_output); int is_output);
int parse_image_size(int *width_ptr, int *height_ptr, const char *str); int parse_image_size(int *width_ptr, int *height_ptr, const char *str);
INT64 parse_date(const char *datestr, int duration);
int64_t parse_date(const char *datestr, int duration);


INT64 av_gettime(void);
int64_t av_gettime(void);


/* ffm specific for ffserver */ /* ffm specific for ffserver */
#define FFM_PACKET_SIZE 4096 #define FFM_PACKET_SIZE 4096


+ 3
- 3
libavformat/avidec.c View File

@@ -28,7 +28,7 @@ typedef struct AVIIndex {
} AVIIndex; } AVIIndex;


typedef struct { typedef struct {
INT64 movi_end;
int64_t movi_end;
offset_t movi_list; offset_t movi_list;
AVIIndex *first, *last; AVIIndex *first, *last;
} AVIContext; } AVIContext;
@@ -49,7 +49,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
UINT32 tag, tag1;
uint32_t tag, tag1;
int codec_type, stream_index, frame_period, bit_rate; int codec_type, stream_index, frame_period, bit_rate;
unsigned int size; unsigned int size;
int i; int i;
@@ -144,7 +144,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec.width = get_le32(pb); st->codec.width = get_le32(pb);
st->codec.height = get_le32(pb); st->codec.height = get_le32(pb);
if (frame_period) if (frame_period)
st->codec.frame_rate = (INT64_C(1000000) * FRAME_RATE_BASE) / frame_period;
st->codec.frame_rate = (int64_t_C(1000000) * FRAME_RATE_BASE) / frame_period;
else else
st->codec.frame_rate = 25 * FRAME_RATE_BASE; st->codec.frame_rate = 25 * FRAME_RATE_BASE;
get_le16(pb); /* panes */ get_le16(pb); /* panes */


+ 4
- 4
libavformat/avienc.c View File

@@ -49,7 +49,7 @@ void end_tag(ByteIOContext *pb, offset_t start)


pos = url_ftell(pb); pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET); url_fseek(pb, start - 4, SEEK_SET);
put_le32(pb, (UINT32)(pos - start));
put_le32(pb, (uint32_t)(pos - start));
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
} }


@@ -211,7 +211,7 @@ static int avi_write_header(AVFormatContext *s)
nb_frames = 0; nb_frames = 0;


if(video_enc){ if(video_enc){
put_le32(pb, (UINT32)(INT64_C(1000000) * FRAME_RATE_BASE / video_enc->frame_rate));
put_le32(pb, (uint32_t)(int64_t_C(1000000) * FRAME_RATE_BASE / video_enc->frame_rate));
} else { } else {
put_le32(pb, 0); put_le32(pb, 0);
} }
@@ -320,7 +320,7 @@ static int avi_write_header(AVFormatContext *s)
} }


static int avi_write_packet(AVFormatContext *s, int stream_index, static int avi_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
@@ -395,7 +395,7 @@ static int avi_write_trailer(AVFormatContext *s)
/* update file size */ /* update file size */
file_size = url_ftell(pb); file_size = url_ftell(pb);
url_fseek(pb, 4, SEEK_SET); url_fseek(pb, 4, SEEK_SET);
put_le32(pb, (UINT32)(file_size - 8));
put_le32(pb, (uint32_t)(file_size - 8));


/* Fill in frame/sample counters */ /* Fill in frame/sample counters */
nb_frames = 0; nb_frames = 0;


+ 11
- 11
libavformat/avio.h View File

@@ -3,7 +3,7 @@


/* output byte stream handling */ /* output byte stream handling */


typedef INT64 offset_t;
typedef int64_t offset_t;


/* unbuffered I/O */ /* unbuffered I/O */


@@ -60,8 +60,8 @@ typedef struct {
int buffer_size; int buffer_size;
unsigned char *buf_ptr, *buf_end; unsigned char *buf_ptr, *buf_end;
void *opaque; void *opaque;
int (*read_packet)(void *opaque, UINT8 *buf, int buf_size);
void (*write_packet)(void *opaque, UINT8 *buf, int buf_size);
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
void (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
int (*seek)(void *opaque, offset_t offset, int whence); int (*seek)(void *opaque, offset_t offset, int whence);
offset_t pos; /* position in the file of the current buffer */ offset_t pos; /* position in the file of the current buffer */
int must_flush; /* true if the next seek should flush */ int must_flush; /* true if the next seek should flush */
@@ -76,14 +76,14 @@ int init_put_byte(ByteIOContext *s,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
void *opaque, void *opaque,
int (*read_packet)(void *opaque, UINT8 *buf, int buf_size),
void (*write_packet)(void *opaque, UINT8 *buf, int buf_size),
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
void (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*seek)(void *opaque, offset_t offset, int whence)); int (*seek)(void *opaque, offset_t offset, int whence));


void put_byte(ByteIOContext *s, int b); void put_byte(ByteIOContext *s, int b);
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
void put_le64(ByteIOContext *s, UINT64 val);
void put_be64(ByteIOContext *s, UINT64 val);
void put_le64(ByteIOContext *s, uint64_t val);
void put_be64(ByteIOContext *s, uint64_t val);
void put_le32(ByteIOContext *s, unsigned int val); void put_le32(ByteIOContext *s, unsigned int val);
void put_be32(ByteIOContext *s, unsigned int val); void put_be32(ByteIOContext *s, unsigned int val);
void put_le16(ByteIOContext *s, unsigned int val); void put_le16(ByteIOContext *s, unsigned int val);
@@ -108,14 +108,14 @@ void put_flush_packet(ByteIOContext *s);
int get_buffer(ByteIOContext *s, unsigned char *buf, int size); int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
int get_byte(ByteIOContext *s); int get_byte(ByteIOContext *s);
unsigned int get_le32(ByteIOContext *s); unsigned int get_le32(ByteIOContext *s);
UINT64 get_le64(ByteIOContext *s);
uint64_t get_le64(ByteIOContext *s);
unsigned int get_le16(ByteIOContext *s); unsigned int get_le16(ByteIOContext *s);


double get_be64_double(ByteIOContext *s); double get_be64_double(ByteIOContext *s);
char *get_strz(ByteIOContext *s, char *buf, int maxlen); char *get_strz(ByteIOContext *s, char *buf, int maxlen);
unsigned int get_be16(ByteIOContext *s); unsigned int get_be16(ByteIOContext *s);
unsigned int get_be32(ByteIOContext *s); unsigned int get_be32(ByteIOContext *s);
UINT64 get_be64(ByteIOContext *s);
uint64_t get_be64(ByteIOContext *s);


static inline int url_is_streamed(ByteIOContext *s) static inline int url_is_streamed(ByteIOContext *s)
{ {
@@ -129,12 +129,12 @@ int url_fclose(ByteIOContext *s);
URLContext *url_fileno(ByteIOContext *s); URLContext *url_fileno(ByteIOContext *s);
int url_fget_max_packet_size(ByteIOContext *s); int url_fget_max_packet_size(ByteIOContext *s);


int url_open_buf(ByteIOContext *s, UINT8 *buf, int buf_size, int flags);
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags);
int url_close_buf(ByteIOContext *s); int url_close_buf(ByteIOContext *s);


int url_open_dyn_buf(ByteIOContext *s); int url_open_dyn_buf(ByteIOContext *s);
int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size); int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size);
int url_close_dyn_buf(ByteIOContext *s, UINT8 **pbuffer);
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer);


/* file.c */ /* file.c */
extern URLProtocol file_protocol; extern URLProtocol file_protocol;


+ 30
- 30
libavformat/aviobuf.c View File

@@ -27,8 +27,8 @@ int init_put_byte(ByteIOContext *s,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
void *opaque, void *opaque,
int (*read_packet)(void *opaque, UINT8 *buf, int buf_size),
void (*write_packet)(void *opaque, UINT8 *buf, int buf_size),
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
void (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*seek)(void *opaque, offset_t offset, int whence)) int (*seek)(void *opaque, offset_t offset, int whence))
{ {
s->buffer = buffer; s->buffer = buffer;
@@ -182,7 +182,7 @@ void put_be64_double(ByteIOContext *s, double val)
{ {
union { union {
double d; double d;
UINT64 ull;
uint64_t ull;
} u; } u;
u.d = val; u.d = val;
put_be64(s, u.ull); put_be64(s, u.ull);
@@ -196,16 +196,16 @@ void put_strz(ByteIOContext *s, const char *str)
put_byte(s, 0); put_byte(s, 0);
} }


void put_le64(ByteIOContext *s, UINT64 val)
void put_le64(ByteIOContext *s, uint64_t val)
{ {
put_le32(s, (UINT32)(val & 0xffffffff));
put_le32(s, (UINT32)(val >> 32));
put_le32(s, (uint32_t)(val & 0xffffffff));
put_le32(s, (uint32_t)(val >> 32));
} }


void put_be64(ByteIOContext *s, UINT64 val)
void put_be64(ByteIOContext *s, uint64_t val)
{ {
put_be32(s, (UINT32)(val >> 32));
put_be32(s, (UINT32)(val & 0xffffffff));
put_be32(s, (uint32_t)(val >> 32));
put_be32(s, (uint32_t)(val & 0xffffffff));
} }


void put_le16(ByteIOContext *s, unsigned int val) void put_le16(ByteIOContext *s, unsigned int val)
@@ -320,11 +320,11 @@ unsigned int get_le32(ByteIOContext *s)
return val; return val;
} }


UINT64 get_le64(ByteIOContext *s)
uint64_t get_le64(ByteIOContext *s)
{ {
UINT64 val;
val = (UINT64)get_le32(s);
val |= (UINT64)get_le32(s) << 32;
uint64_t val;
val = (uint64_t)get_le32(s);
val |= (uint64_t)get_le32(s) << 32;
return val; return val;
} }


@@ -350,7 +350,7 @@ double get_be64_double(ByteIOContext *s)
{ {
union { union {
double d; double d;
UINT64 ull;
uint64_t ull;
} u; } u;


u.ull = get_be64(s); u.ull = get_be64(s);
@@ -372,29 +372,29 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
return buf; return buf;
} }


UINT64 get_be64(ByteIOContext *s)
uint64_t get_be64(ByteIOContext *s)
{ {
UINT64 val;
val = (UINT64)get_be32(s) << 32;
val |= (UINT64)get_be32(s);
uint64_t val;
val = (uint64_t)get_be32(s) << 32;
val |= (uint64_t)get_be32(s);
return val; return val;
} }


/* link with avio functions */ /* link with avio functions */


static void url_write_packet(void *opaque, UINT8 *buf, int buf_size)
static void url_write_packet(void *opaque, uint8_t *buf, int buf_size)
{ {
URLContext *h = opaque; URLContext *h = opaque;
url_write(h, buf, buf_size); url_write(h, buf, buf_size);
} }


static int url_read_packet(void *opaque, UINT8 *buf, int buf_size)
static int url_read_packet(void *opaque, uint8_t *buf, int buf_size)
{ {
URLContext *h = opaque; URLContext *h = opaque;
return url_read(h, buf, buf_size); return url_read(h, buf, buf_size);
} }


static int url_seek_packet(void *opaque, INT64 offset, int whence)
static int url_seek_packet(void *opaque, int64_t offset, int whence)
{ {
URLContext *h = opaque; URLContext *h = opaque;
url_seek(h, offset, whence); url_seek(h, offset, whence);
@@ -403,7 +403,7 @@ static int url_seek_packet(void *opaque, INT64 offset, int whence)


int url_fdopen(ByteIOContext *s, URLContext *h) int url_fdopen(ByteIOContext *s, URLContext *h)
{ {
UINT8 *buffer;
uint8_t *buffer;
int buffer_size, max_packet_size; int buffer_size, max_packet_size;


@@ -431,7 +431,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
/* XXX: must be called before any I/O */ /* XXX: must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size) int url_setbufsize(ByteIOContext *s, int buf_size)
{ {
UINT8 *buffer;
uint8_t *buffer;
buffer = av_malloc(buf_size); buffer = av_malloc(buf_size);
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
@@ -530,7 +530,7 @@ int url_fget_max_packet_size(ByteIOContext *s)
} }


/* buffer handling */ /* buffer handling */
int url_open_buf(ByteIOContext *s, UINT8 *buf, int buf_size, int flags)
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
{ {
return init_put_byte(s, buf, buf_size, return init_put_byte(s, buf, buf_size,
(flags & URL_WRONLY) != 0, NULL, NULL, NULL, NULL); (flags & URL_WRONLY) != 0, NULL, NULL, NULL, NULL);
@@ -547,16 +547,16 @@ int url_close_buf(ByteIOContext *s)


typedef struct DynBuffer { typedef struct DynBuffer {
int pos, size, allocated_size; int pos, size, allocated_size;
UINT8 *buffer;
uint8_t *buffer;
int io_buffer_size; int io_buffer_size;
UINT8 io_buffer[1];
uint8_t io_buffer[1];
} DynBuffer; } DynBuffer;


static void dyn_buf_write(void *opaque, UINT8 *buf, int buf_size)
static void dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
{ {
DynBuffer *d = opaque; DynBuffer *d = opaque;
int new_size, new_allocated_size; int new_size, new_allocated_size;
UINT8 *new_buffer;
uint8_t *new_buffer;
/* reallocate buffer if needed */ /* reallocate buffer if needed */
new_size = d->pos + buf_size; new_size = d->pos + buf_size;
@@ -583,7 +583,7 @@ static void dyn_buf_write(void *opaque, UINT8 *buf, int buf_size)
d->size = d->pos; d->size = d->pos;
} }


static void dyn_packet_buf_write(void *opaque, UINT8 *buf, int buf_size)
static void dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
{ {
unsigned char buf1[4]; unsigned char buf1[4];


@@ -674,7 +674,7 @@ int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size)
* @param pointer to a byte buffer * @param pointer to a byte buffer
* @return the length of the byte buffer * @return the length of the byte buffer
*/ */
int url_close_dyn_buf(ByteIOContext *s, UINT8 **pbuffer)
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
{ {
DynBuffer *d = s->opaque; DynBuffer *d = s->opaque;
int size; int size;


+ 2
- 2
libavformat/crc.c View File

@@ -33,7 +33,7 @@
#define DO8(buf) DO4(buf); DO4(buf); #define DO8(buf) DO4(buf); DO4(buf);
#define DO16(buf) DO8(buf); DO8(buf); #define DO16(buf) DO8(buf); DO8(buf);


static UINT32 adler32(UINT32 adler, UINT8 *buf, unsigned int len)
static uint32_t adler32(uint32_t adler, uint8_t *buf, unsigned int len)
{ {
unsigned long s1 = adler & 0xffff; unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff;
@@ -58,7 +58,7 @@ static UINT32 adler32(UINT32 adler, UINT8 *buf, unsigned int len)
} }


typedef struct CRCState { typedef struct CRCState {
UINT32 crcval;
uint32_t crcval;
} CRCState; } CRCState;


static int crc_write_header(struct AVFormatContext *s) static int crc_write_header(struct AVFormatContext *s)


+ 1
- 1
libavformat/dv1394.c View File

@@ -46,7 +46,7 @@ struct dv1394_data {
int done; /* Number of completed frames */ int done; /* Number of completed frames */


int stream; /* Current stream. 0 - video, 1 - audio */ int stream; /* Current stream. 0 - video, 1 - audio */
INT64 pts; /* Current timestamp */
int64_t pts; /* Current timestamp */
}; };


static int dv1394_reset(struct dv1394_data *dv) static int dv1394_reset(struct dv1394_data *dv)


+ 22
- 22
libavformat/ffm.c View File

@@ -28,7 +28,7 @@
#define FLAG_KEY_FRAME 0x01 #define FLAG_KEY_FRAME 0x01


typedef struct FFMStream { typedef struct FFMStream {
INT64 pts;
int64_t pts;
} FFMStream; } FFMStream;


enum { enum {
@@ -40,15 +40,15 @@ typedef struct FFMContext {
/* only reading mode */ /* only reading mode */
offset_t write_index, file_size; offset_t write_index, file_size;
int read_state; int read_state;
UINT8 header[FRAME_HEADER_SIZE];
uint8_t header[FRAME_HEADER_SIZE];


/* read and write */ /* read and write */
int first_packet; /* true if first packet, needed to set the discontinuity tag */ int first_packet; /* true if first packet, needed to set the discontinuity tag */
int packet_size; int packet_size;
int frame_offset; int frame_offset;
INT64 pts;
UINT8 *packet_ptr, *packet_end;
UINT8 packet[FFM_PACKET_SIZE];
int64_t pts;
uint8_t *packet_ptr, *packet_end;
uint8_t packet[FFM_PACKET_SIZE];
} FFMContext; } FFMContext;


/* disable pts hack for testing */ /* disable pts hack for testing */
@@ -82,8 +82,8 @@ static void flush_packet(AVFormatContext *s)


/* 'first' is true if first data of a frame */ /* 'first' is true if first data of a frame */
static void ffm_write_data(AVFormatContext *s, static void ffm_write_data(AVFormatContext *s,
UINT8 *buf, int size,
INT64 pts, int first)
uint8_t *buf, int size,
int64_t pts, int first)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
int len; int len;
@@ -214,12 +214,12 @@ static int ffm_write_header(AVFormatContext *s)
} }


static int ffm_write_packet(AVFormatContext *s, int stream_index, static int ffm_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];
FFMStream *fst = st->priv_data; FFMStream *fst = st->priv_data;
INT64 pts;
UINT8 header[FRAME_HEADER_SIZE];
int64_t pts;
uint8_t header[FRAME_HEADER_SIZE];
int duration; int duration;


if (st->codec.codec_type == CODEC_TYPE_AUDIO) { if (st->codec.codec_type == CODEC_TYPE_AUDIO) {
@@ -260,7 +260,7 @@ static int ffm_write_trailer(AVFormatContext *s)
put_flush_packet(pb); put_flush_packet(pb);


if (!url_is_streamed(pb)) { if (!url_is_streamed(pb)) {
INT64 size;
int64_t size;
/* update the write offset */ /* update the write offset */
size = url_ftell(pb); size = url_ftell(pb);
url_fseek(pb, 8, SEEK_SET); url_fseek(pb, 8, SEEK_SET);
@@ -305,7 +305,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)


/* first is true if we read the frame header */ /* first is true if we read the frame header */
static int ffm_read_data(AVFormatContext *s, static int ffm_read_data(AVFormatContext *s,
UINT8 *buf, int size, int first)
uint8_t *buf, int size, int first)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
@@ -368,7 +368,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
AVCodecContext *codec; AVCodecContext *codec;
int i; int i;
UINT32 tag;
uint32_t tag;


/* header */ /* header */
tag = get_le32(pb); tag = get_le32(pb);
@@ -382,7 +382,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!url_is_streamed(pb)) { if (!url_is_streamed(pb)) {
ffm->file_size = url_filesize(url_fileno(pb)); ffm->file_size = url_filesize(url_fileno(pb));
} else { } else {
ffm->file_size = (UINT64_C(1) << 63) - 1;
ffm->file_size = (uint64_t_C(1) << 63) - 1;
} }


s->nb_streams = get_be32(pb); s->nb_streams = get_be32(pb);
@@ -411,7 +411,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* specific info */ /* specific info */
switch(codec->codec_type) { switch(codec->codec_type) {
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
codec->frame_rate = ((INT64)get_be32(pb) * FRAME_RATE_BASE) / 1000;
codec->frame_rate = ((int64_t)get_be32(pb) * FRAME_RATE_BASE) / 1000;
codec->width = get_be16(pb); codec->width = get_be16(pb);
codec->height = get_be16(pb); codec->height = get_be16(pb);
codec->gop_size = get_be16(pb); codec->gop_size = get_be16(pb);
@@ -539,10 +539,10 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
} }


static INT64 get_pts(AVFormatContext *s, offset_t pos)
static int64_t get_pts(AVFormatContext *s, offset_t pos)
{ {
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
INT64 pts;
int64_t pts;


ffm_seek1(s, pos); ffm_seek1(s, pos);
url_fskip(pb, 4); url_fskip(pb, 4);
@@ -556,11 +556,11 @@ static INT64 get_pts(AVFormatContext *s, offset_t pos)
/* seek to a given time in the file. The file read pointer is /* seek to a given time in the file. The file read pointer is
positionned at or before pts. XXX: the following code is quite positionned at or before pts. XXX: the following code is quite
approximative */ approximative */
static int ffm_seek(AVFormatContext *s, INT64 wanted_pts)
static int ffm_seek(AVFormatContext *s, int64_t wanted_pts)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
offset_t pos_min, pos_max, pos; offset_t pos_min, pos_max, pos;
INT64 pts_min, pts_max, pts;
int64_t pts_min, pts_max, pts;
double pos1; double pos1;


#ifdef DEBUG_SEEK #ifdef DEBUG_SEEK
@@ -576,7 +576,7 @@ static int ffm_seek(AVFormatContext *s, INT64 wanted_pts)
/* linear interpolation */ /* linear interpolation */
pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) / pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) /
(double)(pts_max - pts_min); (double)(pts_max - pts_min);
pos = (((INT64)pos1) / FFM_PACKET_SIZE) * FFM_PACKET_SIZE;
pos = (((int64_t)pos1) / FFM_PACKET_SIZE) * FFM_PACKET_SIZE;
if (pos <= pos_min) if (pos <= pos_min)
pos = pos_min; pos = pos_min;
else if (pos >= pos_max) else if (pos >= pos_max)
@@ -601,7 +601,7 @@ static int ffm_seek(AVFormatContext *s, INT64 wanted_pts)


offset_t ffm_read_write_index(int fd) offset_t ffm_read_write_index(int fd)
{ {
UINT8 buf[8];
uint8_t buf[8];
offset_t pos; offset_t pos;
int i; int i;


@@ -615,7 +615,7 @@ offset_t ffm_read_write_index(int fd)


void ffm_write_write_index(int fd, offset_t pos) void ffm_write_write_index(int fd, offset_t pos)
{ {
UINT8 buf[8];
uint8_t buf[8];
int i; int i;


for(i=0;i<8;i++) for(i=0;i<8;i++)


+ 1
- 1
libavformat/framehook.c View File

@@ -95,7 +95,7 @@ void frame_hook_process(AVPicture *pict, enum PixelFormat pix_fmt, int width, in
{ {
if (first_hook) { if (first_hook) {
FrameHookEntry *fhe; FrameHookEntry *fhe;
INT64 pts = av_gettime();
int64_t pts = av_gettime();


for (fhe = first_hook; fhe; fhe = fhe->next) { for (fhe = first_hook; fhe; fhe = fhe->next) {
fhe->Process(fhe->ctx, pict, pix_fmt, width, height, pts); fhe->Process(fhe->ctx, pict, pix_fmt, width, height, pts);


+ 1
- 1
libavformat/framehook.h View File

@@ -13,7 +13,7 @@ typedef FrameHookConfigure *FrameHookConfigureFn;
extern FrameHookConfigure Configure; extern FrameHookConfigure Configure;


/* Function must be called 'Process' */ /* Function must be called 'Process' */
typedef void (FrameHookProcess)(void *ctx, struct AVPicture *pict, enum PixelFormat pix_fmt, int width, int height, INT64 pts);
typedef void (FrameHookProcess)(void *ctx, struct AVPicture *pict, enum PixelFormat pix_fmt, int width, int height, int64_t pts);
typedef FrameHookProcess *FrameHookProcessFn; typedef FrameHookProcess *FrameHookProcessFn;
extern FrameHookProcess Process; extern FrameHookProcess Process;




+ 7
- 7
libavformat/gif.c View File

@@ -212,7 +212,7 @@ static int gif_image_write_header(ByteIOContext *pb,
} }


/* this is maybe slow, but allows for extensions */ /* this is maybe slow, but allows for extensions */
static inline unsigned char gif_clut_index(UINT8 r, UINT8 g, UINT8 b)
static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
{ {
return ((((r)/47)%6)*6*6+(((g)/47)%6)*6+(((b)/47)%6)); return ((((r)/47)%6)*6*6+(((g)/47)%6)*6+(((b)/47)%6));
} }
@@ -223,7 +223,7 @@ static int gif_image_write_image(ByteIOContext *pb,
uint8_t *buf, int linesize, int pix_fmt) uint8_t *buf, int linesize, int pix_fmt)
{ {
PutBitContext p; PutBitContext p;
UINT8 buffer[200]; /* 100 * 9 / 8 = 113 */
uint8_t buffer[200]; /* 100 * 9 / 8 = 113 */
int i, left, w, v; int i, left, w, v;
uint8_t *ptr; uint8_t *ptr;
/* image block */ /* image block */
@@ -287,8 +287,8 @@ static int gif_image_write_image(ByteIOContext *pb,
} }


typedef struct { typedef struct {
INT64 time, file_time;
UINT8 buffer[100]; /* data chunks */
int64_t time, file_time;
uint8_t buffer[100]; /* data chunks */
} GIFContext; } GIFContext;


static int gif_write_header(AVFormatContext *s) static int gif_write_header(AVFormatContext *s)
@@ -331,12 +331,12 @@ static int gif_write_header(AVFormatContext *s)
} }


static int gif_write_video(AVFormatContext *s, static int gif_write_video(AVFormatContext *s,
AVCodecContext *enc, UINT8 *buf, int size)
AVCodecContext *enc, uint8_t *buf, int size)
{ {
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
GIFContext *gif = s->priv_data; GIFContext *gif = s->priv_data;
int jiffies; int jiffies;
INT64 delay;
int64_t delay;


/* graphic control extension block */ /* graphic control extension block */
put_byte(pb, 0x21); put_byte(pb, 0x21);
@@ -366,7 +366,7 @@ static int gif_write_video(AVFormatContext *s,
} }


static int gif_write_packet(AVFormatContext *s, int stream_index, static int gif_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
AVCodecContext *codec = &s->streams[stream_index]->codec; AVCodecContext *codec = &s->streams[stream_index]->codec;
if (codec->codec_type == CODEC_TYPE_AUDIO) if (codec->codec_type == CODEC_TYPE_AUDIO)


+ 13
- 13
libavformat/grab.c View File

@@ -31,11 +31,11 @@ typedef struct {
int use_mmap; int use_mmap;
int width, height; int width, height;
int frame_rate; int frame_rate;
INT64 time_frame;
int64_t time_frame;
int frame_size; int frame_size;
struct video_capability video_cap; struct video_capability video_cap;
struct video_audio audio_saved; struct video_audio audio_saved;
UINT8 *video_buf;
uint8_t *video_buf;
struct video_mbuf gb_buffers; struct video_mbuf gb_buffers;
struct video_mmap gb_buf; struct video_mmap gb_buf;
int gb_frame; int gb_frame;
@@ -45,8 +45,8 @@ typedef struct {
int aiw_enabled; int aiw_enabled;
int deint; int deint;
int halfw; int halfw;
UINT8 *src_mem;
UINT8 *lum_m4_mem;
uint8_t *src_mem;
uint8_t *lum_m4_mem;
} VideoData; } VideoData;


static int aiw_init(VideoData *s); static int aiw_init(VideoData *s);
@@ -252,9 +252,9 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return -EIO; return -EIO;
} }


static int v4l_mm_read_picture(VideoData *s, UINT8 *buf)
static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
{ {
UINT8 *ptr;
uint8_t *ptr;


/* Setup to capture the next frame */ /* Setup to capture the next frame */
s->gb_buf.frame = (s->gb_frame + 1) % s->gb_buffers.frames; s->gb_buf.frame = (s->gb_frame + 1) % s->gb_buffers.frames;
@@ -281,9 +281,9 @@ static int v4l_mm_read_picture(VideoData *s, UINT8 *buf)
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt) static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
{ {
VideoData *s = s1->priv_data; VideoData *s = s1->priv_data;
INT64 curtime, delay;
int64_t curtime, delay;
struct timespec ts; struct timespec ts;
INT64 per_frame = (INT64_C(1000000) * FRAME_RATE_BASE) / s->frame_rate;
int64_t per_frame = (int64_t_C(1000000) * FRAME_RATE_BASE) / s->frame_rate;


/* Calculate the time of the next frame */ /* Calculate the time of the next frame */
s->time_frame += per_frame; s->time_frame += per_frame;
@@ -617,13 +617,13 @@ static int aiw_init(VideoData *s)
/* Read two fields separately. */ /* Read two fields separately. */
static int aiw_read_picture(VideoData *s, uint8_t *data) static int aiw_read_picture(VideoData *s, uint8_t *data)
{ {
UINT8 *ptr, *lum, *cb, *cr;
uint8_t *ptr, *lum, *cb, *cr;
int h; int h;
#ifndef HAVE_MMX #ifndef HAVE_MMX
int sum; int sum;
#endif #endif
UINT8* src = s->src_mem;
UINT8 *ptrend = &src[s->width*2];
uint8_t* src = s->src_mem;
uint8_t *ptrend = &src[s->width*2];
lum=data; lum=data;
cb=&lum[s->width*s->height]; cb=&lum[s->width*s->height];
cr=&cb[(s->width*s->height)/4]; cr=&cb[(s->width*s->height)/4];
@@ -715,7 +715,7 @@ static int aiw_read_picture(VideoData *s, uint8_t *data)
read(s->fd,src,s->width*4); read(s->fd,src,s->width*4);
} }
} else { } else {
UINT8 *lum_m1, *lum_m2, *lum_m3, *lum_m4;
uint8_t *lum_m1, *lum_m2, *lum_m3, *lum_m4;
#ifdef HAVE_MMX #ifdef HAVE_MMX
mmx_t rounder; mmx_t rounder;
rounder.uw[0]=4; rounder.uw[0]=4;
@@ -725,7 +725,7 @@ static int aiw_read_picture(VideoData *s, uint8_t *data)
movq_m2r(rounder,mm6); movq_m2r(rounder,mm6);
pxor_r2r(mm7,mm7); pxor_r2r(mm7,mm7);
#else #else
UINT8 *cm = cropTbl + MAX_NEG_CROP;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
#endif #endif


/* read two fields and deinterlace them */ /* read two fields and deinterlace them */


+ 3
- 3
libavformat/http.c View File

@@ -48,7 +48,7 @@ typedef struct {
} HTTPContext; } HTTPContext;


static int http_connect(URLContext *h, const char *path, const char *hoststr); static int http_connect(URLContext *h, const char *path, const char *hoststr);
static int http_write(URLContext *h, UINT8 *buf, int size);
static int http_write(URLContext *h, uint8_t *buf, int size);




/* return non zero if error */ /* return non zero if error */
@@ -236,7 +236,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr)
} }




static int http_read(URLContext *h, UINT8 *buf, int size)
static int http_read(URLContext *h, uint8_t *buf, int size)
{ {
HTTPContext *s = h->priv_data; HTTPContext *s = h->priv_data;
int size1, len; int size1, len;
@@ -265,7 +265,7 @@ static int http_read(URLContext *h, UINT8 *buf, int size)
} }


/* used only when posting data */ /* used only when posting data */
static int http_write(URLContext *h, UINT8 *buf, int size)
static int http_write(URLContext *h, uint8_t *buf, int size)
{ {
HTTPContext *s = h->priv_data; HTTPContext *s = h->priv_data;
return url_write(s->hd, buf, size); return url_write(s->hd, buf, size);


+ 6
- 6
libavformat/img.c View File

@@ -157,18 +157,18 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
char filename[1024]; char filename[1024];
int ret; int ret;
ByteIOContext f1, *f; ByteIOContext f1, *f;
static INT64 first_frame; // BUG -> to context FIXME
static int64_t first_frame; // BUG -> to context FIXME


if (emulate_frame_rate) { if (emulate_frame_rate) {
if (!first_frame) { if (!first_frame) {
first_frame = av_gettime(); first_frame = av_gettime();
} else { } else {
INT64 pts;
INT64 nowus;
int64_t pts;
int64_t nowus;


nowus = av_gettime() - first_frame; nowus = av_gettime() - first_frame;


pts = ((INT64)s->img_number * FRAME_RATE_BASE * 1000000) / (s1->streams[0]->codec.frame_rate);
pts = ((int64_t)s->img_number * FRAME_RATE_BASE * 1000000) / (s1->streams[0]->codec.frame_rate);


if (pts > nowus) if (pts > nowus)
usleep(pts - nowus); usleep(pts - nowus);
@@ -201,7 +201,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
av_free_packet(pkt); av_free_packet(pkt);
return -EIO; /* signal EOF */ return -EIO; /* signal EOF */
} else { } else {
pkt->pts = ((INT64)s->img_number * s1->pts_den * FRAME_RATE_BASE) / (s1->streams[0]->codec.frame_rate * s1->pts_num);
pkt->pts = ((int64_t)s->img_number * s1->pts_den * FRAME_RATE_BASE) / (s1->streams[0]->codec.frame_rate * s1->pts_num);
s->img_number++; s->img_number++;
return 0; return 0;
} }
@@ -265,7 +265,7 @@ static int img_write_header(AVFormatContext *s)
} }


static int img_write_packet(AVFormatContext *s, int stream_index, static int img_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
VideoData *img = s->priv_data; VideoData *img = s->priv_data;
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];


+ 2
- 2
libavformat/jpeg.c View File

@@ -56,8 +56,8 @@ static int jpeg_get_buffer(AVCodecContext *c, AVFrame *picture)
} }
} }


static void img_copy(UINT8 *dst, int dst_wrap,
UINT8 *src, int src_wrap,
static void img_copy(uint8_t *dst, int dst_wrap,
uint8_t *src, int src_wrap,
int width, int height) int width, int height)
{ {
for(;height > 0; height--) { for(;height > 0; height--) {


+ 37
- 37
libavformat/mov.c View File

@@ -61,7 +61,7 @@
* Avoid them. This is here just to help debugging. * Avoid them. This is here just to help debugging.
*/ */
static int debug_indent = 0; static int debug_indent = 0;
void print_atom(const char *str, UINT32 type, UINT64 offset, UINT64 size)
void print_atom(const char *str, uint32_t type, uint64_t offset, uint64_t size)
{ {
unsigned int tag, i; unsigned int tag, i;
tag = (unsigned int) type; tag = (unsigned int) type;
@@ -149,7 +149,7 @@ typedef struct MOVStreamContext {
int is_ff_stream; /* Is this stream presented to ffmpeg ? i.e. is this an audio or video stream ? */ int is_ff_stream; /* Is this stream presented to ffmpeg ? i.e. is this an audio or video stream ? */
long next_chunk; long next_chunk;
long chunk_count; long chunk_count;
INT64 *chunk_offsets;
int64_t *chunk_offsets;
long sample_to_chunk_sz; long sample_to_chunk_sz;
MOV_sample_to_chunk_tbl *sample_to_chunk; MOV_sample_to_chunk_tbl *sample_to_chunk;
long sample_to_chunk_index; long sample_to_chunk_index;
@@ -170,15 +170,15 @@ typedef struct MOVContext {
long time_scale; long time_scale;
int found_moov; /* when both 'moov' and 'mdat' sections has been found */ int found_moov; /* when both 'moov' and 'mdat' sections has been found */
int found_mdat; /* we suppose we have enough data to read the file */ int found_mdat; /* we suppose we have enough data to read the file */
INT64 mdat_size;
INT64 mdat_offset;
int64_t mdat_size;
int64_t mdat_offset;
int total_streams; int total_streams;
/* some streams listed here aren't presented to the ffmpeg API, since they aren't either video nor audio /* some streams listed here aren't presented to the ffmpeg API, since they aren't either video nor audio
* but we need the info to be able to skip data from those streams in the 'mdat' section * but we need the info to be able to skip data from those streams in the 'mdat' section
*/ */
MOVStreamContext *streams[MAX_STREAMS]; MOVStreamContext *streams[MAX_STREAMS];
INT64 next_chunk_offset;
int64_t next_chunk_offset;
int partial; /* != 0 : there is still to read in the current chunk (=id of the stream + 1) */ int partial; /* != 0 : there is still to read in the current chunk (=id of the stream + 1) */
} MOVContext; } MOVContext;


@@ -195,18 +195,18 @@ struct MOVParseTableEntry;
*/ */
typedef int (*mov_parse_function)(const struct MOVParseTableEntry *parse_table, typedef int (*mov_parse_function)(const struct MOVParseTableEntry *parse_table,
ByteIOContext *pb, ByteIOContext *pb,
UINT32 atom_type,
INT64 atom_offset, /* after the size and type field (and eventually the extended size) */
INT64 atom_size, /* total size (excluding the size and type fields) */
uint32_t atom_type,
int64_t atom_offset, /* after the size and type field (and eventually the extended size) */
int64_t atom_size, /* total size (excluding the size and type fields) */
void *param); void *param);


/* links atom IDs to parse functions */ /* links atom IDs to parse functions */
typedef struct MOVParseTableEntry { typedef struct MOVParseTableEntry {
UINT32 type;
uint32_t type;
mov_parse_function func; mov_parse_function func;
} MOVParseTableEntry; } MOVParseTableEntry;


static int parse_leaf(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_leaf(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
#ifdef DEBUG #ifdef DEBUG
print_atom("leaf", atom_type, atom_offset, atom_size); print_atom("leaf", atom_type, atom_offset, atom_size);
@@ -218,11 +218,11 @@ static int parse_leaf(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
} }




static int parse_default(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_default(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
UINT32 type, foo=0;
UINT64 offset, size;
UINT64 total_size = 0;
uint32_t type, foo=0;
uint64_t offset, size;
uint64_t total_size = 0;
int i; int i;
int err = 0; int err = 0;
foo=0; foo=0;
@@ -276,7 +276,7 @@ static int parse_default(const MOVParseTableEntry *parse_table, ByteIOContext *p
return err; return err;
} }


static int parse_mvhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_mvhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
#ifdef DEBUG #ifdef DEBUG
@@ -314,7 +314,7 @@ static int parse_mvhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
} }


/* this atom should contain all header atoms */ /* this atom should contain all header atoms */
static int parse_moov(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_moov(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
int err; int err;
MOVContext *c; MOVContext *c;
@@ -333,7 +333,7 @@ static int parse_moov(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
} }


/* this atom contains actual media data */ /* this atom contains actual media data */
static int parse_mdat(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_mdat(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
#ifdef DEBUG #ifdef DEBUG
@@ -355,10 +355,10 @@ static int parse_mdat(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
/* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */ /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */
/* like the files created with Adobe Premiere 5.0, for samples see */ /* like the files created with Adobe Premiere 5.0, for samples see */
/* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */ /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */
static int parse_wide(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_wide(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
int err; int err;
UINT32 type;
uint32_t type;
#ifdef DEBUG #ifdef DEBUG
print_atom("wide", atom_type, atom_offset, atom_size); print_atom("wide", atom_type, atom_offset, atom_size);
debug_indent++; debug_indent++;
@@ -381,7 +381,7 @@ static int parse_wide(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return err; return err;
} }


static int parse_trak(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_trak(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
AVStream *st; AVStream *st;
@@ -401,7 +401,7 @@ static int parse_trak(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return parse_default(parse_table, pb, atom_type, atom_offset, atom_size, param); return parse_default(parse_table, pb, atom_type, atom_offset, atom_size, param);
} }


static int parse_tkhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_tkhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
AVStream *st; AVStream *st;
@@ -445,7 +445,7 @@ static int parse_tkhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return 0; return 0;
} }


static int parse_mdhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_mdhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
AVStream *st; AVStream *st;
@@ -477,14 +477,14 @@ static int parse_mdhd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return 0; return 0;
} }


static int parse_hdlr(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_hdlr(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int len = 0; int len = 0;
char *buf; char *buf;
UINT32 type;
uint32_t type;
AVStream *st; AVStream *st;
UINT32 ctype;
uint32_t ctype;
#ifdef DEBUG #ifdef DEBUG
print_atom("hdlr", atom_type, atom_offset, atom_size); print_atom("hdlr", atom_type, atom_offset, atom_size);
#endif #endif
@@ -612,11 +612,11 @@ static int mp4_read_descr(ByteIOContext *pb, int *tag)
return len; return len;
} }


static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int entries, size, samp_sz, frames_per_sample, id; int entries, size, samp_sz, frames_per_sample, id;
UINT32 format;
uint32_t format;
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
#ifdef DEBUG #ifdef DEBUG
@@ -691,7 +691,7 @@ static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
size -= (16+8*4+2+32+2*2); size -= (16+8*4+2+32+2*2);
while (size >= 8) { while (size >= 8) {
int atom_size, atom_type; int atom_size, atom_type;
INT64 start_pos;
int64_t start_pos;
atom_size = get_be32(pb); atom_size = get_be32(pb);
atom_type = get_le32(pb); atom_type = get_le32(pb);
@@ -800,7 +800,7 @@ static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return 0; return 0;
} }


static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int entries, i; int entries, i;
@@ -818,7 +818,7 @@ static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb,


entries = get_be32(pb); entries = get_be32(pb);
sc->chunk_count = entries; sc->chunk_count = entries;
sc->chunk_offsets = av_malloc(entries * sizeof(INT64));
sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));
if(atom_type == MKTAG('s', 't', 'c', 'o')) { if(atom_type == MKTAG('s', 't', 'c', 'o')) {
for(i=0; i<entries; i++) { for(i=0; i<entries; i++) {
sc->chunk_offsets[i] = get_be32(pb); sc->chunk_offsets[i] = get_be32(pb);
@@ -839,7 +839,7 @@ static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return 0; return 0;
} }


static int parse_stsc(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_stsc(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int entries, i; int entries, i;
@@ -872,7 +872,7 @@ printf("track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
return 0; return 0;
} }


static int parse_stsz(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_stsz(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int entries, i; int entries, i;
@@ -906,7 +906,7 @@ static int parse_stsz(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
return 0; return 0;
} }


static int parse_stts(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_stts(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
int entries, i; int entries, i;
@@ -944,12 +944,12 @@ printf("track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
} }


#ifdef CONFIG_ZLIB #ifdef CONFIG_ZLIB
static int null_read_packet(void *opaque, UINT8 *buf, int buf_size)
static int null_read_packet(void *opaque, uint8_t *buf, int buf_size)
{ {
return -1; return -1;
} }


static int parse_cmov(const MOVParseTableEntry *parse_table, ByteIOContext *pb, UINT32 atom_type, INT64 atom_offset, INT64 atom_size, void *param)
static int parse_cmov(const MOVParseTableEntry *parse_table, ByteIOContext *pb, uint32_t atom_type, int64_t atom_offset, int64_t atom_size, void *param)
{ {
MOVContext *c; MOVContext *c;
ByteIOContext ctx; ByteIOContext ctx;
@@ -1130,7 +1130,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
MOVContext *mov = s->priv_data; MOVContext *mov = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
int i, j, nb, err; int i, j, nb, err;
INT64 size;
int64_t size;


mov->fc = s; mov->fc = s;
#if 0 #if 0
@@ -1200,7 +1200,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MOVContext *mov = s->priv_data; MOVContext *mov = s->priv_data;
MOVStreamContext *sc; MOVStreamContext *sc;
INT64 offset = 0x0FFFFFFFFFFFFFFF;
int64_t offset = 0x0FFFFFFFFFFFFFFF;
int i; int i;
int st_id = 0, size; int st_id = 0, size;
size = 0x0FFFFFFF; size = 0x0FFFFFFF;


+ 21
- 21
libavformat/mpeg.c View File

@@ -22,12 +22,12 @@
#define NB_STREAMS 2 #define NB_STREAMS 2


typedef struct { typedef struct {
UINT8 buffer[MAX_PAYLOAD_SIZE];
uint8_t buffer[MAX_PAYLOAD_SIZE];
int buffer_ptr; int buffer_ptr;
UINT8 id;
uint8_t id;
int max_buffer_size; /* in bytes */ int max_buffer_size; /* in bytes */
int packet_number; int packet_number;
INT64 start_pts;
int64_t start_pts;
} StreamInfo; } StreamInfo;


typedef struct { typedef struct {
@@ -66,7 +66,7 @@ extern AVOutputFormat mpeg1vcd_mux;
extern AVOutputFormat mpeg2vob_mux; extern AVOutputFormat mpeg2vob_mux;


static int put_pack_header(AVFormatContext *ctx, static int put_pack_header(AVFormatContext *ctx,
UINT8 *buf, INT64 timestamp)
uint8_t *buf, int64_t timestamp)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
PutBitContext pb; PutBitContext pb;
@@ -79,11 +79,11 @@ static int put_pack_header(AVFormatContext *ctx,
} else { } else {
put_bits(&pb, 4, 0x2); put_bits(&pb, 4, 0x2);
} }
put_bits(&pb, 3, (UINT32)((timestamp >> 30) & 0x07));
put_bits(&pb, 3, (uint32_t)((timestamp >> 30) & 0x07));
put_bits(&pb, 1, 1); put_bits(&pb, 1, 1);
put_bits(&pb, 15, (UINT32)((timestamp >> 15) & 0x7fff));
put_bits(&pb, 15, (uint32_t)((timestamp >> 15) & 0x7fff));
put_bits(&pb, 1, 1); put_bits(&pb, 1, 1);
put_bits(&pb, 15, (UINT32)((timestamp) & 0x7fff));
put_bits(&pb, 15, (uint32_t)((timestamp) & 0x7fff));
put_bits(&pb, 1, 1); put_bits(&pb, 1, 1);
if (s->is_mpeg2) { if (s->is_mpeg2) {
/* clock extension */ /* clock extension */
@@ -101,7 +101,7 @@ static int put_pack_header(AVFormatContext *ctx,
return pbBufPtr(&pb) - pb.buf; return pbBufPtr(&pb) - pb.buf;
} }


static int put_system_header(AVFormatContext *ctx, UINT8 *buf)
static int put_system_header(AVFormatContext *ctx, uint8_t *buf)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
int size, rate_bound, i, private_stream_coded, id; int size, rate_bound, i, private_stream_coded, id;
@@ -254,10 +254,10 @@ static void flush_packet(AVFormatContext *ctx, int stream_index, int last_pkt)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
StreamInfo *stream = ctx->streams[stream_index]->priv_data; StreamInfo *stream = ctx->streams[stream_index]->priv_data;
UINT8 *buf_ptr;
uint8_t *buf_ptr;
int size, payload_size, startcode, id, len, stuffing_size, i, header_len; int size, payload_size, startcode, id, len, stuffing_size, i, header_len;
INT64 timestamp;
UINT8 buffer[128];
int64_t timestamp;
uint8_t buffer[128];
int last = last_pkt ? 4 : 0; int last = last_pkt ? 4 : 0;
id = stream->id; id = stream->id;
@@ -314,8 +314,8 @@ static void flush_packet(AVFormatContext *ctx, int stream_index, int last_pkt)
(0x02 << 4) | (0x02 << 4) |
(((timestamp >> 30) & 0x07) << 1) | (((timestamp >> 30) & 0x07) << 1) |
1); 1);
put_be16(&ctx->pb, (UINT16)((((timestamp >> 15) & 0x7fff) << 1) | 1));
put_be16(&ctx->pb, (UINT16)((((timestamp) & 0x7fff) << 1) | 1));
put_be16(&ctx->pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
put_be16(&ctx->pb, (uint16_t)((((timestamp) & 0x7fff) << 1) | 1));


if (startcode == PRIVATE_STREAM_1) { if (startcode == PRIVATE_STREAM_1) {
put_byte(&ctx->pb, id); put_byte(&ctx->pb, id);
@@ -347,7 +347,7 @@ static void flush_packet(AVFormatContext *ctx, int stream_index, int last_pkt)
} }


static int mpeg_mux_write_packet(AVFormatContext *ctx, int stream_index, static int mpeg_mux_write_packet(AVFormatContext *ctx, int stream_index,
UINT8 *buf, int size, int pts)
uint8_t *buf, int size, int pts)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
AVStream *st = ctx->streams[stream_index]; AVStream *st = ctx->streams[stream_index];
@@ -440,7 +440,7 @@ typedef struct MpegDemuxContext {
} MpegDemuxContext; } MpegDemuxContext;


static int find_start_code(ByteIOContext *pb, int *size_ptr, static int find_start_code(ByteIOContext *pb, int *size_ptr,
UINT32 *header_state)
uint32_t *header_state)
{ {
unsigned int state, v; unsigned int state, v;
int val, n; int val, n;
@@ -475,18 +475,18 @@ static int mpegps_read_header(AVFormatContext *s,
return 0; return 0;
} }


static INT64 get_pts(ByteIOContext *pb, int c)
static int64_t get_pts(ByteIOContext *pb, int c)
{ {
INT64 pts;
int64_t pts;
int val; int val;


if (c < 0) if (c < 0)
c = get_byte(pb); c = get_byte(pb);
pts = (INT64)((c >> 1) & 0x07) << 30;
pts = (int64_t)((c >> 1) & 0x07) << 30;
val = get_be16(pb); val = get_be16(pb);
pts |= (INT64)(val >> 1) << 15;
pts |= (int64_t)(val >> 1) << 15;
val = get_be16(pb); val = get_be16(pb);
pts |= (INT64)(val >> 1);
pts |= (int64_t)(val >> 1);
return pts; return pts;
} }


@@ -496,7 +496,7 @@ static int mpegps_read_packet(AVFormatContext *s,
MpegDemuxContext *m = s->priv_data; MpegDemuxContext *m = s->priv_data;
AVStream *st; AVStream *st;
int len, size, startcode, i, c, flags, header_len, type, codec_id; int len, size, startcode, i, c, flags, header_len, type, codec_id;
INT64 pts, dts;
int64_t pts, dts;


/* next start code (should be immediately after) */ /* next start code (should be immediately after) */
redo: redo:


+ 1
- 1
libavformat/mpegts.c View File

@@ -88,7 +88,7 @@ static int mpegts_read_header(AVFormatContext *s,
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
unsigned char buf[1024]; unsigned char buf[1024];
int len; int len;
INT64 pos;
int64_t pos;


/* read the first 1024 bytes to get packet size */ /* read the first 1024 bytes to get packet size */
pos = url_ftell(pb); pos = url_ftell(pb);


+ 4
- 4
libavformat/mpjpeg.c View File

@@ -24,7 +24,7 @@


static int mpjpeg_write_header(AVFormatContext *s) static int mpjpeg_write_header(AVFormatContext *s)
{ {
UINT8 buf1[256];
uint8_t buf1[256];


snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG); snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
put_buffer(&s->pb, buf1, strlen(buf1)); put_buffer(&s->pb, buf1, strlen(buf1));
@@ -33,9 +33,9 @@ static int mpjpeg_write_header(AVFormatContext *s)
} }


static int mpjpeg_write_packet(AVFormatContext *s, int stream_index, static int mpjpeg_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
UINT8 buf1[256];
uint8_t buf1[256];


snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n"); snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
put_buffer(&s->pb, buf1, strlen(buf1)); put_buffer(&s->pb, buf1, strlen(buf1));
@@ -75,7 +75,7 @@ static int single_jpeg_write_header(AVFormatContext *s)
} }


static int single_jpeg_write_packet(AVFormatContext *s, int stream_index, static int single_jpeg_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
put_buffer(&s->pb, buf, size); put_buffer(&s->pb, buf, size);
put_flush_packet(&s->pb); put_flush_packet(&s->pb);


+ 1
- 1
libavformat/pnm.c View File

@@ -161,7 +161,7 @@ static int pnm_write(ByteIOContext *pb, AVImageInfo *info)
{ {
int i, h, h1, c, n, linesize; int i, h, h1, c, n, linesize;
char buf[100]; char buf[100];
UINT8 *ptr, *ptr1, *ptr2;
uint8_t *ptr, *ptr1, *ptr2;


h = info->height; h = info->height;
h1 = h; h1 = h;


+ 1
- 1
libavformat/raw.c View File

@@ -38,7 +38,7 @@ static int raw_write_trailer(struct AVFormatContext *s)
} }


/* raw input */ /* raw input */
static static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
AVStream *st; AVStream *st;
int id; int id;


+ 7
- 7
libavformat/rm.c View File

@@ -322,16 +322,16 @@ static int rm_write_header(AVFormatContext *s)
return 0; return 0;
} }


static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size)
static int rm_write_audio(AVFormatContext *s, uint8_t *buf, int size)
{ {
UINT8 *buf1;
uint8_t *buf1;
RMContext *rm = s->priv_data; RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
StreamInfo *stream = rm->audio_stream; StreamInfo *stream = rm->audio_stream;
int i; int i;


/* XXX: suppress this malloc */ /* XXX: suppress this malloc */
buf1= (UINT8*) av_malloc( size * sizeof(UINT8) );
buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame); write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame);
@@ -347,7 +347,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size)
return 0; return 0;
} }


static int rm_write_video(AVFormatContext *s, UINT8 *buf, int size)
static int rm_write_video(AVFormatContext *s, uint8_t *buf, int size)
{ {
RMContext *rm = s->priv_data; RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
@@ -388,7 +388,7 @@ static int rm_write_video(AVFormatContext *s, UINT8 *buf, int size)
} }


static int rm_write_packet(AVFormatContext *s, int stream_index, static int rm_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
if (s->streams[stream_index]->codec.codec_type == if (s->streams[stream_index]->codec.codec_type ==
CODEC_TYPE_AUDIO) CODEC_TYPE_AUDIO)
@@ -472,7 +472,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
unsigned int tag, v; unsigned int tag, v;
int tag_size, size, codec_data_size, i; int tag_size, size, codec_data_size, i;
INT64 codec_pos;
int64_t codec_pos;
unsigned int h263_hack_version; unsigned int h263_hack_version;
char buf[128]; char buf[128];
int flags = 0; int flags = 0;
@@ -650,7 +650,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
AVStream *st; AVStream *st;
int len, num, timestamp, i, tmp, j; int len, num, timestamp, i, tmp, j;
UINT8 *ptr;
uint8_t *ptr;
int flags; int flags;


redo: redo:


+ 23
- 23
libavformat/rtp.c View File

@@ -90,23 +90,23 @@ enum RTPPayloadType {


typedef struct RTPContext { typedef struct RTPContext {
int payload_type; int payload_type;
UINT32 ssrc;
UINT16 seq;
UINT32 timestamp;
UINT32 base_timestamp;
UINT32 cur_timestamp;
uint32_t ssrc;
uint16_t seq;
uint32_t timestamp;
uint32_t base_timestamp;
uint32_t cur_timestamp;
int max_payload_size; int max_payload_size;
/* rtcp sender statistics receive */ /* rtcp sender statistics receive */
INT64 last_rtcp_ntp_time;
UINT32 last_rtcp_timestamp;
int64_t last_rtcp_ntp_time;
uint32_t last_rtcp_timestamp;
/* rtcp sender statistics */ /* rtcp sender statistics */
unsigned int packet_count; unsigned int packet_count;
unsigned int octet_count; unsigned int octet_count;
unsigned int last_octet_count; unsigned int last_octet_count;
int first_packet; int first_packet;
/* buffer for output */ /* buffer for output */
UINT8 buf[RTP_MAX_PACKET_LENGTH];
UINT8 *buf_ptr;
uint8_t buf[RTP_MAX_PACKET_LENGTH];
uint8_t *buf_ptr;
} RTPContext; } RTPContext;


int rtp_get_codec_info(AVCodecContext *codec, int payload_type) int rtp_get_codec_info(AVCodecContext *codec, int payload_type)
@@ -184,14 +184,14 @@ int rtp_get_payload_type(AVCodecContext *codec)
return payload_type; return payload_type;
} }


static inline UINT32 decode_be32(const UINT8 *p)
static inline uint32_t decode_be32(const uint8_t *p)
{ {
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
} }


static inline UINT32 decode_be64(const UINT8 *p)
static inline uint32_t decode_be64(const uint8_t *p)
{ {
return ((UINT64)decode_be32(p) << 32) | decode_be32(p + 4);
return ((uint64_t)decode_be32(p) << 32) | decode_be32(p + 4);
} }


static int rtcp_parse_packet(AVFormatContext *s1, const unsigned char *buf, int len) static int rtcp_parse_packet(AVFormatContext *s1, const unsigned char *buf, int len)
@@ -221,7 +221,7 @@ int rtp_parse_packet(AVFormatContext *s1, AVPacket *pkt,
unsigned int ssrc, h; unsigned int ssrc, h;
int payload_type, seq, delta_timestamp; int payload_type, seq, delta_timestamp;
AVStream *st; AVStream *st;
UINT32 timestamp;
uint32_t timestamp;
if (len < 12) if (len < 12)
return -1; return -1;
@@ -390,7 +390,7 @@ static int rtp_write_header(AVFormatContext *s1)
} }


/* send an rtcp sender report packet */ /* send an rtcp sender report packet */
static void rtcp_send_sr(AVFormatContext *s1, INT64 ntp_time)
static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
#if defined(DEBUG) #if defined(DEBUG)
@@ -409,7 +409,7 @@ static void rtcp_send_sr(AVFormatContext *s1, INT64 ntp_time)


/* send an rtp packet. sequence number is incremented, but the caller /* send an rtp packet. sequence number is incremented, but the caller
must update the timestamp itself */ must update the timestamp itself */
static void rtp_send_data(AVFormatContext *s1, UINT8 *buf1, int len)
static void rtp_send_data(AVFormatContext *s1, uint8_t *buf1, int len)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;


@@ -435,7 +435,7 @@ static void rtp_send_data(AVFormatContext *s1, UINT8 *buf1, int len)
/* send an integer number of samples and compute time stamp and fill /* send an integer number of samples and compute time stamp and fill
the rtp send buffer before sending. */ the rtp send buffer before sending. */
static void rtp_send_samples(AVFormatContext *s1, static void rtp_send_samples(AVFormatContext *s1,
UINT8 *buf1, int size, int sample_size)
uint8_t *buf1, int size, int sample_size)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
int len, max_packet_size, n; int len, max_packet_size, n;
@@ -468,7 +468,7 @@ static void rtp_send_samples(AVFormatContext *s1,
/* NOTE: we suppose that exactly one frame is given as argument here */ /* NOTE: we suppose that exactly one frame is given as argument here */
/* XXX: test it */ /* XXX: test it */
static void rtp_send_mpegaudio(AVFormatContext *s1, static void rtp_send_mpegaudio(AVFormatContext *s1,
UINT8 *buf1, int size)
uint8_t *buf1, int size)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
AVStream *st = s1->streams[0]; AVStream *st = s1->streams[0];
@@ -524,12 +524,12 @@ static void rtp_send_mpegaudio(AVFormatContext *s1,
/* NOTE: a single frame must be passed with sequence header if /* NOTE: a single frame must be passed with sequence header if
needed. XXX: use slices. */ needed. XXX: use slices. */
static void rtp_send_mpegvideo(AVFormatContext *s1, static void rtp_send_mpegvideo(AVFormatContext *s1,
UINT8 *buf1, int size)
uint8_t *buf1, int size)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
AVStream *st = s1->streams[0]; AVStream *st = s1->streams[0];
int len, h, max_packet_size; int len, h, max_packet_size;
UINT8 *q;
uint8_t *q;


max_packet_size = s->max_payload_size; max_packet_size = s->max_payload_size;


@@ -572,7 +572,7 @@ static void rtp_send_mpegvideo(AVFormatContext *s1,
} }


static void rtp_send_raw(AVFormatContext *s1, static void rtp_send_raw(AVFormatContext *s1,
UINT8 *buf1, int size)
uint8_t *buf1, int size)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
AVStream *st = s1->streams[0]; AVStream *st = s1->streams[0];
@@ -599,12 +599,12 @@ static void rtp_send_raw(AVFormatContext *s1,


/* write an RTP packet. 'buf1' must contain a single specific frame. */ /* write an RTP packet. 'buf1' must contain a single specific frame. */
static int rtp_write_packet(AVFormatContext *s1, int stream_index, static int rtp_write_packet(AVFormatContext *s1, int stream_index,
UINT8 *buf1, int size, int force_pts)
uint8_t *buf1, int size, int force_pts)
{ {
RTPContext *s = s1->priv_data; RTPContext *s = s1->priv_data;
AVStream *st = s1->streams[0]; AVStream *st = s1->streams[0];
int rtcp_bytes; int rtcp_bytes;
INT64 ntp_time;
int64_t ntp_time;
#ifdef DEBUG #ifdef DEBUG
printf("%d: write len=%d\n", stream_index, size); printf("%d: write len=%d\n", stream_index, size);
@@ -615,7 +615,7 @@ static int rtp_write_packet(AVFormatContext *s1, int stream_index,
RTCP_TX_RATIO_DEN; RTCP_TX_RATIO_DEN;
if (s->first_packet || rtcp_bytes >= 28) { if (s->first_packet || rtcp_bytes >= 28) {
/* compute NTP time */ /* compute NTP time */
ntp_time = force_pts; // ((INT64)force_pts << 28) / 5625
ntp_time = force_pts; // ((int64_t)force_pts << 28) / 5625
rtcp_send_sr(s1, ntp_time); rtcp_send_sr(s1, ntp_time);
s->last_octet_count = s->octet_count; s->last_octet_count = s->octet_count;
s->first_packet = 0; s->first_packet = 0;


+ 2
- 2
libavformat/rtpproto.c View File

@@ -171,7 +171,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
return -EIO; return -EIO;
} }


static int rtp_read(URLContext *h, UINT8 *buf, int size)
static int rtp_read(URLContext *h, uint8_t *buf, int size)
{ {
RTPContext *s = h->priv_data; RTPContext *s = h->priv_data;
struct sockaddr_in from; struct sockaddr_in from;
@@ -230,7 +230,7 @@ static int rtp_read(URLContext *h, UINT8 *buf, int size)
return len; return len;
} }


static int rtp_write(URLContext *h, UINT8 *buf, int size)
static int rtp_write(URLContext *h, uint8_t *buf, int size)
{ {
RTPContext *s = h->priv_data; RTPContext *s = h->priv_data;
int ret; int ret;


+ 2
- 2
libavformat/rtsp.h View File

@@ -41,7 +41,7 @@ typedef struct RTSPTransportField {
int client_port_min, client_port_max; /* RTP ports */ int client_port_min, client_port_max; /* RTP ports */
int server_port_min, server_port_max; /* RTP ports */ int server_port_min, server_port_max; /* RTP ports */
int ttl; /* ttl value */ int ttl; /* ttl value */
UINT32 destination; /* destination IP address */
uint32_t destination; /* destination IP address */
enum RTSPProtocol protocol; enum RTSPProtocol protocol;
} RTSPTransportField; } RTSPTransportField;


@@ -63,7 +63,7 @@ enum RTSPCallbackAction {
}; };


typedef struct RTSPActionServerSetup { typedef struct RTSPActionServerSetup {
UINT32 ipaddr;
uint32_t ipaddr;
char transport_option[512]; char transport_option[512];
} RTSPActionServerSetup; } RTSPActionServerSetup;




+ 7
- 7
libavformat/swf.c View File

@@ -107,7 +107,7 @@ static void put_swf_rect(ByteIOContext *pb,
int xmin, int xmax, int ymin, int ymax) int xmin, int xmax, int ymin, int ymax)
{ {
PutBitContext p; PutBitContext p;
UINT8 buf[256];
uint8_t buf[256];
int nbits, mask; int nbits, mask;


init_put_bits(&p, buf, sizeof(buf), NULL, NULL); init_put_bits(&p, buf, sizeof(buf), NULL, NULL);
@@ -164,7 +164,7 @@ static void put_swf_matrix(ByteIOContext *pb,
int a, int b, int c, int d, int tx, int ty) int a, int b, int c, int d, int tx, int ty)
{ {
PutBitContext p; PutBitContext p;
UINT8 buf[256];
uint8_t buf[256];


init_put_bits(&p, buf, sizeof(buf), NULL, NULL); init_put_bits(&p, buf, sizeof(buf), NULL, NULL);
@@ -193,7 +193,7 @@ static int swf_write_header(AVFormatContext *s)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
AVCodecContext *enc, *audio_enc, *video_enc; AVCodecContext *enc, *audio_enc, *video_enc;
PutBitContext p; PutBitContext p;
UINT8 buf1[256];
uint8_t buf1[256];
int i, width, height, rate; int i, width, height, rate;


swf = av_malloc(sizeof(SWFContext)); swf = av_malloc(sizeof(SWFContext));
@@ -230,7 +230,7 @@ static int swf_write_header(AVFormatContext *s)
put_swf_rect(pb, 0, width, 0, height); put_swf_rect(pb, 0, width, 0, height);
put_le16(pb, (rate * 256) / FRAME_RATE_BASE); /* frame rate */ put_le16(pb, (rate * 256) / FRAME_RATE_BASE); /* frame rate */
swf->duration_pos = url_ftell(pb); swf->duration_pos = url_ftell(pb);
put_le16(pb, (UINT16)(DUMMY_DURATION * (INT64)rate / FRAME_RATE_BASE)); /* frame count */
put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / FRAME_RATE_BASE)); /* frame count */
/* define a shape with the jpeg inside */ /* define a shape with the jpeg inside */


@@ -316,7 +316,7 @@ static int swf_write_header(AVFormatContext *s)
} }


static int swf_write_video(AVFormatContext *s, static int swf_write_video(AVFormatContext *s,
AVCodecContext *enc, UINT8 *buf, int size)
AVCodecContext *enc, uint8_t *buf, int size)
{ {
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
static int tag_id = 0; static int tag_id = 0;
@@ -364,7 +364,7 @@ static int swf_write_video(AVFormatContext *s,
return 0; return 0;
} }


static int swf_write_audio(AVFormatContext *s, UINT8 *buf, int size)
static int swf_write_audio(AVFormatContext *s, uint8_t *buf, int size)
{ {
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;


@@ -378,7 +378,7 @@ static int swf_write_audio(AVFormatContext *s, UINT8 *buf, int size)
} }


static int swf_write_packet(AVFormatContext *s, int stream_index, static int swf_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
uint8_t *buf, int size, int force_pts)
{ {
AVCodecContext *codec = &s->streams[stream_index]->codec; AVCodecContext *codec = &s->streams[stream_index]->codec;
if (codec->codec_type == CODEC_TYPE_AUDIO) if (codec->codec_type == CODEC_TYPE_AUDIO)


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save