<div dir="ltr"><div>Hi</div><div><br></div><div>I want to read quickly a jpeg file, and store it in memory interleaved (RGBRGBRGB).<br></div><div>Is this the fastest way to read it?</div><div>(note: dest is already allocated to the proper size)<br></div><div><br></div><div><span style="color:rgb(66,66,66);font-family:"Roboto Mono",monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(248,249,250);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">        void loadImageRGBUint8(const std::string& path, void* dest)
        {
            auto dataSet = static_cast<GDALDataset*>(GDALOpen(path.c_str(), GA_ReadOnly)));
            // check dataSet ...</span></div><div><span style="color:rgb(66,66,66);font-family:"Roboto Mono",monospace;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(248,249,250);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">
            const auto width = dataSet->GetRasterXSize();
            const auto height = dataSet->GetRasterYSize();

            const auto rasterReturn = dataSet->RasterIO(GF_Read,
                                                        0,  // top
                                                        0,  // left
                                                        width,
                                                        height,
                                                        dest,
                                                        width,
                                                        height,
                                                        GDT_Byte,
                                                        3,  // bands
                                                        nullptr,
                                                        3,          // nPixelSpace
                                                        3 * width,  // nLineSpace
                                                        1,          // nBandSpace
                                                        nullptr);
            // ...check rasterReturn and destroy dataSet ...
        }</span></div><div><br></div><div>Regarding the parameter "nLineSpace", documentation says <br></div><div><table class="gmail-params" style="font:400 14px/22px Roboto,sans-serif;margin-left:0px;padding-left:0px;color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><tbody><tr><td class="gmail-paramname" style="color:rgb(96,32,32);white-space:nowrap;font-weight:bold;vertical-align:top">nLineSpace</td><td>The byte offset from the start of one scanline in pData to the start of the next. If defaulted (0) the size of the datatype eBufType * nBufXSize is used.</td></tr></tbody></table></div><div>In the code above, if I set nLineSpace to 0, it works fine. However, if I write what documentation says ( 1 * width ), it does not work. Is this a bug in the documentation, or am I understanding it wrongly?</div><div><br></div><div>Thanks<br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__<br>Entre dos pensamientos racionales <br>hay infinitos pensamientos irracionales.<br><br></div></div></div>