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.

problem about h264 codec on dm365


I use the dvsdk 4.0.2 on dm365 board and use the h264 codec within the dvsdk 4.0.2.
A strange problem is here, the order for encode_init( ) and decode_init( ) becomes fetal :

//------------------------------------------------------------------------------
// file main.cpp
//------------------------------------------------------------------------------


#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <assert.h>

 

#include <getopt.h>

#include <signal.h>

 

#include <fcntl.h>

#include <unistd.h>

#include <errno.h>

#include <malloc.h>

#include <sys/stat.h>

#include <sys/types.h>

#include <sys/time.h>

#include <sys/mman.h>

#include <sys/ioctl.h>

 

#include <asm/types.h>

 

#include <cmem.h>

 

#include <xdc/std.h>

#include <ti/sdo/ce/CERuntime.h>

#include <ti/sdo/ce/Engine.h>

#include <ti/sdo/ce/osal/Memory.h>

 

#include <ti/sdo/ce/video1/videnc1.h>

#include <ti/sdo/ce/video2/viddec2.h>

 

#include <ti/sdo/codecs/h264enc/ih264venc.h>

#include <ti/sdo/codecs/h264dec/ih264vdec.h>

 

 

static int encode_init( );

static int decode_init( );

 

//------------------------------------------------------------------------------

int main (int argc,char ** argv)

{

 

 CMEM_init();

 

 CERuntime_init(); 

 

 // if decode_init( ) first , that's OK

 if( -1 == decode_init(  ) )

 {

  printf( "failed to create h264 decoder\n" );

  return -1 ;

 } 

 

 if( -1 == encode_init(  ) )

 {

  printf( "failed to create h264 encoder\n" );

  return -1 ;

 }

 

 // if decode_init( ) after encode_init( ), that's failed

 if( -1 == decode_init(  ) )

 {

  printf( "failed to create h264 decoder\n" );

  return -1 ;

 }

 

 

 printf( "Success\n" );

 

 return 0 ;

}

//------------------------------------------------------------------------------

//

//----------------------------------------------------------------------

int encode_init(  )

{

 static char *engine_name = (char*) "codec_engine" ;

 static char *encode_name = (char*) "h264enc" ;

 

 static Engine_Handle engine ;

 static VIDENC1_Handle encode ;

 

 

 engine = Engine_open( engine_name, NULL, NULL);

 if( engine == 0 )

 {

  return -1 ;

 }

 

 encode = VIDENC1_create( engine, encode_name, NULL );

 if( encode == 0 )

 {

  Engine_close( engine );

  engine = 0 ;

  return -1 ;

 }

 

 return 0 ;

}

 

//----------------------------------------------------------------------

int decode_init(  )

{

 

 static char *engine_name = (char*) "codec_engine" ;

 static char *decode_name = (char*) "h264dec" ;

 

 static Engine_Handle engine ;

 static VIDDEC2_Handle decode ;

  

 engine = Engine_open( engine_name, NULL, NULL);

 if( engine == 0 )

 {

  return 0 ;

 }

 

 decode = VIDDEC2_create( engine, decode_name, NULL );

 

 if( decode == 0 )

 {

  // if decode_init( ) after encode_init( ), that's failed


  printf( "+++ VIDDEC2_create( ) failed +++ \n" );

 

  Engine_close( engine );

  engine = 0 ;

  return -1 ;

 }  

 

  return 0 ;

}

//----------------------------------------------------------------------


Is there any problem in the h264 codec source ?

  • if use jpeg encoder instead of h264 decoder, the same problem exists.

    to create jpeg encoder or h264 decoder before h264 encoder, that's OK.

    if h264 encoder is created first, then h264 decoder and jpeg encoder can't be created.

    but another h264 encoder can be created.

    does any one encounter the same problem ? 

    any idea to free me ?