void print_index( index_param_t index) { int i; fprintf( logstream, "index info:\n"); fprintf( logstream, "\tCodestream Offset: %#" PRIx64 "\n", index.offset); fprintf( logstream, "\t Length: %#" PRIx64 "\n", index.length); fprintf( logstream, "\tMain header Length: %#" PRIx64 "\n", index.mhead_length); print_SIZ( index.SIZ); print_COD( index.COD); fprintf( logstream, "Tile part information: \n"); print_faixbox( index.tilepart); fprintf( logstream, "Tile header information: \n"); for( i=0; i<(int)(index.SIZ.XTnum*index.SIZ.YTnum);i++) print_mhixbox( index.tileheader[i]); fprintf( logstream, "Precinct packet information: \n"); for( i=0; i<index.SIZ.Csiz; i++){ fprintf( logstream, "Component %d\n", i); print_faixbox( index.precpacket[i]); } print_allmetadata( index.metadatalist); }
OPJ_BOOL OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec) { int outfd; #ifdef _WIN32 if(( outfd = open( fname, O_WRONLY|O_CREAT, _S_IREAD | _S_IWRITE)) == -1){ #else if(( outfd = open( fname, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){ #endif fprintf( stderr, "file %s open error\n", fname); return OPJ_FALSE; } if( write( outfd, dec->jp2kstream, dec->jp2klen) != (int)dec->jp2klen) fprintf( stderr, "j2k file write error\n"); close(outfd); return OPJ_TRUE; } void OPJ_CALLCONV output_log( OPJ_BOOL messages, OPJ_BOOL metadata, OPJ_BOOL ihdrbox, jpip_dec_param_t *dec) { if( messages) print_msgqueue( dec->msgqueue); if( metadata) print_allmetadata( dec->metadatalist); if( ihdrbox){ printf("W*H: %d*%d\n", dec->ihdrbox->height, dec->ihdrbox->width); printf("NC: %d, bpc: %d\n", dec->ihdrbox->nc, dec->ihdrbox->bpc); } } void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec) { opj_free( (*dec)->jpipstream); delete_msgqueue( &(*dec)->msgqueue); if( (*dec)->metadatalist){ delete_metadatalist( &(*dec)->metadatalist); opj_free( (*dec)->ihdrbox); } opj_free( (*dec)->jp2kstream); opj_free( *dec); }