Lines Matching defs:tcd

36 void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
41 img->tw, img->th, tcd->image->x0, tcd->image->x1, tcd->image->y0, tcd->image->y1);
44 opj_tcd_tile_t *tile = &tcd->tcd_image->tiles[tileno];
101 /* create the tcd structure */
102 opj_tcd_t *tcd = (opj_tcd_t*)opj_malloc(sizeof(opj_tcd_t));
103 if(!tcd) return NULL;
104 tcd->cinfo = cinfo;
105 tcd->tcd_image = (opj_tcd_image_t*)opj_malloc(sizeof(opj_tcd_image_t));
106 if(!tcd->tcd_image) {
107 opj_free(tcd);
111 return tcd;
117 void tcd_destroy(opj_tcd_t *tcd) {
118 if(tcd) {
119 opj_free(tcd->tcd_image);
120 opj_free(tcd);
126 void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno) {
129 tcd->image = image;
130 tcd->cp = cp;
131 tcd->tcd_image->tw = cp->tw;
132 tcd->tcd_image->th = cp->th;
133 tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_malloc(sizeof(opj_tcd_tile_t));
143 /* opj_tcd_tile_t *tile=&tcd->tcd_image->tiles[tileno]; */
144 opj_tcd_tile_t *tile = tcd->tcd_image->tiles;
162 /(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) - (((tcd->cur_totnum_tp - 1) * 14 )/ tcp->numlayers)
351 /* tcd_dump(stdout, tcd, &tcd->tcd_image); */
354 void tcd_free_encode(opj_tcd_t *tcd) {
358 opj_tcd_tile_t *tile = tcd->tcd_image->tiles;
397 opj_free(tcd->tcd_image->tiles);
398 tcd->tcd_image->tiles = NULL;
401 void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno) {
411 opj_tcd_tile_t *tile = tcd->tcd_image->tiles;
430 /(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) - (((tcd->cur_totnum_tp - 1) * 14 )/ tcp->numlayers)
612 /* tcd_dump(stdout, tcd, &tcd->tcd_image); */
615 void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp) {
619 tcd->image = image;
620 tcd->tcd_image->tw = cp->tw;
621 tcd->tcd_image->th = cp->th;
622 tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_calloc(cp->tw * cp->th, sizeof(opj_tcd_tile_t));
633 tile = &(tcd->tcd_image->tiles[cp->tileno[tileno]]);
647 tile = &(tcd->tcd_image->tiles[cp->tileno[tileno]]);
680 void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int tileno, opj_codestream_info_t *cstr_info) {
687 tcd->cp = cp;
690 tile = &(tcd->tcd_image->tiles[cp->tileno[tileno]]);
845 /* tcd_dump(stdout, tcd, &tcd->tcd_image); */
848 void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final) {
854 opj_cp_t *cp = tcd->cp;
855 opj_tcd_tile_t *tcd_tile = tcd->tcd_tile;
856 opj_tcp_t *tcd_tcp = tcd->tcp;
867 * (float) (tcd->image->comps[compno].prec / 16.0));
882 int imsb = tcd->image->comps[compno].prec - cblk->numbps; /* number of bit-plan equal to zero */
937 void tcd_rateallocate_fixed(opj_tcd_t *tcd) {
939 for (layno = 0; layno < tcd->tcp->numlayers; layno++) {
940 tcd_makelayer_fixed(tcd, layno, 1);
944 void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
947 opj_tcd_tile_t *tcd_tile = tcd->tcd_tile;
1014 opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
1021 opj_cp_t *cp = tcd->cp;
1022 opj_tcd_tile_t *tcd_tile = tcd->tcd_tile;
1023 opj_tcp_t *tcd_tcp = tcd->tcp;
1077 maxSE += (((double)(1 << tcd->image->comps[compno].prec) - 1.0)
1078 * ((double)(1 << tcd->image->comps[compno].prec) -1.0))
1084 opj_tile_info_t *tile_info = &cstr_info->tile[tcd->tcd_tileno];
1108 opj_t2_t *t2 = t2_create(tcd->cinfo, tcd->image, cp);
1116 tcd_makelayer(tcd, layno, thresh, 0);
1120 l = t2_encode_packets(t2,tcd->tcd_tileno, tcd_tile, layno + 1, dest, maxlen, cstr_info,tcd->cur_tp_num,tcd->tp_pos,tcd->cur_pino,THRESH_CALC, tcd->cur_totnum_tp);
1146 l = t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest, maxlen, cstr_info,tcd->cur_tp_num,tcd->tp_pos,tcd->cur_pino,THRESH_CALC, tcd->cur_totnum_tp);
1148 /* opj_event_msg(tcd->cinfo, EVT_INFO, "rate alloc: len=%d, max=%d\n", l, maxlen); */
1170 cstr_info->tile[tcd->tcd_tileno].thresh[layno] = goodthresh;
1172 tcd_makelayer(tcd, layno, goodthresh, 1);
1181 int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
1188 opj_tcp_t *tcp = &tcd->cp->tcps[0];
1190 opj_image_t *image = tcd->image;
1195 tcd->tcd_tileno = tileno;
1196 tcd->tcd_tile = tcd->tcd_image->tiles;
1197 tcd->tcp = &tcd->cp->tcps[tileno];
1199 tile = tcd->tcd_tile;
1200 tcd_tcp = tcd->tcp;
1201 cp = tcd->cp;
1203 if(tcd->cur_tp_num == 0){
1204 tcd->encoding_time = opj_clock(); /* time needed to encode a tile */
1284 t1 = t1_create(tcd->cinfo);
1296 tcd_rateallocate(tcd, dest, len, cstr_info);
1299 tcd_rateallocate_fixed(tcd);
1309 t2 = t2_create(tcd->cinfo, image, cp);
1310 l = t2_encode_packets(t2,tileno, tile, tcd_tcp->numlayers, dest, len, cstr_info,tcd->tp_num,tcd->tp_pos,tcd->cur_pino,FINAL_PASS,tcd->cur_totnum_tp);
1316 if(tcd->cur_tp_num == tcd->cur_totnum_tp - 1){
1317 tcd->encoding_time = opj_clock() - tcd->encoding_time;
1318 opj_event_msg(tcd->cinfo, EVT_INFO, "- tile encoded in %f s\n", tcd->encoding_time);
1330 opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
1340 tcd->tcd_tileno = tileno;
1341 tcd->tcd_tile = &(tcd->tcd_image->tiles[tileno]);
1342 tcd->tcp = &(tcd->cp->tcps[tileno]);
1343 tile = tcd->tcd_tile;
1346 opj_event_msg(tcd->cinfo, EVT_INFO, "tile %d of %d\n", tileno + 1, tcd->cp->tw * tcd->cp->th);
1352 opj_tcp_t *tcp = &tcd->cp->tcps[0];
1377 t2 = t2_create(tcd->cinfo, tcd->image, tcd->cp);
1383 opj_event_msg(tcd->cinfo, EVT_ERROR, "tcd_decode: incomplete bistream\n");
1389 t1 = t1_create(tcd->cinfo);
1392 opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
1403 opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
1407 t1_decode_cblks(t1, tilec, &tcd->tcp->tccps[compno]);
1411 opj_event_msg(tcd->cinfo, EVT_INFO, "- tiers-1 took %f s\n", t1_time);
1420 if (tcd->cp->reduce != 0) {
1421 if ( tile->comps[compno].numresolutions < ( tcd->cp->reduce - 1 ) ) {
1422 opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
1423 " of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
1427 tcd->image->comps[compno].resno_decoded =
1428 tile->comps[compno].numresolutions - tcd->cp->reduce - 1;
1432 numres2decode = tcd->image->comps[compno].resno_decoded + 1;
1434 if (tcd->tcp->tccps[compno].qmfbid == 1) {
1442 opj_event_msg(tcd->cinfo, EVT_INFO, "- dwt took %f s\n", dwt_time);
1446 if (tcd->tcp->mct) {
1450 if (tcd->tcp->tccps[0].qmfbid == 1) {
1464 opj_event_msg(tcd->cinfo, EVT_WARNING,"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",tile->numcomps);
1472 opj_image_comp_t* imagec = &tcd->image->comps[compno];
1490 opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
1493 if(tcd->tcp->tccps[compno].qmfbid == 1) {
1515 opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
1524 void tcd_free_decode(opj_tcd_t *tcd) {
1525 opj_tcd_image_t *tcd_image = tcd->tcd_image;
1529 tcd_free_decode_tile(tcd, i);
1535 void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno) {
1538 opj_tcd_image_t *tcd_image = tcd->tcd_image;