Originally committed as revision 7587 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -1100,19 +1100,19 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| } | |||
| break; | |||
| case CODEC_ID_ADPCM_EA: | |||
| samples_in_chunk = LE_32(src); | |||
| samples_in_chunk = AV_RL32(src); | |||
| if (samples_in_chunk >= ((buf_size - 12) * 2)) { | |||
| src += buf_size; | |||
| break; | |||
| } | |||
| src += 4; | |||
| current_left_sample = (int16_t)LE_16(src); | |||
| current_left_sample = (int16_t)AV_RL16(src); | |||
| src += 2; | |||
| previous_left_sample = (int16_t)LE_16(src); | |||
| previous_left_sample = (int16_t)AV_RL16(src); | |||
| src += 2; | |||
| current_right_sample = (int16_t)LE_16(src); | |||
| current_right_sample = (int16_t)AV_RL16(src); | |||
| src += 2; | |||
| previous_right_sample = (int16_t)LE_16(src); | |||
| previous_right_sample = (int16_t)AV_RL16(src); | |||
| src += 2; | |||
| for (count1 = 0; count1 < samples_in_chunk/28;count1++) { | |||
| @@ -110,11 +110,11 @@ static int alac_set_info(ALACContext *alac) | |||
| ptr += 4; /* alac */ | |||
| ptr += 4; /* 0 ? */ | |||
| if(BE_32(ptr) >= UINT_MAX/4){ | |||
| if(AV_RB32(ptr) >= UINT_MAX/4){ | |||
| av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n"); | |||
| return -1; | |||
| } | |||
| alac->setinfo_max_samples_per_frame = BE_32(ptr); /* buffer size / 2 ? */ | |||
| alac->setinfo_max_samples_per_frame = AV_RB32(ptr); /* buffer size / 2 ? */ | |||
| ptr += 4; | |||
| alac->setinfo_7a = *ptr++; | |||
| alac->setinfo_sample_size = *ptr++; | |||
| @@ -122,13 +122,13 @@ static int alac_set_info(ALACContext *alac) | |||
| alac->setinfo_rice_initialhistory = *ptr++; | |||
| alac->setinfo_rice_kmodifier = *ptr++; | |||
| alac->setinfo_7f = *ptr++; // channels? | |||
| alac->setinfo_80 = BE_16(ptr); | |||
| alac->setinfo_80 = AV_RB16(ptr); | |||
| ptr += 2; | |||
| alac->setinfo_82 = BE_32(ptr); // max coded frame size | |||
| alac->setinfo_82 = AV_RB32(ptr); // max coded frame size | |||
| ptr += 4; | |||
| alac->setinfo_86 = BE_32(ptr); // bitrate ? | |||
| alac->setinfo_86 = AV_RB32(ptr); // bitrate ? | |||
| ptr += 4; | |||
| alac->setinfo_8a_rate = BE_32(ptr); // samplerate | |||
| alac->setinfo_8a_rate = AV_RB32(ptr); // samplerate | |||
| ptr += 4; | |||
| allocate_buffers(alac); | |||
| @@ -74,8 +74,8 @@ avs_decode_frame(AVCodecContext * avctx, | |||
| int first, last; | |||
| uint32_t *pal = (uint32_t *) avs->picture.data[1]; | |||
| first = LE_16(buf); | |||
| last = first + LE_16(buf + 2); | |||
| first = AV_RL16(buf); | |||
| last = first + AV_RL16(buf + 2); | |||
| buf += 4; | |||
| for (i=first; i<last; i++, buf+=3) | |||
| pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2); | |||
| @@ -138,7 +138,7 @@ static int mp3_header_compress(AVBitStreamFilterContext *bsfc, AVCodecContext *a | |||
| return -1; | |||
| } | |||
| header = BE_32(buf); | |||
| header = AV_RB32(buf); | |||
| mode_extension= (header>>4)&3; | |||
| if(ff_mpa_check_header(header) < 0 || (header&0x60000) != 0x20000){ | |||
| @@ -160,7 +160,7 @@ output_unchanged: | |||
| av_log(avctx, AV_LOG_ERROR, "Extradata invalid\n"); | |||
| return -1; | |||
| } | |||
| extraheader = BE_32(avctx->extradata+11); | |||
| extraheader = AV_RB32(avctx->extradata+11); | |||
| if((extraheader&MP3_MASK) != (header&MP3_MASK)) | |||
| goto output_unchanged; | |||
| @@ -192,7 +192,7 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext | |||
| int sample_rate_index=0; | |||
| int lsf, mpeg25, bitrate_index, frame_size; | |||
| header = BE_32(buf); | |||
| header = AV_RB32(buf); | |||
| if(ff_mpa_check_header(header) >= 0){ | |||
| *poutbuf= (uint8_t *) buf; | |||
| *poutbuf_size= buf_size; | |||
| @@ -205,7 +205,7 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext | |||
| return -1; | |||
| } | |||
| header= BE_32(avctx->extradata+11) & MP3_MASK; | |||
| header= AV_RB32(avctx->extradata+11) & MP3_MASK; | |||
| lsf = sample_rate < (24000+32000)/2; | |||
| mpeg25 = sample_rate < (12000+16000)/2; | |||
| @@ -25,13 +25,13 @@ | |||
| static av_always_inline unsigned int bytestream_get_le32(uint8_t **b) | |||
| { | |||
| (*b) += 4; | |||
| return LE_32(*b - 4); | |||
| return AV_RL32(*b - 4); | |||
| } | |||
| static av_always_inline unsigned int bytestream_get_le16(uint8_t **b) | |||
| { | |||
| (*b) += 2; | |||
| return LE_16(*b - 2); | |||
| return AV_RL16(*b - 2); | |||
| } | |||
| static av_always_inline unsigned int bytestream_get_byte(uint8_t **b) | |||
| @@ -90,7 +90,7 @@ static void cinepak_decode_codebook (cvid_codebook_t *codebook, | |||
| if ((data + 4) > eod) | |||
| break; | |||
| flag = BE_32 (data); | |||
| flag = AV_RB32 (data); | |||
| data += 4; | |||
| mask = 0x80000000; | |||
| } | |||
| @@ -152,7 +152,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, | |||
| if ((data + 4) > eod) | |||
| return -1; | |||
| flag = BE_32 (data); | |||
| flag = AV_RB32 (data); | |||
| data += 4; | |||
| mask = 0x80000000; | |||
| } | |||
| @@ -162,7 +162,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, | |||
| if ((data + 4) > eod) | |||
| return -1; | |||
| flag = BE_32 (data); | |||
| flag = AV_RB32 (data); | |||
| data += 4; | |||
| mask = 0x80000000; | |||
| } | |||
| @@ -278,8 +278,8 @@ static int cinepak_decode_strip (CinepakContext *s, | |||
| return -1; | |||
| while ((data + 4) <= eod) { | |||
| chunk_id = BE_16 (&data[0]); | |||
| chunk_size = BE_16 (&data[2]) - 4; | |||
| chunk_id = AV_RB16 (&data[0]); | |||
| chunk_size = AV_RB16 (&data[2]) - 4; | |||
| if(chunk_size < 0) | |||
| return -1; | |||
| @@ -328,8 +328,8 @@ static int cinepak_decode (CinepakContext *s) | |||
| return -1; | |||
| frame_flags = s->data[0]; | |||
| num_strips = BE_16 (&s->data[8]); | |||
| encoded_buf_size = ((s->data[1] << 16) | BE_16 (&s->data[2])); | |||
| num_strips = AV_RB16 (&s->data[8]); | |||
| encoded_buf_size = ((s->data[1] << 16) | AV_RB16 (&s->data[2])); | |||
| /* if this is the first frame, check for deviant Sega FILM data */ | |||
| if (s->sega_film_skip_bytes == -1) { | |||
| @@ -361,13 +361,13 @@ static int cinepak_decode (CinepakContext *s) | |||
| if ((s->data + 12) > eod) | |||
| return -1; | |||
| s->strips[i].id = BE_16 (s->data); | |||
| s->strips[i].id = AV_RB16 (s->data); | |||
| s->strips[i].y1 = y0; | |||
| s->strips[i].x1 = 0; | |||
| s->strips[i].y2 = y0 + BE_16 (&s->data[8]); | |||
| s->strips[i].y2 = y0 + AV_RB16 (&s->data[8]); | |||
| s->strips[i].x2 = s->avctx->width; | |||
| strip_size = BE_16 (&s->data[2]) - 12; | |||
| strip_size = AV_RB16 (&s->data[2]) - 12; | |||
| s->data += 12; | |||
| strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size; | |||
| @@ -179,7 +179,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, | |||
| case CODEC_ID_ROQ_DPCM: | |||
| if (s->channels == 1) | |||
| predictor[0] = LE_16(&buf[6]); | |||
| predictor[0] = AV_RL16(&buf[6]); | |||
| else { | |||
| predictor[0] = buf[7] << 8; | |||
| predictor[1] = buf[6] << 8; | |||
| @@ -200,12 +200,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, | |||
| case CODEC_ID_INTERPLAY_DPCM: | |||
| in = 6; /* skip over the stream mask and stream length */ | |||
| predictor[0] = LE_16(&buf[in]); | |||
| predictor[0] = AV_RL16(&buf[in]); | |||
| in += 2; | |||
| SE_16BIT(predictor[0]) | |||
| output_samples[out++] = predictor[0]; | |||
| if (s->channels == 2) { | |||
| predictor[1] = LE_16(&buf[in]); | |||
| predictor[1] = AV_RL16(&buf[in]); | |||
| in += 2; | |||
| SE_16BIT(predictor[1]) | |||
| output_samples[out++] = predictor[1]; | |||
| @@ -225,11 +225,11 @@ static int dpcm_decode_frame(AVCodecContext *avctx, | |||
| case CODEC_ID_XAN_DPCM: | |||
| in = 0; | |||
| shift[0] = shift[1] = 4; | |||
| predictor[0] = LE_16(&buf[in]); | |||
| predictor[0] = AV_RL16(&buf[in]); | |||
| in += 2; | |||
| SE_16BIT(predictor[0]); | |||
| if (s->channels == 2) { | |||
| predictor[1] = LE_16(&buf[in]); | |||
| predictor[1] = AV_RL16(&buf[in]); | |||
| in += 2; | |||
| SE_16BIT(predictor[1]); | |||
| } | |||
| @@ -159,7 +159,7 @@ static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned cha | |||
| if (code & (1 << i)) { | |||
| *dst++ = *src++; | |||
| } else { | |||
| cmd = LE_16(src); src += 2; | |||
| cmd = AV_RL16(src); src += 2; | |||
| offset = cmd >> 4; | |||
| sz = (cmd & 0xF) + 2; | |||
| /* don't use memcpy/memmove here as the decoding routine (ab)uses */ | |||
| @@ -321,7 +321,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, | |||
| if (cin->initial_decode_frame) { | |||
| cin->initial_decode_frame = 0; | |||
| cin->delta = (int16_t)LE_16(src); src += 2; | |||
| cin->delta = (int16_t)AV_RL16(src); src += 2; | |||
| *samples++ = cin->delta; | |||
| buf_size -= 2; | |||
| } | |||
| @@ -851,7 +851,7 @@ static void dvbsub_parse_object_segment(AVCodecContext *avctx, | |||
| int coding_method, non_modifying_colour; | |||
| object_id = BE_16(buf); | |||
| object_id = AV_RB16(buf); | |||
| buf += 2; | |||
| object = get_object(ctx, object_id); | |||
| @@ -863,9 +863,9 @@ static void dvbsub_parse_object_segment(AVCodecContext *avctx, | |||
| non_modifying_colour = ((*buf++) >> 1) & 1; | |||
| if (coding_method == 0) { | |||
| top_field_len = BE_16(buf); | |||
| top_field_len = AV_RB16(buf); | |||
| buf += 2; | |||
| bottom_field_len = BE_16(buf); | |||
| bottom_field_len = AV_RB16(buf); | |||
| buf += 2; | |||
| if (buf + top_field_len + bottom_field_len > buf_end) { | |||
| @@ -1042,9 +1042,9 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, | |||
| fill = ((*buf++) >> 3) & 1; | |||
| region->width = BE_16(buf); | |||
| region->width = AV_RB16(buf); | |||
| buf += 2; | |||
| region->height = BE_16(buf); | |||
| region->height = AV_RB16(buf); | |||
| buf += 2; | |||
| if (region->width * region->height != region->buf_size) { | |||
| @@ -1086,7 +1086,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, | |||
| delete_region_display_list(ctx, region); | |||
| while (buf + 5 < buf_end) { | |||
| object_id = BE_16(buf); | |||
| object_id = AV_RB16(buf); | |||
| buf += 2; | |||
| object = get_object(ctx, object_id); | |||
| @@ -1106,9 +1106,9 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, | |||
| display->object_id = object_id; | |||
| display->region_id = region_id; | |||
| display->x_pos = BE_16(buf) & 0xfff; | |||
| display->x_pos = AV_RB16(buf) & 0xfff; | |||
| buf += 2; | |||
| display->y_pos = BE_16(buf) & 0xfff; | |||
| display->y_pos = AV_RB16(buf) & 0xfff; | |||
| buf += 2; | |||
| if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) { | |||
| @@ -1171,9 +1171,9 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, | |||
| display->region_id = region_id; | |||
| display->x_pos = BE_16(buf); | |||
| display->x_pos = AV_RB16(buf); | |||
| buf += 2; | |||
| display->y_pos = BE_16(buf); | |||
| display->y_pos = AV_RB16(buf); | |||
| buf += 2; | |||
| *tmp_ptr = display->next; | |||
| @@ -1405,9 +1405,9 @@ static int dvbsub_decode(AVCodecContext *avctx, | |||
| { | |||
| p += 1; | |||
| segment_type = *p++; | |||
| page_id = BE_16(p); | |||
| page_id = AV_RB16(p); | |||
| p += 2; | |||
| segment_length = BE_16(p); | |||
| segment_length = AV_RB16(p); | |||
| p += 2; | |||
| if (page_id == ctx->composition_id || page_id == ctx->ancillary_id) { | |||
| @@ -1576,7 +1576,7 @@ static int dvbsub_parse(AVCodecParserContext *s, | |||
| { | |||
| if (p + 6 <= p_end) | |||
| { | |||
| len = BE_16(p + 4); | |||
| len = AV_RB16(p + 4); | |||
| if (p + len + 6 <= p_end) | |||
| { | |||
| @@ -87,8 +87,8 @@ static int flic_decode_init(AVCodecContext *avctx) | |||
| s->avctx = avctx; | |||
| avctx->has_b_frames = 0; | |||
| s->fli_type = LE_16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */ | |||
| depth = LE_16(&fli_header[12]); | |||
| s->fli_type = AV_RL16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */ | |||
| depth = AV_RL16(&fli_header[12]); | |||
| if (depth == 0) { | |||
| depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */ | |||
| @@ -172,18 +172,18 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| pixels = s->frame.data[0]; | |||
| pixel_limit = s->avctx->height * s->frame.linesize[0]; | |||
| frame_size = LE_32(&buf[stream_ptr]); | |||
| frame_size = AV_RL32(&buf[stream_ptr]); | |||
| stream_ptr += 6; /* skip the magic number */ | |||
| num_chunks = LE_16(&buf[stream_ptr]); | |||
| num_chunks = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 10; /* skip padding */ | |||
| frame_size -= 16; | |||
| /* iterate through the chunks */ | |||
| while ((frame_size > 0) && (num_chunks > 0)) { | |||
| chunk_size = LE_32(&buf[stream_ptr]); | |||
| chunk_size = AV_RL32(&buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| chunk_type = LE_16(&buf[stream_ptr]); | |||
| chunk_type = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| switch (chunk_type) { | |||
| @@ -200,7 +200,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| else | |||
| color_shift = 2; | |||
| /* set up the palette */ | |||
| color_packets = LE_16(&buf[stream_ptr]); | |||
| color_packets = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| palette_ptr = 0; | |||
| for (i = 0; i < color_packets; i++) { | |||
| @@ -241,10 +241,10 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| case FLI_DELTA: | |||
| y_ptr = 0; | |||
| compressed_lines = LE_16(&buf[stream_ptr]); | |||
| compressed_lines = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| while (compressed_lines > 0) { | |||
| line_packets = LE_16(&buf[stream_ptr]); | |||
| line_packets = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| if ((line_packets & 0xC000) == 0xC000) { | |||
| // line skip opcode | |||
| @@ -290,12 +290,12 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| case FLI_LC: | |||
| /* line compressed */ | |||
| starting_line = LE_16(&buf[stream_ptr]); | |||
| starting_line = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| y_ptr = 0; | |||
| y_ptr += starting_line * s->frame.linesize[0]; | |||
| compressed_lines = LE_16(&buf[stream_ptr]); | |||
| compressed_lines = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| while (compressed_lines > 0) { | |||
| pixel_ptr = y_ptr; | |||
| @@ -466,18 +466,18 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| pixels = s->frame.data[0]; | |||
| pixel_limit = s->avctx->height * s->frame.linesize[0]; | |||
| frame_size = LE_32(&buf[stream_ptr]); | |||
| frame_size = AV_RL32(&buf[stream_ptr]); | |||
| stream_ptr += 6; /* skip the magic number */ | |||
| num_chunks = LE_16(&buf[stream_ptr]); | |||
| num_chunks = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 10; /* skip padding */ | |||
| frame_size -= 16; | |||
| /* iterate through the chunks */ | |||
| while ((frame_size > 0) && (num_chunks > 0)) { | |||
| chunk_size = LE_32(&buf[stream_ptr]); | |||
| chunk_size = AV_RL32(&buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| chunk_type = LE_16(&buf[stream_ptr]); | |||
| chunk_type = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| switch (chunk_type) { | |||
| @@ -492,10 +492,10 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| case FLI_DELTA: | |||
| case FLI_DTA_LC: | |||
| y_ptr = 0; | |||
| compressed_lines = LE_16(&buf[stream_ptr]); | |||
| compressed_lines = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| while (compressed_lines > 0) { | |||
| line_packets = LE_16(&buf[stream_ptr]); | |||
| line_packets = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| if (line_packets < 0) { | |||
| line_packets = -line_packets; | |||
| @@ -512,7 +512,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| byte_run = (signed char)(buf[stream_ptr++]); | |||
| if (byte_run < 0) { | |||
| byte_run = -byte_run; | |||
| pixel = LE_16(&buf[stream_ptr]); | |||
| pixel = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| CHECK_PIXEL_PTR(byte_run); | |||
| for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { | |||
| @@ -522,7 +522,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| } else { | |||
| CHECK_PIXEL_PTR(byte_run); | |||
| for (j = 0; j < byte_run; j++, pixel_countdown--) { | |||
| *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]); | |||
| *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| pixel_ptr += 2; | |||
| } | |||
| @@ -586,12 +586,12 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| * a second pass over the line here, swapping the bytes. | |||
| */ | |||
| pixel = 0xFF00; | |||
| if (0xFF00 != LE_16(&pixel)) /* Check if its not an LE Target */ | |||
| if (0xFF00 != AV_RL16(&pixel)) /* Check if its not an LE Target */ | |||
| { | |||
| pixel_ptr = y_ptr; | |||
| pixel_countdown = s->avctx->width; | |||
| while (pixel_countdown > 0) { | |||
| *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[pixel_ptr]); | |||
| *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]); | |||
| pixel_ptr += 2; | |||
| } | |||
| } | |||
| @@ -611,7 +611,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| while (pixel_countdown > 0) { | |||
| byte_run = (signed char)(buf[stream_ptr++]); | |||
| if (byte_run > 0) { | |||
| pixel = LE_16(&buf[stream_ptr]); | |||
| pixel = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| CHECK_PIXEL_PTR(byte_run); | |||
| for (j = 0; j < byte_run; j++) { | |||
| @@ -626,7 +626,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| byte_run = -byte_run; | |||
| CHECK_PIXEL_PTR(byte_run); | |||
| for (j = 0; j < byte_run; j++) { | |||
| *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]); | |||
| *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| pixel_ptr += 2; | |||
| pixel_countdown--; | |||
| @@ -656,7 +656,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| pixel_countdown = s->avctx->width; | |||
| pixel_ptr = 0; | |||
| while (pixel_countdown > 0) { | |||
| *((signed short*)(&pixels[y_ptr + pixel_ptr])) = LE_16(&buf[stream_ptr+pixel_ptr]); | |||
| *((signed short*)(&pixels[y_ptr + pixel_ptr])) = AV_RL16(&buf[stream_ptr+pixel_ptr]); | |||
| pixel_ptr += 2; | |||
| pixel_countdown--; | |||
| } | |||
| @@ -138,7 +138,7 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, | |||
| for(i = 0; i < 256; i++){ | |||
| s->nodes[i].sym = i; | |||
| s->nodes[i].count = LE_32(src); | |||
| s->nodes[i].count = AV_RL32(src); | |||
| s->nodes[i].n0 = -2; | |||
| if(s->nodes[i].count < 0) { | |||
| av_log(s->avctx, AV_LOG_ERROR, "Symbol count < 0\n"); | |||
| @@ -215,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| int i, is_chroma, planes; | |||
| header = LE_32(buf); | |||
| header = AV_RL32(buf); | |||
| version = header & 0xff; | |||
| header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ | |||
| @@ -337,12 +337,12 @@ static int decode_frame(AVCodecContext *avctx, | |||
| } | |||
| f->pict_type = FF_I_TYPE; | |||
| f->key_frame = 1; | |||
| if ((LE_32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { | |||
| if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { | |||
| av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); | |||
| return -1; | |||
| } | |||
| for(i = 0; i < planes; i++) { | |||
| offs[i] = LE_32(buf + 4 + i * 4); | |||
| offs[i] = AV_RL32(buf + 4 + i * 4); | |||
| if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) { | |||
| av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i); | |||
| return -1; | |||
| @@ -8215,7 +8215,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| cnt = *(p+5) & 0x1f; // Number of sps | |||
| p += 6; | |||
| for (i = 0; i < cnt; i++) { | |||
| nalsize = BE_16(p) + 2; | |||
| nalsize = AV_RB16(p) + 2; | |||
| if(decode_nal_units(h, p, nalsize) < 0) { | |||
| av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i); | |||
| return -1; | |||
| @@ -8225,7 +8225,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| // Decode pps from avcC | |||
| cnt = *(p++); // Number of pps | |||
| for (i = 0; i < cnt; i++) { | |||
| nalsize = BE_16(p) + 2; | |||
| nalsize = AV_RB16(p) + 2; | |||
| if(decode_nal_units(h, p, nalsize) != nalsize) { | |||
| av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i); | |||
| return -1; | |||
| @@ -368,13 +368,13 @@ static int decode_init(AVCodecContext * avctx) | |||
| av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n"); | |||
| c->palsize = 127; | |||
| } else { | |||
| c->palsize = LE_16(avctx->extradata + 10); | |||
| c->palsize = AV_RL16(avctx->extradata + 10); | |||
| } | |||
| if (avctx->extradata_size == 1036) { // palette in extradata | |||
| uint8_t *src = avctx->extradata + 12; | |||
| for (i = 0; i < 256; i++) { | |||
| c->pal[i] = LE_32(src); | |||
| c->pal[i] = AV_RL32(src); | |||
| src += 4; | |||
| } | |||
| c->setpal = 1; | |||
| @@ -237,20 +237,20 @@ static int decode_init(AVCodecContext *avctx){ | |||
| avctx->extradata_size); | |||
| return -1; | |||
| } | |||
| version = LE_32(avctx->extradata); | |||
| version = AV_RL32(avctx->extradata); | |||
| switch(version) { | |||
| case 1: | |||
| l->lossy = 0; | |||
| break; | |||
| case 2: | |||
| l->lossy = LE_32(avctx->extradata + 8); | |||
| l->lossy = AV_RL32(avctx->extradata + 8); | |||
| break; | |||
| default: | |||
| l->lossy = LE_32(avctx->extradata + 8); | |||
| l->lossy = AV_RL32(avctx->extradata + 8); | |||
| av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please upload file for study\n", version); | |||
| } | |||
| l->mode = LE_32(avctx->extradata + 4); | |||
| l->mode = AV_RL32(avctx->extradata + 4); | |||
| switch(l->mode) { | |||
| case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY: | |||
| avctx->pix_fmt = PIX_FMT_YUV422P; | |||
| @@ -2540,12 +2540,12 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av | |||
| break; | |||
| case SOS: | |||
| bytestream_put_be32(&poutbufp, i + 46); /* scan off */ | |||
| bytestream_put_be32(&poutbufp, i + 46 + BE_16(buf + i + 2)); /* data off */ | |||
| bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data off */ | |||
| bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */ | |||
| *poutbuf_size = poutbufp - *poutbuf; | |||
| return 1; | |||
| case APP1: | |||
| if (i + 8 < buf_size && LE_32(buf + i + 8) == ff_get_fourcc("mjpg")) { | |||
| if (i + 8 < buf_size && AV_RL32(buf + i + 8) == ff_get_fourcc("mjpg")) { | |||
| av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n"); | |||
| memcpy(*poutbuf, buf, buf_size); | |||
| *poutbuf_size = buf_size; | |||
| @@ -110,7 +110,7 @@ static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const | |||
| static void mm_decode_inter(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size) | |||
| { | |||
| const int data_ptr = 2 + LE_16(&buf[0]); | |||
| const int data_ptr = 2 + AV_RL16(&buf[0]); | |||
| int d, r, y; | |||
| d = data_ptr; r = 2; y = 0; | |||
| @@ -162,7 +162,7 @@ static int mm_decode_frame(AVCodecContext *avctx, | |||
| palette_control->palette_changed = 0; | |||
| } | |||
| type = LE_16(&buf[0]); | |||
| type = AV_RL16(&buf[0]); | |||
| buf += MM_PREAMBLE_SIZE; | |||
| buf_size -= MM_PREAMBLE_SIZE; | |||
| @@ -245,25 +245,25 @@ static void msvideo1_decode_16bit(Msvideo1Context *s) | |||
| flags = (byte_b << 8) | byte_a; | |||
| CHECK_STREAM_PTR(4); | |||
| colors[0] = LE_16(&s->buf[stream_ptr]); | |||
| colors[0] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[1] = LE_16(&s->buf[stream_ptr]); | |||
| colors[1] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| if (colors[0] & 0x8000) { | |||
| /* 8-color encoding */ | |||
| CHECK_STREAM_PTR(12); | |||
| colors[2] = LE_16(&s->buf[stream_ptr]); | |||
| colors[2] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[3] = LE_16(&s->buf[stream_ptr]); | |||
| colors[3] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[4] = LE_16(&s->buf[stream_ptr]); | |||
| colors[4] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[5] = LE_16(&s->buf[stream_ptr]); | |||
| colors[5] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[6] = LE_16(&s->buf[stream_ptr]); | |||
| colors[6] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| colors[7] = LE_16(&s->buf[stream_ptr]); | |||
| colors[7] = AV_RL16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| for (pixel_y = 0; pixel_y < 4; pixel_y++) { | |||
| @@ -64,9 +64,9 @@ static int get_quant(AVCodecContext *avctx, NuvContext *c, | |||
| return -1; | |||
| } | |||
| for (i = 0; i < 64; i++, buf += 4) | |||
| c->lq[i] = LE_32(buf); | |||
| c->lq[i] = AV_RL32(buf); | |||
| for (i = 0; i < 64; i++, buf += 4) | |||
| c->cq[i] = LE_32(buf); | |||
| c->cq[i] = AV_RL32(buf); | |||
| return 0; | |||
| } | |||
| @@ -1836,7 +1836,7 @@ static int qdm2_decode_init(AVCodecContext *avctx) | |||
| extradata += 8; | |||
| extradata_size -= 8; | |||
| size = BE_32(extradata); | |||
| size = AV_RB32(extradata); | |||
| if(size > extradata_size){ | |||
| av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", | |||
| @@ -1846,29 +1846,29 @@ static int qdm2_decode_init(AVCodecContext *avctx) | |||
| extradata += 4; | |||
| av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size); | |||
| if (BE_32(extradata) != MKBETAG('Q','D','C','A')) { | |||
| if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { | |||
| av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); | |||
| return -1; | |||
| } | |||
| extradata += 8; | |||
| avctx->channels = s->nb_channels = s->channels = BE_32(extradata); | |||
| avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); | |||
| extradata += 4; | |||
| avctx->sample_rate = BE_32(extradata); | |||
| avctx->sample_rate = AV_RB32(extradata); | |||
| extradata += 4; | |||
| avctx->bit_rate = BE_32(extradata); | |||
| avctx->bit_rate = AV_RB32(extradata); | |||
| extradata += 4; | |||
| s->group_size = BE_32(extradata); | |||
| s->group_size = AV_RB32(extradata); | |||
| extradata += 4; | |||
| s->fft_size = BE_32(extradata); | |||
| s->fft_size = AV_RB32(extradata); | |||
| extradata += 4; | |||
| s->checksum_size = BE_32(extradata); | |||
| s->checksum_size = AV_RB32(extradata); | |||
| extradata += 4; | |||
| s->fft_order = av_log2(s->fft_size) + 1; | |||
| @@ -58,7 +58,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| outdata = a->pic.data[0]; | |||
| buf += 0x68; /* jump to palette */ | |||
| colors = BE_32(buf); | |||
| colors = AV_RB32(buf); | |||
| buf += 4; | |||
| if(colors < 0 || colors > 256) { | |||
| @@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| for (i = 0; i <= colors; i++) { | |||
| unsigned int idx; | |||
| idx = BE_16(buf); /* color index */ | |||
| idx = AV_RB16(buf); /* color index */ | |||
| buf += 2; | |||
| if (idx > 255) { | |||
| @@ -93,7 +93,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| /* decode line */ | |||
| out = outdata; | |||
| size = BE_16(buf); /* size of packed line */ | |||
| size = AV_RB16(buf); /* size of packed line */ | |||
| buf += 2; | |||
| left = size; | |||
| next = buf + size; | |||
| @@ -96,15 +96,15 @@ static void qtrle_decode_4bpp(QtrleContext *s) | |||
| /* fetch the header */ | |||
| CHECK_STREAM_PTR(2); | |||
| header = BE_16(&s->buf[stream_ptr]); | |||
| header = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* if a header is present, fetch additional decoding parameters */ | |||
| if (header & 0x0008) { | |||
| CHECK_STREAM_PTR(8); | |||
| start_line = BE_16(&s->buf[stream_ptr]); | |||
| start_line = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| lines_to_change = BE_16(&s->buf[stream_ptr]); | |||
| lines_to_change = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| } else { | |||
| start_line = 0; | |||
| @@ -187,15 +187,15 @@ static void qtrle_decode_8bpp(QtrleContext *s) | |||
| /* fetch the header */ | |||
| CHECK_STREAM_PTR(2); | |||
| header = BE_16(&s->buf[stream_ptr]); | |||
| header = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* if a header is present, fetch additional decoding parameters */ | |||
| if (header & 0x0008) { | |||
| CHECK_STREAM_PTR(8); | |||
| start_line = BE_16(&s->buf[stream_ptr]); | |||
| start_line = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| lines_to_change = BE_16(&s->buf[stream_ptr]); | |||
| lines_to_change = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| } else { | |||
| start_line = 0; | |||
| @@ -269,15 +269,15 @@ static void qtrle_decode_16bpp(QtrleContext *s) | |||
| /* fetch the header */ | |||
| CHECK_STREAM_PTR(2); | |||
| header = BE_16(&s->buf[stream_ptr]); | |||
| header = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* if a header is present, fetch additional decoding parameters */ | |||
| if (header & 0x0008) { | |||
| CHECK_STREAM_PTR(8); | |||
| start_line = BE_16(&s->buf[stream_ptr]); | |||
| start_line = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| lines_to_change = BE_16(&s->buf[stream_ptr]); | |||
| lines_to_change = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| } else { | |||
| start_line = 0; | |||
| @@ -299,7 +299,7 @@ static void qtrle_decode_16bpp(QtrleContext *s) | |||
| /* decode the run length code */ | |||
| rle_code = -rle_code; | |||
| CHECK_STREAM_PTR(2); | |||
| rgb16 = BE_16(&s->buf[stream_ptr]); | |||
| rgb16 = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| CHECK_PIXEL_PTR(rle_code * 2); | |||
| @@ -314,7 +314,7 @@ static void qtrle_decode_16bpp(QtrleContext *s) | |||
| /* copy pixels directly to output */ | |||
| while (rle_code--) { | |||
| rgb16 = BE_16(&s->buf[stream_ptr]); | |||
| rgb16 = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| *(unsigned short *)(&rgb[pixel_ptr]) = rgb16; | |||
| pixel_ptr += 2; | |||
| @@ -347,15 +347,15 @@ static void qtrle_decode_24bpp(QtrleContext *s) | |||
| /* fetch the header */ | |||
| CHECK_STREAM_PTR(2); | |||
| header = BE_16(&s->buf[stream_ptr]); | |||
| header = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* if a header is present, fetch additional decoding parameters */ | |||
| if (header & 0x0008) { | |||
| CHECK_STREAM_PTR(8); | |||
| start_line = BE_16(&s->buf[stream_ptr]); | |||
| start_line = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| lines_to_change = BE_16(&s->buf[stream_ptr]); | |||
| lines_to_change = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| } else { | |||
| start_line = 0; | |||
| @@ -427,15 +427,15 @@ static void qtrle_decode_32bpp(QtrleContext *s) | |||
| /* fetch the header */ | |||
| CHECK_STREAM_PTR(2); | |||
| header = BE_16(&s->buf[stream_ptr]); | |||
| header = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* if a header is present, fetch additional decoding parameters */ | |||
| if (header & 0x0008) { | |||
| CHECK_STREAM_PTR(8); | |||
| start_line = BE_16(&s->buf[stream_ptr]); | |||
| start_line = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| lines_to_change = BE_16(&s->buf[stream_ptr]); | |||
| lines_to_change = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| } else { | |||
| start_line = 0; | |||
| @@ -98,7 +98,7 @@ static void rpza_decode_stream(RpzaContext *s) | |||
| s->buf[stream_ptr]); | |||
| /* Get chunk size, ingnoring first byte */ | |||
| chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF; | |||
| chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; | |||
| stream_ptr += 4; | |||
| /* If length mismatch use size from MOV file and try to decode anyway */ | |||
| @@ -140,7 +140,7 @@ static void rpza_decode_stream(RpzaContext *s) | |||
| /* Fill blocks with one color */ | |||
| case 0xa0: | |||
| colorA = BE_16 (&s->buf[stream_ptr]); | |||
| colorA = AV_RB16 (&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| while (n_blocks--) { | |||
| block_ptr = row_ptr + pixel_ptr; | |||
| @@ -157,10 +157,10 @@ static void rpza_decode_stream(RpzaContext *s) | |||
| /* Fill blocks with 4 colors */ | |||
| case 0xc0: | |||
| colorA = BE_16 (&s->buf[stream_ptr]); | |||
| colorA = AV_RB16 (&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| case 0x20: | |||
| colorB = BE_16 (&s->buf[stream_ptr]); | |||
| colorB = AV_RB16 (&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| /* sort out the colors */ | |||
| @@ -209,7 +209,7 @@ static void rpza_decode_stream(RpzaContext *s) | |||
| for (pixel_x = 0; pixel_x < 4; pixel_x++){ | |||
| /* We already have color of upper left pixel */ | |||
| if ((pixel_y != 0) || (pixel_x !=0)) { | |||
| colorA = BE_16 (&s->buf[stream_ptr]); | |||
| colorA = AV_RB16 (&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| } | |||
| pixels[block_ptr] = colorA; | |||
| @@ -535,7 +535,7 @@ static int rv10_decode_init(AVCodecContext *avctx) | |||
| s->height = avctx->height; | |||
| s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1; | |||
| avctx->sub_id= BE_32((uint8_t*)avctx->extradata + 4); | |||
| avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4); | |||
| switch(avctx->sub_id){ | |||
| case 0x10000000: | |||
| @@ -277,10 +277,10 @@ static int decode_header_trees(SmackVContext *smk) { | |||
| GetBitContext gb; | |||
| int mmap_size, mclr_size, full_size, type_size; | |||
| mmap_size = LE_32(smk->avctx->extradata); | |||
| mclr_size = LE_32(smk->avctx->extradata + 4); | |||
| full_size = LE_32(smk->avctx->extradata + 8); | |||
| type_size = LE_32(smk->avctx->extradata + 12); | |||
| mmap_size = AV_RL32(smk->avctx->extradata); | |||
| mclr_size = AV_RL32(smk->avctx->extradata + 4); | |||
| full_size = AV_RL32(smk->avctx->extradata + 8); | |||
| type_size = AV_RL32(smk->avctx->extradata + 12); | |||
| init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); | |||
| @@ -584,7 +584,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, | |||
| int bits, stereo; | |||
| int pred[2] = {0, 0}; | |||
| unp_size = LE_32(buf); | |||
| unp_size = AV_RL32(buf); | |||
| init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); | |||
| @@ -120,7 +120,7 @@ static void smc_decode_stream(SmcContext *s) | |||
| s->avctx->palctrl->palette_changed = 0; | |||
| } | |||
| chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF; | |||
| chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; | |||
| stream_ptr += 4; | |||
| if (chunk_size != s->size) | |||
| av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n", | |||
| @@ -278,7 +278,7 @@ static void smc_decode_stream(SmcContext *s) | |||
| color_table_index = CPAIR * s->buf[stream_ptr++]; | |||
| while (n_blocks--) { | |||
| color_flags = BE_16(&s->buf[stream_ptr]); | |||
| color_flags = AV_RB16(&s->buf[stream_ptr]); | |||
| stream_ptr += 2; | |||
| flag_mask = 0x8000; | |||
| block_ptr = row_ptr + pixel_ptr; | |||
| @@ -321,7 +321,7 @@ static void smc_decode_stream(SmcContext *s) | |||
| color_table_index = CQUAD * s->buf[stream_ptr++]; | |||
| while (n_blocks--) { | |||
| color_flags = BE_32(&s->buf[stream_ptr]); | |||
| color_flags = AV_RB32(&s->buf[stream_ptr]); | |||
| stream_ptr += 4; | |||
| /* flag mask actually acts as a bit shift count here */ | |||
| flag_mask = 30; | |||
| @@ -830,7 +830,7 @@ static int svq3_decode_frame (AVCodecContext *avctx, | |||
| GetBitContext gb; | |||
| size = BE_32(&extradata[4]); | |||
| size = AV_RB32(&extradata[4]); | |||
| init_get_bits (&gb, extradata + 8, size*8); | |||
| /* 'frame size code' and optional 'width, height' */ | |||
| @@ -61,7 +61,7 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, uint8_t *sr | |||
| *dst = *src; | |||
| break; | |||
| case 2: | |||
| *((uint16_t*)dst) = LE_16(src); | |||
| *((uint16_t*)dst) = AV_RL16(src); | |||
| break; | |||
| case 3: | |||
| dst[0] = src[0]; | |||
| @@ -69,7 +69,7 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, uint8_t *sr | |||
| dst[2] = src[2]; | |||
| break; | |||
| case 4: | |||
| *((uint32_t*)dst) = LE_32(src); | |||
| *((uint32_t*)dst) = AV_RL32(src); | |||
| break; | |||
| } | |||
| dst += depth; | |||
| @@ -104,13 +104,13 @@ static int decode_frame(AVCodecContext *avctx, | |||
| idlen = *buf++; | |||
| pal = *buf++; | |||
| compr = *buf++; | |||
| first_clr = LE_16(buf); buf += 2; | |||
| colors = LE_16(buf); buf += 2; | |||
| first_clr = AV_RL16(buf); buf += 2; | |||
| colors = AV_RL16(buf); buf += 2; | |||
| csize = *buf++; | |||
| x = LE_16(buf); buf += 2; | |||
| y = LE_16(buf); buf += 2; | |||
| w = LE_16(buf); buf += 2; | |||
| h = LE_16(buf); buf += 2; | |||
| x = AV_RL16(buf); buf += 2; | |||
| y = AV_RL16(buf); buf += 2; | |||
| w = AV_RL16(buf); buf += 2; | |||
| h = AV_RL16(buf); buf += 2; | |||
| bpp = *buf++; | |||
| flags = *buf++; | |||
| //skip identifier if any | |||
| @@ -200,11 +200,11 @@ static int decode_frame(AVCodecContext *avctx, | |||
| if((s->bpp + 1) >> 3 == 2){ | |||
| uint16_t *dst16 = (uint16_t*)dst; | |||
| for(x = 0; x < s->width; x++) | |||
| dst16[x] = LE_16(buf + x * 2); | |||
| dst16[x] = AV_RL16(buf + x * 2); | |||
| }else if((s->bpp + 1) >> 3 == 4){ | |||
| uint32_t *dst32 = (uint32_t*)dst; | |||
| for(x = 0; x < s->width; x++) | |||
| dst32[x] = LE_32(buf + x * 4); | |||
| dst32[x] = AV_RL32(buf + x * 4); | |||
| }else | |||
| #endif | |||
| memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3)); | |||
| @@ -87,13 +87,13 @@ typedef struct TiffContext { | |||
| } TiffContext; | |||
| static int tget_short(uint8_t **p, int le){ | |||
| int v = le ? LE_16(*p) : BE_16(*p); | |||
| int v = le ? AV_RL16(*p) : AV_RB16(*p); | |||
| *p += 2; | |||
| return v; | |||
| } | |||
| static int tget_long(uint8_t **p, int le){ | |||
| int v = le ? LE_32(*p) : BE_32(*p); | |||
| int v = le ? AV_RL32(*p) : AV_RB32(*p); | |||
| *p += 4; | |||
| return v; | |||
| } | |||
| @@ -447,7 +447,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| int i, entries; | |||
| //parse image header | |||
| id = LE_16(buf); buf += 2; | |||
| id = AV_RL16(buf); buf += 2; | |||
| if(id == 0x4949) le = 1; | |||
| else if(id == 0x4D4D) le = 0; | |||
| else{ | |||
| @@ -348,9 +348,9 @@ static int truemotion1_decode_header(TrueMotion1Context *s) | |||
| header.compression = header_buffer[0]; | |||
| header.deltaset = header_buffer[1]; | |||
| header.vectable = header_buffer[2]; | |||
| header.ysize = LE_16(&header_buffer[3]); | |||
| header.xsize = LE_16(&header_buffer[5]); | |||
| header.checksum = LE_16(&header_buffer[7]); | |||
| header.ysize = AV_RL16(&header_buffer[3]); | |||
| header.xsize = AV_RL16(&header_buffer[5]); | |||
| header.checksum = AV_RL16(&header_buffer[7]); | |||
| header.version = header_buffer[9]; | |||
| header.header_type = header_buffer[10]; | |||
| header.flags = header_buffer[11]; | |||
| @@ -208,7 +208,7 @@ static inline int tm2_read_header(TM2Context *ctx, uint8_t *buf) | |||
| obuf = buf; | |||
| magic = LE_32(buf); | |||
| magic = AV_RL32(buf); | |||
| buf += 4; | |||
| if(magic == 0x00000100) { /* old header */ | |||
| @@ -217,7 +217,7 @@ static inline int tm2_read_header(TM2Context *ctx, uint8_t *buf) | |||
| } else if(magic == 0x00000101) { /* new header */ | |||
| int w, h, size, flags, xr, yr; | |||
| length = LE_32(buf); | |||
| length = AV_RL32(buf); | |||
| buf += 4; | |||
| init_get_bits(&ctx->gb, buf, 32 * 8); | |||
| @@ -270,17 +270,17 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { | |||
| TM2Codes codes; | |||
| /* get stream length in dwords */ | |||
| len = BE_32(buf); buf += 4; cur += 4; | |||
| len = AV_RB32(buf); buf += 4; cur += 4; | |||
| skip = len * 4 + 4; | |||
| if(len == 0) | |||
| return 4; | |||
| toks = BE_32(buf); buf += 4; cur += 4; | |||
| toks = AV_RB32(buf); buf += 4; cur += 4; | |||
| if(toks & 1) { | |||
| len = BE_32(buf); buf += 4; cur += 4; | |||
| len = AV_RB32(buf); buf += 4; cur += 4; | |||
| if(len == TM2_ESCAPE) { | |||
| len = BE_32(buf); buf += 4; cur += 4; | |||
| len = AV_RB32(buf); buf += 4; cur += 4; | |||
| } | |||
| if(len > 0) { | |||
| init_get_bits(&ctx->gb, buf, (skip - cur) * 8); | |||
| @@ -291,7 +291,7 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { | |||
| } | |||
| } | |||
| /* skip unused fields */ | |||
| if(BE_32(buf) == TM2_ESCAPE) { | |||
| if(AV_RB32(buf) == TM2_ESCAPE) { | |||
| buf += 4; cur += 4; /* some unknown length - could be escaped too */ | |||
| } | |||
| buf += 4; cur += 4; | |||
| @@ -312,7 +312,7 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { | |||
| } | |||
| ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); | |||
| ctx->tok_lens[stream_id] = toks; | |||
| len = BE_32(buf); buf += 4; cur += 4; | |||
| len = AV_RB32(buf); buf += 4; cur += 4; | |||
| if(len > 0) { | |||
| init_get_bits(&ctx->gb, buf, (skip - cur) * 8); | |||
| for(i = 0; i < toks; i++) | |||
| @@ -62,7 +62,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| uint32_t t; | |||
| /* first dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->flag = t & 1; | |||
| @@ -77,7 +77,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->vector[7] = ts_codebook[7][(t >> 29) & 0x7]; | |||
| /* second dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->offset2[0] = (t >> 0) & 0x7F; | |||
| @@ -88,7 +88,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[0] = ((t >> 28) & 0xF) << 4; | |||
| /* third dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulseval[0] = (t >> 0) & 0x3FFF; | |||
| @@ -97,7 +97,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[1] = (t >> 28) & 0x0F; | |||
| /* fourth dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulseval[2] = (t >> 0) & 0x3FFF; | |||
| @@ -106,7 +106,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[1] |= ((t >> 28) & 0x0F) << 4; | |||
| /* fifth dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF; | |||
| @@ -116,7 +116,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[0] |= (t >> 31) & 1; | |||
| /* sixth dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF; | |||
| @@ -126,7 +126,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[0] |= ((t >> 31) & 1) << 1; | |||
| /* seventh dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF; | |||
| @@ -136,7 +136,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) | |||
| dec->offset1[0] |= ((t >> 31) & 1) << 2; | |||
| /* eighth dword */ | |||
| t = LE_32(input); | |||
| t = AV_RL32(input); | |||
| input += 4; | |||
| dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF; | |||
| @@ -121,14 +121,14 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) | |||
| } | |||
| } else if (c->bpp == 16) { | |||
| for(i = 0; i < p2; i++) { | |||
| pix16 = LE_16(src); | |||
| pix16 = AV_RL16(src); | |||
| src += 2; | |||
| *(uint16_t*)output = pix16; | |||
| output += 2; | |||
| } | |||
| } else if (c->bpp == 32) { | |||
| for(i = 0; i < p2; i++) { | |||
| pix32 = LE_32(src); | |||
| pix32 = AV_RL32(src); | |||
| src += 4; | |||
| *(uint32_t*)output = pix32; | |||
| output += 4; | |||
| @@ -140,7 +140,7 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) | |||
| switch(c->bpp){ | |||
| case 8: pix[0] = *src++; | |||
| break; | |||
| case 16: pix16 = LE_16(src); | |||
| case 16: pix16 = AV_RL16(src); | |||
| src += 2; | |||
| *(uint16_t*)pix = pix16; | |||
| break; | |||
| @@ -148,7 +148,7 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) | |||
| pix[1] = *src++; | |||
| pix[2] = *src++; | |||
| break; | |||
| case 32: pix32 = LE_32(src); | |||
| case 32: pix32 = AV_RL32(src); | |||
| src += 4; | |||
| *(uint32_t*)pix = pix32; | |||
| break; | |||
| @@ -4128,7 +4128,7 @@ static int vc1_decode_init(AVCodecContext *avctx) | |||
| } | |||
| while(edata_size > 8) { | |||
| // test if we've found header | |||
| if(BE_32(edata) == 0x0000010F) { | |||
| if(AV_RB32(edata) == 0x0000010F) { | |||
| edata += 4; | |||
| edata_size -= 4; | |||
| break; | |||
| @@ -4144,7 +4144,7 @@ static int vc1_decode_init(AVCodecContext *avctx) | |||
| while(edata_size > 8) { | |||
| // test if we've found entry point | |||
| if(BE_32(edata) == 0x0000010E) { | |||
| if(AV_RB32(edata) == 0x0000010E) { | |||
| edata += 4; | |||
| edata_size -= 4; | |||
| break; | |||
| @@ -92,10 +92,10 @@ static void lz_unpack(unsigned char *src, unsigned char *dest, int dest_len) | |||
| s = src; | |||
| d = dest; | |||
| d_end = d + dest_len; | |||
| dataleft = LE_32(s); | |||
| dataleft = AV_RL32(s); | |||
| s += 4; | |||
| memset(queue, 0x20, QUEUE_SIZE); | |||
| if (LE_32(s) == 0x56781234) { | |||
| if (AV_RL32(s) == 0x56781234) { | |||
| s += 4; | |||
| qpos = 0x111; | |||
| speclen = 0xF + 3; | |||
| @@ -204,10 +204,10 @@ static void vmd_decode(VmdVideoContext *s) | |||
| int frame_width, frame_height; | |||
| int dp_size; | |||
| frame_x = LE_16(&s->buf[6]); | |||
| frame_y = LE_16(&s->buf[8]); | |||
| frame_width = LE_16(&s->buf[10]) - frame_x + 1; | |||
| frame_height = LE_16(&s->buf[12]) - frame_y + 1; | |||
| frame_x = AV_RL16(&s->buf[6]); | |||
| frame_y = AV_RL16(&s->buf[8]); | |||
| frame_width = AV_RL16(&s->buf[10]) - frame_x + 1; | |||
| frame_height = AV_RL16(&s->buf[12]) - frame_y + 1; | |||
| /* if only a certain region will be updated, copy the entire previous | |||
| * frame before the decode */ | |||
| @@ -339,7 +339,7 @@ static int vmdvideo_decode_init(AVCodecContext *avctx) | |||
| } | |||
| vmd_header = (unsigned char *)avctx->extradata; | |||
| s->unpack_buffer_size = LE_32(&vmd_header[800]); | |||
| s->unpack_buffer_size = AV_RL32(&vmd_header[800]); | |||
| s->unpack_buffer = av_malloc(s->unpack_buffer_size); | |||
| if (!s->unpack_buffer) | |||
| return -1; | |||
| @@ -76,10 +76,10 @@ static av_always_inline int vmnc_get_pixel(uint8_t* buf, int bpp, int be) { | |||
| switch(bpp * 2 + be) { | |||
| case 2: | |||
| case 3: return *buf; | |||
| case 4: return LE_16(buf); | |||
| case 5: return BE_16(buf); | |||
| case 8: return LE_32(buf); | |||
| case 9: return BE_32(buf); | |||
| case 4: return AV_RL16(buf); | |||
| case 5: return AV_RB16(buf); | |||
| case 8: return AV_RL32(buf); | |||
| case 9: return AV_RB32(buf); | |||
| default: return 0; | |||
| } | |||
| } | |||
| @@ -328,13 +328,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| } | |||
| } | |||
| src += 2; | |||
| chunks = BE_16(src); src += 2; | |||
| chunks = AV_RB16(src); src += 2; | |||
| while(chunks--) { | |||
| dx = BE_16(src); src += 2; | |||
| dy = BE_16(src); src += 2; | |||
| w = BE_16(src); src += 2; | |||
| h = BE_16(src); src += 2; | |||
| enc = BE_32(src); src += 4; | |||
| dx = AV_RB16(src); src += 2; | |||
| dy = AV_RB16(src); src += 2; | |||
| w = AV_RB16(src); src += 2; | |||
| h = AV_RB16(src); src += 2; | |||
| enc = AV_RB32(src); src += 4; | |||
| outptr = c->pic.data[0] + dx * c->bpp2 + dy * c->pic.linesize[0]; | |||
| size_left = buf_size - (src - buf); | |||
| switch(enc) { | |||
| @@ -63,7 +63,7 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, | |||
| return 0; | |||
| } | |||
| if (separated_coeff || !s->filter_header) { | |||
| coeff_offset = BE_16(buf+2) - 2; | |||
| coeff_offset = AV_RB16(buf+2) - 2; | |||
| buf += 2; | |||
| buf_size -= 2; | |||
| } | |||
| @@ -95,7 +95,7 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, | |||
| return 0; | |||
| if (separated_coeff || !s->filter_header) { | |||
| coeff_offset = BE_16(buf+1) - 2; | |||
| coeff_offset = AV_RB16(buf+1) - 2; | |||
| buf += 2; | |||
| buf_size -= 2; | |||
| } | |||
| @@ -151,8 +151,8 @@ static int vqa_decode_init(AVCodecContext *avctx) | |||
| /* load up the VQA parameters from the header */ | |||
| vqa_header = (unsigned char *)s->avctx->extradata; | |||
| s->vqa_version = vqa_header[0]; | |||
| s->width = LE_16(&vqa_header[6]); | |||
| s->height = LE_16(&vqa_header[8]); | |||
| s->width = AV_RL16(&vqa_header[6]); | |||
| s->height = AV_RL16(&vqa_header[8]); | |||
| if(avcodec_check_dimensions(avctx, s->width, s->height)){ | |||
| s->width= s->height= 0; | |||
| return -1; | |||
| @@ -232,9 +232,9 @@ static void decode_format80(unsigned char *src, int src_size, | |||
| if (src[src_index] == 0xFF) { | |||
| src_index++; | |||
| count = LE_16(&src[src_index]); | |||
| count = AV_RL16(&src[src_index]); | |||
| src_index += 2; | |||
| src_pos = LE_16(&src[src_index]); | |||
| src_pos = AV_RL16(&src[src_index]); | |||
| src_index += 2; | |||
| vqa_debug("(1) copy %X bytes from absolute pos %X\n", count, src_pos); | |||
| CHECK_COUNT(); | |||
| @@ -245,7 +245,7 @@ static void decode_format80(unsigned char *src, int src_size, | |||
| } else if (src[src_index] == 0xFE) { | |||
| src_index++; | |||
| count = LE_16(&src[src_index]); | |||
| count = AV_RL16(&src[src_index]); | |||
| src_index += 2; | |||
| color = src[src_index++]; | |||
| vqa_debug("(2) set %X bytes to %02X\n", count, color); | |||
| @@ -256,7 +256,7 @@ static void decode_format80(unsigned char *src, int src_size, | |||
| } else if ((src[src_index] & 0xC0) == 0xC0) { | |||
| count = (src[src_index++] & 0x3F) + 3; | |||
| src_pos = LE_16(&src[src_index]); | |||
| src_pos = AV_RL16(&src[src_index]); | |||
| src_index += 2; | |||
| vqa_debug("(3) copy %X bytes from absolute pos %X\n", count, src_pos); | |||
| CHECK_COUNT(); | |||
| @@ -276,7 +276,7 @@ static void decode_format80(unsigned char *src, int src_size, | |||
| } else { | |||
| count = ((src[src_index] & 0x70) >> 4) + 3; | |||
| src_pos = BE_16(&src[src_index]) & 0x0FFF; | |||
| src_pos = AV_RB16(&src[src_index]) & 0x0FFF; | |||
| src_index += 2; | |||
| vqa_debug("(5) copy %X bytes from relpos %X\n", count, src_pos); | |||
| CHECK_COUNT(); | |||
| @@ -326,8 +326,8 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| /* first, traverse through the frame and find the subchunks */ | |||
| while (index < s->size) { | |||
| chunk_type = BE_32(&s->buf[index]); | |||
| chunk_size = BE_32(&s->buf[index + 4]); | |||
| chunk_type = AV_RB32(&s->buf[index]); | |||
| chunk_size = AV_RB32(&s->buf[index + 4]); | |||
| switch (chunk_type) { | |||
| @@ -391,7 +391,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| /* convert the RGB palette into the machine's endian format */ | |||
| if (cpl0_chunk != -1) { | |||
| chunk_size = BE_32(&s->buf[cpl0_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[cpl0_chunk + 4]); | |||
| /* sanity check the palette size */ | |||
| if (chunk_size / 3 > 256) { | |||
| av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found a palette chunk with %d colors\n", | |||
| @@ -419,7 +419,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| /* decompress the full codebook chunk */ | |||
| if (cbfz_chunk != -1) { | |||
| chunk_size = BE_32(&s->buf[cbfz_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]); | |||
| cbfz_chunk += CHUNK_PREAMBLE_SIZE; | |||
| decode_format80(&s->buf[cbfz_chunk], chunk_size, | |||
| s->codebook, s->codebook_size, 0); | |||
| @@ -428,7 +428,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| /* copy a full codebook */ | |||
| if (cbf0_chunk != -1) { | |||
| chunk_size = BE_32(&s->buf[cbf0_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[cbf0_chunk + 4]); | |||
| /* sanity check the full codebook size */ | |||
| if (chunk_size > MAX_CODEBOOK_SIZE) { | |||
| av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: CBF0 chunk too large (0x%X bytes)\n", | |||
| @@ -448,7 +448,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| return; | |||
| } | |||
| chunk_size = BE_32(&s->buf[vptz_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[vptz_chunk + 4]); | |||
| vptz_chunk += CHUNK_PREAMBLE_SIZE; | |||
| decode_format80(&s->buf[vptz_chunk], chunk_size, | |||
| s->decode_buffer, s->decode_buffer_size, 1); | |||
| @@ -522,7 +522,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| if (cbp0_chunk != -1) { | |||
| chunk_size = BE_32(&s->buf[cbp0_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[cbp0_chunk + 4]); | |||
| cbp0_chunk += CHUNK_PREAMBLE_SIZE; | |||
| /* accumulate partial codebook */ | |||
| @@ -545,7 +545,7 @@ static void vqa_decode_chunk(VqaContext *s) | |||
| if (cbpz_chunk != -1) { | |||
| chunk_size = BE_32(&s->buf[cbpz_chunk + 4]); | |||
| chunk_size = AV_RB32(&s->buf[cbpz_chunk + 4]); | |||
| cbpz_chunk += CHUNK_PREAMBLE_SIZE; | |||
| /* accumulate partial codebook */ | |||
| @@ -387,15 +387,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, | |||
| memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); | |||
| s->samples = LE_32(buf); buf += 4; | |||
| s->samples = AV_RL32(buf); buf += 4; | |||
| if(!s->samples) return buf_size; | |||
| /* should not happen but who knows */ | |||
| if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ | |||
| av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); | |||
| return -1; | |||
| } | |||
| s->joint = LE_32(buf) & WV_JOINT; buf += 4; | |||
| s->CRC = LE_32(buf); buf += 4; | |||
| s->joint = AV_RL32(buf) & WV_JOINT; buf += 4; | |||
| s->CRC = AV_RL32(buf); buf += 4; | |||
| // parse metadata blocks | |||
| while(buf < buf_end){ | |||
| id = *buf++; | |||
| @@ -467,23 +467,23 @@ static int wavpack_decode_frame(AVCodecContext *avctx, | |||
| t = 0; | |||
| for(i = s->terms - 1; (i >= 0) && (t < size); i--) { | |||
| if(s->decorr[i].value > 8){ | |||
| s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesA[1] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| if(s->stereo){ | |||
| s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[1] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| t += 4; | |||
| } | |||
| t += 4; | |||
| }else if(s->decorr[i].value < 0){ | |||
| s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| t += 4; | |||
| }else{ | |||
| for(j = 0; j < s->decorr[i].value; j++){ | |||
| s->decorr[i].samplesA[j] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| if(s->stereo){ | |||
| s->decorr[i].samplesB[j] = wp_exp2(LE_16(buf)); buf += 2; | |||
| s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; | |||
| } | |||
| } | |||
| t += s->decorr[i].value * 2 * avctx->channels; | |||
| @@ -498,7 +498,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, | |||
| continue; | |||
| } | |||
| for(i = 0; i < 3 * avctx->channels; i++){ | |||
| s->median[i] = wp_exp2(LE_16(buf)); | |||
| s->median[i] = wp_exp2(AV_RL16(buf)); | |||
| buf += 2; | |||
| } | |||
| got_entropy = 1; | |||
| @@ -57,9 +57,9 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, | |||
| if (!buf_size) | |||
| return 0; | |||
| out_size = LE_16(&buf[0]); | |||
| out_size = AV_RL16(&buf[0]); | |||
| *data_size = out_size * 2; | |||
| in_size = LE_16(&buf[2]); | |||
| in_size = AV_RL16(&buf[2]); | |||
| buf += 4; | |||
| if (in_size == out_size) { | |||
| @@ -296,10 +296,10 @@ static void xan_wc3_decode_frame(XanContext *s) { | |||
| unsigned char *vector_segment; | |||
| unsigned char *imagedata_segment; | |||
| huffman_segment = s->buf + LE_16(&s->buf[0]); | |||
| size_segment = s->buf + LE_16(&s->buf[2]); | |||
| vector_segment = s->buf + LE_16(&s->buf[4]); | |||
| imagedata_segment = s->buf + LE_16(&s->buf[6]); | |||
| huffman_segment = s->buf + AV_RL16(&s->buf[0]); | |||
| size_segment = s->buf + AV_RL16(&s->buf[2]); | |||
| vector_segment = s->buf + AV_RL16(&s->buf[4]); | |||
| imagedata_segment = s->buf + AV_RL16(&s->buf[6]); | |||
| xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size); | |||
| @@ -350,7 +350,7 @@ static void xan_wc3_decode_frame(XanContext *s) { | |||
| case 10: | |||
| case 20: | |||
| size = BE_16(&size_segment[0]); | |||
| size = AV_RB16(&size_segment[0]); | |||
| size_segment += 2; | |||
| break; | |||
| @@ -73,7 +73,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| for (j = 0; j < avctx->width; j += 4) { | |||
| /* value is stored in LE dword with word swapped */ | |||
| val = LE_32(buf); | |||
| val = AV_RL32(buf); | |||
| buf -= 4; | |||
| val = ((val >> 16) & 0xFFFF) | ((val & 0xFFFF) << 16); | |||
| @@ -545,7 +545,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| case ZMBV_FMT_15BPP: | |||
| for(j = 0; j < c->height; j++) { | |||
| for(i = 0; i < c->width; i++) { | |||
| uint16_t tmp = LE_16(src); | |||
| uint16_t tmp = AV_RL16(src); | |||
| src += 2; | |||
| out[i * 3 + 0] = (tmp & 0x7C00) >> 7; | |||
| out[i * 3 + 1] = (tmp & 0x03E0) >> 2; | |||
| @@ -557,7 +557,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| case ZMBV_FMT_16BPP: | |||
| for(j = 0; j < c->height; j++) { | |||
| for(i = 0; i < c->width; i++) { | |||
| uint16_t tmp = LE_16(src); | |||
| uint16_t tmp = AV_RL16(src); | |||
| src += 2; | |||
| out[i * 3 + 0] = (tmp & 0xF800) >> 8; | |||
| out[i * 3 + 1] = (tmp & 0x07E0) >> 3; | |||
| @@ -578,7 +578,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| case ZMBV_FMT_32BPP: | |||
| for(j = 0; j < c->height; j++) { | |||
| for(i = 0; i < c->width; i++) { | |||
| uint32_t tmp = LE_32(src); | |||
| uint32_t tmp = AV_RL32(src); | |||
| src += 4; | |||
| out[i * 3 + 0] = tmp >> 16; | |||
| out[i * 3 + 1] = tmp >> 8; | |||
| @@ -82,8 +82,8 @@ static int fourxm_probe(AVProbeData *p) | |||
| if (p->buf_size < 12) | |||
| return 0; | |||
| if ((LE_32(&p->buf[0]) != RIFF_TAG) || | |||
| (LE_32(&p->buf[8]) != _4XMV_TAG)) | |||
| if ((AV_RL32(&p->buf[0]) != RIFF_TAG) || | |||
| (AV_RL32(&p->buf[8]) != _4XMV_TAG)) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -125,19 +125,19 @@ static int fourxm_read_header(AVFormatContext *s, | |||
| /* take the lazy approach and search for any and all vtrk and strk chunks */ | |||
| for (i = 0; i < header_size - 8; i++) { | |||
| fourcc_tag = LE_32(&header[i]); | |||
| size = LE_32(&header[i + 4]); | |||
| fourcc_tag = AV_RL32(&header[i]); | |||
| size = AV_RL32(&header[i + 4]); | |||
| if (fourcc_tag == std__TAG) { | |||
| fourxm->fps = av_int2flt(LE_32(&header[i + 12])); | |||
| fourxm->fps = av_int2flt(AV_RL32(&header[i + 12])); | |||
| } else if (fourcc_tag == vtrk_TAG) { | |||
| /* check that there is enough data */ | |||
| if (size != vtrk_SIZE) { | |||
| av_free(header); | |||
| return AVERROR_INVALIDDATA; | |||
| } | |||
| fourxm->width = LE_32(&header[i + 36]); | |||
| fourxm->height = LE_32(&header[i + 40]); | |||
| fourxm->width = AV_RL32(&header[i + 36]); | |||
| fourxm->height = AV_RL32(&header[i + 40]); | |||
| i += 8 + size; | |||
| /* allocate a new AVStream */ | |||
| @@ -160,7 +160,7 @@ static int fourxm_read_header(AVFormatContext *s, | |||
| av_free(header); | |||
| return AVERROR_INVALIDDATA; | |||
| } | |||
| current_track = LE_32(&header[i + 8]); | |||
| current_track = AV_RL32(&header[i + 8]); | |||
| if (current_track + 1 > fourxm->track_count) { | |||
| fourxm->track_count = current_track + 1; | |||
| if((unsigned)fourxm->track_count >= UINT_MAX / sizeof(AudioTrack)) | |||
| @@ -172,10 +172,10 @@ static int fourxm_read_header(AVFormatContext *s, | |||
| return AVERROR_NOMEM; | |||
| } | |||
| } | |||
| fourxm->tracks[current_track].adpcm = LE_32(&header[i + 12]); | |||
| fourxm->tracks[current_track].channels = LE_32(&header[i + 36]); | |||
| fourxm->tracks[current_track].sample_rate = LE_32(&header[i + 40]); | |||
| fourxm->tracks[current_track].bits = LE_32(&header[i + 44]); | |||
| fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]); | |||
| fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]); | |||
| fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]); | |||
| fourxm->tracks[current_track].bits = AV_RL32(&header[i + 44]); | |||
| i += 8 + size; | |||
| /* allocate a new AVStream */ | |||
| @@ -235,8 +235,8 @@ static int fourxm_read_packet(AVFormatContext *s, | |||
| if ((ret = get_buffer(&s->pb, header, 8)) < 0) | |||
| return ret; | |||
| fourcc_tag = LE_32(&header[0]); | |||
| size = LE_32(&header[4]); | |||
| fourcc_tag = AV_RL32(&header[0]); | |||
| size = AV_RL32(&header[4]); | |||
| if (url_feof(pb)) | |||
| return AVERROR_IO; | |||
| switch (fourcc_tag) { | |||
| @@ -62,11 +62,11 @@ static int cin_probe(AVProbeData *p) | |||
| return 0; | |||
| /* header starts with this special marker */ | |||
| if (LE_32(&p->buf[0]) != 0x55AA0000) | |||
| if (AV_RL32(&p->buf[0]) != 0x55AA0000) | |||
| return 0; | |||
| /* for accuracy, check some header field values */ | |||
| if (LE_32(&p->buf[12]) != 22050 || p->buf[16] != 16 || p->buf[17] != 0) | |||
| if (AV_RL32(&p->buf[12]) != 22050 || p->buf[16] != 16 || p->buf[17] != 0) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -168,7 +168,7 @@ static int ea_probe(AVProbeData *p) | |||
| if (p->buf_size < 4) | |||
| return 0; | |||
| if (LE_32(&p->buf[0]) != SCHl_TAG) | |||
| if (AV_RL32(&p->buf[0]) != SCHl_TAG) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -230,8 +230,8 @@ static int ea_read_packet(AVFormatContext *s, | |||
| if (get_buffer(pb, preamble, EA_PREAMBLE_SIZE) != EA_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| chunk_type = LE_32(&preamble[0]); | |||
| chunk_size = LE_32(&preamble[4]) - EA_PREAMBLE_SIZE; | |||
| chunk_type = AV_RL32(&preamble[0]); | |||
| chunk_size = AV_RL32(&preamble[4]) - EA_PREAMBLE_SIZE; | |||
| switch (chunk_type) { | |||
| /* audio data */ | |||
| @@ -58,7 +58,7 @@ static int flic_probe(AVProbeData *p) | |||
| if (p->buf_size < 6) | |||
| return 0; | |||
| magic_number = LE_16(&p->buf[4]); | |||
| magic_number = AV_RL16(&p->buf[4]); | |||
| if ((magic_number != FLIC_FILE_MAGIC_1) && | |||
| (magic_number != FLIC_FILE_MAGIC_2) && | |||
| (magic_number != FLIC_FILE_MAGIC_3)) | |||
| @@ -83,8 +83,8 @@ static int flic_read_header(AVFormatContext *s, | |||
| if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) | |||
| return AVERROR_IO; | |||
| magic_number = LE_16(&header[4]); | |||
| speed = LE_32(&header[0x10]); | |||
| magic_number = AV_RL16(&header[4]); | |||
| speed = AV_RL32(&header[0x10]); | |||
| /* initialize the decoder streams */ | |||
| st = av_new_stream(s, 0); | |||
| @@ -94,8 +94,8 @@ static int flic_read_header(AVFormatContext *s, | |||
| st->codec->codec_type = CODEC_TYPE_VIDEO; | |||
| st->codec->codec_id = CODEC_ID_FLIC; | |||
| st->codec->codec_tag = 0; /* no fourcc */ | |||
| st->codec->width = LE_16(&header[0x08]); | |||
| st->codec->height = LE_16(&header[0x0A]); | |||
| st->codec->width = AV_RL16(&header[0x08]); | |||
| st->codec->height = AV_RL16(&header[0x0A]); | |||
| if (!st->codec->width || !st->codec->height) | |||
| return AVERROR_INVALIDDATA; | |||
| @@ -110,7 +110,7 @@ static int flic_read_header(AVFormatContext *s, | |||
| /* Time to figure out the framerate: If there is a FLIC chunk magic | |||
| * number at offset 0x10, assume this is from the Bullfrog game, | |||
| * Magic Carpet. */ | |||
| if (LE_16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) { | |||
| if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) { | |||
| flic->frame_pts_inc = FLIC_MC_PTS_INC; | |||
| @@ -174,8 +174,8 @@ static int flic_read_packet(AVFormatContext *s, | |||
| break; | |||
| } | |||
| size = LE_32(&preamble[0]); | |||
| magic = LE_16(&preamble[4]); | |||
| size = AV_RL32(&preamble[0]); | |||
| magic = AV_RL16(&preamble[4]); | |||
| if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) { | |||
| if (av_new_packet(pkt, size)) { | |||
| @@ -109,27 +109,27 @@ static int idcin_probe(AVProbeData *p) | |||
| return 0; | |||
| /* check the video width */ | |||
| number = LE_32(&p->buf[0]); | |||
| number = AV_RL32(&p->buf[0]); | |||
| if ((number == 0) || (number > 1024)) | |||
| return 0; | |||
| /* check the video height */ | |||
| number = LE_32(&p->buf[4]); | |||
| number = AV_RL32(&p->buf[4]); | |||
| if ((number == 0) || (number > 1024)) | |||
| return 0; | |||
| /* check the audio sample rate */ | |||
| number = LE_32(&p->buf[8]); | |||
| number = AV_RL32(&p->buf[8]); | |||
| if ((number != 0) && ((number < 8000) | (number > 48000))) | |||
| return 0; | |||
| /* check the audio bytes/sample */ | |||
| number = LE_32(&p->buf[12]); | |||
| number = AV_RL32(&p->buf[12]); | |||
| if (number > 2) | |||
| return 0; | |||
| /* check the audio channels */ | |||
| number = LE_32(&p->buf[16]); | |||
| number = AV_RL32(&p->buf[16]); | |||
| if (number > 2) | |||
| return 0; | |||
| @@ -61,8 +61,8 @@ static int roq_probe(AVProbeData *p) | |||
| if (p->buf_size < 6) | |||
| return 0; | |||
| if ((LE_16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || | |||
| (LE_32(&p->buf[2]) != 0xFFFFFFFF)) | |||
| if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || | |||
| (AV_RL32(&p->buf[2]) != 0xFFFFFFFF)) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -83,7 +83,7 @@ static int roq_read_header(AVFormatContext *s, | |||
| if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != | |||
| RoQ_CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| roq->framerate = LE_16(&preamble[6]); | |||
| roq->framerate = AV_RL16(&preamble[6]); | |||
| roq->frame_pts_inc = 90000 / roq->framerate; | |||
| /* init private context parameters */ | |||
| @@ -96,8 +96,8 @@ static int roq_read_header(AVFormatContext *s, | |||
| RoQ_CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| chunk_type = LE_16(&preamble[0]); | |||
| chunk_size = LE_32(&preamble[2]); | |||
| chunk_type = AV_RL16(&preamble[0]); | |||
| chunk_size = AV_RL32(&preamble[2]); | |||
| switch (chunk_type) { | |||
| @@ -106,8 +106,8 @@ static int roq_read_header(AVFormatContext *s, | |||
| if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != | |||
| RoQ_CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| roq->width = LE_16(&preamble[0]); | |||
| roq->height = LE_16(&preamble[2]); | |||
| roq->width = AV_RL16(&preamble[0]); | |||
| roq->height = AV_RL16(&preamble[2]); | |||
| break; | |||
| case RoQ_QUAD_CODEBOOK: | |||
| @@ -127,7 +127,7 @@ static int roq_read_header(AVFormatContext *s, | |||
| break; | |||
| default: | |||
| av_log(s, AV_LOG_ERROR, " unknown RoQ chunk type (%04X)\n", LE_16(&preamble[0])); | |||
| av_log(s, AV_LOG_ERROR, " unknown RoQ chunk type (%04X)\n", AV_RL16(&preamble[0])); | |||
| return AVERROR_INVALIDDATA; | |||
| break; | |||
| } | |||
| @@ -196,8 +196,8 @@ static int roq_read_packet(AVFormatContext *s, | |||
| RoQ_CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| chunk_type = LE_16(&preamble[0]); | |||
| chunk_size = LE_32(&preamble[2]); | |||
| chunk_type = AV_RL16(&preamble[0]); | |||
| chunk_size = AV_RL32(&preamble[2]); | |||
| if(chunk_size > INT_MAX) | |||
| return AVERROR_INVALIDDATA; | |||
| @@ -216,7 +216,7 @@ static int roq_read_packet(AVFormatContext *s, | |||
| if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != | |||
| RoQ_CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + | |||
| chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + | |||
| codebook_size; | |||
| /* rewind */ | |||
| @@ -236,8 +236,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != | |||
| CHUNK_PREAMBLE_SIZE) | |||
| return CHUNK_BAD; | |||
| chunk_size = LE_16(&chunk_preamble[0]); | |||
| chunk_type = LE_16(&chunk_preamble[2]); | |||
| chunk_size = AV_RL16(&chunk_preamble[0]); | |||
| chunk_type = AV_RL16(&chunk_preamble[2]); | |||
| debug_ipmovie("chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size); | |||
| @@ -287,7 +287,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| break; | |||
| } | |||
| opcode_size = LE_16(&opcode_preamble[0]); | |||
| opcode_size = AV_RL16(&opcode_preamble[0]); | |||
| opcode_type = opcode_preamble[2]; | |||
| opcode_version = opcode_preamble[3]; | |||
| @@ -325,10 +325,10 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| chunk_type = CHUNK_BAD; | |||
| break; | |||
| } | |||
| s->fps = 1000000.0 / (LE_32(&scratch[0]) * LE_16(&scratch[4])); | |||
| s->fps = 1000000.0 / (AV_RL32(&scratch[0]) * AV_RL16(&scratch[4])); | |||
| s->frame_pts_inc = 90000 / s->fps; | |||
| debug_ipmovie(" %.2f frames/second (timer div = %d, subdiv = %d)\n", | |||
| s->fps, LE_32(&scratch[0]), LE_16(&scratch[4])); | |||
| s->fps, AV_RL32(&scratch[0]), AV_RL16(&scratch[4])); | |||
| break; | |||
| case OPCODE_INIT_AUDIO_BUFFERS: | |||
| @@ -343,8 +343,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| chunk_type = CHUNK_BAD; | |||
| break; | |||
| } | |||
| s->audio_sample_rate = LE_16(&scratch[4]); | |||
| audio_flags = LE_16(&scratch[2]); | |||
| s->audio_sample_rate = AV_RL16(&scratch[4]); | |||
| audio_flags = AV_RL16(&scratch[2]); | |||
| /* bit 0 of the flags: 0 = mono, 1 = stereo */ | |||
| s->audio_channels = (audio_flags & 1) + 1; | |||
| /* bit 1 of the flags: 0 = 8 bit, 1 = 16 bit */ | |||
| @@ -381,8 +381,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| chunk_type = CHUNK_BAD; | |||
| break; | |||
| } | |||
| s->video_width = LE_16(&scratch[0]) * 8; | |||
| s->video_height = LE_16(&scratch[2]) * 8; | |||
| s->video_width = AV_RL16(&scratch[0]) * 8; | |||
| s->video_height = AV_RL16(&scratch[2]) * 8; | |||
| debug_ipmovie("video resolution: %d x %d\n", | |||
| s->video_width, s->video_height); | |||
| break; | |||
| @@ -442,8 +442,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, | |||
| } | |||
| /* load the palette into internal data structure */ | |||
| first_color = LE_16(&scratch[0]); | |||
| last_color = first_color + LE_16(&scratch[2]) - 1; | |||
| first_color = AV_RL16(&scratch[0]); | |||
| last_color = first_color + AV_RL16(&scratch[2]) - 1; | |||
| /* sanity check (since they are 16 bit values) */ | |||
| if ((first_color > 0xFF) || (last_color > 0xFF)) { | |||
| debug_ipmovie("demux_ipmovie: set_palette indices out of range (%d -> %d)\n", | |||
| @@ -542,7 +542,7 @@ static int ipmovie_read_header(AVFormatContext *s, | |||
| if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != | |||
| CHUNK_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| chunk_type = LE_16(&chunk_preamble[2]); | |||
| chunk_type = AV_RL16(&chunk_preamble[2]); | |||
| url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); | |||
| if (chunk_type == CHUNK_VIDEO) | |||
| @@ -2372,7 +2372,7 @@ matroska_find_track_by_num (MatroskaDemuxContext *matroska, | |||
| static inline int | |||
| rv_offset(uint8_t *data, int slice, int slices) | |||
| { | |||
| return LE_32(data+8*slice+4) + 8*slices; | |||
| return AV_RL32(data+8*slice+4) + 8*slices; | |||
| } | |||
| static int | |||
| @@ -61,9 +61,9 @@ static int mm_probe(AVProbeData *p) | |||
| /* the first chunk is always the header */ | |||
| if (p->buf_size < MM_PREAMBLE_SIZE) | |||
| return 0; | |||
| if (LE_16(&p->buf[0]) != MM_TYPE_HEADER) | |||
| if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER) | |||
| return 0; | |||
| if (LE_32(&p->buf[2]) != MM_HEADER_LEN_V && LE_32(&p->buf[2]) != MM_HEADER_LEN_AV) | |||
| if (AV_RL32(&p->buf[2]) != MM_HEADER_LEN_V && AV_RL32(&p->buf[2]) != MM_HEADER_LEN_AV) | |||
| return 0; | |||
| /* only return half certainty since this check is a bit sketchy */ | |||
| @@ -141,8 +141,8 @@ static int mm_read_packet(AVFormatContext *s, | |||
| return AVERROR_IO; | |||
| } | |||
| type = LE_16(&preamble[0]); | |||
| length = LE_16(&preamble[2]); | |||
| type = AV_RL16(&preamble[0]); | |||
| length = AV_RL16(&preamble[2]); | |||
| switch(type) { | |||
| case MM_TYPE_PALETTE : | |||
| @@ -1447,7 +1447,7 @@ static int mov_probe(AVProbeData *p) | |||
| /* ignore invalid offset */ | |||
| if ((offset + 8) > (unsigned int)p->buf_size) | |||
| return score; | |||
| tag = LE_32(p->buf + offset + 4); | |||
| tag = AV_RL32(p->buf + offset + 4); | |||
| switch(tag) { | |||
| /* check for obvious tags */ | |||
| case MKTAG( 'j', 'P', ' ', ' ' ): /* jpeg 2000 signature */ | |||
| @@ -1465,7 +1465,7 @@ static int mov_probe(AVProbeData *p) | |||
| case MKTAG( 'f', 't', 'y', 'p' ): | |||
| case MKTAG( 's', 'k', 'i', 'p' ): | |||
| case MKTAG( 'u', 'u', 'i', 'd' ): | |||
| offset = BE_32(p->buf+offset) + offset; | |||
| offset = AV_RB32(p->buf+offset) + offset; | |||
| /* if we only find those cause probedata is too small at least rate them */ | |||
| score = AVPROBE_SCORE_MAX - 50; | |||
| break; | |||
| @@ -480,7 +480,7 @@ static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) | |||
| put_tag(pb, "avcC"); | |||
| if (track->vosLen > 6) { | |||
| /* check for h264 start code */ | |||
| if (BE_32(track->vosData) == 0x00000001) { | |||
| if (AV_RB32(track->vosData) == 0x00000001) { | |||
| uint8_t *buf, *end; | |||
| uint32_t sps_size=0, pps_size=0; | |||
| uint8_t *sps=0, *pps=0; | |||
| @@ -493,7 +493,7 @@ static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) | |||
| while (buf < end) { | |||
| unsigned int size; | |||
| uint8_t nal_type; | |||
| size = BE_32(buf); | |||
| size = AV_RB32(buf); | |||
| nal_type = buf[4] & 0x1f; | |||
| if (nal_type == 7) { /* SPS */ | |||
| sps = buf + 4; | |||
| @@ -190,7 +190,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { | |||
| if (ret <= 0) | |||
| return ret ? ret : -1; | |||
| frametype = hdr[0]; | |||
| size = PKTSIZE(LE_32(&hdr[8])); | |||
| size = PKTSIZE(AV_RL32(&hdr[8])); | |||
| switch (frametype) { | |||
| case NUV_VIDEO: | |||
| case NUV_EXTRADATA: | |||
| @@ -203,7 +203,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { | |||
| if (ret < 0) | |||
| return ret; | |||
| pkt->pos = url_ftell(pb); | |||
| pkt->pts = LE_32(&hdr[4]); | |||
| pkt->pts = AV_RL32(&hdr[4]); | |||
| pkt->stream_index = ctx->v_id; | |||
| memcpy(pkt->data, hdr, HDRSIZE); | |||
| ret = get_buffer(pb, pkt->data + HDRSIZE, size); | |||
| @@ -215,7 +215,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { | |||
| break; | |||
| } | |||
| ret = av_get_packet(pb, pkt, size); | |||
| pkt->pts = LE_32(&hdr[4]); | |||
| pkt->pts = AV_RL32(&hdr[4]); | |||
| pkt->stream_index = ctx->a_id; | |||
| return ret; | |||
| case NUV_SEEKP: | |||
| @@ -92,8 +92,8 @@ static int str_probe(AVProbeData *p) | |||
| if (p->buf_size < 0x38) | |||
| return 0; | |||
| if ((LE_32(&p->buf[0]) == RIFF_TAG) && | |||
| (LE_32(&p->buf[8]) == CDXA_TAG)) { | |||
| if ((AV_RL32(&p->buf[0]) == RIFF_TAG) && | |||
| (AV_RL32(&p->buf[8]) == CDXA_TAG)) { | |||
| /* RIFF header seen; skip 0x2C bytes */ | |||
| start = RIFF_HEADER_SIZE; | |||
| @@ -143,7 +143,7 @@ static int str_read_header(AVFormatContext *s, | |||
| /* skip over any RIFF header */ | |||
| if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) | |||
| return AVERROR_IO; | |||
| if (LE_32(§or[0]) == RIFF_TAG) | |||
| if (AV_RL32(§or[0]) == RIFF_TAG) | |||
| start = RIFF_HEADER_SIZE; | |||
| else | |||
| start = 0; | |||
| @@ -168,12 +168,12 @@ static int str_read_header(AVFormatContext *s, | |||
| /* check if this channel gets to be the dominant video channel */ | |||
| if (str->video_channel == -1) { | |||
| /* qualify the magic number */ | |||
| if (LE_32(§or[0x18]) != STR_MAGIC) | |||
| if (AV_RL32(§or[0x18]) != STR_MAGIC) | |||
| break; | |||
| str->video_channel = channel; | |||
| str->channels[channel].type = STR_VIDEO; | |||
| str->channels[channel].width = LE_16(§or[0x28]); | |||
| str->channels[channel].height = LE_16(§or[0x2A]); | |||
| str->channels[channel].width = AV_RL16(§or[0x28]); | |||
| str->channels[channel].height = AV_RL16(§or[0x2A]); | |||
| /* allocate a new AVStream */ | |||
| st = av_new_stream(s, 0); | |||
| @@ -273,9 +273,9 @@ static int str_read_packet(AVFormatContext *s, | |||
| /* check if this the video channel we care about */ | |||
| if (channel == str->video_channel) { | |||
| int current_sector = LE_16(§or[0x1C]); | |||
| int sector_count = LE_16(§or[0x1E]); | |||
| int frame_size = LE_32(§or[0x24]); | |||
| int current_sector = AV_RL16(§or[0x1C]); | |||
| int sector_count = AV_RL16(§or[0x1E]); | |||
| int frame_size = AV_RL32(§or[0x24]); | |||
| int bytes_to_copy; | |||
| // printf("%d %d %d\n",current_sector,sector_count,frame_size); | |||
| /* if this is the first sector of the frame, allocate a pkt */ | |||
| @@ -504,7 +504,7 @@ static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf) | |||
| /* decode the first 2 bytes where are stored the AUHeader sections | |||
| length in bits */ | |||
| au_headers_length = BE_16(buf); | |||
| au_headers_length = AV_RB16(buf); | |||
| if (au_headers_length > RTP_MAX_PACKET_LENGTH) | |||
| return -1; | |||
| @@ -209,7 +209,7 @@ static int h264_handle_packet(RTPDemuxContext * s, | |||
| int src_len= len; | |||
| do { | |||
| uint16_t nal_size = BE_16(src); // this going to be a problem if unaligned (can it be?) | |||
| uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?) | |||
| // consume the length of the aggregate... | |||
| src += 2; | |||
| @@ -69,7 +69,7 @@ static int film_probe(AVProbeData *p) | |||
| if (p->buf_size < 4) | |||
| return 0; | |||
| if (BE_32(&p->buf[0]) != FILM_TAG) | |||
| if (AV_RB32(&p->buf[0]) != FILM_TAG) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -93,8 +93,8 @@ static int film_read_header(AVFormatContext *s, | |||
| /* load the main FILM header */ | |||
| if (get_buffer(pb, scratch, 16) != 16) | |||
| return AVERROR_IO; | |||
| data_offset = BE_32(&scratch[4]); | |||
| film->version = BE_32(&scratch[8]); | |||
| data_offset = AV_RB32(&scratch[4]); | |||
| film->version = AV_RB32(&scratch[8]); | |||
| /* load the FDSC chunk */ | |||
| if (film->version == 0) { | |||
| @@ -110,7 +110,7 @@ static int film_read_header(AVFormatContext *s, | |||
| /* normal Saturn .cpk files; 32-byte header */ | |||
| if (get_buffer(pb, scratch, 32) != 32) | |||
| return AVERROR_IO; | |||
| film->audio_samplerate = BE_16(&scratch[24]);; | |||
| film->audio_samplerate = AV_RB16(&scratch[24]);; | |||
| film->audio_channels = scratch[21]; | |||
| film->audio_bits = scratch[22]; | |||
| if (film->audio_bits == 8) | |||
| @@ -121,10 +121,10 @@ static int film_read_header(AVFormatContext *s, | |||
| film->audio_type = 0; | |||
| } | |||
| if (BE_32(&scratch[0]) != FDSC_TAG) | |||
| if (AV_RB32(&scratch[0]) != FDSC_TAG) | |||
| return AVERROR_INVALIDDATA; | |||
| if (BE_32(&scratch[8]) == CVID_TAG) { | |||
| if (AV_RB32(&scratch[8]) == CVID_TAG) { | |||
| film->video_type = CODEC_ID_CINEPAK; | |||
| } else | |||
| film->video_type = 0; | |||
| @@ -138,8 +138,8 @@ static int film_read_header(AVFormatContext *s, | |||
| st->codec->codec_type = CODEC_TYPE_VIDEO; | |||
| st->codec->codec_id = film->video_type; | |||
| st->codec->codec_tag = 0; /* no fourcc */ | |||
| st->codec->width = BE_32(&scratch[16]); | |||
| st->codec->height = BE_32(&scratch[12]); | |||
| st->codec->width = AV_RB32(&scratch[16]); | |||
| st->codec->height = AV_RB32(&scratch[12]); | |||
| } | |||
| if (film->audio_type) { | |||
| @@ -162,10 +162,10 @@ static int film_read_header(AVFormatContext *s, | |||
| /* load the sample table */ | |||
| if (get_buffer(pb, scratch, 16) != 16) | |||
| return AVERROR_IO; | |||
| if (BE_32(&scratch[0]) != STAB_TAG) | |||
| if (AV_RB32(&scratch[0]) != STAB_TAG) | |||
| return AVERROR_INVALIDDATA; | |||
| film->base_clock = BE_32(&scratch[8]); | |||
| film->sample_count = BE_32(&scratch[12]); | |||
| film->base_clock = AV_RB32(&scratch[8]); | |||
| film->sample_count = AV_RB32(&scratch[12]); | |||
| if(film->sample_count >= UINT_MAX / sizeof(film_sample_t)) | |||
| return -1; | |||
| film->sample_table = av_malloc(film->sample_count * sizeof(film_sample_t)); | |||
| @@ -181,9 +181,9 @@ static int film_read_header(AVFormatContext *s, | |||
| return AVERROR_IO; | |||
| } | |||
| film->sample_table[i].sample_offset = | |||
| data_offset + BE_32(&scratch[0]); | |||
| film->sample_table[i].sample_size = BE_32(&scratch[4]); | |||
| if (BE_32(&scratch[8]) == 0xFFFFFFFF) { | |||
| data_offset + AV_RB32(&scratch[0]); | |||
| film->sample_table[i].sample_size = AV_RB32(&scratch[4]); | |||
| if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) { | |||
| film->sample_table[i].stream = film->audio_stream_index; | |||
| film->sample_table[i].pts = audio_frame_counter; | |||
| film->sample_table[i].pts *= film->base_clock; | |||
| @@ -193,7 +193,7 @@ static int film_read_header(AVFormatContext *s, | |||
| (film->audio_channels * film->audio_bits / 8)); | |||
| } else { | |||
| film->sample_table[i].stream = film->video_stream_index; | |||
| film->sample_table[i].pts = BE_32(&scratch[8]) & 0x7FFFFFFF; | |||
| film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF; | |||
| film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1; | |||
| } | |||
| } | |||
| @@ -50,7 +50,7 @@ typedef struct SGIInfo{ | |||
| static int sgi_probe(AVProbeData *pd) | |||
| { | |||
| /* test for sgi magic */ | |||
| if (pd->buf_size >= 2 && BE_16(&pd->buf[0]) == SGI_MAGIC) { | |||
| if (pd->buf_size >= 2 && AV_RB16(&pd->buf[0]) == SGI_MAGIC) { | |||
| return AVPROBE_SCORE_MAX; | |||
| } else { | |||
| return 0; | |||
| @@ -197,7 +197,7 @@ static int read_rle_sgi(const SGIInfo *sgi_info, | |||
| for (y = 0; y < ysize; y++) { | |||
| dest_row = pict->data[0] + (ysize - 1 - y) * (xsize * zsize); | |||
| start_offset = BE_32(&start_table[y + z * ysize]); | |||
| start_offset = AV_RB32(&start_table[y + z * ysize]); | |||
| /* don't seek if already at the next rle start offset */ | |||
| if (url_ftell(f) != start_offset) { | |||
| @@ -64,7 +64,7 @@ static int vmd_probe(AVProbeData *p) | |||
| /* check if the first 2 bytes of the file contain the appropriate size | |||
| * of a VMD header chunk */ | |||
| if (LE_16(&p->buf[0]) != VMD_HEADER_SIZE - 2) | |||
| if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2) | |||
| return 0; | |||
| /* only return half certainty since this check is a bit sketchy */ | |||
| @@ -103,14 +103,14 @@ static int vmd_read_header(AVFormatContext *s, | |||
| vst->codec->codec_type = CODEC_TYPE_VIDEO; | |||
| vst->codec->codec_id = CODEC_ID_VMDVIDEO; | |||
| vst->codec->codec_tag = 0; /* no fourcc */ | |||
| vst->codec->width = LE_16(&vmd->vmd_header[12]); | |||
| vst->codec->height = LE_16(&vmd->vmd_header[14]); | |||
| vst->codec->width = AV_RL16(&vmd->vmd_header[12]); | |||
| vst->codec->height = AV_RL16(&vmd->vmd_header[14]); | |||
| vst->codec->extradata_size = VMD_HEADER_SIZE; | |||
| vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| memcpy(vst->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE); | |||
| /* if sample rate is 0, assume no audio */ | |||
| vmd->sample_rate = LE_16(&vmd->vmd_header[804]); | |||
| vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]); | |||
| if (vmd->sample_rate) { | |||
| st = av_new_stream(s, 0); | |||
| if (!st) | |||
| @@ -121,7 +121,7 @@ static int vmd_read_header(AVFormatContext *s, | |||
| st->codec->codec_tag = 0; /* no fourcc */ | |||
| st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1; | |||
| st->codec->sample_rate = vmd->sample_rate; | |||
| st->codec->block_align = LE_16(&vmd->vmd_header[806]); | |||
| st->codec->block_align = AV_RL16(&vmd->vmd_header[806]); | |||
| if (st->codec->block_align & 0x8000) { | |||
| st->codec->bits_per_sample = 16; | |||
| st->codec->block_align = -(st->codec->block_align - 0x10000); | |||
| @@ -140,14 +140,14 @@ static int vmd_read_header(AVFormatContext *s, | |||
| pts_inc = num; | |||
| } | |||
| toc_offset = LE_32(&vmd->vmd_header[812]); | |||
| vmd->frame_count = LE_16(&vmd->vmd_header[6]); | |||
| vmd->frames_per_block = LE_16(&vmd->vmd_header[18]); | |||
| toc_offset = AV_RL32(&vmd->vmd_header[812]); | |||
| vmd->frame_count = AV_RL16(&vmd->vmd_header[6]); | |||
| vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]); | |||
| url_fseek(pb, toc_offset, SEEK_SET); | |||
| raw_frame_table = NULL; | |||
| vmd->frame_table = NULL; | |||
| sound_buffers = LE_16(&vmd->vmd_header[808]); | |||
| sound_buffers = AV_RL16(&vmd->vmd_header[808]); | |||
| raw_frame_table_size = vmd->frame_count * 6; | |||
| raw_frame_table = av_malloc(raw_frame_table_size); | |||
| if(vmd->frame_count * vmd->frames_per_block >= UINT_MAX / sizeof(vmd_frame_t)){ | |||
| @@ -170,7 +170,7 @@ static int vmd_read_header(AVFormatContext *s, | |||
| total_frames = 0; | |||
| for (i = 0; i < vmd->frame_count; i++) { | |||
| current_offset = LE_32(&raw_frame_table[6 * i + 2]); | |||
| current_offset = AV_RL32(&raw_frame_table[6 * i + 2]); | |||
| /* handle each entry in index block */ | |||
| for (j = 0; j < vmd->frames_per_block; j++) { | |||
| @@ -179,7 +179,7 @@ static int vmd_read_header(AVFormatContext *s, | |||
| get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD); | |||
| type = chunk[0]; | |||
| size = LE_32(&chunk[2]); | |||
| size = AV_RL32(&chunk[2]); | |||
| if(!size) | |||
| continue; | |||
| switch(type) { | |||
| @@ -311,7 +311,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) | |||
| pkt->size = smk->buf_sizes[smk->curstream]; | |||
| pkt->stream_index = smk->stream_id[smk->curstream]; | |||
| pkt->pts = smk->aud_pts[smk->curstream]; | |||
| smk->aud_pts[smk->curstream] += LE_32(pkt->data); | |||
| smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); | |||
| smk->curstream--; | |||
| } | |||
| @@ -878,7 +878,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) | |||
| get_le16(pb); /* BITMAP_ID */ | |||
| av_new_packet(pkt, len-2); | |||
| get_buffer(pb, pkt->data, 4); | |||
| if (BE_32(pkt->data) == 0xffd8ffd9) { | |||
| if (AV_RB32(pkt->data) == 0xffd8ffd9) { | |||
| /* old SWF files containing SOI/EOI as data start */ | |||
| pkt->size -= 4; | |||
| get_buffer(pb, pkt->data, pkt->size); | |||
| @@ -115,8 +115,8 @@ static int wc3_probe(AVProbeData *p) | |||
| if (p->buf_size < 12) | |||
| return 0; | |||
| if ((LE_32(&p->buf[0]) != FORM_TAG) || | |||
| (LE_32(&p->buf[8]) != MOVE_TAG)) | |||
| if ((AV_RL32(&p->buf[0]) != FORM_TAG) || | |||
| (AV_RL32(&p->buf[8]) != MOVE_TAG)) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -153,8 +153,8 @@ static int wc3_read_header(AVFormatContext *s, | |||
| if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != | |||
| WC3_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| fourcc_tag = LE_32(&preamble[0]); | |||
| size = (BE_32(&preamble[4]) + 1) & (~1); | |||
| fourcc_tag = AV_RL32(&preamble[0]); | |||
| size = (AV_RB32(&preamble[4]) + 1) & (~1); | |||
| do { | |||
| switch (fourcc_tag) { | |||
| @@ -170,7 +170,7 @@ static int wc3_read_header(AVFormatContext *s, | |||
| url_fseek(pb, 8, SEEK_CUR); | |||
| if ((ret = get_buffer(pb, preamble, 4)) != 4) | |||
| return AVERROR_IO; | |||
| wc3->palette_count = LE_32(&preamble[0]); | |||
| wc3->palette_count = AV_RL32(&preamble[0]); | |||
| if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ | |||
| wc3->palette_count= 0; | |||
| return -1; | |||
| @@ -193,8 +193,8 @@ static int wc3_read_header(AVFormatContext *s, | |||
| if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != | |||
| WC3_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| wc3->width = LE_32(&preamble[0]); | |||
| wc3->height = LE_32(&preamble[4]); | |||
| wc3->width = AV_RL32(&preamble[0]); | |||
| wc3->height = AV_RL32(&preamble[4]); | |||
| break; | |||
| case PALT_TAG: | |||
| @@ -229,9 +229,9 @@ static int wc3_read_header(AVFormatContext *s, | |||
| if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != | |||
| WC3_PREAMBLE_SIZE) | |||
| return AVERROR_IO; | |||
| fourcc_tag = LE_32(&preamble[0]); | |||
| fourcc_tag = AV_RL32(&preamble[0]); | |||
| /* chunk sizes are 16-bit aligned */ | |||
| size = (BE_32(&preamble[4]) + 1) & (~1); | |||
| size = (AV_RB32(&preamble[4]) + 1) & (~1); | |||
| } while (fourcc_tag != BRCH_TAG); | |||
| @@ -291,9 +291,9 @@ static int wc3_read_packet(AVFormatContext *s, | |||
| WC3_PREAMBLE_SIZE) | |||
| ret = AVERROR_IO; | |||
| fourcc_tag = LE_32(&preamble[0]); | |||
| fourcc_tag = AV_RL32(&preamble[0]); | |||
| /* chunk sizes are 16-bit aligned */ | |||
| size = (BE_32(&preamble[4]) + 1) & (~1); | |||
| size = (AV_RB32(&preamble[4]) + 1) & (~1); | |||
| switch (fourcc_tag) { | |||
| @@ -305,7 +305,7 @@ static int wc3_read_packet(AVFormatContext *s, | |||
| /* load up new palette */ | |||
| if ((ret = get_buffer(pb, preamble, 4)) != 4) | |||
| return AVERROR_IO; | |||
| palette_number = LE_32(&preamble[0]); | |||
| palette_number = AV_RL32(&preamble[0]); | |||
| if (palette_number >= wc3->palette_count) | |||
| return AVERROR_INVALIDDATA; | |||
| base_palette_index = palette_number * PALETTE_COUNT * 3; | |||
| @@ -101,7 +101,7 @@ static int wsaud_probe(AVProbeData *p) | |||
| return 0; | |||
| /* check sample rate */ | |||
| field = LE_16(&p->buf[0]); | |||
| field = AV_RL16(&p->buf[0]); | |||
| if ((field < 8000) || (field > 48000)) | |||
| return 0; | |||
| @@ -124,7 +124,7 @@ static int wsaud_read_header(AVFormatContext *s, | |||
| if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) | |||
| return AVERROR_IO; | |||
| wsaud->audio_samplerate = LE_16(&header[0]); | |||
| wsaud->audio_samplerate = AV_RL16(&header[0]); | |||
| if (header[11] == 99) | |||
| wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS; | |||
| else | |||
| @@ -170,10 +170,10 @@ static int wsaud_read_packet(AVFormatContext *s, | |||
| return AVERROR_IO; | |||
| /* validate the chunk */ | |||
| if (LE_32(&preamble[4]) != AUD_CHUNK_SIGNATURE) | |||
| if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE) | |||
| return AVERROR_INVALIDDATA; | |||
| chunk_size = LE_16(&preamble[0]); | |||
| chunk_size = AV_RL16(&preamble[0]); | |||
| ret= av_get_packet(pb, pkt, chunk_size); | |||
| if (ret != chunk_size) | |||
| return AVERROR_IO; | |||
| @@ -202,8 +202,8 @@ static int wsvqa_probe(AVProbeData *p) | |||
| return 0; | |||
| /* check for the VQA signatures */ | |||
| if ((BE_32(&p->buf[0]) != FORM_TAG) || | |||
| (BE_32(&p->buf[8]) != WVQA_TAG)) | |||
| if ((AV_RB32(&p->buf[0]) != FORM_TAG) || | |||
| (AV_RB32(&p->buf[8]) != WVQA_TAG)) | |||
| return 0; | |||
| return AVPROBE_SCORE_MAX; | |||
| @@ -242,22 +242,22 @@ static int wsvqa_read_header(AVFormatContext *s, | |||
| av_free(st->codec->extradata); | |||
| return AVERROR_IO; | |||
| } | |||
| st->codec->width = LE_16(&header[6]); | |||
| st->codec->height = LE_16(&header[8]); | |||
| st->codec->width = AV_RL16(&header[6]); | |||
| st->codec->height = AV_RL16(&header[8]); | |||
| /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */ | |||
| if (LE_16(&header[24]) || (LE_16(&header[0]) == 1 && LE_16(&header[2]) == 1)) { | |||
| if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) { | |||
| st = av_new_stream(s, 0); | |||
| if (!st) | |||
| return AVERROR_NOMEM; | |||
| av_set_pts_info(st, 33, 1, VQA_FRAMERATE); | |||
| st->codec->codec_type = CODEC_TYPE_AUDIO; | |||
| if (LE_16(&header[0]) == 1) | |||
| if (AV_RL16(&header[0]) == 1) | |||
| st->codec->codec_id = CODEC_ID_WESTWOOD_SND1; | |||
| else | |||
| st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; | |||
| st->codec->codec_tag = 0; /* no tag */ | |||
| st->codec->sample_rate = LE_16(&header[24]); | |||
| st->codec->sample_rate = AV_RL16(&header[24]); | |||
| if (!st->codec->sample_rate) | |||
| st->codec->sample_rate = 22050; | |||
| st->codec->channels = header[26]; | |||
| @@ -281,8 +281,8 @@ static int wsvqa_read_header(AVFormatContext *s, | |||
| av_free(st->codec->extradata); | |||
| return AVERROR_IO; | |||
| } | |||
| chunk_tag = BE_32(&scratch[0]); | |||
| chunk_size = BE_32(&scratch[4]); | |||
| chunk_tag = AV_RB32(&scratch[0]); | |||
| chunk_size = AV_RB32(&scratch[4]); | |||
| /* catch any unknown header tags, for curiousity */ | |||
| switch (chunk_tag) { | |||
| @@ -323,8 +323,8 @@ static int wsvqa_read_packet(AVFormatContext *s, | |||
| int skip_byte; | |||
| while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { | |||
| chunk_type = BE_32(&preamble[0]); | |||
| chunk_size = BE_32(&preamble[4]); | |||
| chunk_type = AV_RB32(&preamble[0]); | |||
| chunk_size = AV_RB32(&preamble[4]); | |||
| skip_byte = chunk_size & 0x01; | |||
| if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) { | |||
| @@ -344,7 +344,7 @@ static int wsvqa_read_packet(AVFormatContext *s, | |||
| } else if(chunk_type == SND1_TAG) { | |||
| pkt->stream_index = wsvqa->audio_stream_index; | |||
| /* unpacked size is stored in header */ | |||
| wsvqa->audio_frame_counter += LE_16(pkt->data) / wsvqa->audio_channels; | |||
| wsvqa->audio_frame_counter += AV_RL16(pkt->data) / wsvqa->audio_channels; | |||
| } else { | |||
| pkt->stream_index = wsvqa->video_stream_index; | |||
| wsvqa->video_pts += VQA_VIDEO_PTS_INC; | |||
| @@ -92,7 +92,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) | |||
| get_le32(pb); // total samples in file | |||
| get_le32(pb); // offset in samples of current block | |||
| get_buffer(pb, wc->extra, WV_EXTRA_SIZE); | |||
| wc->flags = LE_32(wc->extra + 4); | |||
| wc->flags = AV_RL32(wc->extra + 4); | |||
| //parse flags | |||
| if(wc->flags & WV_FLOAT){ | |||
| av_log(ctx, AV_LOG_ERROR, "Floating point data is not supported\n"); | |||
| @@ -26,14 +26,14 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); | |||
| #endif /* !__GNUC__ */ | |||
| /* endian macros */ | |||
| #if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) | |||
| #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) | |||
| #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ | |||
| #if !defined(AV_RB16) || !defined(AV_RB32) || !defined(AV_RL16) || !defined(AV_RL32) | |||
| #define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) | |||
| #define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ | |||
| (((uint8_t*)(x))[1] << 16) | \ | |||
| (((uint8_t*)(x))[2] << 8) | \ | |||
| ((uint8_t*)(x))[3]) | |||
| #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) | |||
| #define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ | |||
| #define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) | |||
| #define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \ | |||
| (((uint8_t*)(x))[2] << 16) | \ | |||
| (((uint8_t*)(x))[1] << 8) | \ | |||
| ((uint8_t*)(x))[0]) | |||