Lines Matching refs:image
100 static void jas_image_setbbox(jas_image_t *image);
102 static int jas_image_growcmpts(jas_image_t *image, int maxcmpts);
107 static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx,
113 static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx,
130 jas_image_t *image; in jas_image_create() local
136 if (!(image = jas_image_create0())) { in jas_image_create()
140 image->clrspc_ = clrspc; in jas_image_create()
141 image->maxcmpts_ = numcmpts; in jas_image_create()
142 image->inmem_ = true; in jas_image_create()
145 if (!(image->cmpts_ = jas_alloc2(image->maxcmpts_, in jas_image_create()
147 jas_image_destroy(image); in jas_image_create()
151 for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) { in jas_image_create()
152 image->cmpts_[cmptno] = 0; in jas_image_create()
169 if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx, in jas_image_create()
173 jas_image_destroy(image); in jas_image_create()
176 ++image->numcmpts_; in jas_image_create()
181 jas_image_setbbox(image); in jas_image_create()
183 return image; in jas_image_create()
188 jas_image_t *image; in jas_image_create0() local
190 if (!(image = jas_malloc(sizeof(jas_image_t)))) { in jas_image_create0()
194 image->tlx_ = 0; in jas_image_create0()
195 image->tly_ = 0; in jas_image_create0()
196 image->brx_ = 0; in jas_image_create0()
197 image->bry_ = 0; in jas_image_create0()
198 image->clrspc_ = JAS_CLRSPC_UNKNOWN; in jas_image_create0()
199 image->numcmpts_ = 0; in jas_image_create0()
200 image->maxcmpts_ = 0; in jas_image_create0()
201 image->cmpts_ = 0; in jas_image_create0()
202 image->inmem_ = true; in jas_image_create0()
203 image->cmprof_ = 0; in jas_image_create0()
205 return image; in jas_image_create0()
208 jas_image_t *jas_image_copy(jas_image_t *image) in jas_image_copy() argument
214 if (jas_image_growcmpts(newimage, image->numcmpts_)) { in jas_image_copy()
217 for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) { in jas_image_copy()
218 if (!(newimage->cmpts_[cmptno] = jas_image_cmpt_copy(image->cmpts_[cmptno]))) { in jas_image_copy()
226 if (image->cmprof_) { in jas_image_copy()
227 if (!(newimage->cmprof_ = jas_cmprof_copy(image->cmprof_))) in jas_image_copy()
282 void jas_image_destroy(jas_image_t *image) in jas_image_destroy() argument
286 if (image->cmpts_) { in jas_image_destroy()
287 for (i = 0; i < image->numcmpts_; ++i) { in jas_image_destroy()
288 jas_image_cmpt_destroy(image->cmpts_[i]); in jas_image_destroy()
289 image->cmpts_[i] = 0; in jas_image_destroy()
291 jas_free(image->cmpts_); in jas_image_destroy()
293 if (image->cmprof_) in jas_image_destroy()
294 jas_cmprof_destroy(image->cmprof_); in jas_image_destroy()
295 jas_free(image); in jas_image_destroy()
355 jas_image_t *image; in jas_image_decode() local
357 image = 0; in jas_image_decode()
372 if (!(image = (*fmtinfo->ops.decode)(in, optstr))) in jas_image_decode()
376 if (!jas_clrspc_isunknown(image->clrspc_) && in jas_image_decode()
377 !jas_clrspc_isgeneric(image->clrspc_) && !image->cmprof_) { in jas_image_decode()
378 if (!(image->cmprof_ = in jas_image_decode()
379 jas_cmprof_createfromclrspc(jas_image_clrspc(image)))) in jas_image_decode()
383 return image; in jas_image_decode()
385 if (image) in jas_image_decode()
386 jas_image_destroy(image); in jas_image_decode()
390 int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, char *optstr) in jas_image_encode() argument
396 return (fmtinfo->ops.encode) ? (*fmtinfo->ops.encode)(image, out, in jas_image_encode()
404 int jas_image_readcmpt(jas_image_t *image, int cmptno, jas_image_coord_t x, in jas_image_readcmpt() argument
418 if (cmptno < 0 || cmptno >= image->numcmpts_) { in jas_image_readcmpt()
422 cmpt = image->cmpts_[cmptno]; in jas_image_readcmpt()
458 int jas_image_writecmpt(jas_image_t *image, int cmptno, jas_image_coord_t x, jas_image_coord_t y, j… in jas_image_writecmpt() argument
471 if (cmptno < 0 || cmptno >= image->numcmpts_) { in jas_image_writecmpt()
475 cmpt = image->cmpts_[cmptno]; in jas_image_writecmpt()
627 uint_fast32_t jas_image_rawsize(jas_image_t *image) in jas_image_rawsize() argument
634 for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) { in jas_image_rawsize()
635 cmpt = image->cmpts_[cmptno]; in jas_image_rawsize()
642 void jas_image_delcmpt(jas_image_t *image, int cmptno) in jas_image_delcmpt() argument
644 if (cmptno >= image->numcmpts_) { in jas_image_delcmpt()
647 jas_image_cmpt_destroy(image->cmpts_[cmptno]); in jas_image_delcmpt()
648 if (cmptno < image->numcmpts_) { in jas_image_delcmpt()
649 memmove(&image->cmpts_[cmptno], &image->cmpts_[cmptno + 1], in jas_image_delcmpt()
650 (image->numcmpts_ - 1 - cmptno) * sizeof(jas_image_cmpt_t *)); in jas_image_delcmpt()
652 --image->numcmpts_; in jas_image_delcmpt()
654 jas_image_setbbox(image); in jas_image_delcmpt()
657 int jas_image_addcmpt(jas_image_t *image, int cmptno, in jas_image_addcmpt() argument
662 cmptno = image->numcmpts_; in jas_image_addcmpt()
663 assert(cmptno >= 0 && cmptno <= image->numcmpts_); in jas_image_addcmpt()
664 if (image->numcmpts_ >= image->maxcmpts_) { in jas_image_addcmpt()
665 if (jas_image_growcmpts(image, image->maxcmpts_ + 128)) { in jas_image_addcmpt()
675 if (cmptno < image->numcmpts_) { in jas_image_addcmpt()
676 memmove(&image->cmpts_[cmptno + 1], &image->cmpts_[cmptno], in jas_image_addcmpt()
677 (image->numcmpts_ - cmptno) * sizeof(jas_image_cmpt_t *)); in jas_image_addcmpt()
679 image->cmpts_[cmptno] = newcmpt; in jas_image_addcmpt()
680 ++image->numcmpts_; in jas_image_addcmpt()
682 jas_image_setbbox(image); in jas_image_addcmpt()
732 static void jas_image_setbbox(jas_image_t *image) in jas_image_setbbox() argument
739 if (image->numcmpts_ > 0) { in jas_image_setbbox()
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()
747 for (cmptno = 1; cmptno < image->numcmpts_; ++cmptno) { 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()
756 if (image->brx_ < x) { in jas_image_setbbox()
757 image->brx_ = x; in jas_image_setbbox()
760 if (image->bry_ < y) { in jas_image_setbbox()
761 image->bry_ = y; in jas_image_setbbox()
765 image->tlx_ = 0; in jas_image_setbbox()
766 image->tly_ = 0; in jas_image_setbbox()
767 image->brx_ = 0; in jas_image_setbbox()
768 image->bry_ = 0; in jas_image_setbbox()
772 static int jas_image_growcmpts(jas_image_t *image, int maxcmpts) in jas_image_growcmpts() argument
777 newcmpts = jas_realloc2(image->cmpts_, maxcmpts, sizeof(jas_image_cmpt_t *)); in jas_image_growcmpts()
781 image->cmpts_ = newcmpts; in jas_image_growcmpts()
782 image->maxcmpts_ = maxcmpts; in jas_image_growcmpts()
783 for (cmptno = image->numcmpts_; cmptno < image->maxcmpts_; ++cmptno) { in jas_image_growcmpts()
784 image->cmpts_[cmptno] = 0; in jas_image_growcmpts()
812 void jas_image_dump(jas_image_t *image, FILE *out) in jas_image_dump() argument
821 for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) { in jas_image_dump()
822 cmpt = image->cmpts_[cmptno]; in jas_image_dump()
825 width = jas_image_cmptwidth(image, cmptno); in jas_image_dump()
826 height = jas_image_cmptheight(image, cmptno); in jas_image_dump()
828 if (jas_image_readcmpt2(image, cmptno, 0, 0, n, 1, buf)) { in jas_image_dump()
835 if (jas_image_readcmpt2(image, cmptno, width - n, height - 1, n, 1, buf)) { in jas_image_dump()
845 int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents, in jas_image_depalettize() argument
854 cmpt = image->cmpts_[cmptno]; in jas_image_depalettize()
864 if (jas_image_addcmpt(image, newcmptno, &cmptparms)) { in jas_image_depalettize()
869 cmpt = image->cmpts_[cmptno]; in jas_image_depalettize()
874 v = jas_image_readcmptsample(image, cmptno, i, j); in jas_image_depalettize()
880 jas_image_writecmptsample(image, newcmptno, i, j, in jas_image_depalettize()
887 int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y) in jas_image_readcmptsample() argument
894 cmpt = image->cmpts_[cmptno]; in jas_image_readcmptsample()
910 void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y, in jas_image_writecmptsample() argument
918 cmpt = image->cmpts_[cmptno]; in jas_image_writecmptsample()
934 int jas_image_getcmptbytype(jas_image_t *image, int ctype) in jas_image_getcmptbytype() argument
938 for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) { in jas_image_getcmptbytype()
939 if (image->cmpts_[cmptno]->type_ == ctype) { in jas_image_getcmptbytype()
966 int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, in jas_image_readcmpt2() argument
976 if (cmptno < 0 || cmptno >= image->numcmpts_) in jas_image_readcmpt2()
978 cmpt = image->cmpts_[cmptno]; in jas_image_readcmpt2()
1001 int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, in jas_image_writecmpt2() argument
1011 if (cmptno < 0 || cmptno >= image->numcmpts_) in jas_image_writecmpt2()
1013 cmpt = image->cmpts_[cmptno]; in jas_image_writecmpt2()
1036 int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, in jas_image_sampcmpt() argument
1067 assert(cmptno >= 0 && cmptno < image->numcmpts_); in jas_image_sampcmpt()
1068 oldcmpt = image->cmpts_[cmptno]; in jas_image_sampcmpt()
1070 jas_image_calcbbox2(image, &tlx, &tly, &brx, &bry); in jas_image_sampcmpt()
1081 if (jas_image_addcmpt(image, newcmptno, &cmptparm)) in jas_image_sampcmpt()
1085 newcmpt = image->cmpts_[newcmptno]; in jas_image_sampcmpt()
1139 int jas_image_ishomosamp(jas_image_t *image) in jas_image_ishomosamp() argument
1145 hstep = jas_image_cmpthstep(image, 0); in jas_image_ishomosamp()
1146 vstep = jas_image_cmptvstep(image, 0); in jas_image_ishomosamp()
1148 for (i = 0; i < image->numcmpts_; ++i) { in jas_image_ishomosamp()
1149 if (jas_image_cmpthstep(image, i) != hstep || in jas_image_ishomosamp()
1150 jas_image_cmptvstep(image, i) != vstep) { in jas_image_ishomosamp()
1159 static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx, in jas_image_calcbbox2() argument
1169 if (image->numcmpts_ > 0) { in jas_image_calcbbox2()
1170 cmpt = image->cmpts_[0]; in jas_image_calcbbox2()
1175 for (i = 0; i < image->numcmpts_; ++i) { in jas_image_calcbbox2()
1176 cmpt = image->cmpts_[i]; in jas_image_calcbbox2()
1269 jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof, in jas_image_chclrspc() argument
1302 jas_image_dump(image, stderr); in jas_image_chclrspc()
1305 if (!(inimage = jas_image_copy(image))) in jas_image_chclrspc()
1307 image = 0; in jas_image_chclrspc()