| @@ -319,6 +319,15 @@ static av_cold int me_cmp_init(MpegEncContext *s, AVCodecContext *avctx) · 318 unmodified lines |
| 319 | 319 | if (ret < 0) |
| 320 | 320 | return ret; |
| 321 | 321 | s->frame_skip_cmp_fn = me_cmp[1]; |
| 322 | + if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { |
| 323 | + ret = ff_set_cmp(&s->mecc, me_cmp, avctx->ildct_cmp); |
| 324 | + if (ret < 0) |
| 325 | + return ret; |
| 326 | + if (!me_cmp[0] || !me_cmp[4]) |
| 327 | + return AVERROR(EINVAL); |
| 328 | + s->ildct_cmp[0] = me_cmp[0]; |
| 329 | + s->ildct_cmp[1] = me_cmp[4]; |
| 330 | + } |
| 322 | 331 | |
| 323 | 332 | return 0; |
| 324 | 333 | } |
| @@ -929,14 +938,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 604 unmodified lines |
| 929 | 938 | |
| 930 | 939 | s->quant_precision = 5; |
| 931 | 940 | |
| 932 | | − if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { |
| 933 | | − ret = ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, avctx->ildct_cmp); |
| 934 | | − if (ret < 0) |
| 935 | | − return ret; |
| 936 | | − if (!s->mecc.ildct_cmp[0] || !s->mecc.ildct_cmp[4]) |
| 937 | | − return AVERROR(EINVAL); |
| 938 | | − } |
| 939 | | − |
| 940 | 941 | if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) { |
| 941 | 942 | ff_h263_encode_init(s); |
| 942 | 943 | #if CONFIG_MSMPEG4ENC |
| @@ -2209,15 +2210,15 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, · 1266 unmodified lines |
| 2209 | 2210 | int progressive_score, interlaced_score; |
| 2210 | 2211 | |
| 2211 | 2212 | s->interlaced_dct = 0; |
| 2212 | | − progressive_score = s->mecc.ildct_cmp[4](s, ptr_y, NULL, wrap_y, 8) + |
| 2213 | | − s->mecc.ildct_cmp[4](s, ptr_y + wrap_y * 8, |
| 2214 | | − NULL, wrap_y, 8) - 400; |
| 2213 | + progressive_score = s->ildct_cmp[1](s, ptr_y, NULL, wrap_y, 8) + |
| 2214 | + s->ildct_cmp[1](s, ptr_y + wrap_y * 8, |
| 2215 | + NULL, wrap_y, 8) - 400; |
| 2215 | 2216 | |
| 2216 | 2217 | if (progressive_score > 0) { |
| 2217 | | − interlaced_score = s->mecc.ildct_cmp[4](s, ptr_y, |
| 2218 | | − NULL, wrap_y * 2, 8) + |
| 2219 | | − s->mecc.ildct_cmp[4](s, ptr_y + wrap_y, |
| 2220 | | − NULL, wrap_y * 2, 8); |
| 2218 | + interlaced_score = s->ildct_cmp[1](s, ptr_y, |
| 2219 | + NULL, wrap_y * 2, 8) + |
| 2220 | + s->ildct_cmp[1](s, ptr_y + wrap_y, |
| 2221 | + NULL, wrap_y * 2, 8); |
| 2221 | 2222 | if (progressive_score > interlaced_score) { |
| 2222 | 2223 | s->interlaced_dct = 1; |
| 2223 | 2224 | |
| @@ -2288,20 +2289,20 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, · 64 unmodified lines |
| 2288 | 2289 | int progressive_score, interlaced_score; |
| 2289 | 2290 | |
| 2290 | 2291 | s->interlaced_dct = 0; |
| 2291 | | − progressive_score = s->mecc.ildct_cmp[0](s, dest_y, ptr_y, wrap_y, 8) + |
| 2292 | | − s->mecc.ildct_cmp[0](s, dest_y + wrap_y * 8, |
| 2293 | | − ptr_y + wrap_y * 8, |
| 2294 | | − wrap_y, 8) - 400; |
| 2292 | + progressive_score = s->ildct_cmp[0](s, dest_y, ptr_y, wrap_y, 8) + |
| 2293 | + s->ildct_cmp[0](s, dest_y + wrap_y * 8, |
| 2294 | + ptr_y + wrap_y * 8, |
| 2295 | + wrap_y, 8) - 400; |
| 2295 | 2296 | |
| 2296 | 2297 | if (s->avctx->ildct_cmp == FF_CMP_VSSE) |
| 2297 | 2298 | progressive_score -= 400; |
| 2298 | 2299 | |
| 2299 | 2300 | if (progressive_score > 0) { |
| 2300 | | − interlaced_score = s->mecc.ildct_cmp[0](s, dest_y, ptr_y, |
| 2301 | | − wrap_y * 2, 8) + |
| 2302 | | − s->mecc.ildct_cmp[0](s, dest_y + wrap_y, |
| 2303 | | − ptr_y + wrap_y, |
| 2304 | | − wrap_y * 2, 8); |
| 2301 | + interlaced_score = s->ildct_cmp[0](s, dest_y, ptr_y, |
| 2302 | + wrap_y * 2, 8) + |
| 2303 | + s->ildct_cmp[0](s, dest_y + wrap_y, |
| 2304 | + ptr_y + wrap_y, |
| 2305 | + wrap_y * 2, 8); |
| 2305 | 2306 | |
| 2306 | 2307 | if (progressive_score > interlaced_score) { |
| 2307 | 2308 | s->interlaced_dct = 1; |