imx6 vpu h.264 encode, Large bit rate when facing white wall, please help!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6 vpu h.264 encode, Large bit rate when facing white wall, please help!

990 Views
zhanghaijian
Contributor II

Hello all,

    I'm working on imx6 vpu hardware H.264 encoding. My camera to collect raw data resolution is 640*480.

    When my encode param "EncOpenParam.bitRate" set to 0, thus the chip decide the whole stream's bitRate.

    But, when my camera face to a simple interface,like a white wall(Attachment 1),the real bitRate become very large, about 8~9 Mbps. When facing a normal interface(Attachment 2), the bitRate only 2~3 Mbps.

   This makes my H.264 stream show choppy in DVR when facing the white wall or some similar environment.

   When the camera is moving, the bitRate is very large too.

   I tried to set bitRate to 3Mbps, the bit rate is down, but when i preview in DVR, the stream is choppy also.

   Does any one know why it happend?

   How to setup the encode param to solve this problem?

   My encode param settings attached below:

    

    EncOpenParam encop;
    encop.bitstreamBuffer = enc_mem_desc.phy_addr;                                  
    encop.bitstreamBufferSize = STREAM_BUF_SIZE;                                    
    encop.bitstreamFormat = STD_AVC;                                                
    encop.mapType = LINEAR_FRAME_MAP;                                               
    encop.linear2TiledEnable = 0;                                                   
    encop.picWidth = ui_width;                                                        
    encop.picHeight = ui_height;                                                   
    encop.frameRateInfo = 17;                                                       
    encop.bitRate = 0;                                                              
    encop.gopSize = 10;
    encop.slicemode.sliceMode = 0;     /* 0: 1 slice per picture; 1: Multiple slices per picture */
    encop.slicemode.sliceSizeMode = 0; /* 0: silceSize defined by bits; 1: sliceSize defined by MB number*/
    encop.slicemode.sliceSize = 4000;  /* Size of a slice in bits or MB numbers */
    encop.initialDelay = 0;                                                         // 
    encop.vbvBufferSize = 0;        /* 0 = ignore 8 */                              // 
    encop.intraRefresh = 0;                                                         // 
    encop.sliceReport = 0;                                                          // 
    encop.mbReport = 0;                                                             // 
    encop.mbQpReport = 0;                                                           // 
    encop.rcIntraQp = -1;                                                           // 
    encop.userQpMax = 0;
    encop.userQpMin = 0;
    encop.userQpMinEnable = 0;
    encop.userQpMaxEnable = 0;
    encop.IntraCostWeight = 0;                                                      // 
    encop.MEUseZeroPmv  = 0;                                                        // 
    /* (3: 16x16, 2:32x16, 1:64x32, 0:128x64, H.263(Short Header : always 3) */
    encop.MESearchRange = 3;
    encop.userGamma = (Uint32)(0.75*32768);         
    encop.RcIntervalMode= 1;        /* 0:normal, 1:frame_level, 2:slice_level, 3: user defined Mb_level */
    encop.MbInterval = 0;                                                           // 
    encop.avcIntra16x16OnlyModeEnable = 0;                                          // 
    encop.ringBufferEnable = 0;                                                     // 
    encop.dynamicAllocEnable = 0;                                                   // 
    encop.chromaInterleave = 0;                                                     // 
    encop.EncStdParam.avcParam.avc_constrainedIntraPredFlag = 0;                    // 
    encop.EncStdParam.avcParam.avc_disableDeblk = 0;                                //
    encop.EncStdParam.avcParam.avc_deblkFilterOffsetAlpha = 6;                      // 
    encop.EncStdParam.avcParam.avc_deblkFilterOffsetBeta = 0;                       // 
    encop.EncStdParam.avcParam.avc_chromaQpOffset = 10;                             // 
    encop.EncStdParam.avcParam.avc_audEnable = 0;                                   // 
    encop.EncStdParam.avcParam.interview_en = 0;                                    // 
    encop.EncStdParam.avcParam.paraset_refresh_en = 0;                              // 
    encop.EncStdParam.avcParam.prefix_nal_en = 0;                                   // 
    encop.EncStdParam.avcParam.mvc_extension = 0;                                   // 
    encop.EncStdParam.avcParam.avc_frameCroppingFlag = 0;                           // 
    encop.EncStdParam.avcParam.avc_frameCropLeft = 0;                               // 
    encop.EncStdParam.avcParam.avc_frameCropRight = 0;                              // 
    encop.EncStdParam.avcParam.avc_frameCropTop = 0;                                // 
    encop.EncStdParam.avcParam.avc_frameCropBottom = 0;                             // 
    encop.EncStdParam.avcParam.avc_fmoEnable = 0,                                   //
    encop.EncStdParam.avcParam.avc_fmoSliceNum = 0,
    encop.EncStdParam.avcParam.avc_fmoType = 0,
    encop.EncStdParam.avcParam.avc_fmoSliceSaveBufSize = 0, 
Tags (1)
0 Kudos
1 Reply

790 Views
art
NXP Employee
NXP Employee

The most likely cause of the issue you describe is not the encoding parameters setup, but the setup of a camera itself. The main camera parameter is its sensitivity. E.g. too high sensitivity in low luminosity conditions may cause the camera signal to become too noisy that, in turns, increases the bit rate of encoded flow. On the other hand, in the overlighting conditions, e.g. when facing highly illuminated white wall, the camera can clip the pixel values, causing the resulting signal to become random, that increases the resulting bit rate as well. Also, if the color conversion operation is performed before putting the resulting image to the VPU, the wrong color conversion parameters can also cause the similar effect.

So, please try to play with your camera setup (especially, with its sensitivity setup) first.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos