From CUVI Wiki
Jump to navigation Jump to search

JPEG Decoding: Decodes a JPEG file into an image pixel array.


CuviStatus decode(const Cuvi8u* src,
                  const size_t srcBytes,
                  CuviImage& dst,
                  const bool srcOnGPU,
                  const CuviStream& stream = CuviStream());


Name Type Description
src Cuvi8u* Pointer to encoded data
srcBytes const size_t Size of encoded data
dst CuviImage& dst Decoded image in CuviImage
srcOnGPU const bool Whether the encoded data is CPU pointer or GPU
stream const CuviStream& GPU stream ID for execution


CuviImage img;

CuviStatus err = cuvi::codecs::decode(inputPath, img);

    if(err!= CUVI_SUCCESS)
        cout <<"Failed to decode image, error: "<<err<<endl;

cout<<"Decoded image dimensions: "<<img.width()<<"x"<<img.height()<<endl;
cout<<"Encoding image and writing to "<<outputPath<<endl;