nn::jpeg::CTR::JpegMpDecoder::StopDecoder Member Function#include <nn/jpeg.h> void StopDecoder();
None.
Makes a request from another thread to stop the decoding process.
This function sets a "stop request flag" inside the decoder object. The decoding functions (StartJpegDecoder, StartJpegDecoderShrink and StartMpDecoderLR) monitor for this flag and stop decoding.
Since the decoder object is not thread-safe, multiple threads basically cannot access the same decoder object.
However, during the periods of time when the application can check whether the decoder object exists (i.e., has been initialized and has not been ended) , this function can be called for the same decoder object from other threads.
In general, it takes time to decode a JPEG image. There is a separate decode-use thread that the application uses in order to maintain the response speed of the main thread.
Consider the example of a screen that shows a compendium of images, and you want to stop the decoding that has already begun for a certain image. To do this, you can call this function from a different thread (the main thread or an alarm handler) that has a higher priority than the decode-use thread.
The decode function internally clears the stop request prior to the main process. There is no certainty that simply calling this function will lead to the stopping of the decoding process. The following restrictions apply:
1. The decode-use thread cannot stop before the call to the decode function, or before the arrival of the main internal decoding process.
2. Decoding cannot stop after the completion of the main internal decoding process. (If some other error has not occurred, the decoding will be successful)
3. StartMpDecoderLR clears the flags after the decoding of every other image. Decoding cannot be stopped during the period between the completion of decoding of the first image and the commencement of decoding of the second image.
To deal with situations 1. and 3. above, you should continue to call this function (for example, in every game frame) until you have verified that decoding has been stopped, or has ended, whether in success or failure.
When a decode function has received the request to stop it will return 0, which is the same value returned when decoding has failed. (If no other error has occurred, the error code returned by GetLastErrorwill be JPEG_DECODER_ERROR_STOPPED.)
The stop request cannot be canceled. Moreover, once decoding has stropped it cannot be restarted.
CONFIDENTIAL