Presentation is loading. Please wait.

Presentation is loading. Please wait.

H.264/AVC code tracing REPORT Group 1. no 1 942015 Tsao.

Similar presentations


Presentation on theme: "H.264/AVC code tracing REPORT Group 1. no 1 942015 Tsao."— Presentation transcript:

1 H.264/AVC code tracing REPORT Group 1. no Tsao

2 Overview 1.encode_one_frame 2.encode_enhancement_layer
Main encode_one_redundant_frame Encode_enhancement_layer

3 encode_one_frame YES NO NO YES replace_top_pic_with_frame
START initialization 依之前選擇FIELD_CODING 與 ADAPTIVE_CODING的取向, store_picture_in_dpb (decode picture buffer) or replace_top_pic_with_frame YES Field picture編碼 FIELD_CODING NO writeout picture Frame picture編碼 收尾 NO ADAPTIVE_CODING YES return Field picture編碼 比較Field picture 與Frame picture 那一個效果好, 並更新context

4 encode_one_frame initialization
START START TIMER 1.start time ms 2.start time s PaddAutoCropBorders() 填補picture的邊界, 因為 其邊界不見得一定為 macroblock/macroblock pair size的倍數 put_buffer_frame() 把指標指向frame structure, 但注意其中不該包含field結構 設定direct mode與deblocking filter的參數 init_frame() 初始化一個new frame 的參數 有input->sp2_frame_indicator NO CalculateFrameNumber() 計算img-> & input-> 的absolute frame number YES sp2_frame_indicator=1 sp2_frame_indicator=0 ReadOneFrame() 利用buf2img() 從file裡讀取一個frame read_SP_coefficients() 讀取SP frames的係數 initialization 結束

5 encode_one_frame YES NO NO YES replace_top_pic_with_frame
START initialization 依之前選擇FIELD_CODING 與 ADAPTIVE_CODING的取向, store_picture_in_dpb (decode picture buffer) or replace_top_pic_with_frame YES Field picture編碼 FIELD_CODING NO writeout picture Frame picture編碼 收尾 NO ADAPTIVE_CODING YES return Field picture編碼 比較Field picture 與Frame picture 那一個效果好, 並更新context

6 encode_one_frame : Field Encoding
START if ( input->RCEnable ) generic_RC->FieldControl=1 img->field_picture = 1 field_picture (top_pic, bottom_pic) 利用top與bottom field, encode a field picture img->fld_flag = 1 field encoding完成, set flag Field Encoding 結束

7 encode_one_frame :NOT Field Encoding
updateQP() 以rc mode決定updateQP的type 會影響each frame的quantization parameter START if ( input->RCEnable ) generic_RC->FieldControl=0 frame_picture () encode a frame picture if if (input->MbInterlace) mb_adaptive = 1 rdPictureCoding() 對同一個picture在不同狀態下, 執行multi-pass encoding else img->field_picture = 0 encode a frame picture if output_SP_coefficients() 如果是SP slice的話, output 其coefficients if(input->RCEnable) 依input->RDPictureDecision可能執行 copy_rc_jvt( quadratic_RC_init, quadratic_RC ) 與copy_rc_generic( generic_RC_init, generic_RC ) to copy jvt(joint video team) rate control objects else if (input->MbInterlace) mb_adaptive = 0 如果待會要進行 field code, 要把MB level field/frame coding flag turn off rc_init_pict() initialize one picture NOT Field Encoding 結束

8 encode_one_frame :Adaptive Encoding
START if ( input->RCEnable ) generic_RC->FieldControl=1 img->write_macroblock = 0 img->bot_MB = 0 encode field, img->field_picture = 1 update_field_frame_contexts (img->fld_flag) 決定要set的是frame context or field context if (input-> RCEnable) 以fld_flag決定 generic_RC->FieldFrame 0 or 1 field_picture () encode a field picture dis_fld dis_frm Adaptive Encoding結束 picture_structure_decision() 傳入frame_pic, top_pic, bottom_pic 呼叫decide_fld_frame() 決定fld_flag 0 or 1

9 encode_one_frame YES NO NO YES replace_top_pic_with_frame
START initialization 依之前選擇FIELD_CODING 與 ADAPTIVE_CODING的取向, store_picture_in_dpb (decode picture buffer) or replace_top_pic_with_frame YES Field picture編碼 FIELD_CODING NO writeout picture Frame picture編碼 收尾 NO ADAPTIVE_CODING YES return Field picture編碼 比較Field picture 與Frame picture 那一個效果好, 並更新context

10 encode_one_frame:output
START img->fld_flag field mode frame mode field_mod_buffer() 設定field mode buffer frame_mod_buffer() 設定frame mode buffer writeout picture() 輸入top_pic, bottom_pic 輸出buffer內的encoded picture writeout picture() 根據rd_pass的值 write out a picture free_slice_list() 把buffer清空 if(input->RCEnable) rc_update_pict_frame() 更新rate control 參數 END

11 encode_one_frame YES NO NO YES replace_top_pic_with_frame
START initialization 依之前選擇FIELD_CODING 與 ADAPTIVE_CODING的取向, store_picture_in_dpb (decode picture buffer) or replace_top_pic_with_frame YES Field picture編碼 FIELD_CODING NO writeout picture Frame picture編碼 收尾 NO ADAPTIVE_CODING YES return Field picture編碼 比較Field picture 與Frame picture 那一個效果好, 並更新context

12 encode_one_frame:收尾1 如果是frame_coding find_snr () redundant pictures
UpdateDecoders() 模擬packet loss的狀態 UpdatePixelMap() find_snr () Calculate PSNR for Y, U and V. redundant pictures save reconstruction to calculate SNR and replace reference picture stop 2 timers

13 encode_one_frame:收尾2 如果是adaptive_coding else
store_picture_in_dpb() store bottom field in decoded picture buffer free_storable_picture() 將picture清掉 或replace_top_pic_with_frame () replace top pic with frame else store_picture_in_dpb (frame 或 bottom pics, 端看rd_pass) free_storable_picture() Report( I_SLICE or SP_SLICE or B_SLICE ) UpdateRCModel

14 Overview 1.encode_one_frame 2.encode_enhancement_layer
Main encode_one_redundant_frame Encode_enhancement_layer

15 encode_enhancement_layer-功能
以HierarchicalCoding決定 1.encoding order 2.自訂的encoding order order決定完成, Encoding B frames

16 encode_enhancement_layer-hierarchicalCoding(1) create_hierarchy() 1.

17 encode_enhancement_layer-hierarchicalCoding(2)

18 encode_enhancement_layer-hierarchicalCoding(3)
User decides.

19 encode_enhancement_layer- Code Structure
if(input->HierarchicalCoding) set the parameter delta_pic_order_cnt[0] encode_one_frame() else

20 encode_enhancement_layer- important variables
IMG_NUMBER: #define IMG_NUMBER (img->number - start_frame_no_in_this_IGOP) <global.h> img->number:current image number to be encoded input->sucessive_Bframe: number of B frame will be used

21 input->BRefPictures:B coded reference pictures replace P pictures (0: not used, 1: used) input->NumFramesInELSubSeq number of frames in the Enhanced Scalability Layer. 0 (default) means that no Enhancement Layer is used.

22 encode_enhancement_layer- setting values
img->frame_num 該frame的編號 img->nal_reference_idc 標示其會不會被refernce到 img->bottompoc pic order count of bottom field of a frame img->b_frame_to_code 被encode的b frame編號 img->b_interval

23 setting values NALU_PRIORITY_HIGH

24 encode_enhancement_layer-example

25 encode_enhancement_layer-other ordering principle
對每一個intra_period,通知client decoder去 清空buffer


Download ppt "H.264/AVC code tracing REPORT Group 1. no 1 942015 Tsao."

Similar presentations


Ads by Google