Lines Matching refs:cmpt

96 static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt);
101 static jas_image_cmpt_t *jas_image_cmpt_copy(jas_image_cmpt_t *cmpt);
241 jas_image_cmpt_t *cmpt; in jas_image_cmpt_create0() local
242 if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) { in jas_image_cmpt_create0()
245 memset(cmpt, 0, sizeof(jas_image_cmpt_t)); in jas_image_cmpt_create0()
246 cmpt->type_ = JAS_IMAGE_CT_UNKNOWN; in jas_image_cmpt_create0()
247 return cmpt; in jas_image_cmpt_create0()
250 static jas_image_cmpt_t *jas_image_cmpt_copy(jas_image_cmpt_t *cmpt) in jas_image_cmpt_copy() argument
257 newcmpt->tlx_ = cmpt->tlx_; in jas_image_cmpt_copy()
258 newcmpt->tly_ = cmpt->tly_; in jas_image_cmpt_copy()
259 newcmpt->hstep_ = cmpt->hstep_; in jas_image_cmpt_copy()
260 newcmpt->vstep_ = cmpt->vstep_; in jas_image_cmpt_copy()
261 newcmpt->width_ = cmpt->width_; in jas_image_cmpt_copy()
262 newcmpt->height_ = cmpt->height_; in jas_image_cmpt_copy()
263 newcmpt->prec_ = cmpt->prec_; in jas_image_cmpt_copy()
264 newcmpt->sgnd_ = cmpt->sgnd_; in jas_image_cmpt_copy()
265 newcmpt->cps_ = cmpt->cps_; in jas_image_cmpt_copy()
266 newcmpt->type_ = cmpt->type_; in jas_image_cmpt_copy()
270 if (jas_stream_seek(cmpt->stream_, 0, SEEK_SET)) { in jas_image_cmpt_copy()
273 if (jas_stream_copy(newcmpt->stream_, cmpt->stream_, -1)) { in jas_image_cmpt_copy()
302 jas_image_cmpt_t *cmpt; in jas_image_cmpt_create() local
305 if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) { in jas_image_cmpt_create()
309 cmpt->type_ = JAS_IMAGE_CT_UNKNOWN; in jas_image_cmpt_create()
310 cmpt->tlx_ = tlx; in jas_image_cmpt_create()
311 cmpt->tly_ = tly; in jas_image_cmpt_create()
312 cmpt->hstep_ = hstep; in jas_image_cmpt_create()
313 cmpt->vstep_ = vstep; in jas_image_cmpt_create()
314 cmpt->width_ = width; in jas_image_cmpt_create()
315 cmpt->height_ = height; in jas_image_cmpt_create()
316 cmpt->prec_ = depth; in jas_image_cmpt_create()
317 cmpt->sgnd_ = sgnd; in jas_image_cmpt_create()
318 cmpt->stream_ = 0; in jas_image_cmpt_create()
319 cmpt->cps_ = (depth + 7) / 8; in jas_image_cmpt_create()
321 size = cmpt->width_ * cmpt->height_ * cmpt->cps_; in jas_image_cmpt_create()
322 cmpt->stream_ = (inmem) ? jas_stream_memopen(0, size) : jas_stream_tmpfile(); in jas_image_cmpt_create()
323 if (!cmpt->stream_) { in jas_image_cmpt_create()
324 jas_image_cmpt_destroy(cmpt); in jas_image_cmpt_create()
330 if (jas_stream_seek(cmpt->stream_, size - 1, SEEK_SET) < 0 || in jas_image_cmpt_create()
331 jas_stream_putc(cmpt->stream_, 0) == EOF || in jas_image_cmpt_create()
332 jas_stream_seek(cmpt->stream_, 0, SEEK_SET) < 0) { in jas_image_cmpt_create()
333 jas_image_cmpt_destroy(cmpt); in jas_image_cmpt_create()
337 return cmpt; in jas_image_cmpt_create()
340 static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt) in jas_image_cmpt_destroy() argument
342 if (cmpt->stream_) { in jas_image_cmpt_destroy()
343 jas_stream_close(cmpt->stream_); in jas_image_cmpt_destroy()
345 jas_free(cmpt); in jas_image_cmpt_destroy()
408 jas_image_cmpt_t *cmpt; in jas_image_readcmpt() local
422 cmpt = image->cmpts_[cmptno]; in jas_image_readcmpt()
423 if (x >= cmpt->width_ || y >= cmpt->height_ || in jas_image_readcmpt()
424 x + width > cmpt->width_ || in jas_image_readcmpt()
425 y + height > cmpt->height_) { in jas_image_readcmpt()
439 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x) in jas_image_readcmpt()
440 * cmpt->cps_, SEEK_SET) < 0) { in jas_image_readcmpt()
445 for (k = cmpt->cps_; k > 0; --k) { in jas_image_readcmpt()
446 if ((c = jas_stream_getc(cmpt->stream_)) == EOF) { in jas_image_readcmpt()
451 *d = bitstoint(v, cmpt->prec_, cmpt->sgnd_); in jas_image_readcmpt()
461 jas_image_cmpt_t *cmpt; in jas_image_writecmpt() local
475 cmpt = image->cmpts_[cmptno]; in jas_image_writecmpt()
476 if (x >= cmpt->width_ || y >= cmpt->height_ || in jas_image_writecmpt()
477 x + width > cmpt->width_ || in jas_image_writecmpt()
478 y + height > cmpt->height_) { in jas_image_writecmpt()
490 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x) in jas_image_writecmpt()
491 * cmpt->cps_, SEEK_SET) < 0) { in jas_image_writecmpt()
495 v = inttobits(*d, cmpt->prec_, cmpt->sgnd_); in jas_image_writecmpt()
496 for (k = cmpt->cps_; k > 0; --k) { in jas_image_writecmpt()
497 c = (v >> (8 * (cmpt->cps_ - 1))) & 0xff; in jas_image_writecmpt()
498 if (jas_stream_putc(cmpt->stream_, in jas_image_writecmpt()
631 jas_image_cmpt_t *cmpt; in jas_image_rawsize() local
635 cmpt = image->cmpts_[cmptno]; in jas_image_rawsize()
636 rawsize += (cmpt->width_ * cmpt->height_ * cmpt->prec_ + in jas_image_rawsize()
734 jas_image_cmpt_t *cmpt; in jas_image_setbbox() local
742 cmpt = image->cmpts_[0]; in jas_image_setbbox()
743 image->tlx_ = cmpt->tlx_; in jas_image_setbbox()
744 image->tly_ = cmpt->tly_; in jas_image_setbbox()
745 image->brx_ = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1; in jas_image_setbbox()
746 image->bry_ = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1; in jas_image_setbbox()
748 cmpt = image->cmpts_[cmptno]; in jas_image_setbbox()
749 if (image->tlx_ > cmpt->tlx_) { in jas_image_setbbox()
750 image->tlx_ = cmpt->tlx_; in jas_image_setbbox()
752 if (image->tly_ > cmpt->tly_) { in jas_image_setbbox()
753 image->tly_ = cmpt->tly_; in jas_image_setbbox()
755 x = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1; in jas_image_setbbox()
759 y = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1; in jas_image_setbbox()
820 jas_image_cmpt_t *cmpt; in jas_image_dump() local
822 cmpt = image->cmpts_[cmptno]; in jas_image_dump()
823 fprintf(out, "prec=%d, sgnd=%d, cmpttype=%d\n", cmpt->prec_, in jas_image_dump()
824 cmpt->sgnd_, (int)cmpt->type_); in jas_image_dump()
852 jas_image_cmpt_t *cmpt; in jas_image_depalettize() local
854 cmpt = image->cmpts_[cmptno]; in jas_image_depalettize()
855 cmptparms.tlx = cmpt->tlx_; in jas_image_depalettize()
856 cmptparms.tly = cmpt->tly_; in jas_image_depalettize()
857 cmptparms.hstep = cmpt->hstep_; in jas_image_depalettize()
858 cmptparms.vstep = cmpt->vstep_; in jas_image_depalettize()
859 cmptparms.width = cmpt->width_; in jas_image_depalettize()
860 cmptparms.height = cmpt->height_; in jas_image_depalettize()
869 cmpt = image->cmpts_[cmptno]; in jas_image_depalettize()
872 for (j = 0; j < cmpt->height_; ++j) { in jas_image_depalettize()
873 for (i = 0; i < cmpt->width_; ++i) { in jas_image_depalettize()
889 jas_image_cmpt_t *cmpt; in jas_image_readcmptsample() local
894 cmpt = image->cmpts_[cmptno]; in jas_image_readcmptsample()
896 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_, in jas_image_readcmptsample()
901 for (k = cmpt->cps_; k > 0; --k) { in jas_image_readcmptsample()
902 if ((c = jas_stream_getc(cmpt->stream_)) == EOF) { in jas_image_readcmptsample()
907 return bitstoint(v, cmpt->prec_, cmpt->sgnd_); in jas_image_readcmptsample()
913 jas_image_cmpt_t *cmpt; in jas_image_writecmptsample() local
918 cmpt = image->cmpts_[cmptno]; in jas_image_writecmptsample()
920 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_, in jas_image_writecmptsample()
924 t = inttobits(v, cmpt->prec_, cmpt->sgnd_); in jas_image_writecmptsample()
925 for (k = cmpt->cps_; k > 0; --k) { in jas_image_writecmptsample()
926 c = (t >> (8 * (cmpt->cps_ - 1))) & 0xff; in jas_image_writecmptsample()
927 if (jas_stream_putc(cmpt->stream_, (unsigned char) c) == EOF) { in jas_image_writecmptsample()
970 jas_image_cmpt_t *cmpt; in jas_image_readcmpt2() local
978 cmpt = image->cmpts_[cmptno]; in jas_image_readcmpt2()
979 if (x < 0 || x >= cmpt->width_ || y < 0 || y >= cmpt->height_ || in jas_image_readcmpt2()
980 width < 0 || height < 0 || x + width > cmpt->width_ || in jas_image_readcmpt2()
981 y + height > cmpt->height_) in jas_image_readcmpt2()
986 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x) in jas_image_readcmpt2()
987 * cmpt->cps_, SEEK_SET) < 0) in jas_image_readcmpt2()
990 if (getint(cmpt->stream_, cmpt->sgnd_, cmpt->prec_, &v)) in jas_image_readcmpt2()
1005 jas_image_cmpt_t *cmpt; in jas_image_writecmpt2() local
1013 cmpt = image->cmpts_[cmptno]; in jas_image_writecmpt2()
1014 if (x < 0 || x >= cmpt->width_ || y < 0 || y >= cmpt->height_ || in jas_image_writecmpt2()
1015 width < 0 || height < 0 || x + width > cmpt->width_ || in jas_image_writecmpt2()
1016 y + height > cmpt->height_) in jas_image_writecmpt2()
1021 if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x) in jas_image_writecmpt2()
1022 * cmpt->cps_, SEEK_SET) < 0) in jas_image_writecmpt2()
1026 if (putint(cmpt->stream_, cmpt->sgnd_, cmpt->prec_, v)) in jas_image_writecmpt2()
1162 jas_image_cmpt_t *cmpt; in jas_image_calcbbox2() local
1170 cmpt = image->cmpts_[0]; in jas_image_calcbbox2()
1171 tmptlx = cmpt->tlx_; in jas_image_calcbbox2()
1172 tmptly = cmpt->tly_; in jas_image_calcbbox2()
1173 tmpbrx = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1); in jas_image_calcbbox2()
1174 tmpbry = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1); in jas_image_calcbbox2()
1176 cmpt = image->cmpts_[i]; in jas_image_calcbbox2()
1177 if (cmpt->tlx_ < tmptlx) in jas_image_calcbbox2()
1178 tmptlx = cmpt->tlx_; in jas_image_calcbbox2()
1179 if (cmpt->tly_ < tmptly) in jas_image_calcbbox2()
1180 tmptly = cmpt->tly_; in jas_image_calcbbox2()
1181 t = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1); in jas_image_calcbbox2()
1184 t = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1); in jas_image_calcbbox2()