* 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 | 1252 | aac_latm_decoder_select="aac_decoder aac_latm_parser" |
| 1253 | 1253 | ac3_decoder_select="mdct ac3dsp ac3_parser" |
| 1254 | 1254 | ac3_encoder_select="mdct ac3dsp" |
| 1255 | −ac3_fixed_encoder_select="ac3dsp" | |
| 1255 | +ac3_fixed_encoder_select="mdct ac3dsp" | |
| 1256 | 1256 | alac_encoder_select="lpc" |
| 1257 | 1257 | amrnb_decoder_select="lsp" |
| 1258 | 1258 | amrwb_decoder_select="lsp" |
| 1259 | 1259 | atrac1_decoder_select="mdct sinewin" |
| 1260 | 1260 | atrac3_decoder_select="mdct" |
| 1261 | −binkaudio_dct_decoder_select="mdct rdft dct" | |
| 1262 | −binkaudio_rdft_decoder_select="mdct rdft" | |
| 1261 | +binkaudio_dct_decoder_select="mdct rdft dct sinewin" | |
| 1262 | +binkaudio_rdft_decoder_select="mdct rdft sinewin" | |
| 1263 | 1263 | cavs_decoder_select="golomb" |
| 1264 | 1264 | cook_decoder_select="mdct sinewin" |
| 1265 | 1265 | cscd_decoder_suggest="zlib" |
| @@ -1291,7 +1291,7 @@ h264_dxva2_hwaccel_deps="dxva2api_h" · 25 unmodified lines | ||
| 1291 | 1291 | h264_dxva2_hwaccel_select="dxva2 h264_decoder" |
| 1292 | 1292 | h264_vaapi_hwaccel_select="vaapi" |
| 1293 | 1293 | h264_vdpau_decoder_select="vdpau h264_decoder" |
| 1294 | −imc_decoder_select="fft mdct" | |
| 1294 | +imc_decoder_select="fft mdct sinewin" | |
| 1295 | 1295 | jpegls_decoder_select="golomb" |
| 1296 | 1296 | jpegls_encoder_select="golomb" |
| 1297 | 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 | 312 | If it depends on a parser or a library, did you add that dependency in |
| 313 | 313 | configure? |
| 314 | 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 | 320 | @end enumerate |
| 317 | 321 | |
| 322 | + | |
| 318 | 323 | @section patch submission checklist |
| 319 | 324 | |
| 320 | 325 | @enumerate |
| @@ -3816,8 +3816,7 @@ static int opt_streamid(const char *opt, const char *arg) · 3815 unmodified lines | ||
| 3816 | 3816 | char *p; |
| 3817 | 3817 | char idx_str[16]; |
| 3818 | 3818 | |
| 3819 | − strncpy(idx_str, arg, sizeof(idx_str)); | |
| 3820 | − idx_str[sizeof(idx_str)-1] = '\0'; | |
| 3819 | + av_strlcpy(idx_str, arg, sizeof(idx_str)); | |
| 3821 | 3820 | p = strchr(idx_str, ':'); |
| 3822 | 3821 | if (!p) { |
| 3823 | 3822 | fprintf(stderr, |
| @@ -277,7 +277,7 @@ OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o · 276 unmodified lines | ||
| 277 | 277 | OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o |
| 278 | 278 | OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o |
| 279 | 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 | 281 | OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o |
| 282 | 282 | OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o |
| 283 | 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 | 556 | OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ |
| 557 | 557 | flacdec.o flacdata.o flac.o \ |
| 558 | 558 | mpegaudiodata.o vorbis_data.o |
| 559 | +OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o | |
| 559 | 560 | |
| 560 | 561 | # external codec libraries |
| 561 | 562 | OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include "libavutil/audioconvert.h" |
| 35 | 35 | #include "libavutil/avassert.h" |
| 36 | +#include "libavutil/avstring.h" | |
| 36 | 37 | #include "libavutil/crc.h" |
| 37 | 38 | #include "libavutil/opt.h" |
| 38 | 39 | #include "avcodec.h" |
| @@ -1551,10 +1552,10 @@ static void dprint_options(AVCodecContext *avctx) · 1512 unmodified lines | ||
| 1551 | 1552 | char strbuf[32]; |
| 1552 | 1553 | |
| 1553 | 1554 | switch (s->bitstream_id) { |
| 1554 | − case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break; | |
| 1555 | − case 8: strncpy(strbuf, "AC-3 (standard)", 32); break; | |
| 1556 | − case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break; | |
| 1557 | − case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break; | |
| 1555 | + case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break; | |
| 1556 | + case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32); break; | |
| 1557 | + case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break; | |
| 1558 | + case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break; | |
| 1558 | 1559 | default: snprintf(strbuf, 32, "ERROR"); |
| 1559 | 1560 | } |
| 1560 | 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 | 1582 | if (opt->audio_production_info) { |
| 1582 | 1583 | av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); |
| 1583 | 1584 | switch (opt->room_type) { |
| 1584 | − case 0: strncpy(strbuf, "notindicated", 32); break; | |
| 1585 | − case 1: strncpy(strbuf, "large", 32); break; | |
| 1586 | − case 2: strncpy(strbuf, "small", 32); break; | |
| 1585 | + case 0: av_strlcpy(strbuf, "notindicated", 32); break; | |
| 1586 | + case 1: av_strlcpy(strbuf, "large", 32); break; | |
| 1587 | + case 2: av_strlcpy(strbuf, "small", 32); break; | |
| 1587 | 1588 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); |
| 1588 | 1589 | } |
| 1589 | 1590 | av_dlog(avctx, "room_type: %s\n", strbuf); |
| @@ -1595,9 +1596,9 @@ static void dprint_options(AVCodecContext *avctx) · 5 unmodified lines | ||
| 1595 | 1596 | av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); |
| 1596 | 1597 | if (s->channel_mode == AC3_CHMODE_STEREO) { |
| 1597 | 1598 | switch (opt->dolby_surround_mode) { |
| 1598 | − case 0: strncpy(strbuf, "notindicated", 32); break; | |
| 1599 | − case 1: strncpy(strbuf, "on", 32); break; | |
| 1600 | − case 2: strncpy(strbuf, "off", 32); break; | |
| 1599 | + case 0: av_strlcpy(strbuf, "notindicated", 32); break; | |
| 1600 | + case 1: av_strlcpy(strbuf, "on", 32); break; | |
| 1601 | + case 2: av_strlcpy(strbuf, "off", 32); break; | |
| 1601 | 1602 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode); |
| 1602 | 1603 | } |
| 1603 | 1604 | av_dlog(avctx, "dsur_mode: %s\n", strbuf); |
| @@ -1609,9 +1610,9 @@ static void dprint_options(AVCodecContext *avctx) · 5 unmodified lines | ||
| 1609 | 1610 | if (s->bitstream_id == 6) { |
| 1610 | 1611 | if (opt->extended_bsi_1) { |
| 1611 | 1612 | switch (opt->preferred_stereo_downmix) { |
| 1612 | − case 0: strncpy(strbuf, "notindicated", 32); break; | |
| 1613 | − case 1: strncpy(strbuf, "ltrt", 32); break; | |
| 1614 | − case 2: strncpy(strbuf, "loro", 32); break; | |
| 1613 | + case 0: av_strlcpy(strbuf, "notindicated", 32); break; | |
| 1614 | + case 1: av_strlcpy(strbuf, "ltrt", 32); break; | |
| 1615 | + case 2: av_strlcpy(strbuf, "loro", 32); break; | |
| 1615 | 1616 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix); |
| 1616 | 1617 | } |
| 1617 | 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 | 1630 | if (opt->extended_bsi_2) { |
| 1630 | 1631 | switch (opt->dolby_surround_ex_mode) { |
| 1631 | − case 0: strncpy(strbuf, "notindicated", 32); break; | |
| 1632 | − case 1: strncpy(strbuf, "on", 32); break; | |
| 1633 | − case 2: strncpy(strbuf, "off", 32); break; | |
| 1632 | + case 0: av_strlcpy(strbuf, "notindicated", 32); break; | |
| 1633 | + case 1: av_strlcpy(strbuf, "on", 32); break; | |
| 1634 | + case 2: av_strlcpy(strbuf, "off", 32); break; | |
| 1634 | 1635 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode); |
| 1635 | 1636 | } |
| 1636 | 1637 | av_dlog(avctx, "dsurex_mode: %s\n", strbuf); |
| 1637 | 1638 | switch (opt->dolby_headphone_mode) { |
| 1638 | − case 0: strncpy(strbuf, "notindicated", 32); break; | |
| 1639 | − case 1: strncpy(strbuf, "on", 32); break; | |
| 1640 | − case 2: strncpy(strbuf, "off", 32); break; | |
| 1639 | + case 0: av_strlcpy(strbuf, "notindicated", 32); break; | |
| 1640 | + case 1: av_strlcpy(strbuf, "on", 32); break; | |
| 1641 | + case 2: av_strlcpy(strbuf, "off", 32); break; | |
| 1641 | 1642 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode); |
| 1642 | 1643 | } |
| 1643 | 1644 | av_dlog(avctx, "dheadphone_mode: %s\n", strbuf); |
| 1644 | 1645 | |
| 1645 | 1646 | switch (opt->ad_converter_type) { |
| 1646 | − case 0: strncpy(strbuf, "standard", 32); break; | |
| 1647 | − case 1: strncpy(strbuf, "hdcd", 32); break; | |
| 1647 | + case 0: av_strlcpy(strbuf, "standard", 32); break; | |
| 1648 | + case 1: av_strlcpy(strbuf, "hdcd", 32); break; | |
| 1648 | 1649 | default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type); |
| 1649 | 1650 | } |
| 1650 | 1651 | av_dlog(avctx, "ad_conv_type: %s\n", strbuf); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #include "avcodec.h" |
| 23 | 23 | #include "ass.h" |
| 24 | +#include "libavutil/avstring.h" | |
| 24 | 25 | |
| 25 | 26 | int ff_ass_subtitle_header(AVCodecContext *avctx, |
| 26 | 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 | 98 | rects[sub->num_rects]->type = SUBTITLE_ASS; |
| 98 | 99 | rects[sub->num_rects]->ass = av_malloc(len + dlen + 1); |
| 99 | 100 | strcpy (rects[sub->num_rects]->ass , header); |
| 100 | − strncpy(rects[sub->num_rects]->ass + len, dialog, dlen); | |
| 101 | − rects[sub->num_rects]->ass[len+dlen] = 0; | |
| 101 | + av_strlcpy(rects[sub->num_rects]->ass + len, dialog, dlen + 1); | |
| 102 | 102 | sub->num_rects++; |
| 103 | 103 | return dlen; |
| 104 | 104 | } |
| @@ -148,7 +148,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, · 147 unmodified lines | ||
| 148 | 148 | if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) { |
| 149 | 149 | av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n"); |
| 150 | 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 | 152 | return -1; |
| 153 | 153 | } |
| 154 | 154 | |
| @@ -195,7 +195,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, · 40 unmodified lines | ||
| 195 | 195 | s->zstream.next_in = buf + (get_bits_count(&gb) / 8); |
| 196 | 196 | s->zstream.avail_in = size; |
| 197 | 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 | 199 | ret = inflate(&(s->zstream), Z_FINISH); |
| 200 | 200 | if (ret == Z_DATA_ERROR) { |
| 201 | 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 | 128 | # define OPEN_READER(name, gb) \ |
| 129 | 129 | unsigned int name##_index = (gb)->index; \ |
| 130 | − av_unused int name##_cache | |
| 130 | + av_unused unsigned int name##_cache | |
| 131 | 131 | |
| 132 | 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 | 151 | struct ustr { |
| 152 | − long xpos; | |
| 153 | − long ypos; | |
| 154 | − long width; | |
| 155 | − long height; | |
| 156 | − long split_flag; | |
| 157 | − long split_direction; | |
| 158 | − long usl7; | |
| 152 | + int xpos; | |
| 153 | + int ypos; | |
| 154 | + int width; | |
| 155 | + int height; | |
| 156 | + int split_flag; | |
| 157 | + int split_direction; | |
| 158 | + int usl7; | |
| 159 | 159 | }; |
| 160 | 160 | |
| 161 | 161 | |
| @@ -203,12 +203,12 @@ struct ustr { · 41 unmodified lines | ||
| 203 | 203 | |
| 204 | 204 | static void iv_Decode_Chunk(Indeo3DecodeContext *s, |
| 205 | 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 | 207 | const uint8_t *buf2, int min_width_160) |
| 208 | 208 | { |
| 209 | 209 | uint8_t bit_buf; |
| 210 | − unsigned long bit_pos, lv, lv1, lv2; | |
| 211 | − long *width_tbl, width_tbl_arr[10]; | |
| 210 | + unsigned int bit_pos, lv, lv1, lv2; | |
| 211 | + int *width_tbl, width_tbl_arr[10]; | |
| 212 | 212 | const signed char *ref_vectors; |
| 213 | 213 | uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; |
| 214 | 214 | uint32_t *cur_lp, *ref_lp; |
| @@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx, · 767 unmodified lines | ||
| 982 | 982 | Indeo3DecodeContext *s = avctx->priv_data; |
| 983 | 983 | unsigned int image_width, image_height, |
| 984 | 984 | chroma_width, chroma_height; |
| 985 | − unsigned long flags, cb_offset, data_size, | |
| 985 | + unsigned int flags, cb_offset, data_size, | |
| 986 | 986 | y_offset, v_offset, u_offset, mc_vector_count; |
| 987 | 987 | const uint8_t *hdr_pos, *buf_pos; |
| 988 | 988 | |
| @@ -130,8 +130,7 @@ do { \ · 129 unmodified lines | ||
| 130 | 130 | |
| 131 | 131 | /** Do inverse transform on 8x8 block |
| 132 | 132 | */ |
| 133 | −static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], | |
| 134 | − int sign, int rangered) | |
| 133 | +static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) | |
| 135 | 134 | { |
| 136 | 135 | vector signed short src0, src1, src2, src3, src4, src5, src6, src7; |
| 137 | 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 | 144 | const vector unsigned int vec_2 = vec_splat_u32(2); |
| 146 | 145 | const vector signed int vec_1s = vec_splat_s32(1); |
| 147 | 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 | 148 | src0 = vec_ld( 0, block); |
| 153 | 149 | src1 = vec_ld( 16, block); |
| @@ -217,27 +213,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], · 63 unmodified lines | ||
| 217 | 213 | src6 = vec_pack(sE, s6); |
| 218 | 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 | 216 | vec_st(src0, 0, block); |
| 242 | 217 | vec_st(src1, 16, block); |
| 243 | 218 | vec_st(src2, 32, block); |
| @@ -248,36 +223,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], · 4 unmodified lines | ||
| 248 | 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 | 226 | /** Do inverse transform on 8x4 part of block |
| 282 | 227 | */ |
| 283 | 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 | 341 | if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) |
| 397 | 342 | return; |
| 398 | 343 | |
| 399 | − dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_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; | |
| 344 | + dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; | |
| 404 | 345 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; |
| 405 | 346 | dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; |
| 406 | 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 | 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 | 284 | * Decode Simple/Main Profiles sequence header |
| 307 | 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 | 337 | v->res_fasttx = get_bits1(gb); |
| 360 | 338 | if (!v->res_fasttx) |
| 361 | 339 | { |
| 362 | − v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add; | |
| 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; | |
| 340 | + v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; | |
| 367 | 341 | v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; |
| 368 | 342 | v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; |
| 369 | 343 | v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; |
| @@ -317,6 +317,8 @@ typedef struct VC1Context{ · 316 unmodified lines | ||
| 317 | 317 | int bi_type; |
| 318 | 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 | 322 | uint32_t *cbp_base, *cbp; |
| 321 | 323 | uint8_t *is_intra_base, *is_intra; |
| 322 | 324 | int16_t (*luma_mv_base)[2], (*luma_mv)[2]; |
| @@ -160,6 +160,72 @@ enum Imode { · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 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 | 229 | static void vc1_loop_filter_iblk(VC1Context *v, int pq) |
| 164 | 230 | { |
| 165 | 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 | 401 | /** Do motion compensation over 1 macroblock |
| 191 | 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 | 2227 | if(i==1) |
| 2017 | 2228 | v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); |
| 2018 | 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 | 2234 | break; |
| @@ -2258,7 +2470,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 235 unmodified lines | ||
| 2258 | 2470 | { |
| 2259 | 2471 | MpegEncContext *s = &v->s; |
| 2260 | 2472 | GetBitContext *gb = &s->gb; |
| 2261 | − int i; | |
| 2473 | + int i, j; | |
| 2262 | 2474 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2263 | 2475 | int cbp; /* cbp decoding stuff */ |
| 2264 | 2476 | int mqdiff, mquant; /* MB quantization */ |
| @@ -2288,8 +2500,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 23 unmodified lines | ||
| 2288 | 2500 | { |
| 2289 | 2501 | if (!skipped) |
| 2290 | 2502 | { |
| 2291 | − vc1_idct_func idct8x8_fn; | |
| 2292 | − | |
| 2293 | 2503 | GET_MVDATA(dmv_x, dmv_y); |
| 2294 | 2504 | |
| 2295 | 2505 | if (s->mb_intra) { |
| @@ -2324,7 +2534,6 @@ static int vc1_decode_p_mb(VC1Context *v) · 28 unmodified lines | ||
| 2324 | 2534 | VC1_TTMB_VLC_BITS, 2); |
| 2325 | 2535 | if(!s->mb_intra) vc1_mc_1mv(v, 0); |
| 2326 | 2536 | dst_idx = 0; |
| 2327 | − idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | |
| 2328 | 2537 | for (i=0; i<6; i++) |
| 2329 | 2538 | { |
| 2330 | 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 | 2552 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
| 2344 | 2553 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2345 | − idct8x8_fn(s->dest[dst_idx] + off, | |
| 2346 | − i & 4 ? s->uvlinesize : s->linesize, | |
| 2347 | − s->block[i]); | |
| 2554 | + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | |
| 2555 | + if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; | |
| 2556 | + s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | |
| 2348 | 2557 | if(v->pq >= 9 && v->overlap) { |
| 2349 | 2558 | if(v->c_avail) |
| 2350 | 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 | 2590 | int intra_count = 0, coded_inter = 0; |
| 2382 | 2591 | int is_intra[6], is_coded[6]; |
| 2383 | − vc1_idct_func idct8x8_fn; | |
| 2384 | 2592 | /* Get CBPCY */ |
| 2385 | 2593 | cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); |
| 2386 | 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 | 2640 | if (!v->ttmbf && coded_inter) |
| 2433 | 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 | 2642 | for (i=0; i<6; i++) |
| 2436 | 2643 | { |
| 2437 | 2644 | dst_idx += i >> 2; |
| @@ -2447,9 +2654,9 @@ static int vc1_decode_p_mb(VC1Context *v) · 9 unmodified lines | ||
| 2447 | 2654 | |
| 2448 | 2655 | vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); |
| 2449 | 2656 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2450 | − idct8x8_fn(s->dest[dst_idx] + off, | |
| 2451 | − (i&4)?s->uvlinesize:s->linesize, | |
| 2452 | − s->block[i]); | |
| 2657 | + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | |
| 2658 | + if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; | |
| 2659 | + s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); | |
| 2453 | 2660 | if(v->pq >= 9 && v->overlap) { |
| 2454 | 2661 | if(v->c_avail) |
| 2455 | 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 | 2705 | MpegEncContext *s = &v->s; |
| 2499 | 2706 | GetBitContext *gb = &s->gb; |
| 2500 | − int i; | |
| 2707 | + int i, j; | |
| 2501 | 2708 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2502 | 2709 | int cbp = 0; /* cbp decoding stuff */ |
| 2503 | 2710 | int mqdiff, mquant; /* MB quantization */ |
| @@ -2510,7 +2717,6 @@ static void vc1_decode_b_mb(VC1Context *v) · 6 unmodified lines | ||
| 2510 | 2717 | int skipped, direct; |
| 2511 | 2718 | int dmv_x[2], dmv_y[2]; |
| 2512 | 2719 | int bmvtype = BMV_TYPE_BACKWARD; |
| 2513 | − vc1_idct_func idct8x8_fn; | |
| 2514 | 2720 | |
| 2515 | 2721 | mquant = v->pq; /* Loosy initialization */ |
| 2516 | 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 | 2816 | dst_idx = 0; |
| 2611 | − idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; | |
| 2612 | 2817 | for (i=0; i<6; i++) |
| 2613 | 2818 | { |
| 2614 | 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 | 2832 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); |
| 2628 | 2833 | if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2629 | − idct8x8_fn(s->dest[dst_idx] + off, | |
| 2630 | − i & 4 ? s->uvlinesize : s->linesize, | |
| 2631 | − s->block[i]); | |
| 2834 | + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | |
| 2835 | + if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; | |
| 2836 | + s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | |
| 2632 | 2837 | } else if(val) { |
| 2633 | 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 | 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 | 2847 | static void vc1_decode_i_blocks(VC1Context *v) |
| 2643 | 2848 | { |
| 2644 | − int k; | |
| 2849 | + int k, j; | |
| 2645 | 2850 | MpegEncContext *s = &v->s; |
| 2646 | 2851 | int cbp, val; |
| 2647 | 2852 | uint8_t *coded_val; |
| 2648 | 2853 | int mb_pos; |
| 2649 | − vc1_idct_func idct8x8_fn; | |
| 2650 | 2854 | |
| 2651 | 2855 | /* select codingmode used for VLC tables selection */ |
| 2652 | 2856 | switch(v->y_ac_table_index){ |
| @@ -2681,10 +2885,6 @@ static void vc1_decode_i_blocks(VC1Context *v) · 28 unmodified lines | ||
| 2681 | 2885 | s->mb_x = s->mb_y = 0; |
| 2682 | 2886 | s->mb_intra = 1; |
| 2683 | 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 | 2888 | for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { |
| 2689 | 2889 | s->mb_x = 0; |
| 2690 | 2890 | ff_init_block_index(s); |
| @@ -2721,9 +2921,14 @@ static void vc1_decode_i_blocks(VC1Context *v) · 30 unmodified lines | ||
| 2721 | 2921 | vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); |
| 2722 | 2922 | |
| 2723 | 2923 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2724 | − idct8x8_fn(dst[k], | |
| 2725 | − k & 4 ? s->uvlinesize : s->linesize, | |
| 2726 | − s->block[k]); | |
| 2924 | + v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); | |
| 2925 | + if(v->pq >= 9 && v->overlap) { | |
| 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 | 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 | 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 | 2980 | int k; |
| 2776 | 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 | 2984 | int mb_pos; |
| 2780 | 2985 | int mquant = v->pq; |
| 2781 | 2986 | int mqdiff; |
| 2782 | − int overlap; | |
| 2783 | 2987 | GetBitContext *gb = &s->gb; |
| 2784 | − vc1_idct_func idct8x8_fn; | |
| 2785 | 2988 | |
| 2786 | 2989 | /* select codingmode used for VLC tables selection */ |
| 2787 | 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 | 3015 | s->mb_x = s->mb_y = 0; |
| 2813 | 3016 | s->mb_intra = 1; |
| 2814 | 3017 | s->first_slice_line = 1; |
| 2815 | − s->mb_y = mby_start; | |
| 2816 | − if (mby_start) { | |
| 3018 | + s->mb_y = s->start_mb_y; | |
| 3019 | + if (s->start_mb_y) { | |
| 2817 | 3020 | s->mb_x = 0; |
| 2818 | 3021 | ff_init_block_index(s); |
| 2819 | 3022 | memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, |
| 2820 | 3023 | s->b8_stride * sizeof(*s->coded_block)); |
| 2821 | 3024 | } |
| 2822 | − idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[0]; | |
| 2823 | − for(; s->mb_y < mby_end; s->mb_y++) { | |
| 3025 | + for(; s->mb_y < s->end_mb_y; s->mb_y++) { | |
| 2824 | 3026 | s->mb_x = 0; |
| 2825 | 3027 | ff_init_block_index(s); |
| 2826 | 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 | 3030 | ff_update_block_index(s); |
| 2829 | − dst[0] = s->dest[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]); | |
| 3031 | + s->dsp.clear_blocks(block[0]); | |
| 2836 | 3032 | mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2837 | 3033 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
| 2838 | 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 | 3041 | else |
| 2846 | 3042 | v->s.ac_pred = v->acpred_plane[mb_pos]; |
| 2847 | 3043 | |
| 2848 | − if(v->condover == CONDOVER_SELECT) { | |
| 2849 | − if(v->overflg_is_raw) | |
| 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); | |
| 3044 | + if (v->condover == CONDOVER_SELECT && v->overflg_is_raw) | |
| 3045 | + v->over_flags_plane[mb_pos] = get_bits1(&v->s.gb); | |
| 2855 | 3046 | |
| 2856 | 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 | 3064 | v->a_avail = !s->first_slice_line || (k==2 || k==3); |
| 2874 | 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 | 3069 | if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; |
| 2879 | − idct8x8_fn(dst[k], | |
| 2880 | − k & 4 ? s->uvlinesize : s->linesize, | |
| 2881 | − s->block[k]); | |
| 3070 | + v->vc1dsp.vc1_inv_trans_8x8(block[k]); | |
| 2882 | 3071 | } |
| 2883 | 3072 | |
| 2884 | − if(overlap) { | |
| 2885 | − if(s->mb_x) { | |
| 2886 | − v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); | |
| 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); | |
| 3073 | + vc1_smooth_overlap_filter_iblk(v); | |
| 3074 | + vc1_put_signed_blocks_clamped(v); | |
| 3075 | + if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); | |
| 2907 | 3076 | |
| 2908 | 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 | 3079 | av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); |
| 2911 | 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 | 3086 | ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); |
| 2918 | 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 | 3098 | if (v->s.loop_filter) |
| 2921 | 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 | 3105 | MpegEncContext *s = &v->s; |
| 2928 | 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 | 3133 | apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); |
| 2956 | 3134 | s->first_slice_line = 1; |
| 2957 | 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 | 3137 | s->mb_x = 0; |
| 2960 | 3138 | ff_init_block_index(s); |
| 2961 | 3139 | for(; s->mb_x < s->mb_width; s->mb_x++) { |
| 2962 | 3140 | ff_update_block_index(s); |
| 2963 | 3141 | |
| 2964 | 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 | 3144 | vc1_apply_p_loop_filter(v); |
| 2967 | 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 | 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 | 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 | 3152 | memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0])*s->mb_stride); |
| 2975 | 3153 | memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); |
| 2976 | 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 | 3156 | s->first_slice_line = 0; |
| 2979 | 3157 | } |
| 2980 | 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 | 3163 | vc1_apply_p_loop_filter(v); |
| 2986 | 3164 | } |
| 2987 | 3165 | } |
| 2988 | − if (mby_end >= mby_start) | |
| 2989 | − ff_draw_horiz_band(s, (mby_end-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)); | |
| 3166 | + if (s->end_mb_y >= s->start_mb_y) | |
| 3167 | + ff_draw_horiz_band(s, (s->end_mb_y-1) * 16, 16); | |
| 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 | 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 | 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 | 3202 | s->mb_x = 0; |
| 3025 | 3203 | ff_init_block_index(s); |
| 3026 | 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 | 3207 | vc1_decode_b_mb(v); |
| 3030 | 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 | 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 | 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 | 3221 | if (v->s.loop_filter) |
| 3044 | 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 | 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 | 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 | 3248 | v->s.esc3_level_length = 0; |
| 3071 | 3249 | if(v->x8_type){ |
| 3072 | 3250 | ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) ); |
| 3073 | 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 | 3256 | switch(v->s.pict_type) { |
| 3075 | 3257 | case AV_PICTURE_TYPE_I: |
| 3076 | 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 | 3260 | else |
| 3079 | 3261 | vc1_decode_i_blocks(v); |
| 3080 | 3262 | break; |
| @@ -3082,16 +3264,16 @@ static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) · 1 unmodified line | ||
| 3082 | 3264 | if(v->p_frame_skipped) |
| 3083 | 3265 | vc1_decode_skip_blocks(v); |
| 3084 | 3266 | else |
| 3085 | − vc1_decode_p_blocks(v, mby_start, mby_end); | |
| 3267 | + vc1_decode_p_blocks(v); | |
| 3086 | 3268 | break; |
| 3087 | 3269 | case AV_PICTURE_TYPE_B: |
| 3088 | 3270 | if(v->bi_type){ |
| 3089 | 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 | 3273 | else |
| 3092 | 3274 | vc1_decode_i_blocks(v); |
| 3093 | 3275 | }else |
| 3094 | − vc1_decode_b_blocks(v, mby_start, mby_end); | |
| 3276 | + vc1_decode_b_blocks(v); | |
| 3095 | 3277 | break; |
| 3096 | 3278 | } |
| 3097 | 3279 | } |
| @@ -3341,6 +3523,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) · 243 unmodified lines | ||
| 3341 | 3523 | v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); |
| 3342 | 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 | 3528 | v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); |
| 3345 | 3529 | v->cbp = v->cbp_base + s->mb_stride; |
| 3346 | 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 | 3740 | for (i = 0; i <= n_slices; i++) { |
| 3557 | 3741 | if (i && get_bits1(&s->gb)) |
| 3558 | 3742 | vc1_parse_frame_header_adv(v, &s->gb); |
| 3559 | − vc1_decode_blocks(v, 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)); | |
| 3743 | + s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].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 | 3746 | if (i != n_slices) s->gb = slices[i].gb; |
| 3562 | 3747 | } |
| 3563 | 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 | 3799 | av_freep(&v->acpred_plane); |
| 3615 | 3800 | av_freep(&v->over_flags_plane); |
| 3616 | 3801 | av_freep(&v->mb_type_base); |
| 3802 | + av_freep(&v->block); | |
| 3617 | 3803 | av_freep(&v->cbp_base); |
| 3618 | 3804 | av_freep(&v->ttblk_base); |
| 3619 | 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 | 134 | * VC-1 in-loop deblocking filter for one line |
| 83 | 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 | 256 | int i; |
| 205 | 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 | 306 | t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; |
| 255 | 307 | t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; |
| 256 | 308 | |
| 257 | − dst[ 0] = (((t5 + t1 ) >> 7) - sub) << shl; | |
| 258 | − dst[ 8] = (((t6 + t2 ) >> 7) - sub) << shl; | |
| 259 | − dst[16] = (((t7 + t3 ) >> 7) - sub) << shl; | |
| 260 | − dst[24] = (((t8 + t4 ) >> 7) - sub) << shl; | |
| 261 | − dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl; | |
| 262 | − dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl; | |
| 263 | − dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl; | |
| 264 | − dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl; | |
| 309 | + dst[ 0] = (t5 + t1) >> 7; | |
| 310 | + dst[ 8] = (t6 + t2) >> 7; | |
| 311 | + dst[16] = (t7 + t3) >> 7; | |
| 312 | + dst[24] = (t8 + t4) >> 7; | |
| 313 | + dst[32] = (t8 - t4 + 1) >> 7; | |
| 314 | + dst[40] = (t7 - t3 + 1) >> 7; | |
| 315 | + dst[48] = (t6 - t2 + 1) >> 7; | |
| 316 | + dst[56] = (t5 - t1 + 1) >> 7; | |
| 265 | 317 | |
| 266 | 318 | src++; |
| 267 | 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 | 323 | /** Do inverse transform on 8x4 part of block |
| 302 | 324 | */ |
| 303 | 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 | 716 | av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { |
| 695 | − dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_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; | |
| 717 | + dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; | |
| 700 | 718 | dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; |
| 701 | 719 | dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; |
| 702 | 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 | 724 | dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; |
| 707 | 725 | dsp->vc1_h_overlap = vc1_h_overlap_c; |
| 708 | 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 | 729 | dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; |
| 710 | 730 | dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c; |
| 711 | 731 | dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c; |
| @@ -30,13 +30,9 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #include "dsputil.h" |
| 32 | 32 | |
| 33 | −typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block); | |
| 34 | − | |
| 35 | 33 | typedef struct VC1DSPContext { |
| 36 | 34 | /* vc1 functions */ |
| 37 | − vc1_idct_func vc1_inv_trans_8x8_add; | |
| 38 | − vc1_idct_func vc1_inv_trans_8x8_put_signed[2]; | |
| 39 | − vc1_idct_func vc1_inv_trans_8x8_put[2]; | |
| 35 | + void (*vc1_inv_trans_8x8)(DCTELEM *b); | |
| 40 | 36 | void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); |
| 41 | 37 | void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); |
| 42 | 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 | 40 | void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); |
| 45 | 41 | void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); |
| 46 | 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); | |
| 48 | − void (*vc1_h_overlap)(uint8_t* src, int stride); | |
| 43 | + void (*vc1_v_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 | 47 | void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); |
| 50 | 48 | void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); |
| 51 | 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 | 585 | return AVERROR(EINVAL); |
| 586 | 586 | |
| 587 | 587 | ret = av_mallocz(sizeof(AVFilterContext)); |
| 588 | + if (!ret) | |
| 589 | + return AVERROR(ENOMEM); | |
| 588 | 590 | |
| 589 | 591 | ret->av_class = &avfilter_class; |
| 590 | 592 | ret->filter = filter; |
| 591 | 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 | 600 | ret->input_count = pad_count(filter->inputs); |
| 595 | 601 | if (ret->input_count) { |
| 596 | 602 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); |
| 603 | + if (!ret->input_pads) | |
| 604 | + goto err; | |
| 597 | 605 | memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); |
| 598 | 606 | ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); |
| 607 | + if (!ret->inputs) | |
| 608 | + goto err; | |
| 599 | 609 | } |
| 600 | 610 | |
| 601 | 611 | ret->output_count = pad_count(filter->outputs); |
| 602 | 612 | if (ret->output_count) { |
| 603 | 613 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); |
| 614 | + if (!ret->output_pads) | |
| 615 | + goto err; | |
| 604 | 616 | memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); |
| 605 | 617 | ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); |
| 618 | + if (!ret->outputs) | |
| 619 | + goto err; | |
| 606 | 620 | } |
| 607 | 621 | |
| 608 | 622 | *filter_ctx = ret; |
| 609 | 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 | 637 | void avfilter_free(AVFilterContext *filter) |
| @@ -299,7 +299,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ · 298 unmodified lines | ||
| 299 | 299 | flacenc_header.o avlanguage.o |
| 300 | 300 | OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o |
| 301 | 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 | 304 | OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o |
| 304 | 305 | OBJS-$(CONFIG_XA_DEMUXER) += xa.o |
| 305 | 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 | 845 | if (asf->packet_flags & 0x01) { |
| 846 | 846 | DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal |
| 847 | 847 | if(asf->packet_frag_size > asf->packet_size_left - rsize){ |
| 848 | − av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n"); | |
| 849 | − return -1; | |
| 848 | + if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { | |
| 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 | 857 | //printf("Fragsize %d\n", asf->packet_frag_size); |
| 852 | 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 | 863 | asf->packet_frag_size = asf->packet_size_left - rsize; |
| 854 | 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 | 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 | 67 | #if CONFIG_FILE_PROTOCOL |
| 55 | 68 | |
| 56 | 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 | 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 | 111 | URLProtocol ff_file_protocol = { |
| 112 | 112 | .name = "file", |
| 113 | 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 | 404 | end_ebml_master(pb, cues_element); |
| 405 | 405 | |
| 406 | − av_free(cues->entries); | |
| 407 | − av_free(cues); | |
| 408 | 406 | return currentpos; |
| 409 | 407 | } |
| 410 | 408 | |
| @@ -1164,6 +1162,8 @@ static int mkv_write_trailer(AVFormatContext *s) · 753 unmodified lines | ||
| 1164 | 1162 | |
| 1165 | 1163 | end_ebml_master(pb, mkv->segment); |
| 1166 | 1164 | av_free(mkv->tracks); |
| 1165 | + av_freep(&mkv->cues->entries); | |
| 1166 | + av_freep(&mkv->cues); | |
| 1167 | 1167 | av_destruct_packet(&mkv->cur_audio_pkt); |
| 1168 | 1168 | avio_flush(pb); |
| 1169 | 1169 | return 0; |
| @@ -829,7 +829,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) · 828 unmodified lines | ||
| 829 | 829 | memset(compressor_name,0,32); |
| 830 | 830 | /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ |
| 831 | 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 | 833 | avio_w8(pb, strlen(compressor_name)); |
| 834 | 834 | avio_write(pb, compressor_name, 31); |
| 835 | 835 | |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include "id3v1.h" |
| 25 | 25 | #include "id3v2.h" |
| 26 | 26 | #include "rawenc.h" |
| 27 | +#include "libavutil/avstring.h" | |
| 27 | 28 | #include "libavutil/intreadwrite.h" |
| 28 | 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 | 34 | AVMetadataTag *tag; |
| 34 | 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 | 37 | return !!tag; |
| 37 | 38 | } |
| 38 | 39 | |
| @@ -589,6 +589,12 @@ static int write_header(AVFormatContext *s){ · 588 unmodified lines | ||
| 589 | 589 | nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); |
| 590 | 590 | nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + |
| 591 | 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 | 599 | for(i=0; i<s->nb_streams; i++){ |
| 594 | 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 | 86 | //#define DEBUG_BRIGHTNESS |
| 87 | 87 | #include "postprocess.h" |
| 88 | 88 | #include "postprocess_internal.h" |
| 89 | +#include "libavutil/avstring.h" | |
| 89 | 90 | |
| 90 | 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 | 767 | ppMode->maxClippedThreshold= 0.01; |
| 767 | 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 | 772 | av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name); |
| 772 | 773 | |
| @@ -1,15 +1,15 @@ | ||
| 1 | −0, 0, 38016, 0xf4715db5 | |
| 2 | −0, 3600, 38016, 0xf4715db5 | |
| 3 | −0, 7200, 38016, 0xf4715db5 | |
| 4 | −0, 10800, 38016, 0xf46af0e1 | |
| 5 | −0, 14400, 38016, 0x9c1c2cf1 | |
| 6 | −0, 18000, 38016, 0xff12d87f | |
| 7 | −0, 21600, 38016, 0x7408432b | |
| 8 | −0, 25200, 38016, 0x7408432b | |
| 9 | −0, 28800, 38016, 0x8d11479a | |
| 10 | −0, 32400, 38016, 0x8d11479a | |
| 11 | −0, 36000, 38016, 0xc4a121ab | |
| 12 | −0, 39600, 38016, 0xc4a121ab | |
| 13 | −0, 43200, 38016, 0xc4a121ab | |
| 14 | −0, 46800, 38016, 0xc4a121ab | |
| 15 | −0, 50400, 38016, 0xc4a121ab | |
| 1 | +0, 0, 38016, 0xa6f15db5 | |
| 2 | +0, 3600, 38016, 0xa6f15db5 | |
| 3 | +0, 7200, 38016, 0xa6f15db5 | |
| 4 | +0, 10800, 38016, 0x5c4ef0e7 | |
| 5 | +0, 14400, 38016, 0x53a42d1d | |
| 6 | +0, 18000, 38016, 0x68f7d89e | |
| 7 | +0, 21600, 38016, 0xc15f4368 | |
| 8 | +0, 25200, 38016, 0xc15f4368 | |
| 9 | +0, 28800, 38016, 0xd1bd47a8 | |
| 10 | +0, 32400, 38016, 0xd1bd47a8 | |
| 11 | +0, 36000, 38016, 0xe1e821ca | |
| 12 | +0, 39600, 38016, 0xe1e821ca | |
| 13 | +0, 43200, 38016, 0xe1e821ca | |
| 14 | +0, 46800, 38016, 0xe1e821ca | |
| 15 | +0, 50400, 38016, 0xe1e821ca | |