Lines Matching defs:mb

662 motion_vector_frame(struct vl_mpg12_bs *bs, int s, struct pipe_mpeg12_macroblock *mb)
664 int dmv = mb->macroblock_modes.bits.frame_motion_type == PIPE_MPEG12_MO_TYPE_DUAL_PRIME;
667 if (mb->macroblock_modes.bits.frame_motion_type == PIPE_MPEG12_MO_TYPE_FIELD) {
668 mb->motion_vertical_field_select |= vl_vlc_get_uimsbf(&bs->vlc, 1) << s;
670 mb->PMV[0][s][0] = wrap(mb->PMV[0][s][0] + delta[0], bs->desc->f_code[s][0]);
671 mb->PMV[0][s][1] = wrap(DIV2DOWN(mb->PMV[0][s][1]) + delta[1], bs->desc->f_code[s][1]) * 2;
673 mb->motion_vertical_field_select |= vl_vlc_get_uimsbf(&bs->vlc, 1) << (s + 2);
675 mb->PMV[1][s][0] = wrap(mb->PMV[1][s][0] + delta[0], bs->desc->f_code[s][0]);
676 mb->PMV[1][s][1] = wrap(DIV2DOWN(mb->PMV[1][s][1]) + delta[1], bs->desc->f_code[s][1]) * 2;
680 mb->PMV[0][s][0] = wrap(mb->PMV[0][s][0] + delta[0], bs->desc->f_code[s][0]);
681 mb->PMV[0][s][1] = wrap(mb->PMV[0][s][1] + delta[1], bs->desc->f_code[s][1]);
686 motion_vector_field(struct vl_mpg12_bs *bs, int s, struct pipe_mpeg12_macroblock *mb)
688 int dmv = mb->macroblock_modes.bits.field_motion_type == PIPE_MPEG12_MO_TYPE_DUAL_PRIME;
691 if (mb->macroblock_modes.bits.field_motion_type == PIPE_MPEG12_MO_TYPE_16x8) {
692 mb->motion_vertical_field_select |= vl_vlc_get_uimsbf(&bs->vlc, 1) << s;
695 mb->motion_vertical_field_select |= vl_vlc_get_uimsbf(&bs->vlc, 1) << (s + 2);
699 mb->motion_vertical_field_select |= vl_vlc_get_uimsbf(&bs->vlc, 1) << s;
710 decode_dct(struct vl_mpg12_bs *bs, struct pipe_mpeg12_macroblock *mb, int scale)
717 bool intra = mb->macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA;
721 short *dst = mb->blocks;
724 mb->coded_block_pattern = cbp = intra ? 0x3F : vl_vlc_get_vlclbf(&bs->vlc, tbl_B9, 9);
792 struct pipe_mpeg12_macroblock mb;
797 memset(&mb, 0, sizeof(mb));
798 mb.base.codec = PIPE_VIDEO_CODEC_MPEG12;
799 mb.y = vl_vlc_get_uimsbf(&bs->vlc, 8) - 1;
800 mb.blocks = dct_blocks;
830 mb.num_skipped_macroblocks = inc - 1;
831 bs->decoder->decode_macroblock(bs->decoder, target, &bs->desc->base, &mb.base, 1);
833 mb.x = x += inc;
837 mb.macroblock_type = vl_vlc_get_vlclbf(&bs->vlc, tbl_B2, 2);
841 mb.macroblock_type = vl_vlc_get_vlclbf(&bs->vlc, tbl_B3, 6);
845 mb.macroblock_type = vl_vlc_get_vlclbf(&bs->vlc, tbl_B4, 6);
849 mb.macroblock_type = 0;
854 mb.macroblock_modes.value = 0;
855 if (mb.macroblock_type & (PIPE_MPEG12_MB_TYPE_MOTION_FORWARD | PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD)) {
858 mb.macroblock_modes.bits.frame_motion_type = vl_vlc_get_uimsbf(&bs->vlc, 2);
860 mb.macroblock_modes.bits.frame_motion_type = 2;
862 mb.macroblock_modes.bits.field_motion_type = vl_vlc_get_uimsbf(&bs->vlc, 2);
864 } else if ((mb.macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA) && bs->desc->concealment_motion_vectors) {
866 mb.macroblock_modes.bits.frame_motion_type = 2;
868 mb.macroblock_modes.bits.field_motion_type = 1;
873 mb.macroblock_type & (PIPE_MPEG12_MB_TYPE_INTRA | PIPE_MPEG12_MB_TYPE_PATTERN))
874 mb.macroblock_modes.bits.dct_type = vl_vlc_get_uimsbf(&bs->vlc, 1);
876 if (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_QUANT)
880 memset(mb.PMV, 0, sizeof(mb.PMV));
882 mb.motion_vertical_field_select = 0;
883 if ((mb.macroblock_type & PIPE_MPEG12_MB_TYPE_MOTION_FORWARD) ||
884 (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA && bs->desc->concealment_motion_vectors)) {
886 motion_vector_frame(bs, 0, &mb);
888 motion_vector_field(bs, 0, &mb);
891 if (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD) {
893 motion_vector_frame(bs, 1, &mb);
895 motion_vector_field(bs, 1, &mb);
898 if (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA && bs->desc->concealment_motion_vectors) {
900 mb.PMV[1][0][0] = mb.PMV[0][0][0];
901 mb.PMV[1][0][1] = mb.PMV[0][0][1];
903 } else if (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA ||
904 !(mb.macroblock_type & (PIPE_MPEG12_MB_TYPE_MOTION_FORWARD |
906 memset(mb.PMV, 0, sizeof(mb.PMV));
909 if ((mb.macroblock_type & PIPE_MPEG12_MB_TYPE_MOTION_FORWARD &&
910 mb.macroblock_modes.bits.frame_motion_type == 2) ||
911 (mb.macroblock_modes.bits.frame_motion_type == 3)) {
912 mb.PMV[1][0][0] = mb.PMV[0][0][0];
913 mb.PMV[1][0][1] = mb.PMV[0][0][1];
916 if (mb.macroblock_type & PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD &&
917 mb.macroblock_modes.bits.frame_motion_type == 2) {
918 mb.PMV[1][1][0] = mb.PMV[0][1][0];
919 mb.PMV[1][1][1] = mb.PMV[0][1][1];
922 if (inc > 1 || !(mb.macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA))
925 if (mb.macroblock_type & (PIPE_MPEG12_MB_TYPE_INTRA | PIPE_MPEG12_MB_TYPE_PATTERN)) {
927 decode_dct(bs, &mb, dct_scale);
929 mb.coded_block_pattern = 0;
934 mb.num_skipped_macroblocks = 0;
935 bs->decoder->decode_macroblock(bs->decoder, target, &bs->desc->base, &mb.base, 1);