Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th January 2013, 21:55   #1  |  Link
prrt
Registered User
 
Join Date: Jan 2008
Posts: 6
CABAC encoder - first 9 bits?

Hi,

I develop H264 CABAC encoder. In CABAC decoder initialization process variable codIOffset is set equal to the value returned from read_bits( 9 ) interpreted as a 9 bit binary representation of an unsigned integer. But how to define these 9 bits in CABAC encoder?

For example, I encode MB=0 (first macroblock in slice) with mb_type = 3 (I_16x16_2_0_0) and intra_chroma_pred_mode=0. Bin string for mb_type will be '100010'. After context modelling and binary arithmetic encoding I will get bits '1111110' (it is result of PutBit()). After binarization and binary arithmetic coding of intra_pred_mode I will add to bitstream bits '10' so the resulted bitstream will be '111111010' (without any headers).

But when CABAC decoder will decode this bits it will set codIOffset = read_bits(9) = '111111010' = 506 and for decoding value of mb_type it will read next bits from bitstream. So in my encoder I must put first 9 bits. But how to calculate them?

I read H264 standard several times but I can't find information about it. Also I traced JM encoder and found that these 9 bits constantly updated during encoding the macroblock data, even when coding coeffs. But I can't understand on what algorithm.

Thanks in advance.

Last edited by prrt; 9th January 2013 at 23:09.
prrt is offline   Reply With Quote
Reply

Tags
cabac encoder, h.264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.