天天看点

H.264句法和语法总结(八)参考图像序列标记 (marking)操作的语义

dec_ref_pic_marking( ) {  
     if( nal_unit_type    = =    5 ) {            
         // no_output_of_prior_pics_flag  仅在当前图像是 IDR 图像时出现这个句法元素,指明是否要将前面已解码的图像全部输出。  
        no_output_of_prior_pics_flag   
         // long_term_reference_flag    与上个图像一样,仅在当前图像是 IDR 图像时出现这一句法元素。这个句法元素指明是否使用长期参考这个机制。如果取值为 1,表明使用长期参考,并且每个 IDR 图像被解码后自动成为长期参考帧,否则(取值为 0),IDR 图像被解码后自动成为短期参考帧。  
         long_term_reference_flag    
     } else {           
         // adaptive_ref_pic_marking_mode_flag         指明标记(marking)操作的模式, 
            adaptive_ref_pic_marking_mode_flag         标记(marking)模式 
            0                                                                  先入先出(FIFO):使用滑动窗的机制,先入先出,在这种模式 
                                                                                下没有办法对长期参考帧进行操作。 
            1                                                                  自适应标记(marking):后续码流中会有一系列句法元素显式指 
                                                                                明操作的步骤。自适应是指编码器可根据情况随机灵活地作出决策。  
        adaptive_ref_pic_marking_mode_flag            if( adaptive_ref_pic_marking_mode_flag )           
             do {           
                /* memory_management_control_operation  在自适应标记(marking)模式中,指明本次操作的具体内容 
                 memory_management_control_operation           标记(marking)操作 
                 0                                                                          结束循环,退出标记(marding)操作。  
                 1                                                                          将一个短期参考图像标记为非参考图像,也 
                                                                                             即将一个短期参考图像移出参考帧队列。 
                 2                                                                          将一个长期参考图像标记为非参考图像,也 
                                                                                             即将一个长期参考图像移出参考帧队列。 
                 3                                                                          将一个短期参考图像转为长期参考图像。 
                 4                                                                          指明长期参考帧的最大数目。 
                 5                                                                          清空参考帧队列,将所有参考图像移出参考 
                                                                                             帧队列,并禁用长期参考机制 
                 6                                                                          将当前图像存为一个长期参考帧。 */ 
                memory_management_control_operation                   if( memory_management_control_operation    = =    1    | | 
                     memory_management_control_operation    = =    3 ) 
                     // difference_of_pic_nums_minus1    当 memory_management_control_operation 等于 3  或 1 时,由  这个 
 句法元素可以计算得到需要操作的图像在短期参考队列中的序号。参考帧队列中必须存在这个图像。 
                    difference_of_pic_nums_minus1                   if(memory_management_control_operation    = =    2    )          
                     // long_term_pic_num    当 memory_management_control_operation 等于 2 时,  从此句法元素得到所要 
 操作的长期参考图像的序号。    
                     long_term_pic_num    
                 if( memory_management_control_operation    = =    3    | | 
                     memory_management_control_operation    = =    6 ) 
                     // long_term_frame_idx    当  memory_management_control_operation 等于 3 或 6  ,分配一个长期参考 
 帧的序号给一个图像。  
                    long_term_frame_idx                    if( memory_management_control_operation    = =    4 )          
                    // max_long_term_frame_idx_plus1  此句法元素减1, 指明长期参考队列的最大数目 。max_long_term_frame_idx_plus1 值的范围  0 to num_ref_frames。    
                    max_long_term_frame_idx_plus1                } while( memory_management_control_operation    !=    0 )           
     }           
 }