Skip to content

Commit e921116

Browse files
committed
README.md: decoder - refinement
1 parent b31504f commit e921116

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)