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.

INTERNAL ERROR: 1080p60 Capture and Enc

Other Parts Discussed in Thread: TVP7002

Hi

   I am now using EVM8168 + Catalog Daughter Card.  Employing TVP7002 and a 1080p60 YUV component source, I managed to make a chain like this:

   1080p60 YUV  ---> Cap ----> Enc ----> H.264 File

   I have successfully get the 1280x720p50 Capture usecase verified.  However, when I changed the parameter and run the program again.  It casts some error log as below:

......

[m3vpss ]  276816: CAPTURE: Start in progress !!!
 [m3video] ENCLINK_H264:HEAPID:0        USED:11912
 [m3video] ENCLINK_H264:HEAPID:3        USED:7176192
 [m3video]  276807: ENCODE: All CH Create ... DONE !!!
 [m3video] ENCLINK:HEAPID:0     USED:12032
 [m3video] ENCLINK:HEAPID:2     USED:7946240
 [m3video] ENCLINK:HEAPID:3     USED:7176192
 [m3video]  276808: ENCODE: Create ... DONE !!!
 [m3video]  276809: IPC_BITS_OUT   : Create in progress !!!
 [m3video]  276810: IPC_BITS_OUT   : Create Done !!!
 [m3vpss ]  276916: CAPTURE: Enabled Time Stamping !!!
 [m3vpss ]  276917: CAPTURE: Start Done !!!
Change dynamics parameters
 [m3vpss ]  278918: CAPTURE: Dynamic resolution change: width: 1920, height: 1080!
 [m3video] 278918:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[232]::INTERNAL ERROR:-1
 [m3video] ALGCONTROL FAILED:CMD:1
 [m3video] ERROR: IH264ENC_LEVEL_INCOMPLAINT_PARAMETER , 0,
 [m3video] 278919:WARN
 [m3video]  ENCLINK: ERROR in Run time parameters changes, Extended Error code:1
......

    It seems some incomplaint parameters exist in my configuration.  But I have my code double checked...

    Could you please help me and give me some advises?

Naroah

Feb/15/2014

  • What is your encoder create time resolution and what is your capture create time resolution.

    Capture and Encoder should be created for max resolution and dynamically switch to smaller resolution.

    ALso for what configuration when you see the issue. Is it 720P60 ?

  • Hi Badri,

        Thank you for your reply!

        My Encoder create time resolution and capture create time resolution are the same: 1920x1080:

    Conf.width[0] = 1920;
    Conf.height[0] = 1080;

    ...

    vcapSetRes.width = SystemUtils_align(Pt_Conf->width[0],16);
    vcapSetRes.height = SystemUtils_align(Pt_Conf->height[0], 1);
    ...

      When I set width=1280, height=720, and feed the TVP7002 with 720p60 YUV component source, the program seems fine.  Indeed, in this case, it would dynamically change its resolution 1280x720.  And I can also get the encoded H264 file sucessfully.

       However, when I set my configuration by modifying the width=1920, height=1080, once I run my program, this issue appears:

    ...............

    [m3video]  3970304: ENCODE: Create ... DONE !!!
     [m3video]  3970305: IPC_BITS_OUT   : Create in progress !!!
     [m3video]  3970306: IPC_BITS_OUT   : Create Done !!!
     [m3vpss ]  3970413: CAPTURE: Enabled Time Stamping !!!
     [m3vpss ]  3970419: CAPTURE: Start Done !!!
    Change dynamics parameters
     [m3vpss ]  3972420: CAPTURE: Dynamic resolution change: width: 1920, height: 1080!
     [m3video] 3972421:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[232]::INTERNAL ERROR:-1
     [m3video] ALGCONTROL FAILED:CMD:1
     [m3video] ERROR: IH264ENC_LEVEL_INCOMPLAINT_PARAMETER , 0,
     [m3video] 3972421:WARN
     [m3video]  ENCLINK: ERROR in Run time parameters changes, Extended Error code:1
    ^CSignal interrupt received
     [m3vpss ]  3973905: CAPTURE: Stop in progress !!!
     [m3vpss ]  3973905: CAPTURE: Stop Done !!!
     [m3video]  3973905: ENCODE: CH-1:
    ..................

        According to the log, I thought the resolution was dynamically set to 1920x1080.  Could you help me and give me some tips so that I could trace if there is something wrong with my configuration?

        By the way, how to create the Capture and Encoder with MAX resolution?

        I am sincerely looking forward to your reply.

    Naroah

    Feb/15/2014

  • Attach your usecase file, console logs from start of application and static and dynamic params of the encoder. Refer encLink_h264.c where the static and dynamic params are printed.

  • Hi Badri,

        I have my usecase file and serial console log attached in this thread.

        Sorry for my ignorance, yet I don't know why I should refer to encLink_h264.c to confirm my static and dynamic params.  Aren't the parameters set by me in my usercase?

        Waiting for your reply, with sincerity.

    Applying sync command
    
     _____                    _____           _         _
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
                  |___|                    |___|
    
    Arago Project http://arago-project.org dm816x ttyO2
    
    Arago 2012.10 dm816x ttyO2
    
    dm816x login: root
    root@dm816x:~# ./init_load.sh
    *** Bootargs Validated for mem param ***
    *** Bootargs Validated for notifyk.vpssm3 params ***
    *** Kernel Base address validated ***
    Kernel bootargs validated
    numid=101,iface=MIXER,name='Left DAC Mux'
      ; type=ENUMERATED,access=rw------,values=1,items=3
      ; Item #0 'DAC_L1'
      ; Item #1 'DAC_L3'
      ; Item #2 'DAC_L2'
      : values=2
    numid=99,iface=MIXER,name='Right DAC Mux'
      ; type=ENUMERATED,access=rw------,values=1,items=3
      ; Item #0 'DAC_R1'
      ; Item #1 'DAC_R3'
      ; Item #2 'DAC_R2'
      : values=2
     [c6xdsp ] Remote Debug Shared Memory @ 0xbf000000
     [m3video] Remote Debug Shared Memory @ 0xbf010820
     [m3vpss ] Remote Debug Shared Memory @ 0xbf021040
    SysLink version : 2.20.02.20
    SysLink module created on Date:Jan 13 2014 Time:16:02:25
    Trace enabled
    Trace SetFailureReason enabled
     Setting DMM priority for [DUCATI  ] to [0] ( 0x4e000624 = 0x08000000 )
     Setting DMM priority for [HDVICP0 ] to [2] ( 0x4e000634 = 0x0000000a )
     Setting DMM priority for [HDVICP1 ] to [2] ( 0x4e000634 = 0x000a0000 )
     Setting DMM priority for [HDVICP2 ] to [2] ( 0x4e000634 = 0x00a00000 )
    
     *** TVP5158 probe : START ***
    
     TI VS EVM : TVP5158 device address : 0x58, 0x5a, 0x5c, 0x5e
     TI DVR    : TVP5158 device address : 0x5c, 0x5d, 0x5e, 0x5f
    
     Device found     : I2C (0xXX): 0x08 = 0x51
                        I2C (0xXX): 0x09 = 0x58
    
     Device NOT found : I2C (0xXX): Read ERROR !!! (reg[0x08], count = 2)
    
     I2C (0x58): Read ERROR !!! (reg[0x08], count = 2)
     I2C (0x5a): Read ERROR !!! (reg[0x08], count = 2)
     I2C (0x5c): 0x08 = 0x00
     I2C (0x5c): 0x09 = 0x00
     I2C (0x5d): 0x08 = 0x00
     I2C (0x5d): 0x09 = 0x00
     I2C (0x5e): Read ERROR !!! (reg[0x08], count = 2)
     I2C (0x5f): Read ERROR !!! (reg[0x08], count = 2)
    
     *** TVP5158 probe : END ***
    
    /opt/dvr_rdk/ti816x
    Attached to slave procId 2.
    Loaded file ../firmware/dvr_rdk_fw_m3vpss_1024M_256M.xem3 on slave procId 2.
    Started slave procId 2.
    After Ipc_loadcallback status [0x00000000]
     [m3vpss ] ***** VPSS Firmware build time 16:31:08 Jan 13 2014  EDG gcc 3.0 mode
     [m3vpss ] ***** SYSTEM  : Frequency <ORG> - 250000000, <NEW> - 274909088
     [m3vpss ] notify_attach  rtnVal  0
     [m3vpss ] initProxyServer  rtnVal  0
     [m3vpss ]
     [m3vpss ]  *** UTILS: CPU KHz = 549818 Khz ***
     [m3vpss ]
     [m3vpss ]  34: SYSTEM  : System Common Init in progress !!!
     [m3vpss ]  35: SYSTEM: IPC init in progress !!!
     [m3vpss ]  35: SYSTEM: Attaching to [HOST] ...
     [m3vpss ]  37: SYSTEM: Attaching to [HOST] ... SUCCESS !!!
    After Ipc_startcallback status [0x00000000]
    Attached to slave procId 1.
    Loaded file ../firmware/dvr_rdk_fw_m3video_1024M_256M.xem3 on slave procId 1.
    Started slave procId 1.
    After Ipc_loadcallback status [0x00000000]
    After Ipc_startcallback status [0x00000000]
     [m3video] ***** VIDEO Firmware build time 16:33:14 Jan 13 2014  EDG gcc 3.0 mode
     [m3video] ***** SYSTEM  : Frequency <ORG> - 250000000, <NEW> - 274909088
     [m3video]
     [m3video]  *** UTILS: CPU KHz = 549818 Khz ***
     [m3video]
     [m3video]  426: SYSTEM  : System Common Init in progress !!!
     [m3video]  426: SYSTEM: IPC init in progress !!!
     [m3video]  426: SYSTEM: Attaching to [HOST] ...
     [m3video]  428: SYSTEM: Attaching to [HOST] ... SUCCESS !!!
    Attached to slave procId 0.
    Loaded file ../firmware/dvr_rdk_fw_c6xdsp_1024M_256M.xe674 on slave procId 0.
    Started slave procId 0.
    After Ipc_loadcallback status [0x00000000]
     [c6xdsp ] ***** VIDEO Firmware build time 16:28:23 Jan 13 2014  EDG gcc 3.0 mode
     [c6xdsp ] ***** SYSTEM  : Frequency <ORG> - 800000000, <NEW> - 1000000000
     [c6xdsp ]
     [c6xdsp ]  *** UTILS: CPU KHz = 1000000 Khz ***
     [c6xdsp ]
     [c6xdsp ]  5: SYSTEM  : System Common Init in progress !!!
     [c6xdsp ]  5: SYSTEM: IPC init in progress !!!
     [c6xdsp ]  5: SYSTEM: Attaching to [HOST] ...
     [c6xdsp ]  8: SYSTEM: Attaching to [HOST] ... SUCCESS !!!
    After Ipc_startcallbDMA: Module install successful, device major num = 251
    ack status [0x00DRV: Module install successful
    000000]
     [c6xdsDRV: Module built on Jan 13 2014 16:03:13
    p ]  10: SYSTEM: Attaching to [VIDEO-M3] ... SUCCESS !!!
     [m3video]  597: SYSTEM: Attaching to [DSP] ... SUCCESS !!!
     [m3vpss ]  598: SYSTEM: Attaching to [DSP] ... SUCCESS !!!
     [c6xdsp ]  12: SYSTEM: Attaching to [VPSS-M3] ... SUCCESS !!!
     [m3video]  599: SYSTEM: Attaching to [VPSS-M3] ... SUCCESS !!!
     [m3vpss ]  599: SYSTEM: Attaching to [VIDEO-M3] ... SUCCESS !!!
     [c6xdsp ]  12: SYSTEM: Creating MsgQ Heap [IPC_MSGQ_MSG_HEAP_0] ...
     [m3video]  599: SYSTEM: Creating MsgQ Heap [IPC_MSGQ_MSG_HEAP_1] ...
     [m3vpss ]  599: SYSTEM: Creating MsgQ Heap [IPC_MSGQ_MSG_HEAP_2] ...
     [c6xdsp ]  12: SYSTEM: Creating MsgQ [DSP_MSGQ] ...
     [m3video]  600: SYSTEM: Creating MsgQ [VIDEO-M3_MSGQ] ...
     [m3vpss ]  600: SYSTEM: Creating MsgQ [VPSS-M3_MSGQ] ...
     [c6xdsp ]  12: SYSTEM: Creating MsgQ [DSP_ACK_MSGQ] ...
     [m3video]  600: SYSTEM: Creating MsgQ [VIDEO-M3_ACK_MSGQ] ...
     [m3vpss ]  600: SYSTEM: Creating MsgQ [VPSS-M3_ACK_MSGQ] ...
     [c6xdsp ]  12: SYSTEM: Notify register to [HOST] line 0, event 15 ...
     [m3video]  601: SYSTEM: Notify register to [HOST] line 0, event 15 ...
     [m3vpss ]  601: SYSTEM: Notify register to [HOST] line 0, event 15 ...
     [c6xdsp ]  12: SYSTEM: Notify register to [VIDEO-M3] line 0, event 15 ...
     [m3video]  602: SYSTEM: Notify register to [DSP] line 0, event 15 ...
     [m3vpss ]  602: SYSTEM: Notify register to [DSP] line 0, event 15 ...
     [c6xdsp ]  12: SYSTEM: Notify register to [VPSS-M3] line 0, event 15 ...
     [m3video]  602: SYSTEM: Notify register to [VPSS-M3] line 0, event 15 ...
     [m3vpss ]  602: SYSTEM: Notify register to [VIDEO-M3] line 0, event 15 ...
     [c6xdsp ]  12: SYSTEM: IPC init DONE !!!
     [m3video]  602: SYSTEM: IPC init DONE !!!
     [m3vpss ]  602: SYSTEM: IPC init DONE !!!
     [c6xdsp ]  14: MEM: Shared Region 2: Base = 0xae000000, Length = 0x109c0000 (265 MB)
     [c6xdsp ]  14: MEM: ERROR: SharedRegion_setEntry (2, 0x9ffa7b9c) FAILED !!!  (status=-1)
     [m3video]  608: MEM: Shared Region 2: Base = 0xae000000, Length = 0x109c0000 (265 MB)
     [m3vpss ]  607: MEM: Shared Region 2: Base = 0xae000000, Length = 0x109c0000 (265 MB)
     [m3video]  608: MEM: Shared Region 1: Base = 0x90000000, Length = 0x0c900000 (201 MB)
     [m3vpss ]  608: MEM: Shared Region 1: Base = 0x90000000, Length = 0x0c900000 (201 MB)
     [m3video]  609: SYSTEM  : System Common Init Done !!!
     [m3vpss ]  609: SYSTEM  : System Common Init Done !!!
     [m3video]  610: SYSTEM  : System Video Init in progress !!!
     [m3vpss ]  609: SYSTEM  : System VPSS Init in progress !!!
     [m3video]  610: SYSTEM  : System Video Init Done !!!
     [m3video]  610: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_0] in region 0 ...
     [m3video]  610: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_0] in region 0 ...
     [m3video]  611: SYSTEM: ListElem Shared Addr = 0xbf273e00
     [m3video]  613: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_1] in region 0 ...
     [m3vpss ] === HDVPSS Clocks are enabled ===
     [m3video]  613: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_1] in region 0 ...
     [m3video]  613: SYSTEM: ListElem Shared Addr = 0xbf277300
     [m3video]  619: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_19] in region 0 ...
     [m3vpss ] === HDVPSS is fully functional ===
     [m3video]  619: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_19] in region 0 ...
     [m3vpss ] === HDVPSS module is not in standby ===
     [m3video]  619: SYSTEM: ListElem Shared Addr = 0xbf27a800
     [m3vpss ] === I2C1 Clk is active ===
     [m3video]  621: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_20] in region 0 ...
     [m3vpss ]  619: SYSTEM: Creating ListMP [VPSS-M3_IPC_OUT_0] in region 0 ...
     [m3video]  622: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_20] in region 0 ...
     [m3vpss ]  620: SYSTEM: Creating ListMP [VPSS-M3_IPC_IN_0] in region 0 ...
     [m3video]  622: SYSTEM: ListElem Shared Addr = 0xbf2a3780
     [m3vpss ]  620: SYSTEM: ListElem Shared Addr = 0xbf2a0000
     [m3video]  624: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_21] in region 0 ...
     [m3vpss ]  622: SYSTEM: Creating ListMP [VPSS-M3_IPC_OUT_1] in region 0 ...
     [m3video]  625: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_21] in region 0 ...
     [m3vpss ]  622: SYSTEM: Creating ListMP [VPSS-M3_IPC_IN_1] in region 0 ...
     [m3video]  625: SYSTEM: ListElem Shared Addr = 0xbf2cc200
     [m3vpss ]  622: SYSTEM: ListElem Shared Addr = 0xbf2c8d00
     [m3video]  638: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_24] in region 0 ...
     [m3vpss ]  636: SYSTEM: Creating ListMP [VPSS-M3_IPC_OUT_19] in region 0 ...
     [m3video]  638: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_24] in region 0 ...
     [m3vpss ]  636: SYSTEM: Creating ListMP [VPSS-M3_IPC_IN_19] in region 0 ...
     [m3video]  638: SYSTEM: ListElem Shared Addr = 0xbf317200
     [m3vpss ]  637: SYSTEM: ListElem Shared Addr = 0xbf2f1a00
     [m3video]  641: SYSTEM: Creating ListMP [VIDEO-M3_IPC_OUT_25] in region 0 ...
     [m3vpss ]  639: SYSTEM: Creating ListMP [VPSS-M3_IPC_OUT_20] in region 0 ...
     [m3video]  641: SYSTEM: Creating ListMP [VIDEO-M3_IPC_IN_25] in region 0 ...
     [m3vpss ]  639: SYSTEM: Creating ListMP [VPSS-M3_IPC_IN_20] in region 0 ...
     [m3video]  641: SYSTEM: ListElem Shared Addr = 0xbf35a500
     [m3vpss ]  639: SYSTEM: ListElem Shared Addr = 0xbf334d00
     [m3video]  643: HDVICP: Doing PRCM for IVAHD[0] ...
     [m3vpss ]  642: SYSTEM: Creating ListMP [VPSS-M3_IPC_OUT_21] in region 0 ...
     [m3video]  643: HDVICP: PRCM for IVAHD[0] ... DONE.
     [m3vpss ]  642: SYSTEM: Creating ListMP [VPSS-M3_IPC_IN_21] in region 0 ...
     [m3video]  643: HDVICP: Doing PRCM for IVAHD[1] ...
     [m3vpss ]  642: SYSTEM: ListElem Shared Addr = 0xbf378000
     [m3video]  643: HDVICP: PRCM for IVAHD[1] ... DONE.
     [m3vpss ]  644: SYSTEM : HDVPSS Drivers Version: HDVPSS_01_00_01_37
     [m3video]  643: HDVICP: Doing PRCM for IVAHD[2] ...
     [m3vpss ]  644: SYSTEM  : FVID2 Init in progress !!!
     [m3video]  643: HDVICP: PRCM for IVAHD[2] ... DONE.
     [m3video]  644: SYSTEM  : Initializing Links !!!
     [c6xdsp ] Remote Debug Shared Memory @ 0xbf000000
     [m3video] Remote Debug Shared Memory @ 0xbf010820
     [m3vpss ] Remote Debug Shared Memory @ 0xbf021040
     [m3vpss ] Received character 's'
     [c6xdsp ] Remote Debug Shared Memory @ 0xbf000000
     [m3video] Remote Debug Shared Memory @ 0xbf010820
     [m3vpss ] Remote Debug Shared Memory @ 0xbf021040
     [m3video] Received character 's'
     [m3video]  644: SYSTEM  : FREE SPACE : System Heap      = 6279304 B, Mbx = 10240 msgs)
     [m3vpss ] TILER_STATS: CNT :8BIT
     [m3video]  644: SYSTEM  : FREE SPACE : SR0 Heap         = 12987904 B (12 MB)
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    16384 x 8192
     [m3video]  644: SYSTEM  : FREE SPACE : Frame Buffer     = 278658944 B (265 MB)
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 16384 x 8188
     [m3video]  644: SYSTEM  : FREE SPACE : Bitstream Buffer = 210763648 B (200 MB)
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3video]  644: SYSTEM: Opening MsgQ [VPSS-M3_MSGQ] ...
     [m3video]  646: SYSTEM  : FREE SPACE : Tiler 8-bit      = 134152192 B (127 MB)  - TILER ON
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     [c6xdsp ] Remote Debug Shared Memory @ 0xbf000000
     [m3video] Remote Debug Shared Memory @ 0xbf010820
     [m3vpss ] Remote Debug Shared Memory @ 0xbf021040
     [m3video]  646: SYSTEM  : FREE SPACE : Tiler 16-bit     = 100663296 B (96 MB)  - TILER ON
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   134152192 (99 %)
     [m3video]  680: SYSTEM  : Initializing Links ... DONE !!!
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
     [m3vpss ] TILER_STATS: CNT :16BIT
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    32768 x 3072
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 32768 x 3072
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   100663296 (100 %)
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
     [m3vpss ]  715: SYSTEM  : FVID2 Init in progress DONE !!!
     [m3vpss ]  715: SYSTEM  : Device Init in progress !!!
     [m3vpss ]  718: SYSTEM  : Device Init in progress DONE !!!
     [m3vpss ]  758: SYSTEM  : System VPSS Init Done !!!
     [m3vpss ]  758: UTILS: DMA: HWI Create for INT63 !!!
     [m3vpss ]  759: SYSTEM  : Initializing Links !!!
     [m3vpss ]  759: SYSTEM  : FREE SPACE : System Heap      = 74000 B, Mbx = 10240 msgs)
     [m3vpss ]  759: SYSTEM  : FREE SPACE : SR0 Heap         = 12987904 B (12 MB)
     [m3vpss ]  759: SYSTEM  : FREE SPACE : Frame Buffer     = 274348928 B (261 MB)
     [m3vpss ]  759: SYSTEM  : FREE SPACE : Bitstream Buffer = 210763648 B (200 MB)
     [m3vpss ] TILER_STATS: CNT :8BIT
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    16384 x 8192
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 16384 x 8188
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   134152192 (99 %)
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
     [m3vpss ] TILER_STATS: CNT :16BIT
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    32768 x 3072
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 32768 x 3072
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   100663296 (100 %)
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
     [m3vpss ]  760: SYSTEM  : FREE SPACE : Tiler 8-bit      = 134152192 B (127 MB)  - TILER ON
     [m3vpss ]  761: SYSTEM  : FREE SPACE : Tiler 16-bit     = 100663296 B (96 MB)  - TILER ON
     [m3vpss ]  875: SYSTEM  : Initializing Links ... DONE !!!
     [m3vpss ]  875: SYSTEM  : Set Static L3 pressure for HDVPSS as High
     [c6xdsp ]  1020: MEM: Shared Region 1: Base = 0x90000000, Length = 0x0c900000 (201 MB)
     [c6xdsp ]  1021: SYSTEM  : System Common Init Done !!!
     [c6xdsp ]  1008: SYSTEM  : System DSP Init in progress !!!
     [c6xdsp ]  1008: SYSTEM  : RpeServer_init() done... Ret Val 0!!!
     [c6xdsp ]  1023: SYSTEM: Creating ListMP [DSP_IPC_OUT_19] in region 0 ...
     [c6xdsp ]  1023: SYSTEM: Creating ListMP [DSP_IPC_IN_19] in region 0 ...
     [c6xdsp ]  1023: SYSTEM: ListElem Shared Addr = 0xbf39d800
     [c6xdsp ]  1024: SYSTEM: Creating ListMP [DSP_IPC_OUT_20] in region 0 ...
     [c6xdsp ]  1024: SYSTEM: Creating ListMP [DSP_IPC_IN_20] in region 0 ...
     [c6xdsp ]  1024: [module] vpss probe done.
    SYSTEM: ListElem Shared Addr = 0xbf3c3000
     [c6xdsp ]  1024: SYSTEM: Creating ListMP [DSP_IPC_OUT_21] in region 0 ...
     [c6xdsp ]  1024: SYSTEM: Creating ListMP [DSP_IPC_IN_21] in region 0 ...
     [c6xdsp ]  1025: SYSTEM: ListElem Shared Addr = 0xbf3e8800
     [c6xdsp ]  1025: SYSTEM: Creating ListMP [DSP_IPC_OUT_24] in reg[module] ti81xxfb probe done.
    ion 0 ...
     [c6xdsp ]  1025: SYSTEM: Creating ListMP [DSP_IPC_IN_24] in region 0 ...
     [c6xdsp ]  1025: SYSTEM: ListElem Shared Addr = 0xbf40e000
     [c6xdsp ]  1026: SYSTEM: Creating ListMP [DSP_IPC_OUT_25] inHDMI W1 rev 2.0
     region 0 ...
     HDMI CEC Spec version 1.2
    [c6xdsp ]  1026: SYSTEM: Creating ListMP [DSP_IPC_IN_25] in region 0 ...
     [c6xdsp ]  1026: SYSTEM: ListElem Shared Addr = 0xbf42bb00
     [c6xdsp ] !!WARNING.Resource already registered:2
     [c6xdsp ]  1013: SYSTEM  : Initializing Links !!!
     [c6xdsp ] Received character 's'
    /opt/dvr_rdk/ti816x
     [c6xdsp ]  1026: SYSTEM  : FREE SPACE : System Heap      = 10391168 B, Mbx = 10240 msgs)
     [c6xdsp ]  1022: SYSTEM  : Initializing Links ... DONE !!!
     [c6xdsp ]  ETH_OFFLOAD: Init !!!
     [c6xdsp ]  1022: SYSTEM  : System DSP Init Done !!!
    I2C No Ack
    
    HDMI failed to read E-EDID
    
     ORG 0x46c00524: 0
     NEW 0x46c00524: 2
    
    root@dm816x:~# ./tvp7002_1080p60.sh
    root@dm816x:~# ./Naro_Link_Test.xv5T
     0: SYSTEM: System Common Init in progress !!!
     0: SYSTEM: IPC init in progress !!!
     13: SYSTEM: CPU [DSP] syslink proc ID is [0] !!!
     13: SYSTEM: CPU [VIDEO-M3] syslink proc ID is [1] !!!
     13: SYSTEM: CPU [VPSS-M3] syslink proc ID is [2] !!!
     13: SYSTEM: CPU [HOST] syslink proc ID is [3] !!!
     13: SYSTEM: Creating MsgQ Heap [IPC_MSGQ_MSG_HEAP_3] ...
     15: SYSTEM: Creating MsgQ [HOST_MSGQ] ...
     17: SYSTEM: Creating MsgQ [HOST_ACK_MSGQ] ...
     18: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     19: SYSTEM: Opening MsgQ [VIDEO-M3_MSGQ] ...
     19: SYSTEM: Opening MsgQ [VPSS-M3_MSGQ] ...
     20: SYSTEM: Notify register to [DSP] line 0, event 15 ...
     21: SYSTEM: Notify register to [VIDEO-M3] line 0, event 15 ...
     21: SYSTEM: Notify register to [VPSS-M3] line 0, event 15 ...
     22: SYSTEM: IPC init DONE !!!
     23: SYSTEM: Creating ListMP [HOST_IPC_OUT_24] in region 0 ...
     25: SYSTEM: Creating ListMP [HOST_IPC_IN_24] in region 0 ...
     26: SYSTEM: ListElem Shared Addr = 0x4067f880
     27: SYSTEM: Creating ListMP [HOST_IPC_OUT_25] in region 0 ...
     29: SYSTEM: Creating ListMP [HOST_IPC_IN_25] in region 0 ...
     30: SYSTEM: ListElem Shared Addr = 0x406b4a80
     32: SYSTEM: Creating ListMP [HOST_IPC_OUT_19] in region 0 ...
     34: SYSTEM: Creating ListMP [HOST_IPC_IN_19] in region 0 ...
     35: SYSTEM: ListElem Shared Addr = 0x406e9c80
     36: SYSTEM: Creating ListMP [HOST_IPC_OUT_20] in region 0 ...
     38: SYSTEM: Creating ListMP [HOST_IPC_IN_20] in region 0 ...
     39: SYSTEM: ListElem Shared Addr = 0x4072cf80
     40: SYSTEM: Creating ListMP [HOST_IPC_OUT_21] in region 0 ...
     42: SYSTEM: Creating ListMP [HOST_IPC_IN_21] in region 0 ...
     44: SYSTEM: ListElem Shared Addr = 0x40770280
     60: SYSTEM: System Common Init Done !!!
    I must hurry. 1080p==================
    
    
     [m3vpss ]  35451: CAPTURE: Create in progress !!!
     [m3vpss ]  35481: CAPTURE: VIP0 PortA capture mode is [16-bit, Non-mux Embedded Sync] !!!
     [m3video]  35599: IPC_IN_M3   : Create in progress !!!
     [m3vpss ]  UTILS: DMA: Allocated CH (TCC) = 58 (58)
     [m3video]  35599: SYSTEM: Opening ListMP [VPSS-M3_IPC_OUT_0] ...
     [m3vpss ]  UTILS: DMA: 0 of 4: Allocated PaRAM = 58 (0x49004740)
     [m3video]  35599: SYSTEM: Opening ListMP [VPSS-M3_IPC_IN_0] ...
     [m3vpss ]  UTILS: DMA: 1 of 4: Allocated PaRAM = 64 (0x49004800)
     [m3video]  35601: IPC_IN_M3   : Create Done !!!
     [m3vpss ]  UTILS: DMA: 2 of 4: Allocated PaRAM = 65 (0x49004820)
     [m3video]  35601: ENCODE: Create in progress ... !!!
     [m3vpss ]  UTILS: DMA: 3 of 4: Allocated PaRAM = 66 (0x49004840)
     [m3video]  ENCLINK: WARNING: User is asking for 8 buffers per CH. But max allowed is 7.
     [m3video]  Over riding user requested with max allowed
     [m3vpss ] CAPTURE::HEAPID:0    USED:328
     [m3vpss ] CAPTURE::HEAPID:4    USED:29030400
     [m3vpss ]  35597: CAPTURE: Create Done !!!
     [m3vpss ]  35598: IPC_OUT_M3   : Create in progress !!!
     [m3vpss ]  35598: IPC_OUT_M3   : Create Done !!!
     [m3video]  35641: ENCODE: Creating CH0 of 1920 x 1080, pitch = (1920, 1920) [PROGRESSIVE] [NON-TILED  ], bitrate = 5000 Kbps ...
    
     [host] IpcBitsInLink_tskMain:Entered
     [host]  319: IPC_BITS_IN   : Create in progress !!!
    
     [host]  319: IPC_BITS_IN   : ListMPOpen start !!!
    
     [host]  319: SYSTEM: Opening ListMP [VIDEO-M3_IPC_OUT_24] ...
     321: SYSTEM: Opening ListMP [VIDEO-M3_IPC_IN_24] ...
    
     [host]  323: IPC_BITS_IN   : ListMPOpen done !!!
    
     [host]  323: IPC_BITS_IN   : System_linkGetInfo done !!!
    
     [host]  323: IPC_BITS_IN   : Create Done !!!
     [m3vpss ]  35684: CAPTURE: Start in progress !!!
     [m3video] ENCLINK_H264:HEAPID:0        USED:13808
     [m3video] ENCLINK_H264:HEAPID:3        USED:7176192
     [m3video]  35676: ENCODE: All CH Create ... DONE !!!
     [m3video] ENCLINK:HEAPID:0     USED:13928
     [m3video] ENCLINK:HEAPID:2     USED:7946240
     [m3video] ENCLINK:HEAPID:3     USED:7176192
     [m3video]  35677: ENCODE: Create ... DONE !!!
     [m3video]  35677: IPC_BITS_OUT   : Create in progress !!!
     [m3video]  35679: IPC_BITS_OUT   : Create Done !!!
     [m3vpss ]  35784: CAPTURE: Enabled Time Stamping !!!
     [m3vpss ]  35792: CAPTURE: Start Done !!!
    Change dynamics parameters
     [m3vpss ]  37793: CAPTURE: Dynamic resolution change: width: 1920, height: 1080!
     [m3video] 37793:!ERROR!:ENCLINK::links_m3video/iva_enc/encLink_h264.c:[232]::INTERNAL ERROR:-1
     [m3video] ALGCONTROL FAILED:CMD:1
     [m3video] ERROR: IH264ENC_LEVEL_INCOMPLAINT_PARAMETER , 0,
     [m3video] 37794:WARN
     [m3video]  ENCLINK: ERROR in Run time parameters changes, Extended Error code:1
    ^CSignal interrupt received
     [m3vpss ]  41320: CAPTURE: Stop in progress !!!
     [m3video]  41321: ENCODE: CH-1:
     [m3video] Stop in progress !!!
     [m3vpss ]  41321: CAPTURE: Stop Done !!!
    
     [host]  5969: IPC_BITS_IN   : Stop Done !!!
    
     [host] 5976: IPCBITSIN:Link[3000001a]:
     [host] RECV:271        FREE:271,DROPPED:0,AVGLATENCY:0,AVG_APP_CB_TIME:0
     [host]  5976: IPC_BITS_IN   : Delete in progress !!!
    
     [host]  5976: IPC_BITS_IN   : Delete Done !!!
     [m3vpss ]
     [m3video]  41328: ENCODE: CH-1:
     [m3video] Stop done !!!
     [m3video]  41334: IPC_IN_M3   : Delete in progress !!!
     [m3vpss ]  *** Capture Driver Advanced Statistics ***
     [m3video]  41334: IPC_IN_M3   : Delete Done !!!
     [m3vpss ]
     [m3video]  41334: ENCODE: CH-1:
     [m3video] Stop in progress !!!
     [m3vpss ]  VIP Parser Reset Count : 0
     [m3video]  41334: ENCODE: CH-1:
     [m3video] Stop done !!!
     [m3vpss ]
     [m3video]  41334: ENCODE: CH-1:
     [m3video]  ENC    : Delete in progress !!!
     [m3video] MemoryLeak:STAGE:0   HEAPNUM:0       ALLOC=13808     FREED=11912
     [m3vpss ]      |   Total    Even     Odd  Total  Even   Odd  Min /  Max  Min /  Max Dropped Fid Repeat Frame Error Y/C
     [m3video]  41335: ENCODE: CH-1:
     [m3video]  ENC    : Delete done !!!
     [m3vpss ]  CH  |  Fields  Fields  Fields    FPS   FPS   FPS       Width      Height  Fields      Count (Desc Error Y/C)
     [m3video]  41335: IPC_BITS_OUT   : Delete in progress !!!
     [m3vpss ]  ------------------------------------------------------------------------------------------------------------
     [m3video] 41335: IPCBITSOUT:Link[10000018]:
     [m3video] RECV:271     FREE:271,DROPPED:0,AVGLATENCY:1
     [m3video]  41335: PRF : IPC_BITS_OUT0 : t: 5 ms, c: 271, f: 271, fps: 54200, fpc: 1
     [m3vpss ]  000 |     331     331       0     66    66     0 1920 / 1920 1080 / 1080       1          0 0/0 (0/0)
     [m3video]  41335: IPC_BITS_OUT   : Delete Done !!!
     [m3vpss ]
     [m3vpss ]  VIP Capture Port 0 | DescMissMatch1 = 0, DescMissMatch2 = 0 , DescMissMatch3 = 0
     [m3vpss ]
     [m3vpss ]  *** Capture List Manager Advanced Statistics ***
     [m3vpss ]
     [m3vpss ]  List Post Count        : 692
     [m3vpss ]  List Stall Count       : 0
     [m3vpss ]  List Post Time (ms)    : Max = 0, Min = 0, Avg = 0, Total = 0
     [m3vpss ]  INTC Timeout Count     : (0, 0) (Min timeout value = 992, 1000)
     [m3vpss ]  Descriptor miss found count : 0
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  VIP and VPDMA registers,
     [m3vpss ]  VIP0 : FIQ_STATUS  : 0x4810551c = 0x00000000
     [m3vpss ]  VIP1 : FIQ_STATUS  : 0x48105a1c = 0x00000000
     [m3vpss ]  VPDMA: LIST_BUSY   : 0x4810d00c = 0x00000000
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  41331: CAPTURE: Fields = 330 (fps = 59, CPU Load = 0)
     [m3vpss ]  41331: CAPTURE: Num Resets = 0 (Avg 0 ms per reset)
     [m3vpss ]  41331: SYSTEM  : FREE SPACE : System Heap      = 68056 B, Mbx = 10239 msgs)
     [m3vpss ]  41331: SYSTEM  : FREE SPACE : SR0 Heap         = 8713728 B (8 MB)
     [m3vpss ]  41331: SYSTEM  : FREE SPACE : Frame Buffer     = 238142336 B (227 MB)
     [m3vpss ]  41331: SYSTEM  : FREE SPACE : Bitstream Buffer = 202817408 B (193 MB)
     [m3vpss ] TILER_STATS: CNT :8BIT
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    16384 x 8192
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 16384 x 8188
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     6308: SYSTEM: System Common De-Init in progress !!!
    
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress...
     [host] OSA_tskDelete:In progress... 6313: SYSTEM: IPC de-init in progress !!!
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   134152192 (99 %)
     6326: SYSTEM: IPC de-init DONE !!!
     6326: SYSTEM: System Common De-Init Done !!!
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
    root@dm816x:~#  [m3vpss ] TILER_STATS: CNT :16BIT
     [m3vpss ] TILER_STATS: CNT RESOLUTION:    32768 x 3072
     [m3vpss ] TILER_STATS: BUCKET RESOLUTION: 32768 x 3072
     [m3vpss ] TILER_STATS: NUM FREE BUCKETS:  1
     [m3vpss ] TILER_STATS: NUM USED BUCKETS:  0
     [m3vpss ] TILER_STATS: TOTAL FREE AREA:   100663296 (100 %)
     [m3vpss ] TILER_STATS: TOTAL USED AREA:   0 (0 %)
     [m3vpss ]  41332: SYSTEM  : FREE SPACE : Tiler 8-bit      = 134152192 B (127 MB)  - TILER ON
     [m3vpss ]  41333: SYSTEM  : FREE SPACE : Tiler 16-bit     = 100663296 B (96 MB)  - TILER ON
     [m3vpss ]  41333: CAPTURE: Delete in progress !!!
     [m3vpss ]  UTILS: DMA: Free'ed CH (TCC) = 58 (58)
     [m3vpss ]  41333: CAPTURE: Delete Done !!!
     [m3vpss ]  41333: IPC_OUT_M3   : Delete in progress !!!
     [m3vpss ]  41333: IPC_OUT_M3   : Delete Done !!!
    

    /** definition de debug */
    #define ENABLE_NSF          0
    #define ENABLE_LOG_BUFFER   0
    
    
    #define ENABLE_TIME_BUFFER  0
    #define ENABLE_LOG_GLOBAL   0
    #define IPC_FRAMERATE       1.0
    /*****************************/
    
    
    #define MAX_PATH_SIZE 255
    #define NUM_CAPTURE_DEVICES        (1)
    
    //ProcMgr_Handle              procMgrHandle;
    FILE*	_fout;
    UInt32 _captureId;
    UInt32 _encId;
    UInt32 _ipcBitsOutVpssId;
    UInt32 _ipcBitsInVideoId;
    UInt32 _ipcBitsOutVideoId;
    UInt32 _ipcBitsInHostId;
    
    typedef struct
    {
    	char	Pt_file[50];
    	UInt32	res0;
    	UInt32  width[4];
    	UInt32	height[4];
    	UInt32  framerate[4];
    	Int32	bitrate;
    	Int32	gopsize[4];
    	VCODEC_TYPE_E	codec;
    } Config_struct;
    
    /*IVA HD MAP Table*/
    static SystemVideo_Ivahd2ChMap_Tbl _systemVid_encDecIvaChMapTbl =
    {
        .isPopulated = 1,
        .ivaMap[0] =
        {
            .EncNumCh  = 1,
            .EncChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0 , 0, 0},
            .DecNumCh  = 0,
            .DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        },
        .ivaMap[1] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
            .DecNumCh  = 0,
            .DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        },
        .ivaMap[2] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
            .DecNumCh  = 0,
            .DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        },
    };
    
    int run = 1;
    
    void sighandler(int signum)
    {
        if (signum == SIGINT)
        {
            printf("Signal interrupt received\n");
            run = 0;
        }
    }
    
    Void capture_encode_bitsWriteCbFxn(Ptr pPrm)
    {
        Bitstream_BufList bitsBuf;
        Bitstream_Buf *pBuf;
        Int32 frameId;
        Int32 status;
        unsigned long writeDataSize;
    #if ENABLE_TIME_BUFFER    
        static unsigned long countImage = 0;
    #endif    
        /* Get buffer list from the IPC Link*/
        bitsBuf.numBufs = 0;
        status = IpcBitsInLink_getFullVideoBitStreamBufs(_ipcBitsInHostId, &bitsBuf);
        if( (status == 0 ) && (bitsBuf.numBufs) && (_fout != NULL) )
        {
            for(frameId = 0; frameId < bitsBuf.numBufs ; frameId++ )
            {
                pBuf = bitsBuf.bufs[frameId];
                if( pBuf->fillLength > 0 )
                {
                    writeDataSize = fwrite(pBuf->addr, sizeof(char),pBuf->fillLength, _fout);
                    if( writeDataSize != pBuf->fillLength)
                    {
                        //fclose(_fout);
                        //_fout = NULL;
                        printf(" Error write : Closing file\n");
                    }
    #if ENABLE_TIME_BUFFER
                    printf("******************************\n");
                    printf("countImage %lu:%lu\n",countImage++,(unsigned long)bitsBuf.numBufs);
                    printf("timeStamp %lu\n",(unsigned long)pBuf->timeStamp);
                    printf("encodeTimeStamp %lu\n",(unsigned long)pBuf->encodeTimeStamp);
                    printf("isKeyFrame %lu\n",(unsigned long)pBuf->isKeyFrame);
    #endif                
    #if ENABLE_LOG_BUFFER
                    printf("******************************\n");
                    printf("countImage %lu\n",countImage++);
                    printf("codingType %d\n",pBuf->codingType);
                    printf("channelNum %d\n",pBuf->channelNum);
                    printf("%d:%d\n",pBuf->frameWidth,pBuf->frameHeight);
    //                printf("timeStamp %lu\n",(unsigned long)pBuf->timeStamp);
                    printf("capture timestamp up %lu\n",(unsigned long)pBuf->upperTimeStamp);
                    printf("capture timestamp low %lu\n",(unsigned long)pBuf->lowerTimeStamp);
                    printf("encodeTimeStamp %lu\n",(unsigned long)pBuf->encodeTimeStamp);
                    printf("isKeyFrame %lu\n",(unsigned long)pBuf->isKeyFrame);
                    printf("doNotDisplay %d\n",pBuf->doNotDisplay);
                    printf("seqId %d\n",pBuf->seqId);
                    printf("inputFileChanged %d\n",pBuf->inputFileChanged);
                    printf("flushFrame %d\n",pBuf->flushFrame);
                    printf("allocPoolID %d\n",pBuf->allocPoolID);
                    printf("temporalId %d\n",pBuf->temporalId);
                    printf("numTemporalLayerSetInCodec %d\n",pBuf->numTemporalLayerSetInCodec);
                    printf("bufSize %lu\n",(unsigned long)pBuf->bufSize);
                    printf("fillLength %lu\n",(unsigned long)pBuf->fillLength);
                    printf("startOffset %lu\n",(unsigned long)pBuf->startOffset);
                    printf("mvDataOffset %lu\n",(unsigned long)pBuf->mvDataOffset);
                    printf("mvDataFilledSize %lu\n",(unsigned long)pBuf->mvDataFilledSize);
                    printf("phyAddr 0x%08lX\n",(unsigned long)pBuf->phyAddr);
    #endif
                }
    
            }
        }
        /* Release buffer list back to the IPC Link*/
        /* On relese tout le temps même si pas de données dispo */
        IpcBitsInLink_putEmptyVideoBitStreamBufs(_ipcBitsInHostId, &bitsBuf);
        
    }
    
    void capture_encode_ipcBitsInitCreateParams_BitsInHLOS(IpcBitsInLinkHLOS_CreateParams *cp)
    {
        cp->baseCreateParams.noNotifyMode = FALSE; //FALSE;
        cp->cbFxn = capture_encode_bitsWriteCbFxn;
        cp->cbCtx = NULL;
        cp->baseCreateParams.notifyNextLink = FALSE;
        /* Previous link of bitsInHLOS is bitsOutRTOS. So, notifyPrevLink
         * should be set to false if bitsInHLOS is to operate in
         * NO_NOTIFY_MODE
         */
        cp->baseCreateParams.notifyPrevLink = TRUE;//TRUE;
    }
    
    void capture_encode_ipcBitsInitCreateParams_BitsOutRTOS(IpcBitsOutLinkRTOS_CreateParams *cp,
                                                    Bool notifyPrevLink)
    {
        /* Next link of bitsOutRTOS is bitsInHLOS. So, notifyPrevLink
         * should be set to false if bitsInHLOS is to operate in
         * NO_NOTIFY_MODE
         */
        cp->baseCreateParams.noNotifyMode = FALSE; //FALSE;
        cp->baseCreateParams.notifyNextLink = TRUE;//TRUE;
        cp->baseCreateParams.notifyPrevLink = notifyPrevLink;
    }
    
    int capture_encode_dynamique_parameters(Config_struct *Pt_Conf)
    {
        CaptureLink_SetResolution vcapSetRes = {0};
        EncLink_ChFpsParams params;
        Int32 status = ERROR_NONE;
        
        /* On force la résolution */
        vcapSetRes.queId  = 0;
        vcapSetRes.chId   = 0;
        vcapSetRes.width = SystemUtils_align(Pt_Conf->width[0],16);
        vcapSetRes.height = SystemUtils_align(Pt_Conf->height[0], 1);
        status = System_linkControl(_captureId,CAPTURE_LINK_CMD_SET_RESOLUTION,
                                    &(vcapSetRes),sizeof(vcapSetRes), TRUE );
    #if 1
        /* configuration de la frequence image */
        params.chId = 0;
        /* New fps vaule in fps x 1000 formate */
        params.targetFps = Pt_Conf->framerate[0] *1000;
        /* Corresponding bitrate value */
        params.targetBitRate = Pt_Conf->bitrate*1000;
        //System_linkControl(_encId, ENC_LINK_CMD_SET_CODEC_INPUT_FPS,
        //                    &params, sizeof(params), TRUE);    
        System_linkControl(_encId, ENC_LINK_CMD_SET_CODEC_FPS,
                            &params, sizeof(params), TRUE);
    #endif
        return 0;
    }
    
    void capture_encode_start(Config_struct *Pt_Conf)
    {
    	UInt32 vipInstId = 0;
    	UInt32 i;
        CaptureLink_CreateParams    capturePrm;
        IpcLink_CreateParams        ipcOutVpssPrm;
        IpcLink_CreateParams        ipcInVideoPrm;
    
        EncLink_CreateParams        encPrm;
    
        IpcBitsOutLinkRTOS_CreateParams   ipcBitsOutVideoPrm;
        IpcBitsInLinkHLOS_CreateParams    ipcBitsInHostPrm;
    
        CaptureLink_VipInstParams *pCaptureInstPrm = NULL;
        CaptureLink_OutParams     *pCaptureOutPrm = NULL;
    
        _captureId            = SYSTEM_LINK_ID_CAPTURE;
    
        _encId                = SYSTEM_LINK_ID_VENC_0;
        _ipcBitsOutVpssId     = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        _ipcBitsInVideoId     = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
        _ipcBitsOutVideoId    = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
        _ipcBitsInHostId      = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
    
    	System_linkControl(
            SYSTEM_LINK_ID_M3VPSS,
            SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
            NULL,
            0,
            TRUE
        );
    
        System_linkControl(
            SYSTEM_LINK_ID_M3VIDEO,
            SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
            &_systemVid_encDecIvaChMapTbl,
            sizeof(SystemVideo_Ivahd2ChMap_Tbl),
            TRUE
        );
    
        //Chains_ipcBitsInit();
        CHAINS_INIT_STRUCT(CaptureLink_CreateParams, capturePrm);
        CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcOutVpssPrm);
        CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcInVideoPrm);
        CHAINS_INIT_STRUCT(EncLink_CreateParams, encPrm);
        CHAINS_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams, ipcBitsOutVideoPrm);
        CHAINS_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams, ipcBitsInHostPrm);
    
        CaptureLink_CreateParams_Init(&capturePrm);
        capturePrm.numVipInst    = 1; /* on utilise qu'un seul VIP inst */
        capturePrm.outQueParams[0].nextLink = _ipcBitsOutVpssId;
        
        capturePrm.tilerEnable              = FALSE;
        capturePrm.enableSdCrop             = FALSE;
        capturePrm.isPalMode                = FALSE;
        capturePrm.numBufsPerCh             = 8;
        capturePrm.numExtraBufs             = 0;
        capturePrm.maxBlindAreasPerCh       = 0;
        capturePrm.doCropInCapture          = FALSE;
    
        //printf("NME :  init pCaptureInstPrm\n");
        for(vipInstId=0; vipInstId < capturePrm.numVipInst ; vipInstId++)
        {
            pCaptureInstPrm                     = &capturePrm.vipInst[vipInstId];
           pCaptureInstPrm->vipInstId          = (SYSTEM_CAPTURE_INST_VIP0_PORTA+vipInstId) % SYSTEM_CAPTURE_INST_MAX;
            pCaptureInstPrm->videoDecoderId     = 0/*SYSTEM_DEVICE_VID_DEC_TVP5158_DRV*/;
    		//输入源的数据格式
            pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
    		//需求的视频标准 参考System_VideoDataFormat
            pCaptureInstPrm->standard           = Pt_Conf->res0; /* resolution est frequence de la video en entrée */
    		//每个VIP的输出数
            pCaptureInstPrm->numOutput          = 1;
    		//每个输出的Channel数量
            pCaptureInstPrm->numChPerOutput     = 1;
            
    
    		//设置输出的配置 注意,其实是pCaptureInstPrm下的子结构体
            pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
    		//需求的视频标准 参考System_VideoDataFormat
            pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV420SP_UV;
            pCaptureOutPrm->scEnable            = FALSE; /* desativation du module de scale */
            pCaptureOutPrm->scOutWidth          = Pt_Conf->width[vipInstId];
            pCaptureOutPrm->scOutHeight         = Pt_Conf->height[vipInstId];
            pCaptureOutPrm->outQueId            = 0;
            
            switch(pCaptureInstPrm->standard)
            {
                case VSYS_STD_NTSC:
                case VSYS_STD_PAL:
                case VSYS_STD_480I:
                case VSYS_STD_576I:
                case VSYS_STD_CIF:
                case VSYS_STD_HALF_D1:
                case VSYS_STD_D1:
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422I_UYVY;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_8BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_INTERLACED;
                    pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
                    break;
                case VSYS_STD_1080I_60:
                case VSYS_STD_1080I_50:
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422I_UYVY;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_16BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_INTERLACED;
                    pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
                    break;
                case VSYS_STD_480P:
                case VSYS_STD_576P:
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422SP_UV;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_8BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_PROGRESSIVE;
                    pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
                    break;
                case VSYS_STD_720P_60:
                case VSYS_STD_720P_50:
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_16BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_PROGRESSIVE;
                    pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
                    break;
                case VSYS_STD_1080P_60:
                case VSYS_STD_1080P_50:
                case VSYS_STD_1080P_24:
                case VSYS_STD_1080P_30:
    				printf("I must hurry. 1080p================== \n\n\n");
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_16BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_PROGRESSIVE;
                    pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
                    break;
                default:
                    pCaptureInstPrm->standard           = VSYS_STD_720P_50;
                    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422SP_UV;
                    pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_16BIT;
                    pCaptureInstPrm->inScanFormat       = SYSTEM_SF_PROGRESSIVE;
                    break;
            }
        }
    
        ipcOutVpssPrm.inQueParams.prevLinkId    = _captureId;
        ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVpssPrm.numOutQue                 = 1;
        ipcOutVpssPrm.notifyNextLink            = TRUE;
        ipcOutVpssPrm.notifyPrevLink            = TRUE;
        ipcOutVpssPrm.noNotifyMode              = FALSE;
        ipcOutVpssPrm.inputFrameRate            = Pt_Conf->framerate[0];
        ipcOutVpssPrm.outputFrameRate            = Pt_Conf->framerate[0];
        //ipcOutVpssPrm.inputFrameRate            = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        //ipcOutVpssPrm.outputFrameRate           = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcOutVpssPrm.outQueParams[0].nextLink  = _ipcBitsInVideoId;
        ipcOutVpssPrm.numChPerOutQue[0]  = 1;
    /**
    * ipcBitsOutVpss to ipcBitsInVideo
    **/
        //printf("NME :  ipcBitsOutVpss to ipcBitsInVideo\n");
        ipcInVideoPrm.inQueParams.prevLinkId    = _ipcBitsOutVpssId;
        ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
        ipcInVideoPrm.numOutQue                 = 1;
        ipcInVideoPrm.notifyNextLink            = TRUE;
        ipcInVideoPrm.notifyPrevLink            = TRUE;
        ipcInVideoPrm.noNotifyMode              = FALSE; //FALSE;
        ipcInVideoPrm.inputFrameRate            = Pt_Conf->framerate[0];
        ipcInVideoPrm.outputFrameRate           = Pt_Conf->framerate[0];
        //ipcInVideoPrm.inputFrameRate            = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        //ipcInVideoPrm.outputFrameRate           = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcInVideoPrm.outQueParams[0].nextLink  = _encId;
        ipcInVideoPrm.numChPerOutQue[0]  = 1;
    
    /**
    * ipcBitsInVideo to Encoder
    **/
        //printf("NME :  ipcBitsInVideo to Encoder\n");
        /* configuartion du module de compression, ici qu'un seul */
        for( i = 0 ; i < 1 ; i++ )
        {
        
            EncLink_ChCreateParams *pLinkChPrm;
            EncLink_ChDynamicParams *pLinkDynPrm;
            if( Pt_Conf->codec == VCODEC_TYPE_H264 )
            {
                encPrm.numBufPerCh[i] = 8;
                pLinkChPrm  = &encPrm.chCreateParams[i];
                pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
    
                pLinkChPrm->format                  = IVIDEO_H264HP;
                pLinkChPrm->profile                 = IH264_HIGH_PROFILE;
                pLinkChPrm->enableAnalyticinfo      = 1;
                pLinkChPrm->enableWaterMarking      = 1;
                pLinkChPrm->maxBitRate              = Pt_Conf->bitrate * 1000 ;
                pLinkChPrm->encodingPreset          = VENC_XDM_HIGH_SPEED_MED_QUALITY;
                
                /**
                    VENC_XDM_DEFAULT = 0,                
                    VENC_XDM_HIGH_QUALITY = 1,           
                    VENC_XDM_HIGH_SPEED = 2,             
                    VENC_XDM_USER_DEFINED = 3,           
                    VENC_XDM_HIGH_SPEED_MED_QUALITY = 4, 
                    VENC_XDM_MED_SPEED_MED_QUALITY = 5,  
                    VENC_XDM_MED_SPEED_HIGH_QUALITY = 6,  */
                pLinkChPrm->rateControlPreset       = VENC_RATE_CTRL_VBR;//VENC_RATE_CTRL_VBR; //IVIDEO_STORAGE
                /**
                VENC_RATE_CTRL_VBR = 0,
                VENC_RATE_CTRL_CBR = 1,*/
                pLinkChPrm->enableHighSpeed         = 0; /* enable only if encodingPreset is set to VENC_XDM_USER_DEFINED*/
                pLinkChPrm->overrideInputScanFormat = FALSE; 
                pLinkChPrm->fieldPicEncode = FALSE; 
    
                pLinkDynPrm->intraFrameInterval     = Pt_Conf->gopsize[i];
                pLinkDynPrm->targetBitRate          = Pt_Conf->bitrate * 1000 ;
                pLinkDynPrm->interFrameInterval     = 1;
                pLinkDynPrm->mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
                pLinkDynPrm->rcAlg                  = 0;//VENC_RATE_CTRL_VBR;
                pLinkDynPrm->qpMin                  = 10;
                pLinkDynPrm->qpMax                  = 40;
                pLinkDynPrm->qpInit                 = -1;
                pLinkDynPrm->vbrDuration            = 8;
                pLinkDynPrm->vbrSensitivity         = 0;
                
                pLinkDynPrm->inputFrameRate         = (UInt32)(Pt_Conf->framerate[i] / (double)IPC_FRAMERATE);
    
                
                switch(Pt_Conf->res0)
                {
                    case VSYS_STD_NTSC:
                    case VSYS_STD_PAL:
                    case VSYS_STD_480I:
                    case VSYS_STD_576I:
                    case VSYS_STD_CIF:
                    case VSYS_STD_HALF_D1:
                    case VSYS_STD_D1:
                    case VSYS_STD_1080I_60:
                    case VSYS_STD_1080I_50:
                        pLinkChPrm->fieldMergeEncodeEnable = TRUE;
                        pLinkChPrm->dataLayout = IVIDEO_FIELD_INTERLEAVED; /*IVIDEO_INTERLACED;*/
                        break;
                    case VSYS_STD_480P:
                    case VSYS_STD_576P:
                    case VSYS_STD_720P_60:
                    case VSYS_STD_720P_50:
                    case VSYS_STD_1080P_60:
                    case VSYS_STD_1080P_50:
                    case VSYS_STD_1080P_24:
                    case VSYS_STD_1080P_30:
                    default:
                        pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                        pLinkChPrm->dataLayout = VCODEC_FIELD_SEPARATED; /*IVIDEO_PROGRESSIVE;*/
                        break;
                }
            }
            else if ( Pt_Conf->codec == VCODEC_TYPE_MJPEG )
            {
                pLinkChPrm->format                 = IVIDEO_MJPEG;
                pLinkChPrm->profile                = 0;
                pLinkChPrm->dataLayout             = VCODEC_FIELD_SEPARATED;
                pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                pLinkChPrm->enableAnalyticinfo     = 0;
                pLinkChPrm->maxBitRate             = Pt_Conf->bitrate * 1000 ;
                pLinkChPrm->encodingPreset         = 0;
                pLinkChPrm->rateControlPreset      = 0;
    
                pLinkDynPrm->intraFrameInterval    = 0;
                pLinkDynPrm->targetBitRate         = Pt_Conf->bitrate * 1000 ;
                pLinkDynPrm->interFrameInterval    = 0;
                pLinkDynPrm->mvAccuracy            = 0;
                pLinkDynPrm->inputFrameRate        = 1;//pDynPrm->inputFrameRate;
                pLinkDynPrm->qpMin                 = 0;
                pLinkDynPrm->qpMax                 = 0;
                pLinkDynPrm->qpInit                = -1;
                pLinkDynPrm->vbrDuration           = 0;
                pLinkDynPrm->vbrSensitivity        = 0;
            }
            
        }
        
        encPrm.inQueParams.prevLinkId   = _ipcBitsInVideoId;
        encPrm.inQueParams.prevLinkQueId= 0;
        encPrm.outQueParams.nextLink = _ipcBitsOutVideoId;
    
    
    /**
    * Encoder to ipcBitsOutVideo
    **/
        //printf("NME :  Encoder to ipcBitsOutVideo\n");
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = _encId;
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
        ipcBitsOutVideoPrm.baseCreateParams.inputFrameRate            = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcBitsOutVideoPrm.baseCreateParams.outputFrameRate           = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = _ipcBitsInHostId;
        ipcBitsOutVideoPrm.baseCreateParams.numChPerOutQue[0]  = 1;
        capture_encode_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm, TRUE);
    
    
        ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = _ipcBitsOutVideoId;
        ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsInHostPrm.baseCreateParams.numOutQue                 = 1;
        ipcBitsInHostPrm.baseCreateParams.inputFrameRate            = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcBitsInHostPrm.baseCreateParams.outputFrameRate           = (UInt32)((double)Pt_Conf->framerate[0] / (double)IPC_FRAMERATE);
        ipcBitsInHostPrm.baseCreateParams.outQueParams[0].nextLink   = SYSTEM_LINK_ID_INVALID;
        ipcBitsInHostPrm.baseCreateParams.numChPerOutQue[0]  = 0;
        capture_encode_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm);
    
        //printf("NME :  System_linkCreate _captureId\n");
        System_linkCreate(_captureId, &capturePrm, sizeof(capturePrm));
        //System_linkControl(_captureId, CAPTURE_LINK_CMD_CONFIGURE_VIP_DECODERS, NULL, 0, TRUE);
        //printf("NME :  System_linkCreate _ipcBitsOutVpssId\n");
        System_linkCreate(_ipcBitsOutVpssId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
        // printf("NME :  System_linkCreate _ipcBitsInVideoId\n");
        System_linkCreate(_ipcBitsInVideoId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
        //printf("NME :  System_linkCreate _encId\n");
        System_linkCreate(_encId, &encPrm, sizeof(encPrm));
        //printf("NME :  System_linkCreate _ipcBitsOutVideoId\n");
        System_linkCreate(_ipcBitsOutVideoId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
        //printf("NME :  System_linkCreate _ipcBitsInHostId\n");
        System_linkCreate(_ipcBitsInHostId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));
    
       
        //printf("NME :  System_linkStart _ipcBitsInHostId\n");
        System_linkStart(_ipcBitsInHostId);
        //printf("NME :  System_linkStart _ipcBitsOutVideoId\n");
        System_linkStart(_ipcBitsOutVideoId);
        //printf("NME :  System_linkStart _encId\n");
        System_linkStart(_encId);
        //printf("NME :  System_linkStart _ipcBitsInVideoId\n");
        System_linkStart(_ipcBitsInVideoId);
        //printf("NME :  System_linkStart _ipcBitsOutVpssId\n");
        System_linkStart(_ipcBitsOutVpssId);
       // printf("NME :  System_linkStart _captureId\n");
        System_linkStart(_captureId);
    
    	return;
    }
    
    void capture_encode_stop()
    {
        //printf("NME :  capture_encode_stop\n");
        System_linkStop(_captureId);
        System_linkStop(_ipcBitsOutVpssId);
        System_linkStop(_ipcBitsInVideoId);
        System_linkStop(_encId);
        System_linkStop(_ipcBitsOutVideoId);
        System_linkStop(_ipcBitsInHostId);
    
        System_linkDelete(_captureId);
        System_linkDelete(_ipcBitsOutVpssId);
        System_linkDelete(_ipcBitsInVideoId);
        System_linkDelete(_encId);
        System_linkDelete(_ipcBitsOutVideoId);
        System_linkDelete(_ipcBitsInHostId);
    	return;
    }
    
    Int32 capture_encode_printDetailedStatistics()
    {
        
        System_linkControl(_captureId, CAPTURE_LINK_CMD_PRINT_ADV_STATISTICS, NULL, 0, TRUE);
        System_linkControl(_captureId, CAPTURE_LINK_CMD_PRINT_BUFFER_STATISTICS, NULL, 0, TRUE);
        System_linkControl(_encId, ENC_LINK_CMD_PRINT_IVAHD_STATISTICS, NULL, 0, TRUE);
        System_linkControl(_encId, ENC_LINK_CMD_PRINT_STATISTICS, NULL, 0, TRUE);
        System_linkControl(_encId, ENC_LINK_CMD_PRINT_BUFFER_STATISTICS, NULL, 0, TRUE);
        
    
        return 0;
    }
    
    int main()
    {
    	Config_struct Conf;
        struct sigaction    sigintAction;
        int count = 0;
    
        sigintAction.sa_handler = sighandler;
        sigemptyset(& (sigintAction.sa_mask));
        if (sigaction(SIGINT, &sigintAction, NULL) != 0)
        {
            fprintf(stderr, "Erreur SIGINT\n\r");
            exit(1);
        }
    
    	strcpy(Conf.Pt_file, "Enc.h264");
    	Conf.res0 = VSYS_STD_1080P_60;
    	//Conf.res0 = VSYS_STD_720P_50;
    	//Conf.res0 = SYSTEM_STD_720P_50;
    	Conf.height[0] = 1080;
    	//Conf.height[0] = 720;
    	Conf.width[0] = 1920;
    	//Conf.width[0] = 1280;
    	Conf.framerate[0] = 60;
    	Conf.codec = VCODEC_TYPE_H264;
    	Conf.bitrate = 5000;
    	Conf.gopsize[0] = 30;
    
    	System_init();
    
    	if(NULL == (_fout = fopen(Conf.Pt_file, "wb")))
    	{
    		printf("error open write file %s\n", Conf.Pt_file);
            return -1;
    	}
    	
    	capture_encode_start(&Conf);
        sleep(2);
        //printf("NME :  run\n");
    
        printf("Change dynamics parameters\n");
        capture_encode_dynamique_parameters(&Conf);
        
        while( run == 1 )
        {
           
            usleep(20000);
            count++;
            if( count >= 1000)
            {
                printf("NME :  capture_encode_printDetailedStatistics\n");
                capture_encode_printDetailedStatistics();
                
                count = 0;
            }
           
        }
    
    
        capture_encode_stop();
    
    	if(NULL != _fout)
    	{
    		fclose(_fout);
    	}
    
    	System_deInit();
    	return 0;
    }
    
    

    Naroah

    Feb/16/2014