Discussion on cofac and related arrays in jm8.6

Source: Internet
Author: User

Understanding of int *** cofac Variables

Discussion on cofac, cofac8x8, cofdc, cofac4x4, and cofac4x4intern


Here I want to explain the meanings of some variables in the red box:

I searched the jm86 code and found that cofac4x4intern is used in a few places:


Again, I think cofac4x4intern is useless, just to use get_memaccoeff to allocate memory space for cofac4x4. Maybe I am too lazy to write a function that separately allocates space for cofac4x4.

Cofac4x4 is easy to understand, that is, the AC coefficient of a 4x4 small block.

Cofdc is the DC coefficient of 6 8x8 blocks including the color block (the brightness has 4 8x8, 2 10x8 ).

Cofac corresponds to cofdc and should be the AC coefficient.

April 10, 2011 17:36:37

Several transformation coefficient arrays in JM code


Download(11.62 KB)

AM

What are the differences between these arrays?
In particular, what does cofac4x4intern mean?

The following are the search results in understand:





In fact, we can see the differences and relationships between the four AC coefficient arrays through the above four figures.

The following four examples show reference results in vs2008, which are more accurate:


  1. First, for the int *** cofac array, as rdopt. A global variable of C, which is a 4-dimensional array, stores all the AC coefficients in a macro block: divides the 16x16 macro block into four 8x8 blocks, then four 8x8 blocks are divided into four 4x4 blocks, and 15 AC coefficient values in 4x4 are stored according to different levels/run. this array is mainly used in the store_macroblock_parameters function,
    Because the IMG structure contains the cofac array, here, in the rodpt. c file, cofac mainly saves IMG-> cofac during the intermediate process.


  2. For the int *** cofac8x8 array, it is also a global variable, which is the same as cofac, however, it mainly stores the AC coefficients of each 8x8 block (4 8x8 blocks) in the sub-Macro Block Mode Selection between frames, and is applied in both rdo and non-rdo, in fact, the main reason is that encoding is required in the mode selection, so the AC coefficient must be saved.


  3. The Int ** cofac4x4 array is well understood. It stores the AC coefficient of a 4x4 block. The first dimension is level/run, and the second dimension is scan_pos, this array is mainly used as an intermediate amount when selecting 9 Internal Frame modes in 4x4 blocks, saving the AC coefficient, and then Coding


  4. Int ***** the cofac4x4intern array is actually useless. by looking at the code, we can find that this array is mainly used to serve the two-dimensional array cofac4x4, because in the code, after the cofac4x4intern is allocated by using the get_mem_accoeff function, we assign the two-dimensional pointer in cofacintern [0] [0] To cofac4x4. That's all.

Through the comparison above, we can find that the first three arrays cofac, cofac8x8, and cofac4x4 are similar, all of which are an intermediate volume. encoding is required during the selection of the intra-frame mode, therefore, in order to save the IMG-> cofac value during the encoding process, the above three arrays are used.

Cofac is used in store_macroblock_parameters function to save Macro Block parameters.


Cofac8x8 is used to save some AC coefficients of four 8x8 macro blocks during the selection of the sub-Macro Block Mode between frames.


Cofac4x4 is used to save the AC coefficient of a 4x4 block during the selection of nine modes within the frame.


Summary:

The following is defined in the rdopt. c file,


The definition in the imageparameters struct is as follows:


First, cofac is a four-dimensional array, cofdc is a three-dimensional array, and cofac8x8 is also a four-dimensional array, which can be understood as follows:

The cofac in the imageparameters struct is used to save all the AC coefficients in a macro block (brightness and color). It is saved in a program encoding mode, and the corresponding cofdc is the DC coefficient of YUV.

In rdopt. both cofac and cofac8x8 in the C file are used to save IMG-> cofac and IMG-> cofdc variables. cofac4x4 is a 4x4 AC coefficient, used to save the last two dimensions of IMG-> cofac (usage in mode_decision_for_4x4intrablocks)

 

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.