Exemplo n.º 1
0
Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox)
{
  Byte_t *pnmstream;
  Byte_t *j2kstream; // j2k or jp2 codestream
  Byte8_t j2klen;

  j2kstream = recons_j2k( msgqueue, jpipstream, csn, fw, fh, &j2klen); 
  pnmstream = j2k_to_pnm( j2kstream, j2klen, ihdrbox);

  free( j2kstream);

  return pnmstream;
}
Exemplo n.º 2
0
Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox)
{
  Byte_t *pnmstream;
  Byte_t *j2kstream; /* j2k or jp2 codestream */
  Byte8_t j2klen;
  FILE *fp;
  const char j2kfname[] = "tmp.j2k";

  j2kstream = recons_j2k( msgqueue, jpipstream, csn, fw, fh, &j2klen); 

  fp = fopen( j2kfname, "w+b");
  fwrite( j2kstream, j2klen, 1, fp);
  free( j2kstream);
  fseek( fp, 0, SEEK_SET);

  pnmstream = j2k_to_pnm( fp, ihdrbox);

  fclose( fp);
  remove( j2kfname);

  return pnmstream;
}
Exemplo n.º 3
0
Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox)
{
  Byte_t *pnmstream;
  Byte_t *j2kstream; /* j2k or jp2 codestream */
  Byte8_t j2klen;
  size_t retlen;
  FILE *fp;
  const char j2kfname[] = "tmp.j2k";

  fp = fopen( j2kfname, "w+b");
  if( !fp )
    {
    return NULL;
    }
  j2kstream = recons_j2k( msgqueue, jpipstream, csn, fw, fh, &j2klen); 
  if( !j2kstream )
    {
    fclose(fp);
    remove( j2kfname);
    return NULL;
    }

  retlen = fwrite( j2kstream, 1, j2klen, fp);
  opj_free( j2kstream);
  fclose(fp);
  if( retlen != j2klen )
    {
    remove( j2kfname);
    return NULL;
    }

  pnmstream = j2k_to_pnm( j2kfname, ihdrbox);

  remove( j2kfname);

  return pnmstream;
}