Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 110636 Details for
Bug 127026
Requesting a Second Life client ebuild (secondlife)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
secondlife/files/llimagej2coj_bug_fixes.patch
llimagej2coj_bug_fixes.patch (text/plain), 4.40 KB, created by
MATSUU Takuto (RETIRED)
on 2007-02-19 14:08:24 UTC
(
hide
)
Description:
secondlife/files/llimagej2coj_bug_fixes.patch
Filename:
MIME Type:
Creator:
MATSUU Takuto (RETIRED)
Created:
2007-02-19 14:08:24 UTC
Size:
4.40 KB
patch
obsolete
>Only in llimagej2coj: .#llimagej2coj.cpp.1.7 >Only in llimagej2coj: .llimagej2coj.cpp.swp >Only in llimagej2coj: .llimagej2coj.h.swp >Only in llimagej2coj: CVS >diff -upr llimagej2coj_FL-1.13.3.57876.orig/llimagej2coj.cpp llimagej2coj/llimagej2coj.cpp >--- llimagej2coj_FL-1.13.3.57876.orig/llimagej2coj.cpp 2007-02-09 23:49:21.000000000 -0600 >+++ llimagej2coj/llimagej2coj.cpp 2007-02-10 20:23:08.000000000 -0600 >@@ -122,46 +122,58 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C > > /* decode the stream and fill the image structure */ > image = opj_decode(dinfo, cio); >- if(!image) >- { >- fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); >- opj_destroy_decompress(dinfo); >- opj_cio_close(cio); >- return 1; >- } > > /* close the byte stream */ > opj_cio_close(cio); > >- > /* free remaining structures */ >- if(dinfo) { >+ if(dinfo) >+ { > opj_destroy_decompress(dinfo); > } > >+ // The image decode failed if the return was NULL or the component >+ // count was zero. The latter is just a sanity check before we >+ // dereference the array. >+ if(!image || !image->numcomps) >+ { >+ fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); >+ return FALSE; >+ } >+ > // Copy image data into our raw image format (instead of the separate channel format >- S32 width = 0; >- S32 height = 0; > > S32 img_components = image->numcomps; > S32 channels = img_components - first_channel; > if( channels > max_channel_count ) >- { > channels = max_channel_count; >- } >- width = image->x1 - image->x0; >- height = image->y1 - image->y0; >+ >+ // Component buffers are allocated in an image width by height buffer. >+ // The image placed in that buffer is ceil(width/2^factor) by >+ // ceil(height/2^factor) and if the factor isn't zero it will be at the >+ // top left of the buffer with black filled in the rest of the pixels. >+ // It is integer math so the formual is written in ceildivpo2. >+ // (Assuming all the components have the same width, height and >+ // factor.) >+ S32 comp_width = image->comps[0].w; >+ S32 f=image->comps[0].factor; >+ S32 width = ceildivpow2(image->x1 - image->x0, f); >+ S32 height = ceildivpow2(image->y1 - image->y0, f); > raw_image.resize(width, height, channels); > U8 *rawp = raw_image.getData(); > >- for (S32 comp = first_channel; comp < first_channel + channels; comp++) >+ // first_channel is what channel to start copying from >+ // dest is what channel to copy to. first_channel comes from the >+ // argument, dest always starts writing at channel zero. >+ for (S32 comp = first_channel, dest=0; comp < first_channel + channels; >+ comp++, dest++) > { >- S32 offset = comp; >+ S32 offset = dest; > for (S32 y = (height - 1); y >= 0; y--) > { > for (S32 x = 0; x < width; x++) > { >- rawp[offset] = image->comps[comp].data[y*width + x]; >+ rawp[offset] = image->comps[comp].data[y*comp_width + x]; > offset += channels; > } > } >@@ -323,6 +335,9 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2 > /* set decoding parameters to default values */ > opj_set_default_decoder_parameters(¶meters); > >+ // Only decode what's required to get the size data. >+ parameters.cp_limit_tags=OPJ_LIMIT_FOR_SIZE; >+ > //parameters.cp_reduce = mRawDiscardLevel; > > /* decode the code-stream */ >@@ -349,7 +364,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2 > fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); > opj_destroy_decompress(dinfo); > opj_cio_close(cio); >- return 1; >+ return FALSE; > } > > /* close the byte stream */ >@@ -371,5 +386,6 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2 > base.setSize(width, height, img_components); > > /* free image data structure */ >- opj_image_destroy(image); return TRUE; >+ opj_image_destroy(image); >+ return TRUE; > } >diff -upr llimagej2coj_FL-1.13.3.57876.orig/llimagej2coj.h llimagej2coj/llimagej2coj.h >--- llimagej2coj_FL-1.13.3.57876.orig/llimagej2coj.h 2007-02-09 23:49:21.000000000 -0600 >+++ llimagej2coj/llimagej2coj.h 2007-02-10 20:15:33.000000000 -0600 >@@ -40,6 +40,11 @@ protected: > /*virtual*/ BOOL getMetadata(LLImageJ2C &base); > /*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); > /*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0); >+ int ceildivpow2(int a, int b) >+ { >+ // Divide a by b to the power of 2 and round upwards. >+ return (a + (1 << b) - 1) >> b; >+ } > > // Temporary variables for in-progress decodes... > LLImageRaw *mRawImagep;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 127026
:
87669
|
90814
|
90819
|
92739
|
101806
|
106217
|
106219
|
106221
|
106223
|
106225
|
106253
|
106259
|
106263
|
106265
|
106350
|
106352
|
106354
|
106554
|
106556
|
106558
|
106833
|
106834
|
106839
|
106898
|
106900
|
107290
|
107515
|
107540
|
107542
|
107550
|
107566
|
107598
|
107599
|
107600
|
107601
|
107603
|
108183
|
108224
|
110626
|
110627
|
110629
|
110630
|
110634
|
110636
|
110647
|
110648
|
110649
|
110651
|
110652
|
110654
|
110655
|
110656
|
110696
|
110698
|
111517
|
111519
|
111521
|
113643
|
113644
|
113664
|
113666
|
113668
|
113670
|
135152
|
142612
|
151751
|
151753
|
151755
|
152403
|
152405
|
152481
|
152485
|
152487
|
152745
|
152747
|
152749
|
156521