* qatar/master: (23 commits) doc: Check standalone compilation before submitting new components. Fix standalone compilation of pipe protocol. Fix standalone compilation of ac3_fixed encoder. Fix standalone compilation of binkaudio_dct / binkaudio_rdft decoders. Fix standalone compilation of IMC decoder. Fix standalone compilation of WTV demuxer. Fix standalone compilation of MXPEG decoder. flashsv: K&R cosmetics matroskaenc: fix memory leak vc1: make overlap filter for I-frames bit-exact. vc1dec: use s->start/end_mb_y instead of passing them as function args. Revert "VC1: merge idct8x8, coeff adjustments and put_pixels." Replace strncpy() with av_strlcpy(). indeo3: Eliminate use of long. get_bits: make cache unsigned to eliminate undefined signed overflow. asfdec: fix assert failure on invalid files avfilter: check malloc return values. Not pulled as reason for reindent is not pulled: mpegvideo: reindent. nutenc: check malloc return values. Not pulled due to much simpler solution in ffmpeg *: don't av_malloc(0). ... Conflicts: doc/developer.texi libavcodec/Makefile libavcodec/get_bits.h libavcodec/mpegvideo.c libavformat/Makefile libavutil/log.c
Unified · Split
| @@ -1252,14 +1252,14 @@ aac_encoder_select="mdct sinewin" · 1251 unmodified lines | |||
| 1252 | aac_latm_decoder_select="aac_decoder aac_latm_parser" | 1252 | aac_latm_decoder_select="aac_decoder aac_latm_parser" |
| 1253 | ac3_decoder_select="mdct ac3dsp ac3_parser" | 1253 | ac3_decoder_select="mdct ac3dsp ac3_parser" |
| 1254 | ac3_encoder_select="mdct ac3dsp" | 1254 | ac3_encoder_select="mdct ac3dsp" |
| 1255 | ac3_fixed_encoder_select="ac3dsp" | 1255 | ac3_fixed_encoder_select="mdct ac3dsp" |
| 1256 | alac_encoder_select="lpc" | 1256 | alac_encoder_select="lpc" |
| 1257 | amrnb_decoder_select="lsp" | 1257 | amrnb_decoder_select="lsp" |
| 1258 | amrwb_decoder_select="lsp" | 1258 | amrwb_decoder_select="lsp" |
| 1259 | atrac1_decoder_select="mdct sinewin" | 1259 | atrac1_decoder_select="mdct sinewin" |
| 1260 | atrac3_decoder_select="mdct" | 1260 | atrac3_decoder_select="mdct" |
| 1261 | binkaudio_dct_decoder_select="mdct rdft dct" | 1261 | binkaudio_dct_decoder_select="mdct rdft dct sinewin" |
| 1262 | binkaudio_rdft_decoder_select="mdct rdft" | 1262 | binkaudio_rdft_decoder_select="mdct rdft sinewin" |
| 1263 | cavs_decoder_select="golomb" | 1263 | cavs_decoder_select="golomb" |
| 1264 | cook_decoder_select="mdct sinewin" | 1264 | cook_decoder_select="mdct sinewin" |
| 1265 | cscd_decoder_suggest="zlib" | 1265 | cscd_decoder_suggest="zlib" |
| @@ -1291,7 +1291,7 @@ h264_dxva2_hwaccel_deps="dxva2api_h" · 25 unmodified lines | |||
| 1291 | h264_dxva2_hwaccel_select="dxva2 h264_decoder" | 1291 | h264_dxva2_hwaccel_select="dxva2 h264_decoder" |
| 1292 | h264_vaapi_hwaccel_select="vaapi" | 1292 | h264_vaapi_hwaccel_select="vaapi" |
| 1293 | h264_vdpau_decoder_select="vdpau h264_decoder" | 1293 | h264_vdpau_decoder_select="vdpau h264_decoder" |
| 1294 | imc_decoder_select="fft mdct" | 1294 | imc_decoder_select="fft mdct sinewin" |
| 1295 | jpegls_decoder_select="golomb" | 1295 | jpegls_decoder_select="golomb" |
| 1296 | jpegls_encoder_select="golomb" | 1296 | jpegls_encoder_select="golomb" |
| 1297 | ljpeg_encoder_select="aandct" | 1297 | ljpeg_encoder_select="aandct" |
| @@ -312,9 +312,14 @@ send a reminder by email. Your patch should eventually be dealt with. · 311 unmodified lines | |||
| 312 | If it depends on a parser or a library, did you add that dependency in | 312 | If it depends on a parser or a library, did you add that dependency in |
| 313 | configure? | 313 | configure? |
| 314 | @item | 314 | @item |
| 315 | Did you "git add" the appropriate files before committing? | 315 | Did you @code{git add} the appropriate files before committing? |
| 316 | @item | ||
| 317 | Did you make sure it compiles standalone, i.e. with | ||
| 318 | @code{configure --disable-everything --enable-decoder=foo} | ||
| 319 | (or @code{--enable-demuxer} or whatever your component is)? | ||
| 316 | @end enumerate | 320 | @end enumerate |
| 317 | 321 | ||
| 322 | |||
| 318 | @section patch submission checklist | 323 | @section patch submission checklist |
| 319 | 324 | ||
| 320 | @enumerate | 325 | @enumerate |
| @@ -3816,8 +3816,7 @@ static int opt_streamid(const char *opt, const char *arg) · 3815 unmodified lines | |||
| 3816 | char *p; | 3816 | char *p; |
| 3817 | char idx_str[16]; | 3817 | char idx_str[16]; |
| 3818 | 3818 | ||
| 3819 | strncpy(idx_str, arg, sizeof(idx_str)); | 3819 | av_strlcpy(idx_str, arg, sizeof(idx_str)); |
| 3820 | idx_str[sizeof(idx_str)-1] = '\0'; | ||
| 3821 | p = strchr(idx_str, ':'); | 3820 | p = strchr(idx_str, ':'); |
| 3822 | if (!p) { | 3821 | if (!p) { |
| 3823 | fprintf(stderr, | 3822 | fprintf(stderr, |
| @@ -277,7 +277,7 @@ OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o · 276 unmodified lines | |||
| 277 | OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o | 277 | OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o |
| 278 | OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o | 278 | OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o |
| 279 | OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o | 279 | OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o |
| 280 | OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o | 280 | OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o |
| 281 | OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o | 281 | OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o |
| 282 | OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o | 282 | OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o |
| 283 | OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o | 283 | OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o |
| @@ -556,6 +556,7 @@ OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o · 272 unmodified lines | |||
| 556 | OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ | 556 | OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ |
| 557 | flacdec.o flacdata.o flac.o \ | 557 | flacdec.o flacdata.o flac.o \ |
| 558 | mpegaudiodata.o vorbis_data.o | 558 | mpegaudiodata.o vorbis_data.o |
| 559 | OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o | ||
| 559 | 560 | ||
| 560 | # external codec libraries | 561 | # external codec libraries |
| 561 | OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o | 562 | OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | #include "libavutil/audioconvert.h" | 34 | #include "libavutil/audioconvert.h" |
| 35 | #include "libavutil/avassert.h" | 35 | #include "libavutil/avassert.h" |
| 36 | #include "libavutil/avstring.h" | ||
| 36 | #include "libavutil/crc.h" | 37 | #include "libavutil/crc.h" |
| 37 | #include "libavutil/opt.h" | 38 | #include "libavutil/opt.h" |
| 38 | #include "avcodec.h" | 39 | #include "avcodec.h" |
| @@ -1551,10 +1552,10 @@ static void dprint_options(AVCodecContext *avctx) · 1512 unmodified lines | |||
| 1551 | char strbuf[32]; | 1552 | char strbuf[32]; |
| 1552 | 1553 | ||
| 1553 | switch (s->bitstream_id) { | 1554 | switch (s->bitstream_id) { |
| 1554 | case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break; | 1555 | case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break; |
| 1555 | case 8: strncpy(strbuf, "AC-3 (standard)", 32); break; | 1556 | case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32); break; |
| 1556 | case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break; | 1557 | case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break; |
| 1557 | case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break; | 1558 | case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break; |
| 1558 | default: snprintf(strbuf, 32, "ERROR"); | 1559 | default: snprintf(strbuf, 32, "ERROR"); |
| 1559 | } | 1560 | } |
| 1560 | av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id); | 1561 | av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id); |
| @@ -1581,9 +1582,9 @@ static void dprint_options(AVCodecContext *avctx) · 20 unmodified lines | |||
| 1581 | if (opt->audio_production_info) { | 1582 | if (opt->audio_production_info) { |
| 1582 | av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); | 1583 | av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); |
| 1583 | switch (opt->room_type) { | 1584 | switch (opt->room_type) { |
| 1584 | case 0: strncpy(strbuf, "notindicated", 32); break; | 1585 | case 0: av_strlcpy(strbuf, "notindicated", 32); break; |
| 1585 | case 1: strncpy(strbuf, "large", 32); break; | 1586 | case 1: av_strlcpy(strbuf, "large", 32); break; |
| 1586 | case 2: strncpy(strbuf, "small", 32); break; | 1587 | case 2: av_strlcpy(strbuf, "small", 32); break; |
| 1587 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); | 1588 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); |
| 1588 | } | 1589 | } |
| 1589 | av_dlog(avctx, "room_type: %s\n", strbuf); | 1590 | av_dlog(avctx, "room_type: %s\n", strbuf); |
| @@ -1595,9 +1596,9 @@ static void dprint_options(AVCodecContext *avctx) · 5 unmodified lines | |||
| 1595 | av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); | 1596 | av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); |
| 1596 | if (s->channel_mode == AC3_CHMODE_STEREO) { | 1597 | if (s->channel_mode == AC3_CHMODE_STEREO) { |
| 1597 | switch (opt->dolby_surround_mode) { | 1598 | switch (opt->dolby_surround_mode) { |
| 1598 | case 0: strncpy(strbuf, "notindicated", 32); break; | 1599 | case 0: av_strlcpy(strbuf, "notindicated", 32); break; |
| 1599 | case 1: strncpy(strbuf, "on", 32); break; | 1600 | case 1: av_strlcpy(strbuf, "on", 32); break; |
| 1600 | case 2: strncpy(strbuf, "off", 32); break; | 1601 | case 2: av_strlcpy(strbuf, "off", 32); break; |
| 1601 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode); | 1602 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode); |
| 1602 | } | 1603 | } |
| 1603 | av_dlog(avctx, "dsur_mode: %s\n", strbuf); | 1604 | av_dlog(avctx, "dsur_mode: %s\n", strbuf); |
| @@ -1609,9 +1610,9 @@ static void dprint_options(AVCodecContext *avctx) · 5 unmodified lines | |||
| 1609 | if (s->bitstream_id == 6) { | 1610 | if (s->bitstream_id == 6) { |
| 1610 | if (opt->extended_bsi_1) { | 1611 | if (opt->extended_bsi_1) { |
| 1611 | switch (opt->preferred_stereo_downmix) { | 1612 | switch (opt->preferred_stereo_downmix) { |
| 1612 | case 0: strncpy(strbuf, "notindicated", 32); break; | 1613 | case 0: av_strlcpy(strbuf, "notindicated", 32); break; |
| 1613 | case 1: strncpy(strbuf, "ltrt", 32); break; | 1614 | case 1: av_strlcpy(strbuf, "ltrt", 32); break; |
| 1614 | case 2: strncpy(strbuf, "loro", 32); break; | 1615 | case 2: av_strlcpy(strbuf, "loro", 32); break; |
| 1615 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix); | 1616 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix); |
| 1616 | } | 1617 | } |
| 1617 | av_dlog(avctx, "dmix_mode: %s\n", strbuf); | 1618 | av_dlog(avctx, "dmix_mode: %s\n", strbuf); |
| @@ -1628,23 +1629,23 @@ static void dprint_options(AVCodecContext *avctx) · 10 unmodified lines | |||
| 1628 | } | 1629 | } |
| 1629 | if (opt->extended_bsi_2) { | 1630 | if (opt->extended_bsi_2) { |
| 1630 | switch (opt->dolby_surround_ex_mode) { | 1631 | switch (opt->dolby_surround_ex_mode) { |
| 1631 | case 0: strncpy(strbuf, "notindicated", 32); break; | 1632 | case 0: av_strlcpy(strbuf, "notindicated", 32); break; |
| 1632 | case 1: strncpy(strbuf, "on", 32); break; | 1633 | case 1: av_strlcpy(strbuf, "on", 32); break; |
| 1633 | case 2: strncpy(strbuf, "off", 32); break; | 1634 | case 2: av_strlcpy(strbuf, "off", 32); break; |
| 1634 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode); | 1635 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode); |
| 1635 | } | 1636 | } |
| 1636 | av_dlog(avctx, "dsurex_mode: %s\n", strbuf); | 1637 | av_dlog(avctx, "dsurex_mode: %s\n", strbuf); |
| 1637 | switch (opt->dolby_headphone_mode) { | 1638 | switch (opt->dolby_headphone_mode) { |
| 1638 | case 0: strncpy(strbuf, "notindicated", 32); break; | 1639 | case 0: av_strlcpy(strbuf, "notindicated", 32); break; |
| 1639 | case 1: strncpy(strbuf, "on", 32); break; | 1640 | case 1: av_strlcpy(strbuf, "on", 32); break; |
| 1640 | case 2: strncpy(strbuf, "off", 32); break; | 1641 | case 2: av_strlcpy(strbuf, "off", 32); break; |
| 1641 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode); | 1642 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode); |
| 1642 | } | 1643 | } |
| 1643 | av_dlog(avctx, "dheadphone_mode: %s\n", strbuf); | 1644 | av_dlog(avctx, "dheadphone_mode: %s\n", strbuf); |
| 1644 | 1645 | ||
| 1645 | switch (opt->ad_converter_type) { | 1646 | switch (opt->ad_converter_type) { |
| 1646 | case 0: strncpy(strbuf, "standard", 32); break; | 1647 | case 0: av_strlcpy(strbuf, "standard", 32); break; |
| 1647 | case 1: strncpy(strbuf, "hdcd", 32); break; | 1648 | case 1: av_strlcpy(strbuf, "hdcd", 32); break; |
| 1648 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type); | 1649 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type); |
| 1649 | } | 1650 | } |
| 1650 | av_dlog(avctx, "ad_conv_type: %s\n", strbuf); | 1651 | av_dlog(avctx, "ad_conv_type: %s\n", strbuf); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #include "avcodec.h" | 22 | #include "avcodec.h" |
| 23 | #include "ass.h" | 23 | #include "ass.h" |
| 24 | #include "libavutil/avstring.h" | ||
| 24 | 25 | ||
| 25 | int ff_ass_subtitle_header(AVCodecContext *avctx, | 26 | int ff_ass_subtitle_header(AVCodecContext *avctx, |
| 26 | const char *font, int font_size, | 27 | const char *font, int font_size, |
| @@ -97,8 +98,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, · 70 unmodified lines | |||
| 97 | rects[sub->num_rects]->type = SUBTITLE_ASS; | 98 | rects[sub->num_rects]->type = SUBTITLE_ASS; |
| 98 | rects[sub->num_rects]->ass = av_malloc(len + dlen + 1); | 99 | rects[sub->num_rects]->ass = av_malloc(len + dlen + 1); |
| 99 | strcpy (rects[sub->num_rects]->ass , header); | 100 | strcpy (rects[sub->num_rects]->ass , header); |
| 100 | strncpy(rects[sub->num_rects]->ass + len, dialog, dlen); | 101 | av_strlcpy(rects[sub->num_rects]->ass + len, dialog, dlen + 1); |
| 101 | rects[sub->num_rects]->ass[len+dlen] = 0; | ||
| 102 | sub->num_rects++; | 102 | sub->num_rects++; |
| 103 | return dlen; | 103 | return dlen; |
| 104 | } | 104 | } |
| @@ -148,7 +148,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, · 147 unmodified lines | |||
| 148 | if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) { | 148 | if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) { |
| 149 | av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n"); | 149 | av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n"); |
| 150 | av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n", avctx->height, | 150 | av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n", avctx->height, |
| 151 | avctx->width,s->image_height, s->image_width); | 151 | avctx->width, s->image_height, s->image_width); |
| 152 | return -1; | 152 | return -1; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -195,7 +195,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, · 40 unmodified lines | |||
| 195 | s->zstream.next_in = buf + (get_bits_count(&gb) / 8); | 195 | s->zstream.next_in = buf + (get_bits_count(&gb) / 8); |
| 196 | s->zstream.avail_in = size; | 196 | s->zstream.avail_in = size; |
| 197 | s->zstream.next_out = s->tmpblock; | 197 | s->zstream.next_out = s->tmpblock; |
| 198 | s->zstream.avail_out = s->block_size*3; | 198 | s->zstream.avail_out = s->block_size * 3; |
| 199 | ret = inflate(&(s->zstream), Z_FINISH); | 199 | ret = inflate(&(s->zstream), Z_FINISH); |
| 200 | if (ret == Z_DATA_ERROR) { | 200 | if (ret == Z_DATA_ERROR) { |
| 201 | av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n"); | 201 | av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n"); |
| @@ -127,7 +127,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc · 126 unmodified lines | |||
| 127 | 127 | ||
| 128 | # define OPEN_READER(name, gb) \ | 128 | # define OPEN_READER(name, gb) \ |
| 129 | unsigned int name##_index = (gb)->index; \ | 129 | unsigned int name##_index = (gb)->index; \ |
| 130 | av_unused int name##_cache | 130 | av_unused unsigned int name##_cache |
| 131 | 131 | ||
| 132 | # define CLOSE_READER(name, gb) (gb)->index = name##_index | 132 | # define CLOSE_READER(name, gb) (gb)->index = name##_index |
| 133 | 133 | ||
| @@ -149,13 +149,13 @@ static av_cold void iv_free_func(Indeo3DecodeContext *s) · 148 unmodified lines | |||
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | struct ustr { | 151 | struct ustr { |
| 152 | long xpos; | 152 | int xpos; |
| 153 | long ypos; | 153 | int ypos; |
| 154 | long width; | 154 | int width; |
| 155 | long height; | 155 | int height; |
| 156 | long split_flag; | 156 | int split_flag; |
| 157 | long split_direction; | 157 | int split_direction; |
| 158 | long usl7; | 158 | int usl7; |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | 161 | ||
| @@ -203,12 +203,12 @@ struct ustr { · 41 unmodified lines | |||
| 203 | 203 | ||
| 204 | static void iv_Decode_Chunk(Indeo3DecodeContext *s, | 204 | static void iv_Decode_Chunk(Indeo3DecodeContext *s, |
| 205 | uint8_t *cur, uint8_t *ref, int width, int height, | 205 | uint8_t *cur, uint8_t *ref, int width, int height, |
| 206 | const uint8_t *buf1, long cb_offset, const uint8_t *hdr, | 206 | const uint8_t *buf1, int cb_offset, const uint8_t *hdr, |
| 207 | const uint8_t *buf2, int min_width_160) | 207 | const uint8_t *buf2, int min_width_160) |
| 208 | { | 208 | { |
| 209 | uint8_t bit_buf; | 209 | uint8_t bit_buf; |
| 210 | unsigned long bit_pos, lv, lv1, lv2; | 210 | unsigned int bit_pos, lv, lv1, lv2; |
| 211 | long *width_tbl, width_tbl_arr[10]; | 211 | int *width_tbl, width_tbl_arr[10]; |
| 212 | const signed char *ref_vectors; | 212 | const signed char *ref_vectors; |
| 213 | uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; | 213 | uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; |
| 214 | uint32_t *cur_lp, *ref_lp; | 214 | uint32_t *cur_lp, *ref_lp; |
| @@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx, · 767 unmodified lines | |||
| 982 | Indeo3DecodeContext *s = avctx->priv_data; | 982 | Indeo3DecodeContext *s = avctx->priv_data; |
| 983 | unsigned int image_width, image_height, | 983 | unsigned int image_width, image_height, |
| 984 | chroma_width, chroma_height; | 984 | chroma_width, chroma_height; |
| 985 | unsigned long flags, cb_offset, data_size, | 985 | unsigned int flags, cb_offset, data_size, |
| 986 | y_offset, v_offset, u_offset, mc_vector_count; | 986 | y_offset, v_offset, u_offset, mc_vector_count; |
| 987 | const uint8_t *hdr_pos, *buf_pos; | 987 | const uint8_t *hdr_pos, *buf_pos; |
| 988 | 988 | ||
| @@ -130,8 +130,7 @@ do { \ · 129 unmodified lines | |||
| 130 | 130 | ||
| 131 | /** Do inverse transform on 8x8 block | 131 | /** Do inverse transform on 8x8 block |
| 132 | */ | 132 | */ |
| 133 | static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], | 133 | static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) |
| 134 | int sign, int rangered) | ||
| 135 | { | 134 | { |
| 136 | vector signed short src0, src1, src2, src3, src4, src5, src6, src7; | 135 | vector signed short src0, src1, src2, src3, src4, src5, src6, src7; |
| 137 | vector signed int s0, s1, s2, s3, s4, s5, s6, s7; | 136 | vector signed int s0, s1, s2, s3, s4, s5, s6, s7; |
| @@ -145,9 +144,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], · 7 unmodified lines | |||
| 145 | const vector unsigned int vec_2 = vec_splat_u32(2); | 144 | const vector unsigned int vec_2 = vec_splat_u32(2); |
| 146 | const vector signed int vec_1s = vec_splat_s32(1); | 145 | const vector signed int vec_1s = vec_splat_s32(1); |
| 147 | const vector unsigned int vec_1 = vec_splat_u32(1); | 146 | const vector unsigned int vec_1 = vec_splat_u32(1); |
| 148 | const vector unsigned short rangered_shift = vec_splat_u16(1); | ||
| 149 | const vector signed short signed_bias = vec_sl(vec_splat_s16(4), | ||
| 150 | vec_splat_u16(4)); | ||
| 151 | 147 | ||
| 152 | src0 = vec_ld( 0, block); | 148 | src0 = vec_ld( 0, block); |
| 153 | src1 = vec_ld( 16, block); | 149 | src1 = vec_ld( 16, block); |
| @@ -217,27 +213,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], · 63 unmodified lines | |||
| 217 | src6 = vec_pack(sE, s6); | 213 | src6 = vec_pack(sE, s6); |
| 218 | src7 = vec_pack(sF, s7); | 214 | src7 = vec_pack(sF, s7); |
| 219 | 215 | ||
| 220 | if (rangered) { | ||
| 221 | if (!sign) { | ||
| 222 | src0 = vec_sub(src0, signed_bias); | ||
| 223 | src1 = vec_sub(src1, signed_bias); | ||
| 224 | src2 = vec_sub(src2, signed_bias); | ||
| 225 | src3 = vec_sub(src3, signed_bias); | ||
| 226 | src4 = vec_sub(src4, signed_bias); | ||
| 227 | src5 = vec_sub(src5, signed_bias); | ||
| 228 | src6 = vec_sub(src6, signed_bias); | ||
| 229 | src7 = vec_sub(src7, signed_bias); | ||
| 230 | } | ||
| 231 | src0 = vec_sl(src0, rangered_shift); | ||
| 232 | src1 = vec_sl(src1, rangered_shift); | ||
| 233 | src2 = vec_sl(src2, rangered_shift); | ||
| 234 | src3 = vec_sl(src3, rangered_shift); | ||
| 235 | src4 = vec_sl(src4, rangered_shift); | ||
| 236 | src5 = vec_sl(src5, rangered_shift); | ||
| 237 | src6 = vec_sl(src6, rangered_shift); | ||
| 238 | src7 = vec_sl(src7, rangered_shift); | ||
| 239 | } | ||
| 240 | |||
| 241 | vec_st(src0, 0, block); | 216 | vec_st(src0, 0, block); |
| 242 | vec_st(src1, 16, block); | 217 | vec_st(src1, 16, block); |
| 243 | vec_st(src2, 32, block); | 218 | vec_st(src2, 32, block); |
| @@ -248,36 +223,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], · 4 unmodified lines | |||
| 248 | vec_st(src7,112, block); | 223 | vec_st(src7,112, block); |
| 249 | } | 224 | } |
| 250 | 225 | ||
| 251 | static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b) | ||
| 252 | { | ||
| 253 | vc1_inv_trans_8x8_altivec(b, 0, 0); | ||
| 254 | ff_add_pixels_clamped_c(b, dest, stride); | ||
| 255 | } | ||
| 256 | |||
| 257 | static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b) | ||
| 258 | { | ||
| 259 | vc1_inv_trans_8x8_altivec(b, 1, 0); | ||
| 260 | ff_put_signed_pixels_clamped_c(b, dest, stride); | ||
| 261 | } | ||
| 262 | |||
| 263 | static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) | ||
| 264 | { | ||
| 265 | vc1_inv_trans_8x8_altivec(b, 1, 1); | ||
| 266 | ff_put_signed_pixels_clamped_c(b, dest, stride); | ||
| 267 | } | ||
| 268 | |||
| 269 | static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b) | ||
| 270 | { | ||
| 271 | vc1_inv_trans_8x8_altivec(b, 0, 0); | ||
| 272 | ff_put_pixels_clamped_c(b, dest, stride); | ||
| 273 | } | ||
| 274 | |||
| 275 | static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) | ||
| 276 | { | ||
| 277 | vc1_inv_trans_8x8_altivec(b, 0, 1); | ||
| 278 | ff_put_pixels_clamped_c(b, dest, stride); | ||
| 279 | } | ||
| 280 | |||
| 281 | /** Do inverse transform on 8x4 part of block | 226 | /** Do inverse transform on 8x4 part of block |
| 282 | */ | 227 | */ |
| 283 | static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) | 228 | static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) |
| @@ -396,11 +341,7 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) · 112 unmodified lines | |||
| 396 | if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) | 341 | if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) |
| 397 | return; | 342 | return; |
| 398 | 343 | ||
| 399 | dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec; | 344 | dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; |
| 400 | dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec; | ||
| 401 | dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec; | ||
| 402 | dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec; | ||
| 403 | dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec; | ||
| 404 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; | 345 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; |
| 405 | dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; | 346 | dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; |
| 406 | dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; | 347 | dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; |
| @@ -280,28 +280,6 @@ static int vop_dquant_decoding(VC1Context *v) · 279 unmodified lines | |||
| 280 | 280 | ||
| 281 | static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); | 281 | static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); |
| 282 | 282 | ||
| 283 | static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block) | ||
| 284 | { | ||
| 285 | int i; | ||
| 286 | ff_simple_idct(block); | ||
| 287 | for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1; | ||
| 288 | ff_put_pixels_clamped_c(block, dest, line_size); | ||
| 289 | } | ||
| 290 | |||
| 291 | static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block) | ||
| 292 | { | ||
| 293 | ff_simple_idct(block); | ||
| 294 | ff_put_signed_pixels_clamped_c(block, dest, line_size); | ||
| 295 | } | ||
| 296 | |||
| 297 | static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block) | ||
| 298 | { | ||
| 299 | int i; | ||
| 300 | ff_simple_idct(block); | ||
| 301 | for (i = 0; i < 64; i++) block[i] <<= 1; | ||
| 302 | ff_put_signed_pixels_clamped_c(block, dest, line_size); | ||
| 303 | } | ||
| 304 | |||
| 305 | /** | 283 | /** |
| 306 | * Decode Simple/Main Profiles sequence header | 284 | * Decode Simple/Main Profiles sequence header |
| 307 | * @see Figure 7-8, p16-17 | 285 | * @see Figure 7-8, p16-17 |
| @@ -359,11 +337,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte · 51 unmodified lines | |||
| 359 | v->res_fasttx = get_bits1(gb); | 337 | v->res_fasttx = get_bits1(gb); |
| 360 | if (!v->res_fasttx) | 338 | if (!v->res_fasttx) |
| 361 | { | 339 | { |
| 362 | v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add; | 340 | v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; |
| 363 | v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put; | ||
| 364 | v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered; | ||
| 365 | v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed; | ||
| 366 | v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered; | ||
| 367 | v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; | 341 | v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; |
| 368 | v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; | 342 | v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; |
| 369 | v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; | 343 | v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; |
| @@ -317,6 +317,8 @@ typedef struct VC1Context{ · 316 unmodified lines | |||
| 317 | int bi_type; | 317 | int bi_type; |
| 318 | int x8_type; | 318 | int x8_type; |
| 319 | 319 | ||
| 320 | DCTELEM (*block)[6][64]; | ||
| 321 | int n_allocated_blks, cur_blk_idx, left_blk_idx, topleft_blk_idx, top_blk_idx; | ||
| 320 | uint32_t *cbp_base, *cbp; | 322 | uint32_t *cbp_base, *cbp; |
| 321 | uint8_t *is_intra_base, *is_intra; | 323 | uint8_t *is_intra_base, *is_intra; |
| 322 | int16_t (*luma_mv_base)[2], (*luma_mv)[2]; | 324 | int16_t (*luma_mv_base)[2], (*luma_mv)[2]; |
| @@ -160,6 +160,72 @@ enum Imode { · 159 unmodified lines | |||
| 160 | 160 | ||
| 161 | /** @} */ //Bitplane group | 161 | /** @} */ //Bitplane group |
| 162 | 162 | ||
| 163 | static void vc1_put_signed_blocks_clamped(VC1Context *v) | ||
| 164 | { | ||
| 165 | MpegEncContext *s = &v->s; | ||
| 166 | |||
| 167 | /* The put pixels loop is always one MB row behind the decoding loop, | ||
| 168 | * because we can only put pixels when overlap filtering is done, and | ||
| 169 | * for filtering of the bottom edge of a MB, we need the next MB row | ||
| 170 | * present as well. | ||
| 171 | * Within the row, the put pixels loop is also one MB col behind the | ||
| 172 | * decoding loop. The reason for this is again, because for filtering | ||
| 173 | * of the right MB edge, we need the next MB present. */ | ||
| 174 | if (!s->first_slice_line) { | ||
| 175 | if (s->mb_x) { | ||
| 176 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][0], | ||
| 177 | s->dest[0] - 16 * s->linesize - 16, | ||
| 178 | s->linesize); | ||
| 179 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][1], | ||
| 180 | s->dest[0] - 16 * s->linesize - 8, | ||
| 181 | s->linesize); | ||
| 182 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][2], | ||
| 183 | s->dest[0] - 8 * s->linesize - 16, | ||
| 184 | s->linesize); | ||
| 185 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][3], | ||
| 186 | s->dest[0] - 8 * s->linesize - 8, | ||
| 187 | s->linesize); | ||
| 188 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][4], | ||
| 189 | s->dest[1] - 8 * s->uvlinesize - 8, | ||
| 190 | s->uvlinesize); | ||
| 191 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][5], | ||
| 192 | s->dest[2] - 8 * s->uvlinesize - 8, | ||
| 193 | s->uvlinesize); | ||
| 194 | } | ||
| 195 | if (s->mb_x == s->mb_width - 1) { | ||
| 196 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][0], | ||
| 197 | s->dest[0] - 16 * s->linesize, | ||
| 198 | s->linesize); | ||
| 199 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][1], | ||
| 200 | s->dest[0] - 16 * s->linesize + 8, | ||
| 201 | s->linesize); | ||
| 202 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][2], | ||
| 203 | s->dest[0] - 8 * s->linesize, | ||
| 204 | s->linesize); | ||
| 205 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][3], | ||
| 206 | s->dest[0] - 8 * s->linesize + 8, | ||
| 207 | s->linesize); | ||
| 208 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][4], | ||
| 209 | s->dest[1] - 8 * s->uvlinesize, | ||
| 210 | s->uvlinesize); | ||
| 211 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][5], | ||
| 212 | s->dest[2] - 8 * s->uvlinesize, | ||
| 213 | s->uvlinesize); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | |||
| 217 | #define inc_blk_idx(idx) do { \ | ||
| 218 | idx++; \ | ||
| 219 | if (idx >= v->n_allocated_blks) \ | ||
| 220 | idx = 0; \ | ||
| 221 | } while (0) | ||
| 222 | |||
| 223 | inc_blk_idx(v->topleft_blk_idx); | ||
| 224 | inc_blk_idx(v->top_blk_idx); | ||
| 225 | inc_blk_idx(v->left_blk_idx); | ||
| 226 | inc_blk_idx(v->cur_blk_idx); | ||
| 227 | } | ||
| 228 | |||
| 163 | static void vc1_loop_filter_iblk(VC1Context *v, int pq) | 229 | static void vc1_loop_filter_iblk(VC1Context *v, int pq) |
| 164 | { | 230 | { |
| 165 | MpegEncContext *s = &v->s; | 231 | MpegEncContext *s = &v->s; |
| @@ -187,6 +253,151 @@ static void vc1_loop_filter_iblk(VC1Context *v, int pq) · 21 unmodified lines | |||
| 187 | } | 253 | } |
| 188 | } | 254 | } |
| 189 | 255 | ||
| 256 | static void vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) | ||
| 257 | { | ||
| 258 | MpegEncContext *s = &v->s; | ||
| 259 | int j; | ||
| 260 | |||
| 261 | /* The loopfilter runs 1 row and 1 column behind the overlap filter, which | ||
| 262 | * means it runs two rows/cols behind the decoding loop. */ | ||
| 263 | if (!s->first_slice_line) { | ||
| 264 | if (s->mb_x) { | ||
| 265 | if (s->mb_y >= s->start_mb_y + 2) { | ||
| 266 | v->vc1dsp.vc1_v_loop_filter16(s->dest[0] - 16 * s->linesize - 16, s->linesize, pq); | ||
| 267 | |||
| 268 | if (s->mb_x >= 2) | ||
| 269 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 16, s->linesize, pq); | ||
| 270 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 8, s->linesize, pq); | ||
| 271 | for(j = 0; j < 2; j++) { | ||
| 272 | v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); | ||
| 273 | if (s->mb_x >= 2) { | ||
| 274 | v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 16 * s->uvlinesize - 8, s->uvlinesize, pq); | ||
| 275 | } | ||
| 276 | } | ||
| 277 | } | ||
| 278 | v->vc1dsp.vc1_v_loop_filter16(s->dest[0] - 8 * s->linesize - 16, s->linesize, pq); | ||
| 279 | } | ||
| 280 | |||
| 281 | if (s->mb_x == s->mb_width - 1) { | ||
| 282 | if (s->mb_y >= s->start_mb_y + 2) { | ||
| 283 | v->vc1dsp.vc1_v_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); | ||
| 284 | |||
| 285 | if (s->mb_x) | ||
| 286 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize, s->linesize, pq); | ||
| 287 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize + 8, s->linesize, pq); | ||
| 288 | for(j = 0; j < 2; j++) { | ||
| 289 | v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize, s->uvlinesize, pq); | ||
| 290 | if (s->mb_x >= 2) { | ||
| 291 | v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 16 * s->uvlinesize, s->uvlinesize, pq); | ||
| 292 | } | ||
| 293 | } | ||
| 294 | } | ||
| 295 | v->vc1dsp.vc1_v_loop_filter16(s->dest[0] - 8 * s->linesize, s->linesize, pq); | ||
| 296 | } | ||
| 297 | |||
| 298 | if (s->mb_y == s->mb_height) { | ||
| 299 | if (s->mb_x) { | ||
| 300 | if (s->mb_x >= 2) | ||
| 301 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 16, s->linesize, pq); | ||
| 302 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 8, s->linesize, pq); | ||
| 303 | if (s->mb_x >= 2) { | ||
| 304 | for(j = 0; j < 2; j++) { | ||
| 305 | v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); | ||
| 306 | } | ||
| 307 | } | ||
| 308 | } | ||
| 309 | |||
| 310 | if (s->mb_x == s->mb_width - 1) { | ||
| 311 | if (s->mb_x) | ||
| 312 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); | ||
| 313 | v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq); | ||
| 314 | if (s->mb_x) { | ||
| 315 | for(j = 0; j < 2; j++) { | ||
| 316 | v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize, s->uvlinesize, pq); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | } | ||
| 320 | } | ||
| 321 | } | ||
| 322 | } | ||
| 323 | |||
| 324 | static void vc1_smooth_overlap_filter_iblk(VC1Context *v) | ||
| 325 | { | ||
| 326 | MpegEncContext *s = &v->s; | ||
| 327 | int mb_pos; | ||
| 328 | |||
| 329 | if (v->condover == CONDOVER_NONE) | ||
| 330 | return; | ||
| 331 | |||
| 332 | mb_pos = s->mb_x + s->mb_y * s->mb_stride; | ||
| 333 | |||
| 334 | /* Within a MB, the horizontal overlap always runs before the vertical. | ||
| 335 | * To accomplish that, we run the H on left and internal borders of the | ||
| 336 | * currently decoded MB. Then, we wait for the next overlap iteration | ||
| 337 | * to do H overlap on the right edge of this MB, before moving over and | ||
| 338 | * running the V overlap. Therefore, the V overlap makes us trail by one | ||
| 339 | * MB col and the H overlap filter makes us trail by one MB row. This | ||
| 340 | * is reflected in the time at which we run the put_pixels loop. */ | ||
| 341 | if(v->condover == CONDOVER_ALL || v->pq >= 9 || v->over_flags_plane[mb_pos]) { | ||
| 342 | if(s->mb_x && (v->condover == CONDOVER_ALL || v->pq >= 9 || | ||
| 343 | v->over_flags_plane[mb_pos - 1])) { | ||
| 344 | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][1], | ||
| 345 | v->block[v->cur_blk_idx][0]); | ||
| 346 | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][3], | ||
| 347 | v->block[v->cur_blk_idx][2]); | ||
| 348 | if(!(s->flags & CODEC_FLAG_GRAY)) { | ||
| 349 | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][4], | ||
| 350 | v->block[v->cur_blk_idx][4]); | ||
| 351 | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][5], | ||
| 352 | v->block[v->cur_blk_idx][5]); | ||
| 353 | } | ||
| 354 | } | ||
| 355 | v->vc1dsp.vc1_h_s_overlap(v->block[v->cur_blk_idx][0], | ||
| 356 | v->block[v->cur_blk_idx][1]); | ||
| 357 | v->vc1dsp.vc1_h_s_overlap(v->block[v->cur_blk_idx][2], | ||
| 358 | v->block[v->cur_blk_idx][3]); | ||
| 359 | |||
| 360 | if (s->mb_x == s->mb_width - 1) { | ||
| 361 | if(!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || | ||
| 362 | v->over_flags_plane[mb_pos - s->mb_stride])) { | ||
| 363 | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][2], | ||
| 364 | v->block[v->cur_blk_idx][0]); | ||
| 365 | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][3], | ||
| 366 | v->block[v->cur_blk_idx][1]); | ||
| 367 | if(!(s->flags & CODEC_FLAG_GRAY)) { | ||
| 368 | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][4], | ||
| 369 | v->block[v->cur_blk_idx][4]); | ||
| 370 | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][5], | ||
| 371 | v->block[v->cur_blk_idx][5]); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | v->vc1dsp.vc1_v_s_overlap(v->block[v->cur_blk_idx][0], | ||
| 375 | v->block[v->cur_blk_idx][2]); | ||
| 376 | v->vc1dsp.vc1_v_s_overlap(v->block[v->cur_blk_idx][1], | ||
| 377 | v->block[v->cur_blk_idx][3]); | ||
| 378 | } | ||
| 379 | } | ||
| 380 | if (s->mb_x && (v->condover == CONDOVER_ALL || v->over_flags_plane[mb_pos - 1])) { | ||
| 381 | if(!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || | ||
| 382 | v->over_flags_plane[mb_pos - s->mb_stride - 1])) { | ||
| 383 | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][2], | ||
| 384 | v->block[v->left_blk_idx][0]); | ||
| 385 | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][3], | ||
| 386 | v->block[v->left_blk_idx][1]); | ||
| 387 | if(!(s->flags & CODEC_FLAG_GRAY)) { | ||
| 388 | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][4], | ||
| 389 | v->block[v->left_blk_idx][4]); | ||
| 390 | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][5], | ||
| 391 | v->block[v->left_blk_idx][5]); | ||
| 392 | } | ||
| 393 | } | ||
| 394 | v->vc1dsp.vc1_v_s_overlap(v->block[v->left_blk_idx][0], | ||
| 395 | v->block[v->left_blk_idx][2]); | ||
| 396 | v->vc1dsp.vc1_v_s_overlap(v->block[v->left_blk_idx][1], | ||
| 397 | v->block[v->left_blk_idx][3]); | ||
| 398 | } | ||
| 399 | } | ||
| 400 | |||
| 190 | /** Do motion compensation over 1 macroblock | 401 | /** Do motion compensation over 1 macroblock |
| 191 | * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c | 402 | * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c |
| 192 | */ | 403 | */ |
| @@ -2016,7 +2227,8 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan · 1823 unmodified lines | |||
| 2016 | if(i==1) | 2227 | if(i==1) |
| 2017 | v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); | 2228 | v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); |
| 2018 | else{ | 2229 | else{ |
| 2019 | v->vc1dsp.vc1_inv_trans_8x8_add(dst, linesize, block); | 2230 | v->vc1dsp.vc1_inv_trans_8x8(block); |
| 2231 | s->dsp.add_pixels_clamped(block, dst, linesize); | ||
| 2020 | } | 2232 | } |
| 2021 | } | 2233 | } |
| 2022 | break; | 2234 | break; |
| @@ -2258,7 +2470,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 235 unmodified lines | |||
| 2258 | { | 2470 | { |
| 2259 | MpegEncContext *s = &v->s; | 2471 | MpegEncContext *s = &v->s; |
| 2260 | GetBitContext *gb = &s->gb; | 2472 | GetBitContext *gb = &s->gb; |
| 2261 | int i; | 2473 | int i, j; |
| 2262 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; | 2474 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2263 | int cbp; /* cbp decoding stuff */ | 2475 | int cbp; /* cbp decoding stuff */ |
| 2264 | int mqdiff, mquant; /* MB quantization */ | 2476 | int mqdiff, mquant; /* MB quantization */ |
| @@ -2288,8 +2500,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 23 unmodified lines | |||
| 2288 | { | 2500 | { |
| 2289 | if (!skipped) | 2501 | if (!skipped) |
| 2290 | { | 2502 | { |
| 2291 | vc1_idct_func idct8x8_fn; | ||
| 2292 | |||
| 2293 | GET_MVDATA(dmv_x, dmv_y); | 2503 | GET_MVDATA(dmv_x, dmv_y); |
| 2294 | 2504 | ||
| 2295 | if (s->mb_intra) { | 2505 | if (s->mb_intra) { |
| @@ -2324,7 +2534,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 28 unmodified lines | |||
| 2324 | VC1_TTMB_VLC_BITS, 2); | 2534 | VC1_TTMB_VLC_BITS, 2); |
| 2325 | if(!s->mb_intra) vc1_mc_1mv(v, 0); | 2535 | if(!s->mb_intra) vc1_mc_1mv(v, 0); |
| 2326 | dst_idx = 0; | 2536 | dst_idx = 0; |
| 2327 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | ||
| 2328 | for (i=0; i<6; i++) | 2537 | for (i=0; i<6; i++) |
| 2329 | { | 2538 | { |
| 2330 | s->dc_val[0][s->block_index[i]] = 0; | 2539 | s->dc_val[0][s->block_index[i]] = 0; |
| @@ -2342,9 +2551,9 @@ static int vc1_decode_p_mb(VC1Context *v) · 11 unmodified lines | |||
| 2342 | 2551 | ||
| 2343 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); | 2552 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
| 2344 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; | 2553 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2345 | idct8x8_fn(s->dest[dst_idx] + off, | 2554 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); |
| 2346 | i & 4 ? s->uvlinesize : s->linesize, | 2555 | if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
| 2347 | s->block[i]); | 2556 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| 2348 | if(v->pq >= 9 && v->overlap) { | 2557 | if(v->pq >= 9 && v->overlap) { |
| 2349 | if(v->c_avail) | 2558 | if(v->c_avail) |
| 2350 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 2559 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| @@ -2380,7 +2589,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 29 unmodified lines | |||
| 2380 | { | 2589 | { |
| 2381 | int intra_count = 0, coded_inter = 0; | 2590 | int intra_count = 0, coded_inter = 0; |
| 2382 | int is_intra[6], is_coded[6]; | 2591 | int is_intra[6], is_coded[6]; |
| 2383 | vc1_idct_func idct8x8_fn; | ||
| 2384 | /* Get CBPCY */ | 2592 | /* Get CBPCY */ |
| 2385 | cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); | 2593 | cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
| 2386 | for (i=0; i<6; i++) | 2594 | for (i=0; i<6; i++) |
| @@ -2431,7 +2639,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 44 unmodified lines | |||
| 2431 | } | 2639 | } |
| 2432 | if (!v->ttmbf && coded_inter) | 2640 | if (!v->ttmbf && coded_inter) |
| 2433 | ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); | 2641 | ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); |
| 2434 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | ||
| 2435 | for (i=0; i<6; i++) | 2642 | for (i=0; i<6; i++) |
| 2436 | { | 2643 | { |
| 2437 | dst_idx += i >> 2; | 2644 | dst_idx += i >> 2; |
| @@ -2447,9 +2654,9 @@ static int vc1_decode_p_mb(VC1Context *v) · 9 unmodified lines | |||
| 2447 | 2654 | ||
| 2448 | vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); | 2655 | vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); |
| 2449 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; | 2656 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2450 | idct8x8_fn(s->dest[dst_idx] + off, | 2657 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); |
| 2451 | (i&4)?s->uvlinesize:s->linesize, | 2658 | if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
| 2452 | s->block[i]); | 2659 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); |
| 2453 | if(v->pq >= 9 && v->overlap) { | 2660 | if(v->pq >= 9 && v->overlap) { |
| 2454 | if(v->c_avail) | 2661 | if(v->c_avail) |
| 2455 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 2662 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| @@ -2497,7 +2704,7 @@ static void vc1_decode_b_mb(VC1Context *v) · 41 unmodified lines | |||
| 2497 | { | 2704 | { |
| 2498 | MpegEncContext *s = &v->s; | 2705 | MpegEncContext *s = &v->s; |
| 2499 | GetBitContext *gb = &s->gb; | 2706 | GetBitContext *gb = &s->gb; |
| 2500 | int i; | 2707 | int i, j; |
| 2501 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; | 2708 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2502 | int cbp = 0; /* cbp decoding stuff */ | 2709 | int cbp = 0; /* cbp decoding stuff */ |
| 2503 | int mqdiff, mquant; /* MB quantization */ | 2710 | int mqdiff, mquant; /* MB quantization */ |
| @@ -2510,7 +2717,6 @@ static void vc1_decode_b_mb(VC1Context *v) · 6 unmodified lines | |||
| 2510 | int skipped, direct; | 2717 | int skipped, direct; |
| 2511 | int dmv_x[2], dmv_y[2]; | 2718 | int dmv_x[2], dmv_y[2]; |
| 2512 | int bmvtype = BMV_TYPE_BACKWARD; | 2719 | int bmvtype = BMV_TYPE_BACKWARD; |
| 2513 | vc1_idct_func idct8x8_fn; | ||
| 2514 | 2720 | ||
| 2515 | mquant = v->pq; /* Loosy initialization */ | 2721 | mquant = v->pq; /* Loosy initialization */ |
| 2516 | s->mb_intra = 0; | 2722 | s->mb_intra = 0; |
| @@ -2608,7 +2814,6 @@ static void vc1_decode_b_mb(VC1Context *v) · 91 unmodified lines | |||
| 2608 | } | 2814 | } |
| 2609 | } | 2815 | } |
| 2610 | dst_idx = 0; | 2816 | dst_idx = 0; |
| 2611 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | ||
| 2612 | for (i=0; i<6; i++) | 2817 | for (i=0; i<6; i++) |
| 2613 | { | 2818 | { |
| 2614 | s->dc_val[0][s->block_index[i]] = 0; | 2819 | s->dc_val[0][s->block_index[i]] = 0; |
| @@ -2626,9 +2831,9 @@ static void vc1_decode_b_mb(VC1Context *v) · 11 unmodified lines | |||
| 2626 | 2831 | ||
| 2627 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); | 2832 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
| 2628 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; | 2833 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2629 | idct8x8_fn(s->dest[dst_idx] + off, | 2834 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); |
| 2630 | i & 4 ? s->uvlinesize : s->linesize, | 2835 | if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; |
| 2631 | s->block[i]); | 2836 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| 2632 | } else if(val) { | 2837 | } else if(val) { |
| 2633 | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), NULL); | 2838 | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), NULL); |
| 2634 | if(!v->ttmbf && ttmb < 8) ttmb = -1; | 2839 | if(!v->ttmbf && ttmb < 8) ttmb = -1; |
| @@ -2641,12 +2846,11 @@ static void vc1_decode_b_mb(VC1Context *v) · 6 unmodified lines | |||
| 2641 | */ | 2846 | */ |
| 2642 | static void vc1_decode_i_blocks(VC1Context *v) | 2847 | static void vc1_decode_i_blocks(VC1Context *v) |
| 2643 | { | 2848 | { |
| 2644 | int k; | 2849 | int k, j; |
| 2645 | MpegEncContext *s = &v->s; | 2850 | MpegEncContext *s = &v->s; |
| 2646 | int cbp, val; | 2851 | int cbp, val; |
| 2647 | uint8_t *coded_val; | 2852 | uint8_t *coded_val; |
| 2648 | int mb_pos; | 2853 | int mb_pos; |
| 2649 | vc1_idct_func idct8x8_fn; | ||
| 2650 | 2854 | ||
| 2651 | /* select codingmode used for VLC tables selection */ | 2855 | /* select codingmode used for VLC tables selection */ |
| 2652 | switch(v->y_ac_table_index){ | 2856 | switch(v->y_ac_table_index){ |
| @@ -2681,10 +2885,6 @@ static void vc1_decode_i_blocks(VC1Context *v) · 28 unmodified lines | |||
| 2681 | s->mb_x = s->mb_y = 0; | 2885 | s->mb_x = s->mb_y = 0; |
| 2682 | s->mb_intra = 1; | 2886 | s->mb_intra = 1; |
| 2683 | s->first_slice_line = 1; | 2887 | s->first_slice_line = 1; |
| 2684 | if(v->pq >= 9 && v->overlap) { | ||
| 2685 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | ||
| 2686 | } else | ||
| 2687 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put[!!v->rangeredfrm]; | ||
| 2688 | for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { | 2888 | for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
| 2689 | s->mb_x = 0; | 2889 | s->mb_x = 0; |
| 2690 | ff_init_block_index(s); | 2890 | ff_init_block_index(s); |
| @@ -2721,9 +2921,14 @@ static void vc1_decode_i_blocks(VC1Context *v) · 30 unmodified lines | |||
| 2721 | vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); | 2921 | vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); |
| 2722 | 2922 | ||
| 2723 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; | 2923 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2724 | idct8x8_fn(dst[k], | 2924 | v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); |
| 2725 | k & 4 ? s->uvlinesize : s->linesize, | 2925 | if(v->pq >= 9 && v->overlap) { |
| 2726 | s->block[k]); | 2926 | if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] <<= 1; |
| 2927 | s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); | ||
| 2928 | } else { | ||
| 2929 | if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] = (s->block[k][j] - 64) << 1; | ||
| 2930 | s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); | ||
| 2931 | } | ||
| 2727 | } | 2932 | } |
| 2728 | 2933 | ||
| 2729 | if(v->pq >= 9 && v->overlap) { | 2934 | if(v->pq >= 9 && v->overlap) { |
| @@ -2770,7 +2975,7 @@ static void vc1_decode_i_blocks(VC1Context *v) · 40 unmodified lines | |||
| 2770 | 2975 | ||
| 2771 | /** Decode blocks of I-frame for advanced profile | 2976 | /** Decode blocks of I-frame for advanced profile |
| 2772 | */ | 2977 | */ |
| 2773 | static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) | 2978 | static void vc1_decode_i_blocks_adv(VC1Context *v) |
| 2774 | { | 2979 | { |
| 2775 | int k; | 2980 | int k; |
| 2776 | MpegEncContext *s = &v->s; | 2981 | MpegEncContext *s = &v->s; |
| @@ -2779,9 +2984,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) · 2 unmodified lines | |||
| 2779 | int mb_pos; | 2984 | int mb_pos; |
| 2780 | int mquant = v->pq; | 2985 | int mquant = v->pq; |
| 2781 | int mqdiff; | 2986 | int mqdiff; |
| 2782 | int overlap; | ||
| 2783 | GetBitContext *gb = &s->gb; | 2987 | GetBitContext *gb = &s->gb; |
| 2784 | vc1_idct_func idct8x8_fn; | ||
| 2785 | 2988 | ||
| 2786 | /* select codingmode used for VLC tables selection */ | 2989 | /* select codingmode used for VLC tables selection */ |
| 2787 | switch(v->y_ac_table_index){ | 2990 | switch(v->y_ac_table_index){ |
| @@ -2812,27 +3015,20 @@ static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) · 24 unmodified lines | |||
| 2812 | s->mb_x = s->mb_y = 0; | 3015 | s->mb_x = s->mb_y = 0; |
| 2813 | s->mb_intra = 1; | 3016 | s->mb_intra = 1; |
| 2814 | s->first_slice_line = 1; | 3017 | s->first_slice_line = 1; |
| 2815 | s->mb_y = mby_start; | 3018 | s->mb_y = s->start_mb_y; |
| 2816 | if (mby_start) { | 3019 | if (s->start_mb_y) { |
| 2817 | s->mb_x = 0; | 3020 | s->mb_x = 0; |
| 2818 | ff_init_block_index(s); | 3021 | ff_init_block_index(s); |
| 2819 | memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, | 3022 | memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, |
| 2820 | s->b8_stride * sizeof(*s->coded_block)); | 3023 | s->b8_stride * sizeof(*s->coded_block)); |
| 2821 | } | 3024 | } |
| 2822 | idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[0]; | 3025 | for(; s->mb_y < s->end_mb_y; s->mb_y++) { |
| 2823 | for(; s->mb_y < mby_end; s->mb_y++) { | ||
| 2824 | s->mb_x = 0; | 3026 | s->mb_x = 0; |
| 2825 | ff_init_block_index(s); | 3027 | ff_init_block_index(s); |
| 2826 | for(;s->mb_x < s->mb_width; s->mb_x++) { | 3028 | for(;s->mb_x < s->mb_width; s->mb_x++) { |
| 2827 | uint8_t *dst[6]; | 3029 | DCTELEM (*block)[64] = v->block[v->cur_blk_idx]; |
| 2828 | ff_update_block_index(s); | 3030 | ff_update_block_index(s); |
| 2829 | dst[0] = s->dest[0]; | 3031 | s->dsp.clear_blocks(block[0]); |
| 2830 | dst[1] = dst[0] + 8; | ||
| 2831 | dst[2] = s->dest[0] + s->linesize * 8; | ||
| 2832 | dst[3] = dst[2] + 8; | ||
| 2833 | dst[4] = s->dest[1]; | ||
| 2834 | dst[5] = s->dest[2]; | ||
| 2835 | s->dsp.clear_blocks(s->block[0]); | ||
| 2836 | mb_pos = s->mb_x + s->mb_y * s->mb_stride; | 3032 | mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2837 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; | 3033 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
| 2838 | s->current_picture.motion_val[1][s->block_index[0]][0] = 0; | 3034 | s->current_picture.motion_val[1][s->block_index[0]][0] = 0; |
| @@ -2845,13 +3041,8 @@ static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) · 6 unmodified lines | |||
| 2845 | else | 3041 | else |
| 2846 | v->s.ac_pred = v->acpred_plane[mb_pos]; | 3042 | v->s.ac_pred = v->acpred_plane[mb_pos]; |
| 2847 | 3043 | ||
| 2848 | if(v->condover == CONDOVER_SELECT) { | 3044 | if (v->condover == CONDOVER_SELECT && v->overflg_is_raw) |
| 2849 | if(v->overflg_is_raw) | 3045 | v->over_flags_plane[mb_pos] = get_bits1(&v->s.gb); |
| 2850 | overlap = get_bits1(&v->s.gb); | ||
| 2851 | else | ||
| 2852 | overlap = v->over_flags_plane[mb_pos]; | ||
| 2853 | } else | ||
| 2854 | overlap = (v->condover == CONDOVER_ALL); | ||
| 2855 | 3046 | ||
| 2856 | GET_MQUANT(); | 3047 | GET_MQUANT(); |
| 2857 | 3048 | ||
| @@ -2873,40 +3064,18 @@ static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) · 15 unmodified lines | |||
| 2873 | v->a_avail = !s->first_slice_line || (k==2 || k==3); | 3064 | v->a_avail = !s->first_slice_line || (k==2 || k==3); |
| 2874 | v->c_avail = !!s->mb_x || (k==1 || k==3); | 3065 | v->c_avail = !!s->mb_x || (k==1 || k==3); |
| 2875 | 3066 | ||
| 2876 | vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); | 3067 | vc1_decode_i_block_adv(v, block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); |
| 2877 | 3068 | ||
| 2878 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; | 3069 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2879 | idct8x8_fn(dst[k], | 3070 | v->vc1dsp.vc1_inv_trans_8x8(block[k]); |
| 2880 | k & 4 ? s->uvlinesize : s->linesize, | ||
| 2881 | s->block[k]); | ||
| 2882 | } | 3071 | } |
| 2883 | 3072 | ||
| 2884 | if(overlap) { | 3073 | vc1_smooth_overlap_filter_iblk(v); |
| 2885 | if(s->mb_x) { | 3074 | vc1_put_signed_blocks_clamped(v); |
| 2886 | v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); | 3075 | if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); |
| 2887 | v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); | ||
| 2888 | if(!(s->flags & CODEC_FLAG_GRAY)) { | ||
| 2889 | v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); | ||
| 2890 | v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); | ||
| 2891 | } | ||
| 2892 | } | ||
| 2893 | v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); | ||
| 2894 | v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); | ||
| 2895 | if(!s->first_slice_line) { | ||
| 2896 | v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); | ||
| 2897 | v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); | ||
| 2898 | if(!(s->flags & CODEC_FLAG_GRAY)) { | ||
| 2899 | v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); | ||
| 2900 | v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); | ||
| 2901 | } | ||
| 2902 | } | ||
| 2903 | v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); | ||
| 2904 | v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); | ||
| 2905 | } | ||
| 2906 | if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); | ||
| 2907 | 3076 | ||
| 2908 | if(get_bits_count(&s->gb) > v->bits) { | 3077 | if(get_bits_count(&s->gb) > v->bits) { |
| 2909 | ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); | 3078 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
| 2910 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); | 3079 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); |
| 2911 | return; | 3080 | return; |
| 2912 | } | 3081 | } |
| @@ -2917,12 +3086,21 @@ static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end) · 4 unmodified lines | |||
| 2917 | ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); | 3086 | ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); |
| 2918 | s->first_slice_line = 0; | 3087 | s->first_slice_line = 0; |
| 2919 | } | 3088 | } |
| 3089 | |||
| 3090 | /* raw bottom MB row */ | ||
| 3091 | s->mb_x = 0; | ||
| 3092 | ff_init_block_index(s); | ||
| 3093 | for(;s->mb_x < s->mb_width; s->mb_x++) { | ||
| 3094 | ff_update_block_index(s); | ||
| 3095 | vc1_put_signed_blocks_clamped(v); | ||
| 3096 | if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); | ||
| 3097 | } | ||
| 2920 | if (v->s.loop_filter) | 3098 | if (v->s.loop_filter) |
| 2921 | ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); | 3099 | ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); |
| 2922 | ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END)); | 3100 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); |
| 2923 | } | 3101 | } |
| 2924 | 3102 | ||
| 2925 | static void vc1_decode_p_blocks(VC1Context *v, int mby_start, int mby_end) | 3103 | static void vc1_decode_p_blocks(VC1Context *v) |
| 2926 | { | 3104 | { |
| 2927 | MpegEncContext *s = &v->s; | 3105 | MpegEncContext *s = &v->s; |
| 2928 | int apply_loop_filter; | 3106 | int apply_loop_filter; |
| @@ -2955,17 +3133,17 @@ static void vc1_decode_p_blocks(VC1Context *v, int mby_start, int mby_end) · 26 unmodified lines | |||
| 2955 | apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); | 3133 | apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); |
| 2956 | s->first_slice_line = 1; | 3134 | s->first_slice_line = 1; |
| 2957 | memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); | 3135 | memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); |
| 2958 | for(s->mb_y = mby_start; s->mb_y < mby_end; s->mb_y++) { | 3136 | for(s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { |
| 2959 | s->mb_x = 0; | 3137 | s->mb_x = 0; |
| 2960 | ff_init_block_index(s); | 3138 | ff_init_block_index(s); |
| 2961 | for(; s->mb_x < s->mb_width; s->mb_x++) { | 3139 | for(; s->mb_x < s->mb_width; s->mb_x++) { |
| 2962 | ff_update_block_index(s); | 3140 | ff_update_block_index(s); |
| 2963 | 3141 | ||
| 2964 | vc1_decode_p_mb(v); | 3142 | vc1_decode_p_mb(v); |
| 2965 | if (s->mb_y != mby_start && apply_loop_filter) | 3143 | if (s->mb_y != s->start_mb_y && apply_loop_filter) |
| 2966 | vc1_apply_p_loop_filter(v); | 3144 | vc1_apply_p_loop_filter(v); |
| 2967 | if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { | 3145 | if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { |
| 2968 | ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); | 3146 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
| 2969 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); | 3147 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); |
| 2970 | return; | 3148 | return; |
| 2971 | } | 3149 | } |
| @@ -2974,7 +3152,7 @@ static void vc1_decode_p_blocks(VC1Context *v, int mby_start, int mby_end) · 2 unmodified lines | |||
| 2974 | memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0])*s->mb_stride); | 3152 | memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0])*s->mb_stride); |
| 2975 | memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); | 3153 | memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); |
| 2976 | memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0])*s->mb_stride); | 3154 | memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0])*s->mb_stride); |
| 2977 | if (s->mb_y != mby_start) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); | 3155 | if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); |
| 2978 | s->first_slice_line = 0; | 3156 | s->first_slice_line = 0; |
| 2979 | } | 3157 | } |
| 2980 | if (apply_loop_filter) { | 3158 | if (apply_loop_filter) { |
| @@ -2985,12 +3163,12 @@ static void vc1_decode_p_blocks(VC1Context *v, int mby_start, int mby_end) · 4 unmodified lines | |||
| 2985 | vc1_apply_p_loop_filter(v); | 3163 | vc1_apply_p_loop_filter(v); |
| 2986 | } | 3164 | } |
| 2987 | } | 3165 | } |
| 2988 | if (mby_end >= mby_start) | 3166 | if (s->end_mb_y >= s->start_mb_y) |
| 2989 | ff_draw_horiz_band(s, (mby_end-1) * 16, 16); | 3167 | ff_draw_horiz_band(s, (s->end_mb_y-1) * 16, 16); |
| 2990 | ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END)); | 3168 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); |
| 2991 | } | 3169 | } |
| 2992 | 3170 | ||
| 2993 | static void vc1_decode_b_blocks(VC1Context *v, int mby_start, int mby_end) | 3171 | static void vc1_decode_b_blocks(VC1Context *v) |
| 2994 | { | 3172 | { |
| 2995 | MpegEncContext *s = &v->s; | 3173 | MpegEncContext *s = &v->s; |
| 2996 | 3174 | ||
| @@ -3020,7 +3198,7 @@ static void vc1_decode_b_blocks(VC1Context *v, int mby_start, int mby_end) · 23 unmodified lines | |||
| 3020 | } | 3198 | } |
| 3021 | 3199 | ||
| 3022 | s->first_slice_line = 1; | 3200 | s->first_slice_line = 1; |
| 3023 | for(s->mb_y = mby_start; s->mb_y < mby_end; s->mb_y++) { | 3201 | for(s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { |
| 3024 | s->mb_x = 0; | 3202 | s->mb_x = 0; |
| 3025 | ff_init_block_index(s); | 3203 | ff_init_block_index(s); |
| 3026 | for(; s->mb_x < s->mb_width; s->mb_x++) { | 3204 | for(; s->mb_x < s->mb_width; s->mb_x++) { |
| @@ -3028,7 +3206,7 @@ static void vc1_decode_b_blocks(VC1Context *v, int mby_start, int mby_end) · 1 unmodified line | |||
| 3028 | 3206 | ||
| 3029 | vc1_decode_b_mb(v); | 3207 | vc1_decode_b_mb(v); |
| 3030 | if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { | 3208 | if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { |
| 3031 | ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); | 3209 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); |
| 3032 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); | 3210 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); |
| 3033 | return; | 3211 | return; |
| 3034 | } | 3212 | } |
| @@ -3042,7 +3220,7 @@ static void vc1_decode_b_blocks(VC1Context *v, int mby_start, int mby_end) · 7 unmodified lines | |||
| 3042 | } | 3220 | } |
| 3043 | if (v->s.loop_filter) | 3221 | if (v->s.loop_filter) |
| 3044 | ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); | 3222 | ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); |
| 3045 | ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END)); | 3223 | ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); |
| 3046 | } | 3224 | } |
| 3047 | 3225 | ||
| 3048 | static void vc1_decode_skip_blocks(VC1Context *v) | 3226 | static void vc1_decode_skip_blocks(VC1Context *v) |
| @@ -3064,17 +3242,21 @@ static void vc1_decode_skip_blocks(VC1Context *v) · 15 unmodified lines | |||
| 3064 | s->pict_type = AV_PICTURE_TYPE_P; | 3242 | s->pict_type = AV_PICTURE_TYPE_P; |
| 3065 | } | 3243 | } |
| 3066 | 3244 | ||
| 3067 | static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) | 3245 | static void vc1_decode_blocks(VC1Context *v) |
| 3068 | { | 3246 | { |
| 3069 | 3247 | ||
| 3070 | v->s.esc3_level_length = 0; | 3248 | v->s.esc3_level_length = 0; |
| 3071 | if(v->x8_type){ | 3249 | if(v->x8_type){ |
| 3072 | ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) ); | 3250 | ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) ); |
| 3073 | }else{ | 3251 | }else{ |
| 3252 | v->cur_blk_idx = 0; | ||
| 3253 | v->left_blk_idx = -1; | ||
| 3254 | v->topleft_blk_idx = 1; | ||
| 3255 | v->top_blk_idx = 2; | ||
| 3074 | switch(v->s.pict_type) { | 3256 | switch(v->s.pict_type) { |
| 3075 | case AV_PICTURE_TYPE_I: | 3257 | case AV_PICTURE_TYPE_I: |
| 3076 | if(v->profile == PROFILE_ADVANCED) | 3258 | if(v->profile == PROFILE_ADVANCED) |
| 3077 | vc1_decode_i_blocks_adv(v, mby_start, mby_end); | 3259 | vc1_decode_i_blocks_adv(v); |
| 3078 | else | 3260 | else |
| 3079 | vc1_decode_i_blocks(v); | 3261 | vc1_decode_i_blocks(v); |
| 3080 | break; | 3262 | break; |
| @@ -3082,16 +3264,16 @@ static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) · 1 unmodified line | |||
| 3082 | if(v->p_frame_skipped) | 3264 | if(v->p_frame_skipped) |
| 3083 | vc1_decode_skip_blocks(v); | 3265 | vc1_decode_skip_blocks(v); |
| 3084 | else | 3266 | else |
| 3085 | vc1_decode_p_blocks(v, mby_start, mby_end); | 3267 | vc1_decode_p_blocks(v); |
| 3086 | break; | 3268 | break; |
| 3087 | case AV_PICTURE_TYPE_B: | 3269 | case AV_PICTURE_TYPE_B: |
| 3088 | if(v->bi_type){ | 3270 | if(v->bi_type){ |
| 3089 | if(v->profile == PROFILE_ADVANCED) | 3271 | if(v->profile == PROFILE_ADVANCED) |
| 3090 | vc1_decode_i_blocks_adv(v, mby_start, mby_end); | 3272 | vc1_decode_i_blocks_adv(v); |
| 3091 | else | 3273 | else |
| 3092 | vc1_decode_i_blocks(v); | 3274 | vc1_decode_i_blocks(v); |
| 3093 | }else | 3275 | }else |
| 3094 | vc1_decode_b_blocks(v, mby_start, mby_end); | 3276 | vc1_decode_b_blocks(v); |
| 3095 | break; | 3277 | break; |
| 3096 | } | 3278 | } |
| 3097 | } | 3279 | } |
| @@ -3341,6 +3523,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) · 243 unmodified lines | |||
| 3341 | v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); | 3523 | v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); |
| 3342 | v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height); | 3524 | v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height); |
| 3343 | 3525 | ||
| 3526 | v->n_allocated_blks = s->mb_width + 2; | ||
| 3527 | v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); | ||
| 3344 | v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); | 3528 | v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); |
| 3345 | v->cbp = v->cbp_base + s->mb_stride; | 3529 | v->cbp = v->cbp_base + s->mb_stride; |
| 3346 | v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); | 3530 | v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); |
| @@ -3556,8 +3740,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, · 209 unmodified lines | |||
| 3556 | for (i = 0; i <= n_slices; i++) { | 3740 | for (i = 0; i <= n_slices; i++) { |
| 3557 | if (i && get_bits1(&s->gb)) | 3741 | if (i && get_bits1(&s->gb)) |
| 3558 | vc1_parse_frame_header_adv(v, &s->gb); | 3742 | vc1_parse_frame_header_adv(v, &s->gb); |
| 3559 | vc1_decode_blocks(v, i == 0 ? 0 : FFMAX(0, slices[i-1].mby_start), | 3743 | s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start); |
| 3560 | i == n_slices ? s->mb_height : FFMIN(s->mb_height, slices[i].mby_start)); | 3744 | s->end_mb_y = (i == n_slices) ? s->mb_height : FFMIN(s->mb_height, slices[i].mby_start); |
| 3745 | vc1_decode_blocks(v); | ||
| 3561 | if (i != n_slices) s->gb = slices[i].gb; | 3746 | if (i != n_slices) s->gb = slices[i].gb; |
| 3562 | } | 3747 | } |
| 3563 | //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); | 3748 | //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); |
| @@ -3614,6 +3799,7 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx) · 50 unmodified lines | |||
| 3614 | av_freep(&v->acpred_plane); | 3799 | av_freep(&v->acpred_plane); |
| 3615 | av_freep(&v->over_flags_plane); | 3800 | av_freep(&v->over_flags_plane); |
| 3616 | av_freep(&v->mb_type_base); | 3801 | av_freep(&v->mb_type_base); |
| 3802 | av_freep(&v->block); | ||
| 3617 | av_freep(&v->cbp_base); | 3803 | av_freep(&v->cbp_base); |
| 3618 | av_freep(&v->ttblk_base); | 3804 | av_freep(&v->ttblk_base); |
| 3619 | av_freep(&v->is_intra_base); // FIXME use v->mb_type[] | 3805 | av_freep(&v->is_intra_base); // FIXME use v->mb_type[] |
| @@ -78,6 +78,58 @@ static void vc1_h_overlap_c(uint8_t* src, int stride) · 77 unmodified lines | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static void vc1_v_s_overlap_c(DCTELEM *top, DCTELEM *bottom) | ||
| 82 | { | ||
| 83 | int i; | ||
| 84 | int a, b, c, d; | ||
| 85 | int d1, d2; | ||
| 86 | int rnd1 = 4, rnd2 = 3; | ||
| 87 | for(i = 0; i < 8; i++) { | ||
| 88 | a = top[48]; | ||
| 89 | b = top[56]; | ||
| 90 | c = bottom[0]; | ||
| 91 | d = bottom[8]; | ||
| 92 | d1 = a - d; | ||
| 93 | d2 = a - d + b - c; | ||
| 94 | |||
| 95 | top[48] = ((a << 3) - d1 + rnd1) >> 3; | ||
| 96 | top[56] = ((b << 3) - d2 + rnd2) >> 3; | ||
| 97 | bottom[0] = ((c << 3) + d2 + rnd1) >> 3; | ||
| 98 | bottom[8] = ((d << 3) + d1 + rnd2) >> 3; | ||
| 99 | |||
| 100 | bottom++; | ||
| 101 | top++; | ||
| 102 | rnd2 = 7 - rnd2; | ||
| 103 | rnd1 = 7 - rnd1; | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | static void vc1_h_s_overlap_c(DCTELEM *left, DCTELEM *right) | ||
| 108 | { | ||
| 109 | int i; | ||
| 110 | int a, b, c, d; | ||
| 111 | int d1, d2; | ||
| 112 | int rnd1 = 4, rnd2 = 3; | ||
| 113 | for(i = 0; i < 8; i++) { | ||
| 114 | a = left[6]; | ||
| 115 | b = left[7]; | ||
| 116 | c = right[0]; | ||
| 117 | d = right[1]; | ||
| 118 | d1 = a - d; | ||
| 119 | d2 = a - d + b - c; | ||
| 120 | |||
| 121 | left[6] = ((a << 3) - d1 + rnd1) >> 3; | ||
| 122 | left[7] = ((b << 3) - d2 + rnd2) >> 3; | ||
| 123 | right[0] = ((c << 3) + d2 + rnd1) >> 3; | ||
| 124 | right[1] = ((d << 3) + d1 + rnd2) >> 3; | ||
| 125 | |||
| 126 | right += 8; | ||
| 127 | left += 8; | ||
| 128 | rnd2 = 7 - rnd2; | ||
| 129 | rnd1 = 7 - rnd1; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 81 | /** | 133 | /** |
| 82 | * VC-1 in-loop deblocking filter for one line | 134 | * VC-1 in-loop deblocking filter for one line |
| 83 | * @param src source block type | 135 | * @param src source block type |
| @@ -199,7 +251,7 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) · 115 unmodified lines | |||
| 199 | } | 251 | } |
| 200 | } | 252 | } |
| 201 | 253 | ||
| 202 | static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int sub) | 254 | static void vc1_inv_trans_8x8_c(DCTELEM block[64]) |
| 203 | { | 255 | { |
| 204 | int i; | 256 | int i; |
| 205 | register int t1,t2,t3,t4,t5,t6,t7,t8; | 257 | register int t1,t2,t3,t4,t5,t6,t7,t8; |
| @@ -254,50 +306,20 @@ static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int · 48 unmodified lines | |||
| 254 | t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; | 306 | t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; |
| 255 | t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; | 307 | t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; |
| 256 | 308 | ||
| 257 | dst[ 0] = (((t5 + t1 ) >> 7) - sub) << shl; | 309 | dst[ 0] = (t5 + t1) >> 7; |
| 258 | dst[ 8] = (((t6 + t2 ) >> 7) - sub) << shl; | 310 | dst[ 8] = (t6 + t2) >> 7; |
| 259 | dst[16] = (((t7 + t3 ) >> 7) - sub) << shl; | 311 | dst[16] = (t7 + t3) >> 7; |
| 260 | dst[24] = (((t8 + t4 ) >> 7) - sub) << shl; | 312 | dst[24] = (t8 + t4) >> 7; |
| 261 | dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl; | 313 | dst[32] = (t8 - t4 + 1) >> 7; |
| 262 | dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl; | 314 | dst[40] = (t7 - t3 + 1) >> 7; |
| 263 | dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl; | 315 | dst[48] = (t6 - t2 + 1) >> 7; |
| 264 | dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl; | 316 | dst[56] = (t5 - t1 + 1) >> 7; |
| 265 | 317 | ||
| 266 | src++; | 318 | src++; |
| 267 | dst++; | 319 | dst++; |
| 268 | } | 320 | } |
| 269 | } | 321 | } |
| 270 | 322 | ||
| 271 | static void vc1_inv_trans_8x8_add_c(uint8_t *dest, int linesize, DCTELEM *block) | ||
| 272 | { | ||
| 273 | vc1_inv_trans_8x8_c(block, 0, 0); | ||
| 274 | ff_add_pixels_clamped_c(block, dest, linesize); | ||
| 275 | } | ||
| 276 | |||
| 277 | static void vc1_inv_trans_8x8_put_signed_c(uint8_t *dest, int linesize, DCTELEM *block) | ||
| 278 | { | ||
| 279 | vc1_inv_trans_8x8_c(block, 0, 0); | ||
| 280 | ff_put_signed_pixels_clamped_c(block, dest, linesize); | ||
| 281 | } | ||
| 282 | |||
| 283 | static void vc1_inv_trans_8x8_put_signed_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) | ||
| 284 | { | ||
| 285 | vc1_inv_trans_8x8_c(block, 1, 0); | ||
| 286 | ff_put_signed_pixels_clamped_c(block, dest, linesize); | ||
| 287 | } | ||
| 288 | |||
| 289 | static void vc1_inv_trans_8x8_put_c(uint8_t *dest, int linesize, DCTELEM *block) | ||
| 290 | { | ||
| 291 | vc1_inv_trans_8x8_c(block, 0, 0); | ||
| 292 | ff_put_pixels_clamped_c(block, dest, linesize); | ||
| 293 | } | ||
| 294 | |||
| 295 | static void vc1_inv_trans_8x8_put_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) | ||
| 296 | { | ||
| 297 | vc1_inv_trans_8x8_c(block, 1, 64); | ||
| 298 | ff_put_pixels_clamped_c(block, dest, linesize); | ||
| 299 | } | ||
| 300 | |||
| 301 | /** Do inverse transform on 8x4 part of block | 323 | /** Do inverse transform on 8x4 part of block |
| 302 | */ | 324 | */ |
| 303 | static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) | 325 | static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) |
| @@ -692,11 +714,7 @@ static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a · 388 unmodified lines | |||
| 692 | } | 714 | } |
| 693 | 715 | ||
| 694 | av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { | 716 | av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { |
| 695 | dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_c; | 717 | dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; |
| 696 | dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_c; | ||
| 697 | dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_c; | ||
| 698 | dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_c; | ||
| 699 | dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_c; | ||
| 700 | dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; | 718 | dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; |
| 701 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; | 719 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; |
| 702 | dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; | 720 | dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; |
| @@ -706,6 +724,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { · 3 unmodified lines | |||
| 706 | dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; | 724 | dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; |
| 707 | dsp->vc1_h_overlap = vc1_h_overlap_c; | 725 | dsp->vc1_h_overlap = vc1_h_overlap_c; |
| 708 | dsp->vc1_v_overlap = vc1_v_overlap_c; | 726 | dsp->vc1_v_overlap = vc1_v_overlap_c; |
| 727 | dsp->vc1_h_s_overlap = vc1_h_s_overlap_c; | ||
| 728 | dsp->vc1_v_s_overlap = vc1_v_s_overlap_c; | ||
| 709 | dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; | 729 | dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; |
| 710 | dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c; | 730 | dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c; |
| 711 | dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c; | 731 | dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c; |
| @@ -30,13 +30,9 @@ · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | #include "dsputil.h" | 31 | #include "dsputil.h" |
| 32 | 32 | ||
| 33 | typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block); | ||
| 34 | |||
| 35 | typedef struct VC1DSPContext { | 33 | typedef struct VC1DSPContext { |
| 36 | /* vc1 functions */ | 34 | /* vc1 functions */ |
| 37 | vc1_idct_func vc1_inv_trans_8x8_add; | 35 | void (*vc1_inv_trans_8x8)(DCTELEM *b); |
| 38 | vc1_idct_func vc1_inv_trans_8x8_put_signed[2]; | ||
| 39 | vc1_idct_func vc1_inv_trans_8x8_put[2]; | ||
| 40 | void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); | 36 | void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); |
| 41 | void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); | 37 | void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); |
| 42 | void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); | 38 | void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); |
| @@ -44,8 +40,10 @@ typedef struct VC1DSPContext { · 1 unmodified line | |||
| 44 | void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); | 40 | void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); |
| 45 | void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); | 41 | void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); |
| 46 | void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); | 42 | void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); |
| 47 | void (*vc1_v_overlap)(uint8_t* src, int stride); | 43 | void (*vc1_v_overlap)(uint8_t *src, int stride); |
| 48 | void (*vc1_h_overlap)(uint8_t* src, int stride); | 44 | void (*vc1_h_overlap)(uint8_t *src, int stride); |
| 45 | void (*vc1_v_s_overlap)(DCTELEM *top, DCTELEM *bottom); | ||
| 46 | void (*vc1_h_s_overlap)(DCTELEM *left, DCTELEM *right); | ||
| 49 | void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); | 47 | void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); |
| 50 | void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); | 48 | void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); |
| 51 | void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); | 49 | void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); |
| @@ -585,28 +585,53 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 584 unmodified lines | |||
| 585 | return AVERROR(EINVAL); | 585 | return AVERROR(EINVAL); |
| 586 | 586 | ||
| 587 | ret = av_mallocz(sizeof(AVFilterContext)); | 587 | ret = av_mallocz(sizeof(AVFilterContext)); |
| 588 | if (!ret) | ||
| 589 | return AVERROR(ENOMEM); | ||
| 588 | 590 | ||
| 589 | ret->av_class = &avfilter_class; | 591 | ret->av_class = &avfilter_class; |
| 590 | ret->filter = filter; | 592 | ret->filter = filter; |
| 591 | ret->name = inst_name ? av_strdup(inst_name) : NULL; | 593 | ret->name = inst_name ? av_strdup(inst_name) : NULL; |
| 592 | ret->priv = av_mallocz(filter->priv_size); | 594 | if (filter->priv_size) { |
| 595 | ret->priv = av_mallocz(filter->priv_size); | ||
| 596 | if (!ret->priv) | ||
| 597 | goto err; | ||
| 598 | } | ||
| 593 | 599 | ||
| 594 | ret->input_count = pad_count(filter->inputs); | 600 | ret->input_count = pad_count(filter->inputs); |
| 595 | if (ret->input_count) { | 601 | if (ret->input_count) { |
| 596 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); | 602 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); |
| 603 | if (!ret->input_pads) | ||
| 604 | goto err; | ||
| 597 | memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); | 605 | memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); |
| 598 | ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); | 606 | ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); |
| 607 | if (!ret->inputs) | ||
| 608 | goto err; | ||
| 599 | } | 609 | } |
| 600 | 610 | ||
| 601 | ret->output_count = pad_count(filter->outputs); | 611 | ret->output_count = pad_count(filter->outputs); |
| 602 | if (ret->output_count) { | 612 | if (ret->output_count) { |
| 603 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); | 613 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); |
| 614 | if (!ret->output_pads) | ||
| 615 | goto err; | ||
| 604 | memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); | 616 | memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); |
| 605 | ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); | 617 | ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); |
| 618 | if (!ret->outputs) | ||
| 619 | goto err; | ||
| 606 | } | 620 | } |
| 607 | 621 | ||
| 608 | *filter_ctx = ret; | 622 | *filter_ctx = ret; |
| 609 | return 0; | 623 | return 0; |
| 624 | |||
| 625 | err: | ||
| 626 | av_freep(&ret->inputs); | ||
| 627 | av_freep(&ret->input_pads); | ||
| 628 | ret->input_count = 0; | ||
| 629 | av_freep(&ret->outputs); | ||
| 630 | av_freep(&ret->output_pads); | ||
| 631 | ret->output_count = 0; | ||
| 632 | av_freep(&ret->priv); | ||
| 633 | av_free(ret); | ||
| 634 | return AVERROR(ENOMEM); | ||
| 610 | } | 635 | } |
| 611 | 636 | ||
| 612 | void avfilter_free(AVFilterContext *filter) | 637 | void avfilter_free(AVFilterContext *filter) |
| @@ -299,7 +299,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ · 298 unmodified lines | |||
| 299 | flacenc_header.o avlanguage.o | 299 | flacenc_header.o avlanguage.o |
| 300 | OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o | 300 | OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o |
| 301 | OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o | 301 | OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o |
| 302 | OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asf.o asfdec.o mpegts.o riff.o | 302 | OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asfdec.o asf.o asfcrypt.o \ |
| 303 | avlanguage.o mpegts.o isom.o riff.o | ||
| 303 | OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o | 304 | OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o |
| 304 | OBJS-$(CONFIG_XA_DEMUXER) += xa.o | 305 | OBJS-$(CONFIG_XA_DEMUXER) += xa.o |
| 305 | OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o | 306 | OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o |
| @@ -845,11 +845,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 844 unmodified lines | |||
| 845 | if (asf->packet_flags & 0x01) { | 845 | if (asf->packet_flags & 0x01) { |
| 846 | DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal | 846 | DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal |
| 847 | if(asf->packet_frag_size > asf->packet_size_left - rsize){ | 847 | if(asf->packet_frag_size > asf->packet_size_left - rsize){ |
| 848 | av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n"); | 848 | if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { |
| 849 | return -1; | 849 | av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); |
| 850 | return -1; | ||
| 851 | } else { | ||
| 852 | int diff = asf->packet_frag_size - (asf->packet_size_left - rsize); | ||
| 853 | asf->packet_size_left += diff; | ||
| 854 | asf->packet_padsize -= diff; | ||
| 855 | } | ||
| 850 | } | 856 | } |
| 851 | //printf("Fragsize %d\n", asf->packet_frag_size); | 857 | //printf("Fragsize %d\n", asf->packet_frag_size); |
| 852 | } else { | 858 | } else { |
| 859 | if (rsize > asf->packet_size_left) { | ||
| 860 | av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); | ||
| 861 | return -1; | ||
| 862 | } | ||
| 853 | asf->packet_frag_size = asf->packet_size_left - rsize; | 863 | asf->packet_frag_size = asf->packet_size_left - rsize; |
| 854 | //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); | 864 | //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); |
| 855 | } | 865 | } |
| @@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h) · 50 unmodified lines | |||
| 51 | return (intptr_t) h->priv_data; | 51 | return (intptr_t) h->priv_data; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | static int file_check(URLContext *h, int mask) | ||
| 55 | { | ||
| 56 | struct stat st; | ||
| 57 | int ret = stat(h->filename, &st); | ||
| 58 | if (ret < 0) | ||
| 59 | return AVERROR(errno); | ||
| 60 | |||
| 61 | ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; | ||
| 62 | ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; | ||
| 63 | |||
| 64 | return ret; | ||
| 65 | } | ||
| 66 | |||
| 54 | #if CONFIG_FILE_PROTOCOL | 67 | #if CONFIG_FILE_PROTOCOL |
| 55 | 68 | ||
| 56 | static int file_open(URLContext *h, const char *filename, int flags) | 69 | static int file_open(URLContext *h, const char *filename, int flags) |
| @@ -95,19 +108,6 @@ static int file_close(URLContext *h) · 38 unmodified lines | |||
| 95 | return close(fd); | 108 | return close(fd); |
| 96 | } | 109 | } |
| 97 | 110 | ||
| 98 | static int file_check(URLContext *h, int mask) | ||
| 99 | { | ||
| 100 | struct stat st; | ||
| 101 | int ret = stat(h->filename, &st); | ||
| 102 | if (ret < 0) | ||
| 103 | return AVERROR(errno); | ||
| 104 | |||
| 105 | ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; | ||
| 106 | ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; | ||
| 107 | |||
| 108 | return ret; | ||
| 109 | } | ||
| 110 | |||
| 111 | URLProtocol ff_file_protocol = { | 111 | URLProtocol ff_file_protocol = { |
| 112 | .name = "file", | 112 | .name = "file", |
| 113 | .url_open = file_open, | 113 | .url_open = file_open, |
| @@ -403,8 +403,6 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) · 402 unmodified lines | |||
| 403 | } | 403 | } |
| 404 | end_ebml_master(pb, cues_element); | 404 | end_ebml_master(pb, cues_element); |
| 405 | 405 | ||
| 406 | av_free(cues->entries); | ||
| 407 | av_free(cues); | ||
| 408 | return currentpos; | 406 | return currentpos; |
| 409 | } | 407 | } |
| 410 | 408 | ||
| @@ -1164,6 +1162,8 @@ static int mkv_write_trailer(AVFormatContext *s) · 753 unmodified lines | |||
| 1164 | 1162 | ||
| 1165 | end_ebml_master(pb, mkv->segment); | 1163 | end_ebml_master(pb, mkv->segment); |
| 1166 | av_free(mkv->tracks); | 1164 | av_free(mkv->tracks); |
| 1165 | av_freep(&mkv->cues->entries); | ||
| 1166 | av_freep(&mkv->cues); | ||
| 1167 | av_destruct_packet(&mkv->cur_audio_pkt); | 1167 | av_destruct_packet(&mkv->cur_audio_pkt); |
| 1168 | avio_flush(pb); | 1168 | avio_flush(pb); |
| 1169 | return 0; | 1169 | return 0; |
| @@ -829,7 +829,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) · 828 unmodified lines | |||
| 829 | memset(compressor_name,0,32); | 829 | memset(compressor_name,0,32); |
| 830 | /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ | 830 | /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ |
| 831 | if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) | 831 | if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) |
| 832 | strncpy(compressor_name,track->enc->codec->name,31); | 832 | av_strlcpy(compressor_name,track->enc->codec->name,32); |
| 833 | avio_w8(pb, strlen(compressor_name)); | 833 | avio_w8(pb, strlen(compressor_name)); |
| 834 | avio_write(pb, compressor_name, 31); | 834 | avio_write(pb, compressor_name, 31); |
| 835 | 835 | ||
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include "id3v1.h" | 24 | #include "id3v1.h" |
| 25 | #include "id3v2.h" | 25 | #include "id3v2.h" |
| 26 | #include "rawenc.h" | 26 | #include "rawenc.h" |
| 27 | #include "libavutil/avstring.h" | ||
| 27 | #include "libavutil/intreadwrite.h" | 28 | #include "libavutil/intreadwrite.h" |
| 28 | #include "libavutil/opt.h" | 29 | #include "libavutil/opt.h" |
| 29 | 30 | ||
| @@ -32,7 +33,7 @@ static int id3v1_set_string(AVFormatContext *s, const char *key, · 2 unmodified lines | |||
| 32 | { | 33 | { |
| 33 | AVMetadataTag *tag; | 34 | AVMetadataTag *tag; |
| 34 | if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) | 35 | if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) |
| 35 | strncpy(buf, tag->value, buf_size); | 36 | av_strlcpy(buf, tag->value, buf_size); |
| 36 | return !!tag; | 37 | return !!tag; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| @@ -589,6 +589,12 @@ static int write_header(AVFormatContext *s){ · 588 unmodified lines | |||
| 589 | nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); | 589 | nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); |
| 590 | nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + | 590 | nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + |
| 591 | s->nb_chapters)); | 591 | s->nb_chapters)); |
| 592 | if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) { | ||
| 593 | av_freep(&nut->stream); | ||
| 594 | av_freep(&nut->chapter); | ||
| 595 | av_freep(&nut->time_base); | ||
| 596 | return AVERROR(ENOMEM); | ||
| 597 | } | ||
| 592 | 598 | ||
| 593 | for(i=0; i<s->nb_streams; i++){ | 599 | for(i=0; i<s->nb_streams; i++){ |
| 594 | AVStream *st= s->streams[i]; | 600 | AVStream *st= s->streams[i]; |
| @@ -86,6 +86,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks · 85 unmodified lines | |||
| 86 | //#define DEBUG_BRIGHTNESS | 86 | //#define DEBUG_BRIGHTNESS |
| 87 | #include "postprocess.h" | 87 | #include "postprocess.h" |
| 88 | #include "postprocess_internal.h" | 88 | #include "postprocess_internal.h" |
| 89 | #include "libavutil/avstring.h" | ||
| 89 | 90 | ||
| 90 | unsigned postproc_version(void) | 91 | unsigned postproc_version(void) |
| 91 | { | 92 | { |
| @@ -766,7 +767,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality) · 674 unmodified lines | |||
| 766 | ppMode->maxClippedThreshold= 0.01; | 767 | ppMode->maxClippedThreshold= 0.01; |
| 767 | ppMode->error=0; | 768 | ppMode->error=0; |
| 768 | 769 | ||
| 769 | strncpy(temp, name, GET_MODE_BUFFER_SIZE); | 770 | av_strlcpy(temp, name, GET_MODE_BUFFER_SIZE); |
| 770 | 771 | ||
| 771 | av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name); | 772 | av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name); |
| 772 | 773 | ||
| @@ -1,15 +1,15 @@ | |||
| 1 | 0, 0, 38016, 0xf4715db5 | 1 | 0, 0, 38016, 0xa6f15db5 |
| 2 | 0, 3600, 38016, 0xf4715db5 | 2 | 0, 3600, 38016, 0xa6f15db5 |
| 3 | 0, 7200, 38016, 0xf4715db5 | 3 | 0, 7200, 38016, 0xa6f15db5 |
| 4 | 0, 10800, 38016, 0xf46af0e1 | 4 | 0, 10800, 38016, 0x5c4ef0e7 |
| 5 | 0, 14400, 38016, 0x9c1c2cf1 | 5 | 0, 14400, 38016, 0x53a42d1d |
| 6 | 0, 18000, 38016, 0xff12d87f | 6 | 0, 18000, 38016, 0x68f7d89e |
| 7 | 0, 21600, 38016, 0x7408432b | 7 | 0, 21600, 38016, 0xc15f4368 |
| 8 | 0, 25200, 38016, 0x7408432b | 8 | 0, 25200, 38016, 0xc15f4368 |
| 9 | 0, 28800, 38016, 0x8d11479a | 9 | 0, 28800, 38016, 0xd1bd47a8 |
| 10 | 0, 32400, 38016, 0x8d11479a | 10 | 0, 32400, 38016, 0xd1bd47a8 |
| 11 | 0, 36000, 38016, 0xc4a121ab | 11 | 0, 36000, 38016, 0xe1e821ca |
| 12 | 0, 39600, 38016, 0xc4a121ab | 12 | 0, 39600, 38016, 0xe1e821ca |
| 13 | 0, 43200, 38016, 0xc4a121ab | 13 | 0, 43200, 38016, 0xe1e821ca |
| 14 | 0, 46800, 38016, 0xc4a121ab | 14 | 0, 46800, 38016, 0xe1e821ca |
| 15 | 0, 50400, 38016, 0xc4a121ab | 15 | 0, 50400, 38016, 0xe1e821ca |