See header for documentation. */
| 1249 | |
| 1250 | /* See header for documentation. */ |
| 1251 | astcenc_error astcenc_compress_cancel( |
| 1252 | astcenc_context* ctxo |
| 1253 | ) { |
| 1254 | #if defined(ASTCENC_DECOMPRESS_ONLY) |
| 1255 | (void)ctxo; |
| 1256 | return ASTCENC_ERR_BAD_CONTEXT; |
| 1257 | #else |
| 1258 | astcenc_contexti* ctx = &ctxo->context; |
| 1259 | if (ctx->config.flags & ASTCENC_FLG_DECOMPRESS_ONLY) |
| 1260 | { |
| 1261 | return ASTCENC_ERR_BAD_CONTEXT; |
| 1262 | } |
| 1263 | |
| 1264 | // Cancel compression before cancelling avg. This avoids the race condition |
| 1265 | // where cancelling them in the other order could see a compression worker |
| 1266 | // starting to process even though some of the avg data is undefined. |
| 1267 | ctxo->manage_compress.cancel(); |
| 1268 | ctxo->manage_avg.cancel(); |
| 1269 | return ASTCENC_SUCCESS; |
| 1270 | #endif |
| 1271 | } |
| 1272 | |
| 1273 | /* See header for documentation. */ |
| 1274 | astcenc_error astcenc_decompress_image( |