aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/libavcodec/msrledec.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@xbmc.org>2011-02-02 01:29:29 +0200
committerAnssi Hannula <anssi@xbmc.org>2011-02-03 00:16:55 +0200
commit1a6a927ec5a0c305f58fa44bc0d023e007820b64 (patch)
tree480da2a288b605711c96a7315937c33ccf6c8257 /lib/ffmpeg/libavcodec/msrledec.c
parent4d8e27ceb8c6218f4dd62b381ec786650f594ac9 (diff)
updated: internal ffmpeg to c3beafa0f1
Update internal FFmpeg to c3beafa0f1 from git://git.ffmpeg.org/ffmpeg.git. This update adds a new library, libavcore, which contains common multimedia utilities. Build scripts are updated to handle it (both internal and external). FFmpeg is no longer built with libfaad as it now supports LATM AAC audio natively. The unused build_xbmc.sh script is removed. The patchset in ffmpeg/patches has been updated, removals and additions are documented below. The following patches have been removed as no longer necessary: - Ticket #5481 - added support for LATM encapsulated AAC audio streams within FFmpeg (thanks Paul Kendall). - re-add libfaad wrapper to ffmpeg for now - added: ffmpeg spdif demuxer (fixes ac3-in-wav) - ffmpeg issue2137 patch for MKV (fixes #9014) - ffmpeg issue2137 patch for AVI (fixes #9014) - fixed: bitstream mode improperly set. Ticket #10981. - Add av_popcount() to libavutil/common.h and bump minor version - added: export DTS profile information in ffmpeg - Add av_get_profile_name() to get profile names. - Show profile in avcodec_string(). - libfaac: add recognized profiles array - dca: add profile names - h264: add profile names for the existing defines - dca: consider a stream with XXCh/X96 in ExSS as DTS-HD HRA - added: metadata support to oggenc with vorbis streams (submitted upstream Issue #555) The following patch has been removed as its purpose is unclear and upstream code has diverged (passthrough works even without it): - Setup wanted pkt size in spdif muxers header parser The following patch: - When PMT is found, we have found mpegts header information, and av_find_stream_info doesn't need to read more to find streams has been re-replaced with - Speed up mpegts av_find_stream_info. The latter was apparently accidentally reverted in the previous FFmpeg update. The following patch has been added to fix a build regression with the configure flags we use on darwin: - swscale: fix build with --enable-runtime-cpudetect --disable-mmx/mmx2/amd3dnow
Diffstat (limited to 'lib/ffmpeg/libavcodec/msrledec.c')
-rw-r--r--lib/ffmpeg/libavcodec/msrledec.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/lib/ffmpeg/libavcodec/msrledec.c b/lib/ffmpeg/libavcodec/msrledec.c
index 6e16d535b3..97510830d5 100644
--- a/lib/ffmpeg/libavcodec/msrledec.c
+++ b/lib/ffmpeg/libavcodec/msrledec.c
@@ -45,7 +45,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
unsigned char rle_code;
unsigned char extra_byte, odd_pixel;
unsigned char stream_byte;
- int pixel_ptr = 0;
+ unsigned int pixel_ptr = 0;
int row_dec = pic->linesize[0];
int row_ptr = (avctx->height - 1) * row_dec;
int frame_size = row_dec * avctx->height;
@@ -70,39 +70,37 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
pixel_ptr += stream_byte;
FETCH_NEXT_STREAM_BYTE();
row_ptr -= stream_byte * row_dec;
- } else {
- // copy pixels from encoded stream
- odd_pixel = stream_byte & 1;
- rle_code = (stream_byte + 1) / 2;
- extra_byte = rle_code & 0x01;
- if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
- (row_ptr < 0)) {
- av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
- return -1;
- }
+ } else {
+ // copy pixels from encoded stream
+ odd_pixel = stream_byte & 1;
+ rle_code = (stream_byte + 1) / 2;
+ extra_byte = rle_code & 0x01;
+ if (row_ptr + pixel_ptr + stream_byte > frame_size) {
+ av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
+ return -1;
+ }
- for (i = 0; i < rle_code; i++) {
- if (pixel_ptr >= avctx->width)
- break;
- FETCH_NEXT_STREAM_BYTE();
- pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
- pixel_ptr++;
- if (i + 1 == rle_code && odd_pixel)
- break;
- if (pixel_ptr >= avctx->width)
- break;
- pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
- pixel_ptr++;
- }
+ for (i = 0; i < rle_code; i++) {
+ if (pixel_ptr >= avctx->width)
+ break;
+ FETCH_NEXT_STREAM_BYTE();
+ pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
+ pixel_ptr++;
+ if (i + 1 == rle_code && odd_pixel)
+ break;
+ if (pixel_ptr >= avctx->width)
+ break;
+ pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
+ pixel_ptr++;
+ }
- // if the RLE code is odd, skip a byte in the stream
- if (extra_byte)
- stream_ptr++;
+ // if the RLE code is odd, skip a byte in the stream
+ if (extra_byte)
+ stream_ptr++;
}
} else {
// decode a run of data
- if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
- (row_ptr < 0)) {
+ if (row_ptr + pixel_ptr + stream_byte > frame_size) {
av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
return -1;
}
@@ -138,6 +136,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
int p1, p2, line=avctx->height - 1, pos=0, i;
uint16_t av_uninit(pix16);
uint32_t av_uninit(pix32);
+ unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3);
output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
output_end = pic->data[0] + (avctx->height) * pic->linesize[0];
@@ -159,11 +158,11 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
p1 = *src++;
p2 = *src++;
line -= p2;
- if (line < 0){
+ pos += p1;
+ if (line < 0 || pos >= width){
av_log(avctx, AV_LOG_ERROR, "Skip beyond picture bounds\n");
return -1;
}
- pos += p1;
output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3);
continue;
}