MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / mpv_reconstruct_mb_internal

Function mpv_reconstruct_mb_internal

libavcodec/mpegvideo_dec.c:933–1103  ·  view source on GitHub ↗

generic function called after a macroblock has been parsed by the decoder. Important variables used: s->mb_intra : true if intra macroblock s->mv_dir : motion vector direction s->mv_type : motion vector type s->mv : motion vector s->interlaced_dct : true if interlaced dct used (mpeg2) */

Source from the content-addressed store, hash-verified

931 s->interlaced_dct : true if interlaced dct used (mpeg2)
932 */
933static av_always_inline
934void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64],
935 int lowres_flag, int is_mpeg12)
936{
937#define IS_MPEG12_H261(s) (is_mpeg12 == MAY_BE_MPEG12_H261 ? ((s)->out_format <= FMT_H261) : is_mpeg12)
938 uint8_t *dest_y = s->dest[0], *dest_cb = s->dest[1], *dest_cr = s->dest[2];
939 int dct_linesize, dct_offset;
940 const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics
941 const int uvlinesize = s->cur_pic.linesize[1];
942 const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8;
943
944 dct_linesize = linesize << s->interlaced_dct;
945 dct_offset = s->interlaced_dct ? linesize : linesize * block_size;
946
947 if (!s->mb_intra) {
948 /* motion handling */
949 if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12_H261 &&
950 s->avctx->active_thread_type & FF_THREAD_FRAME) {
951 if (s->mv_dir & MV_DIR_FORWARD) {
952 ff_thread_progress_await(&s->last_pic.ptr->progress,
953 lowest_referenced_row(s, 0));
954 }
955 if (s->mv_dir & MV_DIR_BACKWARD) {
956 ff_thread_progress_await(&s->next_pic.ptr->progress,
957 lowest_referenced_row(s, 1));
958 }
959 }
960
961 if (lowres_flag) {
962 const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab;
963
964 if (s->mv_dir & MV_DIR_FORWARD) {
965 MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix);
966 op_pix = s->h264chroma.avg_h264_chroma_pixels_tab;
967 }
968 if (s->mv_dir & MV_DIR_BACKWARD) {
969 MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix);
970 }
971 } else {
972 const op_pixels_func (*op_pix)[4];
973 const qpel_mc_func (*op_qpix)[16];
974
975 if ((is_mpeg12 == DEFINITELY_MPEG12_H261 || !s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
976 op_pix = s->hdsp.put_pixels_tab;
977 op_qpix = s->qdsp.put_qpel_pixels_tab;
978 } else {
979 op_pix = s->hdsp.put_no_rnd_pixels_tab;
980 op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab;
981 }
982 if (s->mv_dir & MV_DIR_FORWARD) {
983 ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix, op_qpix);
984 op_pix = s->hdsp.avg_pixels_tab;
985 op_qpix = s->qdsp.avg_qpel_pixels_tab;
986 }
987 if (s->mv_dir & MV_DIR_BACKWARD) {
988 ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix, op_qpix);
989 }
990 }

Callers 1

ff_mpv_reconstruct_mbFunction · 0.85

Calls 9

ff_thread_progress_awaitFunction · 0.85
lowest_referenced_rowFunction · 0.85
MPV_motion_lowresFunction · 0.85
ff_mpv_motionFunction · 0.85
add_dctFunction · 0.85
ff_wmv2_add_mbFunction · 0.85
ff_mpeg4_decode_studioFunction · 0.85
add_dequant_dctFunction · 0.70
put_dctFunction · 0.70

Tested by

no test coverage detected