H.264 reference frame List Management Analysis -- Analysis of related functions in JM (lower)

Source: Internet
Author: User

This article analyzes several functions related to the image marking process.

[Cpp]
/*!
**************************************** ********************************
* \ Brief
* Perform Sliding window decoded reference picture marking process refer to the Sliding window marking process of the image
*
**************************************** ********************************
*/
Static void sliding_window_memory_management (StorablePicture * p)
{
Unsigned I;
 
Assert (! P-> idr_flag );
// If this is a reference pic with sliding window, unmark first ref frame
If (dpb. ref_frames_in_buffer = dpb. num_ref_frames-dpb. ltref_frames_in_buffer )//! <Less dpb. ltref_frames_in_buffer cannot be used on long-term reference frames due to Sliding Window labels
{
For (I = 0; I <dpb. used_size; I ++ )//! <Adopt a FIFO policy to remove the first short-term reference frame from the reference frame list in dpb and update the reference frame list.
{
If (dpb. fs [I]-> is_reference &&(! (Dpb. fs [I]-> is_long_term )))
{
Unmark_for_reference (dpb. fs [I]); //! <Mark this frame as a non-Reference Frame
Update_ref_list ();//! <Update the reference frame list
Break;
}
}
}
 
P-> is_long_term = 0;
}

 

[Cpp]
<Span style = "font-size: 12px;"> /*!
**************************************** ********************************
* \ Brief
* Perform Adaptive memory control decoded reference picture marking process Adaptive marking process
**************************************** ********************************
*/
Static void adaptive_memory_management (StorablePicture * p)
{
DecRefPicMarking_t * tmp_drpm;

Img-> last_has_mmco_5 = 0 ;//! <Memory_management_control_operation
 
Assert (! P-> idr_flag );
Assert (p-> adaptive_ref_pic_buffering_flag );
 
While (p-> dec_ref_pic_marking_buffer )//! <Stores the memory management control operations
{
Tmp_drpm = p-> dec_ref_pic_marking_buffer ;//! <Temporary save operation, which can be used to release the corresponding memory after the operation is completed
Switch (tmp_drpm-> memory_management_control_operation)
{
Case 0 ://! <End loop: exit the tag operation.
If (tmp_drpm-> Next! = NULL)
{
Error ("memory_management_control_operation = 0 not last operation in buffer", 500 );
}
Break;
Case 1 ://! <Mark a short-term reference image as a non-Reference Image
Mm_unmark_short_term_for_reference (p, tmp_drpm-> difference_of_pic_nums_minus1 );
Update_ref_list ();
Break;
Case 2 ://! <Mark a long-term reference image as a non-Reference Image
Mm_unmark_long_term_for_reference (p, tmp_drpm-> long_term_pic_num );
Update_ltref_list ();
Break;
Case 3 ://! <Convert a short-term reference image to a long-term reference image
Mm_assign_long_term_frame_idx (p, tmp_drpm-> difference_of_pic_nums_minus1, tmp_drpm-> long_term_frame_idx );
Update_ref_list ();
Update_ltref_list ();
Break;
Case 4 ://! <Specify the maximum number of long-term reference frames
Mm_update_max_long_term_frame_idx (tmp_drpm-> max_long_term_frame_idx_plus1 );
Update_ltref_list ();
Break;
Case 5 ://! <Clear the reference frame queue, remove all reference images from the reference frame queue, and disable the long-term reference mechanism.
Mm_unmark_all_short_term_for_reference ();
Mm_unmark_all_long_term_for_reference ();
Img-> last_has_mmco_5 = 1 ;//! <Mark here for the next POC update
Break;
Case 6 ://! <Save the current image as a long-term reference frame
Mm_mark_current_picture_long_term (p, tmp_drpm-> long_term_frame_idx );
Check_num_ref ();
Break;
Default:
Error ("invalid memory_management_control_operation in buffer", 500 );
}
P-> dec_ref_pic_marking_buffer = tmp_drpm-> Next ;//! <Take the next operation
Free (tmp_drpm );//! <Release the memory of the completed operation
}
If (img-> last_has_mmco_5)
{
P-> pic_num = p-> frame_num = 0 ;//! <Frame_num is cleared because the reference frame list is cleared.

Switch (p-> structure)
{
Case TOP_FIELD:
{
P-> poc = p-> top_poc = img-> toppoc = 0;
Break;
}
Case BOTTOM_FIELD:
{
P-> poc = p-> bottom_poc = img-> bottompoc = 0;
Break;
}
Case FRAME ://! <Frame mode
{Www.2cto.com
P-> top_poc-= p-> poc;
P-> bottom_poc-= p-> poc;
 
Img-> toppoc = p-> top_poc;
Img-> bottompoc = p-> bottom_poc;
 
P-> poc = min (p-> top_poc, p-> bottom_poc );
Img-> framepoc = p-> poc;
Break;
}
}
Img-> ThisPOC = p-> poc;
Flush_dpb ();
}
} </Span>

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.