]> granicus.if.org Git - openjpeg/commitdiff
[trunk] add j2k_pre_write_tile function in trunk from v2alpha
authorMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 9 Mar 2012 17:15:55 +0000 (17:15 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 9 Mar 2012 17:15:55 +0000 (17:15 +0000)
libopenjpeg/j2k.c

index 91242a0f5960d331dee57ae0f92467999c6ca8e2..c6fcb0846276c17d9195e1eea78cdb2d90492b93 100644 (file)
@@ -195,9 +195,15 @@ static void j2k_copy_tile_quantization_parameters(
 /**
  * Reads the tiles.
  */
-opj_bool j2k_decode_tiles (            opj_j2k_v2_t *p_j2k,
-                                                               opj_stream_private_t *p_stream,
-                                                               opj_event_mgr_t * p_manager);
+opj_bool j2k_decode_tiles (    opj_j2k_v2_t *p_j2k,
+                                                       opj_stream_private_t *p_stream,
+                                                       opj_event_mgr_t * p_manager);
+
+
+static opj_bool j2k_pre_write_tile ( opj_j2k_v2_t * p_j2k,
+                                                                        OPJ_UINT32 p_tile_index,
+                                                                        opj_stream_private_t *p_stream,
+                                                                        opj_event_mgr_t * p_manager );
 
 static opj_bool j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image);
 
@@ -8628,3 +8634,30 @@ opj_bool j2k_start_compress(opj_j2k_v2_t *p_j2k,
 
        return OPJ_TRUE;
 }
+
+/*
+ *
+ */
+opj_bool j2k_pre_write_tile (  opj_j2k_v2_t * p_j2k,
+                                                               OPJ_UINT32 p_tile_index,
+                                                               opj_stream_private_t *p_stream,
+                                                               opj_event_mgr_t * p_manager )
+{
+       if (p_tile_index != p_j2k->m_current_tile_number) {
+               opj_event_msg_v2(p_manager, EVT_ERROR, "The given tile index does not match." );
+               return OPJ_FALSE;
+       }
+
+       opj_event_msg_v2(p_manager, EVT_INFO, "tile number %d / %d\n", p_j2k->m_current_tile_number + 1, p_j2k->m_cp.tw * p_j2k->m_cp.th);
+
+       p_j2k->m_specific_param.m_encoder.m_current_tile_part_number = 0;
+       p_j2k->m_tcd->cur_totnum_tp = p_j2k->m_cp.tcps[p_tile_index].m_nb_tile_parts;
+       p_j2k->m_specific_param.m_encoder.m_current_poc_tile_part_number = 0;
+
+       /* initialisation before tile encoding  */
+       if (! tcd_init_encode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number)) {
+               return OPJ_FALSE;
+       }
+
+       return OPJ_TRUE;
+}