File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -319,17 +319,20 @@ a file):
319319
320320 struct gpujpeg_decoder_output decoder_output;
321321 gpujpeg_decoder_output_set_default(&decoder_output);
322- if ( gpujpeg_decoder_decode(decoder, image, image_size,
323- &decoder_output) != 0 )
322+ int dec_rc = gpujpeg_decoder_decode(decoder, image, image_size,
323+ &decoder_output);
324+ gpujpeg_image_destroy(image);
325+ if ( dec_rc != 0 )
324326 return -1;
325327
326- Now we can save decoded raw image data to file and perform cleanup :
328+ Then you can process the decoded image, eg. save the raw data to a file :
327329
328330 if ( gpujpeg_image_save_to_file("output_image.pnm", decoder_output.data,
329331 decoder_output.data_size, &decoder_output.param_image) != 0 )
330332 return -1;
333+
334+ You can continue decoding more images. When done, perform the cleanup:
331335
332- gpujpeg_image_destroy(image);
333336 gpujpeg_decoder_destroy(decoder);
334337
335338### GPUJPEG console application
You can’t perform that action at this time.
0 commit comments