movie = (opj_mj2_t*) dinfo->mj2_handle;
mj2_setup_decoder(movie, ¶meters);
- if (mj2_read_struct(file, movie)) // Creating the movie structure
+ if (mj2_read_struct(file, movie)) /* Creating the movie structure*/
return 1;
- // Decode first video track
+ /* Decode first video track */
tnum = 0;
while (movie->tk[tnum].track_type != 0)
tnum ++;
for (snum=0; snum < track->num_samples; snum++)
{
sample = &track->sample[snum];
- frame_codestream = (unsigned char*) malloc (sample->sample_size-8); // Skipping JP2C marker
+ frame_codestream = (unsigned char*) malloc (sample->sample_size-8); /* Skipping JP2C marker*/
fseek(file,sample->offset+8,SEEK_SET);
- fread(frame_codestream,sample->sample_size-8,1, file); // Assuming that jp and ftyp markers size do
+ fread(frame_codestream,sample->sample_size-8,1, file); /* Assuming that jp and ftyp markers size do*/
sprintf(outfilename,"%s_%05d.j2k",argv[2],snum);
outfile = fopen(outfilename, "wb");
if (tk->track_type == 0) {
mj2_write_smj2(tk, cio);
} else if (tk->track_type == 1) {
- // Not implemented
+ /* Not implemented*/
}
if (tk->track_type == 2) {
- // Not implemented
+ /* Not implemented*/
}
return 1;
}
} else if (tk->track_type == 1) {
- len_2skip = cio_read(cio, 4); // Not implemented -> skipping box
+ len_2skip = cio_read(cio, 4); /* Not implemented -> skipping box*/
cio_skip(cio,len_2skip - 4);
} else if (tk->track_type == 2) {
- len_2skip = cio_read(cio, 4); // Not implemented -> skipping box
+ len_2skip = cio_read(cio, 4); /* Not implemented -> skipping box*/
cio_skip(cio,len_2skip - 4);
}
mj2_box_t box;
mj2_read_boxhdr(&box, cio);
- if (!(MJ2_MHDR == box.type || MJ2_MDHD == box.type)) { // Kakadu writes MHDR instead of MDHD
+ if (!(MJ2_MHDR == box.type || MJ2_MDHD == box.type)) { /* Kakadu writes MHDR instead of MDHD*/
opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MDHD Marker\n");
return 1;
}
tk = &movie->tk[i];
if (tk->name_size != 0)
opj_free(tk->name);
- if (tk->track_type == 0) {// Video track
+ if (tk->track_type == 0) {/* Video track*/
if (tk->jp2_struct.comps != NULL)
opj_free(tk->jp2_struct.comps);
if (tk->jp2_struct.cl != NULL)
if(movie && parameters) {
opj_jp2_t *jp2_struct;
- movie->num_htk = 0; // No hint tracks
- movie->num_stk = 0; // No sound tracks
- movie->num_vtk = 1; // One video track
+ movie->num_htk = 0; /* No hint tracks*/
+ movie->num_stk = 0; /* No sound tracks*/
+ movie->num_vtk = 1; /* One video track*/
- movie->brand = MJ2_MJ2; // One brand: MJ2
- movie->num_cl = 2; // Two compatible brands: MJ2 and MJ2S
+ movie->brand = MJ2_MJ2; /* One brand: MJ2*/
+ movie->num_cl = 2; /* Two compatible brands: MJ2 and MJ2S*/
movie->cl = (unsigned int*) opj_malloc(movie->num_cl * sizeof(unsigned int));
movie->cl[0] = MJ2_MJ2;
movie->cl[1] = MJ2_MJ2S;
- movie->minversion = 0; // Minimum version: 0
+ movie->minversion = 0; /* Minimum version: 0 */
- movie->tk = (mj2_tk_t*) opj_malloc(sizeof(mj2_tk_t)); //Memory allocation for the video track
- movie->tk[0].track_ID = 1; // Track ID = 1
- movie->tk[0].track_type = 0; // Video track
+ movie->tk = (mj2_tk_t*) opj_malloc(sizeof(mj2_tk_t)); /*Memory allocation for the video track*/
+ movie->tk[0].track_ID = 1; /* Track ID = 1 */
+ movie->tk[0].track_type = 0; /* Video track */
movie->tk[0].Dim[0] = parameters->Dim[0];
movie->tk[0].Dim[1] = parameters->Dim[1];
movie->tk[0].w = parameters->w;
movie->tk[0].depth = parameters->prec;
jp2_struct = &movie->tk[0].jp2_struct;
- jp2_struct->numcomps = parameters->numcomps; // NC
+ jp2_struct->numcomps = parameters->numcomps; /* NC */
jp2_struct->comps = (opj_jp2_comps_t*) opj_malloc(jp2_struct->numcomps * sizeof(opj_jp2_comps_t));
jp2_struct->precedence = 0; /* PRECEDENCE*/
jp2_struct->approx = 0; /* APPROX*/
tk = &movie->tk[i];
if (tk->name_size != 0)
opj_free(tk->name);
- if (tk->track_type == 0) {// Video track
+ if (tk->track_type == 0) {/* Video track*/
if (tk->jp2_struct.comps != NULL)
opj_free(tk->jp2_struct.comps);
if (tk->jp2_struct.cl != NULL)
return (unsigned int)(end_of_f / frame_size);
}
-// -----------------------
-//
-//
-// YUV to IMAGE
-//
-// -----------------------
+/* ----------------------- */
+/* */
+/* */
+/* YUV to IMAGE */
+/* */
+/* ----------------------- */
opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
{
-// -----------------------
-//
-//
-// IMAGE to YUV
-//
-// -----------------------
+/* ----------------------- */
+/* */
+/* */
+/* IMAGE to YUV */
+/* */
+/* ----------------------- */
opj_bool imagetoyuv(opj_image_t * img, char *outfile)
return OPJ_TRUE;
}
-// -----------------------
-//
-//
-// IMAGE to BMP
-//
-// -----------------------
+/* ----------------------- */
+/* */
+/* */
+/* IMAGE to BMP */
+/* */
+/* ----------------------- */
int imagetobmp(opj_image_t * img, char *outfile) {
int w,wr,h,hr,i,pad;
for (i = 0; i < wr * hr; i++) {
unsigned char R, G, B;
/* a modifier */
- // R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+ /* R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
R = img->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
- // G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+ /* G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
G = img->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
- // B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+ /* B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
B = img->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
fprintf(f, "%c%c%c", B, G, R);
cstr_info->marknum = 0;
cstr_info->maxmarknum = 0;
/* opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to add a marker\n"); */
- // TODO_test_add_marker_result;
+ /* TODO_test_add_marker_result;*/
return OPJ_FALSE;
}
cstr_info->marker = new_marker;
/* update markers struct */
j2k_add_marker(j2k->cstr_info, J2K_MS_EPB, -1, epb->Lepb + 2);
-};
+}
jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, opj_bool esd_on, opj_bool red_on, opj_bool epb_on, opj_bool info_on) {
/* update markers struct */
j2k_add_marker(j2k->cstr_info, J2K_MS_EPC, -1, epc->Lepc + 2);
-};
+}
int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
int comps, unsigned char addrm, unsigned char ad_size,