| 358 | } |
| 359 | |
| 360 | static int decode_slice(AVCodecContext *c, void *arg) |
| 361 | { |
| 362 | FFV1Context *f = c->priv_data; |
| 363 | FFV1SliceContext *sc = arg; |
| 364 | int width, height, x, y, ret; |
| 365 | const int ps = av_pix_fmt_desc_get(f->pix_fmt)->comp[0].step; |
| 366 | AVFrame * const p = f->picture.f; |
| 367 | const int si = sc - f->slices; |
| 368 | GetBitContext gb; |
| 369 | int ac = f->ac || sc->slice_coding_mode == 1; |
| 370 | |
| 371 | if (!(p->flags & AV_FRAME_FLAG_KEY) && f->last_picture.f) |
| 372 | ff_progress_frame_await(&f->last_picture, si); |
| 373 | |
| 374 | if (f->slice_damaged[si]) |
| 375 | slice_set_damaged(f, sc); |
| 376 | |
| 377 | sc->slice_rct_by_coef = 1; |
| 378 | sc->slice_rct_ry_coef = 1; |
| 379 | |
| 380 | if (f->version > 2) { |
| 381 | if (ff_ffv1_init_slice_state(f, sc) < 0) |
| 382 | return AVERROR(ENOMEM); |
| 383 | if (decode_slice_header(f, sc, p) < 0) { |
| 384 | sc->slice_x = sc->slice_y = sc->slice_height = sc->slice_width = 0; |
| 385 | slice_set_damaged(f, sc); |
| 386 | return AVERROR_INVALIDDATA; |
| 387 | } |
| 388 | } |
| 389 | if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0) |
| 390 | return ret; |
| 391 | if ((p->flags & AV_FRAME_FLAG_KEY) || sc->slice_reset_contexts) { |
| 392 | ff_ffv1_clear_slice_state(f, sc); |
| 393 | } else if (sc->slice_damaged) { |
| 394 | return AVERROR_INVALIDDATA; |
| 395 | } |
| 396 | |
| 397 | width = sc->slice_width; |
| 398 | height = sc->slice_height; |
| 399 | x = sc->slice_x; |
| 400 | y = sc->slice_y; |
| 401 | |
| 402 | if (sc->remap) { |
| 403 | const int pixel_num = sc->slice_width * sc->slice_height; |
| 404 | |
| 405 | for(int p = 0; p < 1 + 2*f->chroma_planes + f->transparency ; p++) { |
| 406 | if (f->avctx->bits_per_raw_sample == 32) { |
| 407 | av_fast_malloc(&sc->fltmap32[p], &sc->fltmap32_size[p], pixel_num * sizeof(*sc->fltmap32[p])); |
| 408 | if (!sc->fltmap32[p]) |
| 409 | return AVERROR(ENOMEM); |
| 410 | } else { |
| 411 | av_fast_malloc(&sc->fltmap[p], &sc->fltmap_size[p], pixel_num * sizeof(*sc->fltmap[p])); |
| 412 | if (!sc->fltmap[p]) |
| 413 | return AVERROR(ENOMEM); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | ret = decode_remap(f, sc); |
nothing calls this directly
no test coverage detected