- l_nb_tiles = (OPJ_UINT32)(image_width/tile_width) * (OPJ_UINT32)(image_height/tile_height);
- l_data_size = (OPJ_UINT32)tile_width * (OPJ_UINT32)tile_height * (OPJ_UINT32)num_comps * (OPJ_UINT32)(comp_prec/8);
-
- l_data = (OPJ_BYTE*) malloc(l_data_size * sizeof(OPJ_BYTE));
- if(l_data == NULL){
- return 1;
- }
- fprintf(stdout, "Encoding random values -> keep in mind that this is very hard to compress\n");
- for (i=0;i<l_data_size;++i) {
- l_data[i] = (OPJ_BYTE)i; /*rand();*/
- }
-
- opj_set_default_encoder_parameters(&l_param);
- /** you may here add custom encoding parameters */
- /* rate specifications */
- /** number of quality layers in the stream */
- l_param.tcp_numlayers = 1;
- l_param.cp_fixed_quality = 1;
- l_param.tcp_distoratio[0] = 20;
- /* is using others way of calculation */
- /* l_param.cp_disto_alloc = 1 or l_param.cp_fixed_alloc = 1 */
- /* l_param.tcp_rates[0] = ... */
-
-
- /* tile definitions parameters */
- /* position of the tile grid aligned with the image */
- l_param.cp_tx0 = 0;
- l_param.cp_ty0 = 0;
- /* tile size, we are using tile based encoding */
- l_param.tile_size_on = OPJ_TRUE;
- l_param.cp_tdx = tile_width;
- l_param.cp_tdy = tile_height;
-
- /* use irreversible encoding ?*/
- l_param.irreversible = irreversible;
-
- /* do not bother with mct, the rsiz is set when calling opj_set_MCT*/
- /*l_param.cp_rsiz = OPJ_STD_RSIZ;*/
-
- /* no cinema */
- /*l_param.cp_cinema = 0;*/
-
- /* no not bother using SOP or EPH markers, do not use custom size precinct */
- /* number of precincts to specify */
- /* l_param.csty = 0;*/
- /* l_param.res_spec = ... */
- /* l_param.prch_init[i] = .. */
- /* l_param.prcw_init[i] = .. */
-
-
- /* do not use progression order changes */
- /*l_param.numpocs = 0;*/
- /* l_param.POC[i].... */
-
- /* do not restrain the size for a component.*/
- /* l_param.max_comp_size = 0; */
-
- /** block encoding style for each component, do not use at the moment */
- /** J2K_CCP_CBLKSTY_TERMALL, J2K_CCP_CBLKSTY_LAZY, J2K_CCP_CBLKSTY_VSC, J2K_CCP_CBLKSTY_SEGSYM, J2K_CCP_CBLKSTY_RESET */
- /* l_param.mode = 0;*/
-
- /** number of resolutions */
- l_param.numresolution = 6;
-
- /** progression order to use*/
- /** OPJ_LRCP, OPJ_RLCP, OPJ_RPCL, PCRL, CPRL */
- l_param.prog_order = OPJ_LRCP;
-
- /** no "region" of interest, more precisally component */
- /* l_param.roi_compno = -1; */
- /* l_param.roi_shift = 0; */
-
- /* we are not using multiple tile parts for a tile. */
- /* l_param.tp_on = 0; */
- /* l_param.tp_flag = 0; */
-
- /* if we are using mct */
+ fprintf(stdout,
+ "Encoding random values -> keep in mind that this is very hard to compress\n");
+ for (i = 0; i < l_data_size; ++i) {
+ l_data[i] = (OPJ_BYTE)i; /*rand();*/
+ }
+
+ opj_set_default_encoder_parameters(&l_param);
+ /** you may here add custom encoding parameters */
+ /* rate specifications */
+ /** number of quality layers in the stream */
+ l_param.tcp_numlayers = 1;
+ l_param.cp_fixed_quality = 1;
+ l_param.tcp_distoratio[0] = 20;
+ /* is using others way of calculation */
+ /* l_param.cp_disto_alloc = 1 or l_param.cp_fixed_alloc = 1 */
+ /* l_param.tcp_rates[0] = ... */
+
+
+ /* tile definitions parameters */
+ /* position of the tile grid aligned with the image */
+ l_param.cp_tx0 = 0;
+ l_param.cp_ty0 = 0;
+ /* tile size, we are using tile based encoding */
+ l_param.tile_size_on = OPJ_TRUE;
+ l_param.cp_tdx = tile_width;
+ l_param.cp_tdy = tile_height;
+
+ /* use irreversible encoding ?*/
+ l_param.irreversible = irreversible;
+
+ /* do not bother with mct, the rsiz is set when calling opj_set_MCT*/
+ /*l_param.cp_rsiz = OPJ_STD_RSIZ;*/
+
+ /* no cinema */
+ /*l_param.cp_cinema = 0;*/
+
+ /* no not bother using SOP or EPH markers, do not use custom size precinct */
+ /* number of precincts to specify */
+ /* l_param.csty = 0;*/
+ /* l_param.res_spec = ... */
+ /* l_param.prch_init[i] = .. */
+ /* l_param.prcw_init[i] = .. */
+
+
+ /* do not use progression order changes */
+ /*l_param.numpocs = 0;*/
+ /* l_param.POC[i].... */
+
+ /* do not restrain the size for a component.*/
+ /* l_param.max_comp_size = 0; */
+
+ /** block encoding style for each component, do not use at the moment */
+ /** J2K_CCP_CBLKSTY_TERMALL, J2K_CCP_CBLKSTY_LAZY, J2K_CCP_CBLKSTY_VSC, J2K_CCP_CBLKSTY_SEGSYM, J2K_CCP_CBLKSTY_RESET */
+ /* l_param.mode = 0;*/
+
+ /** number of resolutions */
+ l_param.numresolution = 6;
+
+ /** progression order to use*/
+ /** OPJ_LRCP, OPJ_RLCP, OPJ_RPCL, PCRL, CPRL */
+ l_param.prog_order = OPJ_LRCP;
+
+ /** no "region" of interest, more precisally component */
+ /* l_param.roi_compno = -1; */
+ /* l_param.roi_shift = 0; */
+
+ /* we are not using multiple tile parts for a tile. */
+ /* l_param.tp_on = 0; */
+ /* l_param.tp_flag = 0; */
+
+ /* if we are using mct */