! * \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 */
| 209 | * \return 0 if OK, 1 on error |
| 210 | */ |
| 211 | l_int32 |
| 212 | readHeaderMemWebP(const l_uint8 *data, |
| 213 | size_t size, |
| 214 | l_int32 *pw, |
| 215 | l_int32 *ph, |
| 216 | l_int32 *pspp) |
| 217 | { |
| 218 | WebPBitstreamFeatures 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 | /*---------------------------------------------------------------------* |
no outgoing calls
no test coverage detected