Problem with GUI_JPEG_DrawScaledEx(GUI_GET_DATA_FUNC * pfGetData, void * p, int x0, int y0, int Num, int Denom)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem with GUI_JPEG_DrawScaledEx(GUI_GET_DATA_FUNC * pfGetData, void * p, int x0, int y0, int Num, int Denom)

    Dear sirs,

    we are using binary format emWin 5.24 version with LPC1788 processor.
    We use GUI_JPEG_DrawScaledEx(GUI_GET_DATA_FUNC * pfGetData, void * p, int x0, int y0, int Num, int Denom) and we need to exit from this routine before it is normally completed.
    Looking at emWina manual (page 174, paragraph 8.5 Getting data with the ...Ex() functions), they write:
    Return value
    The number of bytes which were actually read. If the number of read bytes does not
    match, the drawing function will return immediately.
    We experienced that it does not work, that is: in our pfGetData function (that works correctly) we tried to return a not-matching value to anticipate exit from GUI_JPEG_DrawScaledEx(), but it does not exit. Any suggestion?


    Best regards and thank you,


    Valter Rasicci
  • Hi Adrian,

    thank you for your reply.
    Are you able to forecast when this update will be available?
    I think this could be a serious limitation because, when you call GUI_JPEG_ScaledEx() routine, you have no way to exit from it and, if you started a huge JPEG file procedure, you have to wait unacceptable time to recover from that situation. For example, try to imagine a photoframe and you want exit quickly from it .....

    Best regards,

    Valter Rasicci
  • Hi Adrian,

    looking at the issue we shown, I have another important consideration.
    I tried to call GUI_JPEG_DrawScaledEx() routine in a separate task (we use freeRTOS) so that I delete this task when I need to exit before routine is completed; it seemed to work but soon emwin crashes. I suppose that emWin manager will allocate memory when I call GUI_JPEG_DrawScaledEx() to do the operation but, when I delete the task, that memory is cannot be deallocated! Sooner or later memory will terminate and emWin will crash.
    We noticed this using GUI_ALLOC_GetNumFreeBytes() routine that, time by time, gave us memory decrease .... until crash.

    Is there a way so that I can free that memory manually? Is there an API function I can use to understand where this memory is and, maybe, we will be able to "clean" it? I think this is a serious issue and, probably, I will need to look for another JPEG decompression open-source code that will allow me to operate without risk. But this is paradoxical!



    Best regards,


    Valter Rasicci
  • Hello Valter,

    Please note that exiting a function by terminating the task it is executed in can under no circumstances be a reasonable way to go.

    From my point of view the only way to solve this is to update you with a fixed version of the JPEG module. I assume you are using a pre-compiled emWin library. Unfortunately the library you are using was not created at Segger, so we are not able to send you a new one. Please understand that you will have to contact your emWin provider for that who has the obligation to support their customers. Thank you.

    Best regards,
    Adrian
  • Hello Adrian,

    I confirm that we are using emWin 5.24h in binary format. In fact I activated NXP to find a solution on this.

    However, deleting a task (and consequently exiting from any routine running in it) is a normally used method (implemented in several circumstancies like in lwIP for example) but, obviously, memory consistency must be kept when task is deleted; and using binary emWin routine this cannot be done. My problem is that,at the moment, I have no way to exit from GUI_JPEG_DrawScaledEx() routine.

    Best regards,

    Valter Rasicci
  • emWin memory management bug. ...Ex() functions.

    valterrasicci wrote:

    Hi Adrian,

    looking at the issue we shown, I have another important consideration.
    I tried to call GUI_JPEG_DrawScaledEx() routine in a separate task (we use freeRTOS) so that I delete this task when I need to exit before routine is completed; it seemed to work but soon emwin crashes. I suppose that emWin manager will allocate memory when I call GUI_JPEG_DrawScaledEx() to do the operation but, when I delete the task, that memory is cannot be deallocated! Sooner or later memory will terminate and emWin will crash.
    We noticed this using GUI_ALLOC_GetNumFreeBytes() routine that, time by time, gave us memory decrease .... until crash.

    Is there a way so that I can free that memory manually? Is there an API function I can use to understand where this memory is and, maybe, we will be able to "clean" it? I think this is a serious issue and, probably, I will need to look for another JPEG decompression open-source code that will allow me to operate without risk. But this is paradoxical!



    Best regards,


    Valter Rasicci

    valterrasicci wrote:

    Absolutely the same trouble with 5.28 library version on STM. Except in my case I work with BMP ...Ex() functions.