Using BCI images in BREW 2.1.3.3+ | developer.brewmp.com Using BCI images in BREW 2.1.3.3+ | developer.brewmp.com

Developer

Using BCI images in BREW 2.1.3.3+

Forums:

Hello everyone,

We've recently found an issue in BREW 2.1.3 which will affect applications using BCI images. If you are experiencing unexplained crashing when using BCI images, this may be your problem.

The issue manifests itself when a BCI image is loaded and released without allowing the IImage notification callback to be invoked.

THIS WILL OCCUR WHETHER YOU HAVE REGISTERED A NOTIFICATION CALLBACK OR NOT.

The workaround is to release the IImage instance only after this callback has been invoked. So if you aren't currently registering a callback, you should.

Here's a quick example of code that is VERY VERY BAD:
pMe->mImage = ISHELL_LoadImage( pMe->pIShell, "image.bci" );

if ( pMe->mImage ) {
IIMAGE_Notify(pMe->mImage, ImageNotifyCB, pMe);
IIMAGE_SetParm( pMe->mImage, IPARM_ROP, AEE_RO_TRANSPARENT, 0 );
IIMAGE_Draw( pMe->mImage, 0, 0 );
IIMAGE_Release( pMe->mImage );
IDISPLAY_Update( pMe->mDisplay );

See how the IImage is released without ever giving control back to the BREW subsystem? In all likelyhood, this little chunk of code will CRASH. So don't do that on BREW 2.1.3.3+ devices.

This has been fixed in BREW 2.1.4, 3.0, and 3.1.

If anyone has any questions, feel free to ask.

Does this apply only to loading image from file using ISHELL_LoadImage?
We load images using ISHELL_LoadResImage and we did experienced some strange crashes on BREW 2.1.3 phones.
So, we had to implement a workaround. But it looks like on simulator the callback is never called if I load BCI image from the resource file. And it is always called if I load a BMP image.
Is this suppose to be like that or is there a bug in simulator, that does not call registered callback when loading BCI image from resource file with ISHELL_LoadResImage? (the simulator is 2.0, maybe we should use newer version?)

Does this apply only to loading image from file using ISHELL_LoadImage?
We load images using ISHELL_LoadResImage and we did experienced some strange crashes on BREW 2.1.3 phones.
So, we had to implement a workaround. But it looks like on simulator the callback is never called if I load BCI image from the resource file. And it is always called if I load a BMP image.
Is this suppose to be like that or is there a bug in simulator, that does not call registered callback when loading BCI image from resource file with ISHELL_LoadResImage? (the simulator is 2.0, maybe we should use newer version?)

Hi Archi,
I would definitely suggest testing this out on the 2.1 Emulator as the behavior has likely changed.
If you find that no callback is ever being invoked, it is probably because the image data is being loaded in a synchronous operation. If this is the case, then you are probably safe from this crash anyway. The catch here though is that which types of image data are loaded synchronously may change.
I suppose one safe way to go would be to just release the IImage in your FreeAppData function, but that's not exactly ideal from a memory usage standpoint. If you are confident that the load is synchronous and you're willing to gamble that that won't change on different devices and BREW versions, you can go ahead and try releasing the IImage immediately after use, but i don't recommend it.

Hi Archi,
I would definitely suggest testing this out on the 2.1 Emulator as the behavior has likely changed.
If you find that no callback is ever being invoked, it is probably because the image data is being loaded in a synchronous operation. If this is the case, then you are probably safe from this crash anyway. The catch here though is that which types of image data are loaded synchronously may change.
I suppose one safe way to go would be to just release the IImage in your FreeAppData function, but that's not exactly ideal from a memory usage standpoint. If you are confident that the load is synchronous and you're willing to gamble that that won't change on different devices and BREW versions, you can go ahead and try releasing the IImage immediately after use, but i don't recommend it.

But is this so, that on devices that have this crash problem (BREW 2.1.3.3+) callback will always be called regardless of image type?
So, we could just determine if the device has this crash problem and enable callback functionality. If the problem is not there - we will release image not waiting for callback to execute?
P.S. I investigated this issue on LGE VX4600 and LGE VX4700.
First does not have this crash problem and does not calls a callback for BCI image loading, however calls for BMP.
LGE 4700 seems to call the callback always. Can we rely on 4700 to always call the callback, regardless of image type?

But is this so, that on devices that have this crash problem (BREW 2.1.3.3+) callback will always be called regardless of image type?
So, we could just determine if the device has this crash problem and enable callback functionality. If the problem is not there - we will release image not waiting for callback to execute?
P.S. I investigated this issue on LGE VX4600 and LGE VX4700.
First does not have this crash problem and does not calls a callback for BCI image loading, however calls for BMP.
LGE 4700 seems to call the callback always. Can we rely on 4700 to always call the callback, regardless of image type?

In BREW 2.1.3.8, you should always receive the callback (I tried it with BMP, PNG, and BCI).
The LG VX4600, being a BREW 2.0.2.6 device, will not exhibit the crash.

In BREW 2.1.3.8, you should always receive the callback (I tried it with BMP, PNG, and BCI).
The LG VX4600, being a BREW 2.0.2.6 device, will not exhibit the crash.

Hi Nathan,
I have a question related to asynchronous image decoding.
I am opening JPEG and PNG files with BREW SDK 2.1.0 and 2.1.1 in an asynchronous way using IIMAGE_Notify with a callback. The callback mechanism works fine, but sometimes I'd like to cancel decoding *before* the callback is being called. Can I safely do this by calling IIMAGE_Release ? The crash you originally talked about wouldn't happen with JPEG and PNG files, would it ?
Thanks !
Stephane

Hi Nathan,
I have a question related to asynchronous image decoding.
I am opening JPEG and PNG files with BREW SDK 2.1.0 and 2.1.1 in an asynchronous way using IIMAGE_Notify with a callback. The callback mechanism works fine, but sometimes I'd like to cancel decoding *before* the callback is being called. Can I safely do this by calling IIMAGE_Release ? The crash you originally talked about wouldn't happen with JPEG and PNG files, would it ?
Thanks !
Stephane

Hi Stephane,
There should be no problem with releasing a JPEG or PNG IImage before the callback is invoked.

Hi Stephane,
There should be no problem with releasing a JPEG or PNG IImage before the callback is invoked.

Hi Nathan
When I compress a 24bit color image file into BCI file, the image plays on the display which the color looks downgraded. It happened on both the emulator and the real handset.
So my question is that the BCI support 24bit color image?
I'd love to use BCI to build the animations. Could you advise how to avoid 24bit color image downgrading in BCI.
Thanks
Alex.

Hi Nathan
When I compress a 24bit color image file into BCI file, the image plays on the display which the color looks downgraded. It happened on both the emulator and the real handset.
So my question is that the BCI support 24bit color image?
I'd love to use BCI to build the animations. Could you advise how to avoid 24bit color image downgrading in BCI.
Thanks
Alex.

Is the color degredation more than what you would expect when converting from 24-bit color to 16-bit color? Both the device and the emulator are going to display in 16-bit color.
What image format are you converting from?

Is the color degredation more than what you would expect when converting from 24-bit color to 16-bit color? Both the device and the emulator are going to display in 16-bit color.
What image format are you converting from?

Hi Nathan
What I used to convert into BCI format is "PNG" image files.... And after you reply I try to test convert JPG into BCI, wow... yes no degration!!!
So the root cause may be the "BREW Compressed Authoring Tool" not completely support PNG format.
Thanks for your support
Best,
Alex.

Hi Nathan
What I used to convert into BCI format is "PNG" image files.... And after you reply I try to test convert JPG into BCI, wow... yes no degration!!!
So the root cause may be the "BREW Compressed Authoring Tool" not completely support PNG format.
Thanks for your support
Best,
Alex.

I have seen this behavior before. I have not yet had a chance to test it out on the latest version of CMX Studio (v3.3.9), but you may want to try it out and see if it fixes the problem.

I have seen this behavior before. I have not yet had a chance to test it out on the latest version of CMX Studio (v3.3.9), but you may want to try it out and see if it fixes the problem.

hello everyone:
now I have some problems about display BCI file and GIF File.
1.I use ISHELL_CreateInstance() to create a IImageCtl Cls,and use ISHELL_LoadImage() to load a BCI File.Then I use IIMAGE_Notify() and IIMAGECTL_SetRedraw() to set IImage and IImageCtl CallBack Function. then I use IIMAGECTL_SetImage() to let ImageCtl Cls control Image .But I found when I load a BCI File, IImage's CB function does not work,but load others file, CB func work fine.Why? Does Loading BCI File needn't CB Func? and when I use IIMAGE_Draw() to draw this BCI File,only first frame display on the screen.Why???
2.When I load a gif file and try to display it,If GIF file has only one frame, I must use IIMAGE_DrawFrame(pi,0,0,0) to display it.I cannot use IIMAGE_Start() to play it. Also I cannot use IImageCtl_Redraw() to redraw it. Also Why?
These problems has made me crazy,I have try many method ,but it doesnot work!Every body ,who can help me?

hello everyone:
now I have some problems about display BCI file and GIF File.
1.I use ISHELL_CreateInstance() to create a IImageCtl Cls,and use ISHELL_LoadImage() to load a BCI File.Then I use IIMAGE_Notify() and IIMAGECTL_SetRedraw() to set IImage and IImageCtl CallBack Function. then I use IIMAGECTL_SetImage() to let ImageCtl Cls control Image .But I found when I load a BCI File, IImage's CB function does not work,but load others file, CB func work fine.Why? Does Loading BCI File needn't CB Func? and when I use IIMAGE_Draw() to draw this BCI File,only first frame display on the screen.Why???
2.When I load a gif file and try to display it,If GIF file has only one frame, I must use IIMAGE_DrawFrame(pi,0,0,0) to display it.I cannot use IIMAGE_Start() to play it. Also I cannot use IImageCtl_Redraw() to redraw it. Also Why?
These problems has made me crazy,I have try many method ,but it doesnot work!Every body ,who can help me?

Hi!
I am facing problem in displaying .bci image file in Sharp Z-800 device in emulator.
It does not draw the image if I load .bci image file. But if I load the same image in .bmp fomat , the image is drawn. This problem is not there in BenQ S-80. I do the following:
pMMI->pIImageEmotion = ISHELL_LoadResImage(.., .., IMG_MSN_EMOTION);
/*IMG_MSN_EMOTION is the image resource id */
IIMAGE_SetParm(pImgEmotion, IPARM_ROP, AEE_RO_TRANSPARENT, 0);
IIMAGE_Draw(pImgEmotion, x, y);
Sometimes drawing area may be smaller than the image size. But I tried by setting drawing area equal to the image size also without success.
Thanks in advance,
BR,
Ari

Hi!
I am facing problem in displaying .bci image file in Sharp Z-800 device in emulator.
It does not draw the image if I load .bci image file. But if I load the same image in .bmp fomat , the image is drawn. This problem is not there in BenQ S-80. I do the following:
pMMI->pIImageEmotion = ISHELL_LoadResImage(.., .., IMG_MSN_EMOTION);
/*IMG_MSN_EMOTION is the image resource id */
IIMAGE_SetParm(pImgEmotion, IPARM_ROP, AEE_RO_TRANSPARENT, 0);
IIMAGE_Draw(pImgEmotion, x, y);
Sometimes drawing area may be smaller than the image size. But I tried by setting drawing area equal to the image size also without success.
Thanks in advance,
BR,
Ari

using
void IIMAGE_Start(IImage * pIImage, int x, int y)
and
void IIMAGE_Stop(IImage * pIImage)
for displaying BCI Image will have no problem

using
void IIMAGE_Start(IImage * pIImage, int x, int y)
and
void IIMAGE_Stop(IImage * pIImage)
for displaying BCI Image will have no problem

Hello everyone,
BCI stands for Brew Compressed Image tool.
But when 4 small bitmap images each of size 4Kb will convert into a BCI file, with size nearly 3 time of total size of all bitmaps(nearly 35- 40kb).
So, is it better to write a function that animates BMP in our app or use BCI files?
Which is the better option, Plz specify...
Thanks in advance to everyone.

Hello everyone,
BCI stands for Brew Compressed Image tool.
But when 4 small bitmap images each of size 4Kb will convert into a BCI file, with size nearly 3 time of total size of all bitmaps(nearly 35- 40kb).
So, is it better to write a function that animates BMP in our app or use BCI files?
Which is the better option, Plz specify...
Thanks in advance to everyone.

Hi,
When i load the BCI file and start using IIMAGE_Start() API. Then after few seconds it is stopped. When i press any key in emulator then it works fine.
How to solve this for continuos animation?

Hi,
When i load the BCI file and start using IIMAGE_Start() API. Then after few seconds it is stopped. When i press any key in emulator then it works fine.
How to solve this for continuos animation?

hi thilsen,
This is not a problem.
The application goes to sleep mode without any key activity for some time.
In the main event handler of your application, add this:
case EVT_APP_START:
case EVT_APP_NO_SLEEP:
return TRUE;
Hopefully it'll solve your concern.

hi thilsen,
This is not a problem.
The application goes to sleep mode without any key activity for some time.
In the main event handler of your application, add this:
case EVT_APP_START:
case EVT_APP_NO_SLEEP:
return TRUE;
Hopefully it'll solve your concern.