Setmotionvectorpredictor () in macroblock. c ()

Source: Internet
Author: User
Reference software jm95, ldecode
In macroblock. C Setmotionvectorpredictor ()

PMV: prediction vector to be obtained.
Ref_frame: Number of the current reference frame, refidxlx
Rframel: The reference frame number of adjacent block A, that is, the standard refidxlxa.
Rframeu: refidxlxb
Rframeur: refidxlxc
Refpic: Reference Frame index of each 4x4 sub-block of the current Encoding Frame.
Tmp_mv: The motion music of each 4x4 sub-block of the current Encoding Frame includes two directions: X and Y.
(The child blocks that have been estimated by motion. The adjacent A, B, C, and D blocks of the current encoding block are all estimated by motion. Therefore, refpic and tmp_mv can be used for reference)
Ref_frame: refer to the frame index number, which is not frame_num or POC number. It is the serial number in the list.
Block_x: coordinates in the X direction
Block_y: Y coordinate
Blockshape_x: the size of the Child block in the X direction, mbpartwidth,
Blockshape_y: the size of the Child block in the Y direction mbpartheight
Mb_x, mb_y = 4 * block_x (block_y) = x + Xs.
Mb_nr = currmbaddr
Rel_x = XD
Block_x = (x + XS)/4?
Blockshape_x = standard predpartwidth
The output of getluma4x4neighbour () is equal to 1/4 of the output of getneighbour, XW/4, YW/4

Call getluma4x4neighbour to calculate block_a, block_ B, block_c, block_d parameters (including validity, address, XW, YW, pos_x, pos_y)

Which situations does block_c not work? (mb_x, mb_y is the coordinate in the XN Macro Block ?)
1.16 × 8, if XN and yn are in the No.1 Macro Block, block_c is invalid (the Macro Block in 16*8, so there is no C Block)
2. mb_x = 0, blcokshape_x = 8, mb_y! = 8, mb_y> 0 (not 0 Macro Block), C is also invalid. (That is, 2nd macro block of 8x8 ?)
3. mb_x = 8, blockshape_x = 8, mb_y! = 0 (the No. 3 macro block of 8x8), and C is invalid.

If C is invalid, replace C with the data of D.
Mvpredtype = 0; (0: MVP, 1: Use A, 2 only use B, 3 only use C)
1. if it is not mbaff: rframel (left) = pos_x of a Macro Block in refpic, pos_y points to the vertex value, rframeu (top) retrieves the value of B macro block points, rframeur (top right) obtain the value of the C macro block.
2. For mbaff:
A) currmb is a field: Then, when rframel is a field, take the value specified by block_x and block_y. If it is a frame, multiply the refidx value by 2, rframeu, and Ur.
B) currmb is a frame. When field a is set, refidx is divided by 2. When frame a is set, block _x and block_y point to the value.

Only when the sequence number of the reference frame of an adjacent block is the same as that of the current reference frame:
Rframel = ref_frame (indicating the serial number of the reference frame = the serial number of the current reference frame)
If the current reference frame only references the same reference frame as a, then mvpredtype = 1. If it is only for B, it is equal to 2. If it is only for C, it is equal to 3;

The following standard p121
1) 8 × 16, 0th macro blocks, and a references the same as currmb references, then mvpredtype = 1
2) 8 × 16, 1st macro blocks, and C references the same as currmb references, then mvpredtype = 3;
3) 16 × 8, 0th macro blocks, and B references the same as currmb references, then mvpredtype = 2
4) 16 × 8, 1st macro blocks, and a references the same as currmb, then mvpredtype = 1;

HV is the parameter for 0, 1 (two cycles) (whether 0 is X, 1 is Y)
1) HV = 0: mv_a, mv_ B, and mv_c both use temp_mv [0].
2) HV = 1:
A) if it is not mbaff: mv_a, mv_ B, and mv_c, use temp_mv [1].
B) For mbaff:
I. currmb is the field: A is the field, mv_a = tmp_mv [1], a is the frame, mv_a = tmp_mv [1]/2, B, C is similar.
Ii. currmb is frame: A is field, mv_a = tmp_mv [1] × 2, A is frame, mv_a = tmp_mv [1]

Different prediction methods are adopted based on mvpredtype:
1) mvpred_median mode: if both B and C are invalid, pred_vec = mv_a; otherwise, pred_vec = mv_a, mv_ B, and mv_c are the intermediate values.
2) mvpred_l mode: pred_vec = mv_a
3) mvpred_u mode: pred_vec = mv_ B;
4) mvpred_ur mode: pred_vec = mv_c;

HV = 0, pmv_x = pred_vec;
HV = 1, pmv_y = pred_vec;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.