Region of Interest Encoding

Issue #438 new
Mohamed Hegazy created an issue

Hi,

I am working on a region-of-interest aware rate control technique that requires the following:

  • Having realtime performance by setting the preset to utlrafast and tune to zerolatency (this is because I need the number of bits used after encoding one frame to be able to encode the next frame)
  • I need to be able to set different QPs on a block-level (e.g. each 64x64 block). Setting the quantization offsets in my algorithm depends on the assumption that the encoder will give the same QPs to all the blocks if I use CQP mode (e.g. if in the CQP mode I set the QP to 22 and for a given 64x64 block I give it a QP of 26 then the quantization offset for this block should be 4 (26-22))

The problem is that the CU tree is disabled in the CQP mode and if I enable it, then I need to enable the rc-lookahead which will prevent the encoder from giving me the encoded frame right away (like I said above I need the encoded frame right away to know the number of bits that were used in the current frame to decide the number of bits to be used for the next frame).

Comments (1)

  1. Mohamed Hegazy reporter

    I think my issue can be solved by doing the following:

    1. Comment out line 2669 in encoder.cpp:
    if (p->rc.rateControlMode == X265_RC_CQP)
        {
            //p->rc.aqMode = X265_AQ_NONE;
            p->rc.bitrate = 0;
            p->rc.cuTree = 0;
            p->rc.aqStrength = 0;
        }
    
    1. Comment out lines 2693 and 2694 in encoder.cpp:
    /*if (p->rc.aqStrength == 0 && p->rc.cuTree == 0)
            p->rc.aqMode = X265_AQ_NONE;*/
    

    This way I can set the preset to ultrafast and tune to zerolatency and then use CQP mode (e.g. QP=22) with AQ mode of 1 and set the quantOffsets array for each frame to be offsets from the QP I chose (i.e. 22) for each of 16X16 blocks.

    However, I still want to know if this has any other impacts on the encoder's behavior.

  2. Log in to comment