This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM386 encode HD video on 1080i loses frames

Other Parts Discussed in Thread: TVP7002

I actually are using the DM368 to encode HD video in H264 from TVP7002 with the ti-dvsdk_dm368-evm_4_02_00_06 sdk.

 

All works fine in 720P@60fps and even in 1080P@30fps with no lost frame.

When 1080I is used on input, sometimes frames are lost and I can’t get exactly 30fps.

I can’t understand why all is ok in 1080P but not in 1080I. The frame are provided to the encode process at the same rate (one each 33ms) with the same content (output buffer size from capture are equal in the two “resolutions”) and encoding parameters are also the same.

Do you already have seen this problem (in the encode example software provided in the ti-dvsdk_dm368-evm_4_02_00_06 : when 1080I is selected then input is automatically set to Capture_Input_CAMERA. Why ?)

Is this due to a DMA sharing “problem” between VPFE and encoder hardware ?

Can you help me because there are cases where we have to use 1080I not 1080P.

Let me know if you need more informations.

  • Hello, anybody who can help me with this question?

  • Hi,

    Can you little more information?. 1080i encoding will be slow compare to 1080p, but it should not affect your system performance much. you should able to achive 1080i@60 fields per sec. Can you tell us what is the bitrate you are using and how much performance you are seeing

  • Herewith some more information:

     

    The DM368 is used in an audio/HD video to COFDM modulator.

    The video encoded bitrate is 12 Mb/s and it works fine in 720P60.

    For 1080P, frames are provided to the encoder @ 30 fps and again all is OK for us.

    For 1080I, full frames (2 fields) are also provided to the encoder @ 30 fps (in the same way as for 1080P) but result are not as good as for 1080P. We’d like to achieve 30 fps for 1080I but it seems that the encoding process is not as fast as for 1080P and sometimes frames are lost.

    For your information, in 1080I@25 fps all is OK.

    We just not understand why there is a difference for the encoder if the 1920x1080 picture is captured in interleaved or in progressive mode as the frame to be encoded and the frame rate are the same. May be we did something wrong but we can’t find what.

    We have to inputs. One is HDMI input, and the other is component (via TVP7002). For the HDMI our hardware limits us to 1080I so correct behavior in 1080I is required.

  • Hello, any update for me?

  • Hi Johan,

    Sorry for delayed reply

    Even it is interlace video, you are feeding both the fields to encoder as frame(field interleaved). So encoder is running in frame mode only. Is my understanding right?. In that case there should not be any difference in performance. which rate control mode you are using?CBR or VBR or any other?. Can you send us all encoder parameters and input YUV(around 30frame will enough). We will try to run at our end see the performance.

    Can you try with encQuality = 3 once.

  • Hello,

     

    Yes you are right : the encoder is running in frame mode only and I agree when you say there should be no difference in performance but there are some.

    As requested, please find below encoding parameters as I set them :

     

    h264Params.videncParams.size                  = 124                            

    h264Params.videncParams.encodingPreset        = 2                              

    h264Params.videncParams.rateControlPreset     = 1                              

    h264Params.videncParams.maxHeight             = 1088                           

    h264Params.videncParams.maxWidth              = 1920                           

    h264Params.videncParams.maxFrameRate          = 30000                          

    h264Params.videncParams.maxBitRate            = 9000000                        

    h264Params.videncParams.dataEndianness        = 1                              

    h264Params.videncParams.maxInterFrameInterval = 0                              

    h264Params.videncParams.inputChromaFormat     = 9                              

    h264Params.videncParams.inputContentType      = 0                              

    h264Params.videncParams.reconChromaFormat     = 9                               

                                                                                    

    h264Params.profileIdc = 100                                                    

    h264Params.levelIdc = 40                                                        

    h264Params.Log2MaxFrameNumMinus4 = 0                                           

    h264Params.ConstraintSetFlag = 0                                               

    h264Params.entropyMode = 1                                                      

    h264Params.transform8x8FlagIntraFrame = 1                                      

    h264Params.transform8x8FlagInterFrame = 0                                      

    h264Params.enableVUIparams = 4                                                 

    h264Params.meAlgo = 0                                                          

    h264Params.seqScalingFlag = 1                                                  

    h264Params.encQuality = 2                                                      

    h264Params.enableARM926Tcm = 0                                                 

    h264Params.enableDDRbuff = 0                                                   

    h264Params.sliceMode = 0                                                       

    h264Params.numTemporalLayers = 0                                               

    h264Params.svcSyntaxEnable = 0                                                 

    h264Params.EnableLongTermFrame = 0                                             

    h264Params.outputDataMode = 1                                                   

    h264Params.sliceFormat = 1                                                     

                                                                                    

    ------------------------------------------------------------------------       

    h264Dynamic.videncDynamicParams.size               = 212                       

    h264Dynamic.videncDynamicParams.inputHeight        = 1080                      

    h264Dynamic.videncDynamicParams.inputWidth         = 1920                       

    h264Dynamic.videncDynamicParams.refFrameRate       = 30000                     

    h264Dynamic.videncDynamicParams.targetFrameRate    = 30000                     

    h264Dynamic.videncDynamicParams.targetBitRate      = 9000000                    

    h264Dynamic.videncDynamicParams.intraFrameInterval = 30                        

    h264Dynamic.videncDynamicParams.generateHeader     = 0                         

    h264Dynamic.videncDynamicParams.captureWidth       = 0                         

    h264Dynamic.videncDynamicParams.forceFrame         = -1                        

    h264Dynamic.videncDynamicParams.interFrameInterval = 1                         

    h264Dynamic.videncDynamicParams.mbDataFlag         = 0                         

                                                                                    

    h264Dynamic.sliceSize               = 0                                        

    h264Dynamic.airRate                 = 0                                        

    h264Dynamic.intraFrameQP            = 28                                       

    h264Dynamic.interPFrameQP           = 28                                       

    h264Dynamic.initQ                   = 28                                       

    h264Dynamic.rcQMax                  = 45                                       

    h264Dynamic.rcQMin                  = 0                                        

    h264Dynamic.rcQMaxI                 = 42                                       

    h264Dynamic.rcQMinI                 = 0                                        

    h264Dynamic.rcAlgo                  = 0                                        

    h264Dynamic.maxDelay                = 2000                                     

    h264Dynamic.aspectRatioX            = 1                                        

    h264Dynamic.aspectRatioY            = 1                                        

    h264Dynamic.lfDisableIdc            = 0                                        

    h264Dynamic.enableBufSEI            = 0                                         

    h264Dynamic.enablePicTimSEI         = 0                                        

    h264Dynamic.perceptualRC            = 1                                        

    h264Dynamic.idrFrameInterval        = 30                                        

    h264Dynamic.mvSADoutFlag            = 0                                        

    h264Dynamic.resetHDVICPeveryFrame   = 1                                        

    h264Dynamic.enableROI               = 0                                         

    h264Dynamic.metaDataGenerateConsume = 0                                        

    h264Dynamic.maxBitrateCVBR          = 50000000                                 

    h264Dynamic.interlaceRefMode        = 1                                        

    h264Dynamic.enableGDR               = 0                                        

    h264Dynamic.GDRduration             = 0                                        

    h264Dynamic.GDRinterval             = 0                                        

    h264Dynamic.LongTermRefreshInterval = 0                                        

    h264Dynamic.UseLongTermFrame        = 0                                        

    h264Dynamic.SetLongTermFrame        = 0                                        

    h264Dynamic.CVBRsensitivity         = 0                                        

    h264Dynamic.CVBRminbitrate          = 0                                        

    h264Dynamic.LBRmaxpicsize           = 18                                       

    h264Dynamic.LBRminpicsize           = 4                                        

    h264Dynamic.LBRskipcontrol          = 393221                                   

    h264Dynamic.maxHighCmpxIntCVBR      = 0                                        

                                                                                    

    h264Dynamic.VUI_Buffer->aspectRatioInfoPresentFlag = 0                         

    h264Dynamic.VUI_Buffer->overscanInfoPresentFlag = 0                            

    h264Dynamic.VUI_Buffer->overscanAppropriateFlag = 0                            

    h264Dynamic.VUI_Buffer->videoSignalTypePresentFlag = 1                         

    h264Dynamic.VUI_Buffer->videoFormat = 2                                        

    h264Dynamic.VUI_Buffer->pixelRange = 1                                          

    h264Dynamic.VUI_Buffer->colourDescriptionPresentFlag = 0                       

    h264Dynamic.VUI_Buffer->colourPrimaries = 2                                    

    h264Dynamic.VUI_Buffer->transferCharacteristics = 2                             

    h264Dynamic.VUI_Buffer->matrixCoefficients = 2                                 

    h264Dynamic.VUI_Buffer->timingInfoPresentFlag = 1                              

    h264Dynamic.VUI_Buffer->numUnitsInTicks = 1                                     

    h264Dynamic.VUI_Buffer->timeScale = 60                                         

    h264Dynamic.VUI_Buffer->fixedFrameRateFlag = 0                                 

    h264Dynamic.VUI_Buffer->nalHrdParameterspresentFlag = 1                         

    h264Dynamic.VUI_Buffer->picStructPresentFlag = 0                               

    h264Dynamic.VUI_Buffer->bitstreamRestrictionFlag = 1           

               

         

    Below is the output of  my software, when input is 1080I, showing 2 frames are lost every 5 to 10 seconds :

     

    [STA]00:00.26 Audio : 48.0 KHz CPU 38% 30 fps V 9610 kbps A   0 kbps           

    [STA]00:00.27 Audio : 48.0 KHz CPU 31% 30 fps V 8028 kbps A   0 kbps           

    [STA]00:00.29 Audio : 48.0 KHz CPU 35% 30 fps V 9053 kbps A   0 kbps           

     [STA]00:00.30 Audio : 48.0 KHz CPU 40% 30 fps V 9751 kbps A   0 kbps           

    [STA]00:00.31 Audio : 48.0 KHz CPU 31% 30 fps V 8121 kbps A   0 kbps           

    [STA]00:00.32 Audio : 48.0 KHz CPU 35% 30 fps V 9066 kbps A   0 kbps           

    [STA]00:00.34 Audio : 48.0 KHz CPU 36% 30 fps V 9163 kbps A   0 kbps           

    [TS]Video Diff. : 70521 us - Resynchronisation                                 

    [STA]00:00.35 Audio : 48.0 KHz CPU 31% 30 fps V 8676 kbps A   0 kbps           

    [STA]00:00.36 Audio : 48.0 KHz CPU 31% 30 fps V 8635 kbps A   0 kbps           

    [STA]00:00.37 Audio : 48.0 KHz CPU 37% 30 fps V 9350 kbps A   0 kbps           

    [STA]00:00.38 Audio : 48.0 KHz CPU 37% 30 fps V 8828 kbps A   0 kbps           

     [STA]00:00.40 Audio : 48.0 KHz CPU 33% 30 fps V 8897 kbps A   0 kbps           

    [STA]00:00.41 Audio : 48.0 KHz CPU 33% 30 fps V 8850 kbps A   0 kbps           

    [STA]00:00.42 Audio : 48.0 KHz CPU 34% 30 fps V 9493 kbps A   0 kbps           

    [STA]00:00.43 Audio : 48.0 KHz CPU 36% 30 fps V 8934 kbps A   0 kbps           

    [STA]00:00.44 Audio : 48.0 KHz CPU 39% 30 fps V 8774 kbps A   0 kbps           

    [STA]00:00.46 Audio : 48.0 KHz CPU 29% 30 fps V 8696 kbps A   0 kbps           

    [TS]Video Diff. : 69691 us - Resynchronisation                                 

    [STA]00:00.47 Audio : 48.0 KHz CPU 32% 30 fps V 8815 kbps A   0 kbps           

    [STA]00:00.48 Audio : 48.0 KHz CPU 42% 30 fps V 8973 kbps A   0 kbps    

     

    When input is 1080P (with same video sequence), encoder parameters are the same but log does not let appear lost frame and all is OK.

     

    Hope this will help and you’ll be able to get the same behavior on your side.

  • Hi,

    When you said frame loss, I thought ecnoder is running slow and causing frame loss. But after seeing ur params and log, I feel frame skip are happening. As you are running CBR mode(rcAlgo = 0). Rate control strictly tries to achive targetbitrate so causing the frames to skip.

    Can you try below things:

    1: rcAlgo = 0. h264Dynamic.rcQMin    =  8 and  h264Dynamic.rcQMinI =  8

    2: rcAlgo = 1. h264Dynamic.rcQMin    =  8 and  h264Dynamic.rcQMinI =  8

    Thanks,

    Veeranna

  • hello,Johan deben,i am using the dm368 to encode HD video in 

    H264 from tvp7002,too!where to set the encoding parameters ?can you give me a demo?the email:liyaocai2008@aliyun.com 

    thanks!

  • Hi, Which software you are using? DVSDK or IPNC RDK?. If you search for string "IH264VENC_Params" or "IVIDENC1_Params". You will get the encoder param setting file.

  • I am using the DVSDK,   where to set the extented Paramers in the DEMO? There is not "IH264VENC_Params" or "IVIDENC1_Params"  in the DEMO.   can you give me a demo that including  the  IH264VENC_Params" or "IVIDENC1_Params".  thank you!

  • We still have not resolved our problem regarding 1080I @30fps encoding with DM368 from TI.

    Our product works well when 50fps/25fps is used but we now have to make it works well too in 1080I-30fps because we have to encode blu-ray sources which we can’t force to be output in 50/25 fps. Please find here attached a document with 2 sketches showing the problem we are encountering. I hope it will help TI to understand our problem.[

    View:http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/100/5633.DM368_5F00_1080I_5F00_1080P.pdf]