* qatar/master: mpeg12: fixed parsing in some mpeg2 streams Add SMPTE240M transfer characteristics flag. mpegts: Some additional HDMV types and reg descriptors for mpegts motionpixels: Clip YUV values after applying a gradient. jpeg: handle progressive in second field of interlaced. ituh263dec: Implement enough of Annex O (scalability) to fix a FPE. h263: more strictly forbid frame size changes with frame-mt. h264: additional protection against unsupported size/bitdepth changes. tta: prevents overflows for 32bit integers in header. configure: remove malloc_aligned. vp8: update frame size changes on thread context switches. snowdsp: explicitily state instruction size. wmall: fix reconstructing audio with uncoded channels WMAL cosmetics: fix indentation gitignore: add Win32 library suffixes Conflicts: configure libavcodec/h263dec.c libavcodec/h264.c libavcodec/ituh263dec.c libavcodec/mjpegdec.c libavcodec/wmalosslessdec.c libavcodec/x86/snowdsp_mmx.c libavformat/mpegts.c Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n0.11
| @@ -3,8 +3,11 @@ | |||||
| *.a | *.a | ||||
| *.o | *.o | ||||
| *.d | *.d | ||||
| *.def | |||||
| *.dll | |||||
| *.exe | *.exe | ||||
| *.ho | *.ho | ||||
| *.lib | |||||
| *.pc | *.pc | ||||
| *.so | *.so | ||||
| *.so.* | *.so.* | ||||
| @@ -2670,7 +2670,6 @@ case $target_os in | |||||
| oss_outdev_extralibs="-lossaudio" | oss_outdev_extralibs="-lossaudio" | ||||
| ;; | ;; | ||||
| openbsd) | openbsd) | ||||
| enable malloc_aligned | |||||
| # On OpenBSD 4.5. the compiler does not use PIC unless | # On OpenBSD 4.5. the compiler does not use PIC unless | ||||
| # explicitly using -fPIC. FFmpeg builds fine without PIC, | # explicitly using -fPIC. FFmpeg builds fine without PIC, | ||||
| # however the generated executable will not do anything | # however the generated executable will not do anything | ||||
| @@ -2683,18 +2682,15 @@ case $target_os in | |||||
| oss_outdev_extralibs="-lossaudio" | oss_outdev_extralibs="-lossaudio" | ||||
| ;; | ;; | ||||
| dragonfly) | dragonfly) | ||||
| enable malloc_aligned | |||||
| disable symver | disable symver | ||||
| ;; | ;; | ||||
| freebsd) | freebsd) | ||||
| enable malloc_aligned | |||||
| ;; | ;; | ||||
| bsd/os) | bsd/os) | ||||
| add_extralibs -lpoll -lgnugetopt | add_extralibs -lpoll -lgnugetopt | ||||
| strip="strip -d" | strip="strip -d" | ||||
| ;; | ;; | ||||
| darwin) | darwin) | ||||
| enable malloc_aligned | |||||
| gas="gas-preprocessor.pl $cc" | gas="gas-preprocessor.pl $cc" | ||||
| enabled ppc && add_asflags -force_cpusubtype_ALL | enabled ppc && add_asflags -force_cpusubtype_ALL | ||||
| SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' | SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' | ||||
| @@ -2718,7 +2714,6 @@ case $target_os in | |||||
| fi | fi | ||||
| LIBTARGET=i386 | LIBTARGET=i386 | ||||
| if enabled x86_64; then | if enabled x86_64; then | ||||
| enable malloc_aligned | |||||
| LIBTARGET=x64 | LIBTARGET=x64 | ||||
| elif enabled arm; then | elif enabled arm; then | ||||
| LIBTARGET=arm-wince | LIBTARGET=arm-wince | ||||
| @@ -3470,7 +3465,7 @@ if test $target_os = "haiku"; then | |||||
| disable posix_memalign | disable posix_memalign | ||||
| fi | fi | ||||
| ! enabled_any memalign posix_memalign malloc_aligned && | |||||
| ! enabled_any memalign posix_memalign && | |||||
| enabled_any $need_memalign && enable memalign_hack | enabled_any $need_memalign && enable memalign_hack | ||||
| # add_dep lib dep | # add_dep lib dep | ||||
| @@ -452,6 +452,15 @@ retry: | |||||
| if (ret < 0){ | if (ret < 0){ | ||||
| av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); | av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); | ||||
| return -1; | return -1; | ||||
| } else if ((s->width != avctx->coded_width || | |||||
| s->height != avctx->coded_height || | |||||
| (s->width + 15) >> 4 != s->mb_width || | |||||
| (s->height + 15) >> 4 != s->mb_height) && | |||||
| (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))) { | |||||
| av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0); | |||||
| s->width = avctx->coded_width; | |||||
| s->height= avctx->coded_height; | |||||
| return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding | |||||
| } | } | ||||
| avctx->has_b_frames= !s->low_delay; | avctx->has_b_frames= !s->low_delay; | ||||
| @@ -592,13 +601,6 @@ retry: | |||||
| /* H.263 could change picture size any time */ | /* H.263 could change picture size any time */ | ||||
| ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat | ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat | ||||
| if (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_FRAME)) { | |||||
| av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0); | |||||
| s->width = avctx->coded_width; | |||||
| s->height= avctx->coded_height; | |||||
| return -1; // width / height changed during parallelized decoding | |||||
| } | |||||
| s->parse_context.buffer=0; | s->parse_context.buffer=0; | ||||
| ff_MPV_common_end(s); | ff_MPV_common_end(s); | ||||
| s->parse_context= pc; | s->parse_context= pc; | ||||
| @@ -2956,7 +2956,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) | |||||
| if(must_reinit && (h != h0 || (s->avctx->active_thread_type & FF_THREAD_FRAME))) { | if(must_reinit && (h != h0 || (s->avctx->active_thread_type & FF_THREAD_FRAME))) { | ||||
| av_log_missing_feature(s->avctx, | av_log_missing_feature(s->avctx, | ||||
| "Width/height/bit depth/chroma idc changing with threads is", 0); | "Width/height/bit depth/chroma idc changing with threads is", 0); | ||||
| return -1; // width / height changed during parallelized decoding | |||||
| return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding | |||||
| } | } | ||||
| s->mb_width = h->sps.mb_width; | s->mb_width = h->sps.mb_width; | ||||
| @@ -522,6 +522,9 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){ | |||||
| if(pps_id >= MAX_PPS_COUNT) { | if(pps_id >= MAX_PPS_COUNT) { | ||||
| av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); | av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); | ||||
| return -1; | return -1; | ||||
| } else if (h->sps.bit_depth_luma > 10) { | |||||
| av_log(h->s.avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d (max=10)\n", h->sps.bit_depth_luma); | |||||
| return AVERROR_PATCHWELCOME; | |||||
| } | } | ||||
| pps= av_mallocz(sizeof(PPS)); | pps= av_mallocz(sizeof(PPS)); | ||||
| @@ -1086,13 +1086,15 @@ int ff_h263_decode_picture_header(MpegEncContext *s) | |||||
| } | } | ||||
| if (s->pict_type!=AV_PICTURE_TYPE_B) { | if (s->pict_type!=AV_PICTURE_TYPE_B) { | ||||
| s->time= s->picture_number; | |||||
| s->pp_time= s->time - s->last_non_b_time; | |||||
| s->last_non_b_time= s->time; | |||||
| s->time = s->picture_number; | |||||
| s->pp_time = s->time - s->last_non_b_time; | |||||
| s->last_non_b_time = s->time; | |||||
| }else{ | }else{ | ||||
| s->time= s->picture_number; | |||||
| s->pb_time= s->pp_time - (s->last_non_b_time - s->time); | |||||
| if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ | |||||
| s->time = s->picture_number; | |||||
| s->pb_time = s->pp_time - (s->last_non_b_time - s->time); | |||||
| if (s->pp_time <=s->pb_time || | |||||
| s->pp_time <= s->pp_time - s->pb_time || | |||||
| s->pp_time <= 0){ | |||||
| s->pp_time = 2; | s->pp_time = 2; | ||||
| s->pb_time = 1; | s->pb_time = 1; | ||||
| } | } | ||||
| @@ -326,9 +326,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) | |||||
| av_log_ask_for_sample(s->avctx, "progressively coded interlaced pictures not supported\n"); | av_log_ask_for_sample(s->avctx, "progressively coded interlaced pictures not supported\n"); | ||||
| return AVERROR_INVALIDDATA; | return AVERROR_INVALIDDATA; | ||||
| } | } | ||||
| return 0; | |||||
| } | |||||
| } else{ | |||||
| /* XXX: not complete test ! */ | /* XXX: not complete test ! */ | ||||
| pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) | | pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) | | ||||
| (s->h_count[1] << 20) | (s->v_count[1] << 16) | | (s->h_count[1] << 20) | (s->v_count[1] << 16) | | ||||
| @@ -445,6 +443,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) | |||||
| if (len != (8 + (3 * nb_components))) | if (len != (8 + (3 * nb_components))) | ||||
| av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); | av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); | ||||
| } | |||||
| /* totally blank picture as progressive JPEG will only add details to it */ | /* totally blank picture as progressive JPEG will only add details to it */ | ||||
| if (s->progressive) { | if (s->progressive) { | ||||
| @@ -191,10 +191,13 @@ static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y) | |||||
| p = mp_get_yuv_from_rgb(mp, x - 1, y); | p = mp_get_yuv_from_rgb(mp, x - 1, y); | ||||
| } else { | } else { | ||||
| p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); | p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); | ||||
| p.y = av_clip(p.y, 0, 31); | |||||
| if ((x & 3) == 0) { | if ((x & 3) == 0) { | ||||
| if ((y & 3) == 0) { | if ((y & 3) == 0) { | ||||
| p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); | p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); | ||||
| p.v = av_clip(p.v, -32, 31); | |||||
| p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); | p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); | ||||
| p.u = av_clip(p.u, -32, 31); | |||||
| mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p; | mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p; | ||||
| } else { | } else { | ||||
| p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v; | p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v; | ||||
| @@ -218,9 +221,12 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb) | |||||
| p = mp_get_yuv_from_rgb(mp, 0, y); | p = mp_get_yuv_from_rgb(mp, 0, y); | ||||
| } else { | } else { | ||||
| p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); | p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); | ||||
| p.y = av_clip(p.y, 0, 31); | |||||
| if ((y & 3) == 0) { | if ((y & 3) == 0) { | ||||
| p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); | p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); | ||||
| p.v = av_clip(p.v, -32, 31); | |||||
| p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); | p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); | ||||
| p.u = av_clip(p.u, -32, 31); | |||||
| } | } | ||||
| mp->vpt[y] = p; | mp->vpt[y] = p; | ||||
| mp_set_rgb_from_yuv(mp, 0, y, &p); | mp_set_rgb_from_yuv(mp, 0, y, &p); | ||||
| @@ -61,7 +61,8 @@ typedef struct TTAContext { | |||||
| GetBitContext gb; | GetBitContext gb; | ||||
| const AVCRC *crc_table; | const AVCRC *crc_table; | ||||
| int format, channels, bps, data_length; | |||||
| int format, channels, bps; | |||||
| unsigned data_length; | |||||
| int frame_length, last_frame_length, total_frames; | int frame_length, last_frame_length, total_frames; | ||||
| int32_t *decode_buffer; | int32_t *decode_buffer; | ||||
| @@ -235,7 +236,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) | |||||
| } | } | ||||
| // prevent overflow | // prevent overflow | ||||
| if (avctx->sample_rate > 0x7FFFFF) { | |||||
| if (avctx->sample_rate > 0x7FFFFFu) { | |||||
| av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); | av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); | ||||
| return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
| } | } | ||||
| @@ -255,7 +256,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) | |||||
| return AVERROR_INVALIDDATA; | return AVERROR_INVALIDDATA; | ||||
| // FIXME: seek table | // FIXME: seek table | ||||
| if (get_bits_left(&s->gb) < 32 * s->total_frames + 32) | |||||
| if (avctx->extradata_size <= 26 || s->total_frames > INT_MAX / 4 || | |||||
| avctx->extradata_size - 26 < s->total_frames * 4) | |||||
| av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\n"); | av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\n"); | ||||
| else if (avctx->err_recognition & AV_EF_CRCCHECK) { | else if (avctx->err_recognition & AV_EF_CRCCHECK) { | ||||
| if (avctx->extradata_size < 26 + s->total_frames * 4 || tta_check_crc(s, avctx->extradata + 22, s->total_frames * 4)) | if (avctx->extradata_size < 26 + s->total_frames * 4 || tta_check_crc(s, avctx->extradata + 22, s->total_frames * 4)) | ||||
| @@ -1834,6 +1834,8 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo | |||||
| (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) { | (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) { | ||||
| free_buffers(s); | free_buffers(s); | ||||
| s->maps_are_invalid = 1; | s->maps_are_invalid = 1; | ||||
| s->mb_width = s_src->mb_width; | |||||
| s->mb_height = s_src->mb_height; | |||||
| } | } | ||||
| s->prob[0] = s_src->prob[!s_src->update_probabilities]; | s->prob[0] = s_src->prob[!s_src->update_probabilities]; | ||||
| @@ -793,7 +793,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size) | |||||
| { | { | ||||
| if (s->num_channels != 2) | if (s->num_channels != 2) | ||||
| return; | return; | ||||
| else { | |||||
| else if (s->is_channel_coded[0] || s->is_channel_coded[1]) { | |||||
| int icoef; | int icoef; | ||||
| for (icoef = 0; icoef < tile_size; icoef++) { | for (icoef = 0; icoef < tile_size; icoef++) { | ||||
| s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1; | s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1; | ||||
| @@ -959,8 +959,9 @@ static int decode_subframe(WmallDecodeCtx *s) | |||||
| else | else | ||||
| use_normal_update_speed(s, i); | use_normal_update_speed(s, i); | ||||
| revert_cdlms(s, i, 0, subframe_len); | revert_cdlms(s, i, 0, subframe_len); | ||||
| } else | |||||
| memset(s->channel_residues[i], 0, sizeof(s->channel_residues[i])); | |||||
| } else { | |||||
| memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len); | |||||
| } | |||||
| } | } | ||||
| if (s->do_mclms) | if (s->do_mclms) | ||||
| revert_mclms(s, subframe_len); | revert_mclms(s, subframe_len); | ||||
| @@ -1217,7 +1218,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, | |||||
| /* decode the cross packet frame if it is valid */ | /* decode the cross packet frame if it is valid */ | ||||
| if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) | if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) | ||||
| decode_frame(s); | |||||
| decode_frame(s); | |||||
| } else if (s->num_saved_bits - s->frame_offset) { | } else if (s->num_saved_bits - s->frame_offset) { | ||||
| av_dlog(avctx, "ignoring %x previously saved bits\n", | av_dlog(avctx, "ignoring %x previously saved bits\n", | ||||
| s->num_saved_bits - s->frame_offset); | s->num_saved_bits - s->frame_offset); | ||||