MCPcopy Create free account
hub / github.com/creatale/node-dv / readHeaderMemWebP

Function readHeaderMemWebP

deps/leptonica/src/webpio.c:211–236  ·  view source on GitHub ↗

! * \brief readHeaderMemWebP() * * \param[in] data * \param[in] size 100 bytes is sufficient * \param[out] pw width * \param[out] ph height * \param[out] pspp spp (3 or 4) * \return 0 if OK, 1 on error */

Source from the content-addressed store, hash-verified

209 * \return 0 if OK, 1 on error
210 */
211l_int32
212readHeaderMemWebP(const l_uint8 *data,
213 size_t size,
214 l_int32 *pw,
215 l_int32 *ph,
216 l_int32 *pspp)
217{
218WebPBitstreamFeatures features;
219
220 PROCNAME("readHeaderWebP");
221
222 if (pw) *pw = 0;
223 if (ph) *ph = 0;
224 if (pspp) *pspp = 0;
225 if (!data)
226 return ERROR_INT("data not defined", procName, 1);
227 if (!pw || !ph || !pspp)
228 return ERROR_INT("input ptr(s) not defined", procName, 1);
229
230 if (WebPGetFeatures(data, (l_int32)size, &features))
231 return ERROR_INT("invalid WebP file", procName, 1);
232 *pw = features.width;
233 *ph = features.height;
234 *pspp = (features.has_alpha) ? 4 : 3;
235 return 0;
236}
237
238
239/*---------------------------------------------------------------------*

Callers 2

pixReadHeaderMemFunction · 0.70
readHeaderWebPFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected