From: Michael Niedermayer Date: Fri, 12 Jun 2015 18:47:14 +0000 (+0200) Subject: Merge commit '8b5007a31b8d1ddbe3661bf45a732336450b7d25' X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=58f63670e173c1113ab231850572be303a21faef;p=ffmpeg Merge commit '8b5007a31b8d1ddbe3661bf45a732336450b7d25' * commit '8b5007a31b8d1ddbe3661bf45a732336450b7d25': mpegvideo: Move ER functions to a separate file Conflicts: libavcodec/mpegvideo.c Merged-by: Michael Niedermayer --- 58f63670e173c1113ab231850572be303a21faef diff --cc libavcodec/mpegvideo.c index 2b01d7bb727,2e8fb89c1dd..a3ff7460e90 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@@ -256,47 -267,6 +257,19 @@@ static void dct_unquantize_h263_inter_c } } - static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, - int (*mv)[2][4][2], - int mb_x, int mb_y, int mb_intra, int mb_skipped) - { - MpegEncContext *s = opaque; - - s->mv_dir = mv_dir; - s->mv_type = mv_type; - s->mb_intra = mb_intra; - s->mb_skipped = mb_skipped; - s->mb_x = mb_x; - s->mb_y = mb_y; - memcpy(s->mv, mv, sizeof(*mv)); - - ff_init_block_index(s); - ff_update_block_index(s); - - s->bdsp.clear_blocks(s->block[0]); - - s->dest[0] = s->current_picture.f->data[0] + (s->mb_y * 16 * s->linesize) + s->mb_x * 16; - s->dest[1] = s->current_picture.f->data[1] + (s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16 >> s->chroma_x_shift); - s->dest[2] = s->current_picture.f->data[2] + (s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16 >> s->chroma_x_shift); - - if (ref) - av_log(s->avctx, AV_LOG_DEBUG, - "Interlaced error concealment is not fully implemented\n"); - ff_mpv_decode_mb(s, s->block); - } + +static void gray16(uint8_t *dst, const uint8_t *src, ptrdiff_t linesize, int h) +{ + while(h--) + memset(dst + h*linesize, 128, 16); +} + +static void gray8(uint8_t *dst, const uint8_t *src, ptrdiff_t linesize, int h) +{ + while(h--) + memset(dst + h*linesize, 128, 8); +} + /* init common dct for both encoder and decoder */ static av_cold int dct_init(MpegEncContext *s) { @@@ -675,54 -617,6 +648,18 @@@ void ff_mpv_decode_defaults(MpegEncCont ff_mpv_common_defaults(s); } +void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) +{ + s->avctx = avctx; + s->width = avctx->coded_width; + s->height = avctx->coded_height; + s->codec_id = avctx->codec->id; + s->workaround_bugs = avctx->workaround_bugs; + + /* convert fourcc to upper case */ + s->codec_tag = avpriv_toupper4(avctx->codec_tag); +} + - static int init_er(MpegEncContext *s) - { - ERContext *er = &s->er; - int mb_array_size = s->mb_height * s->mb_stride; - int i; - - er->avctx = s->avctx; - - er->mb_index2xy = s->mb_index2xy; - er->mb_num = s->mb_num; - er->mb_width = s->mb_width; - er->mb_height = s->mb_height; - er->mb_stride = s->mb_stride; - er->b8_stride = s->b8_stride; - - er->er_temp_buffer = av_malloc(s->mb_height * s->mb_stride); - er->error_status_table = av_mallocz(mb_array_size); - if (!er->er_temp_buffer || !er->error_status_table) - goto fail; - - er->mbskip_table = s->mbskip_table; - er->mbintra_table = s->mbintra_table; - - for (i = 0; i < FF_ARRAY_ELEMS(s->dc_val); i++) - er->dc_val[i] = s->dc_val[i]; - - er->decode_mb = mpeg_er_decode_mb; - er->opaque = s; - - return 0; - fail: - av_freep(&er->er_temp_buffer); - av_freep(&er->error_status_table); - return AVERROR(ENOMEM); - } - /** * Initialize and allocates MpegEncContext fields dependent on the resolution. */