| 302 | } |
| 303 | |
| 304 | static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) |
| 305 | { |
| 306 | AVCodecContext *avctx = ctx->avctx; |
| 307 | uint8_t block; |
| 308 | uint8_t *dst[3]; |
| 309 | int pred[3]; |
| 310 | int ret; |
| 311 | int i, j; |
| 312 | VLC vlc[2]; |
| 313 | |
| 314 | pred[0] = 0x80; |
| 315 | pred[1] = 0x80; |
| 316 | pred[2] = 0x80; |
| 317 | |
| 318 | dst[0] = pic->data[0]; |
| 319 | dst[1] = pic->data[1]; |
| 320 | dst[2] = pic->data[2]; |
| 321 | |
| 322 | skip_bits(gb, 8); |
| 323 | |
| 324 | block = get_bits(gb, 8); |
| 325 | if (block) { |
| 326 | avpriv_request_sample(ctx->avctx, "Blocked YUV"); |
| 327 | return AVERROR_PATCHWELCOME; |
| 328 | } |
| 329 | |
| 330 | /* Read in code table for luma and chroma */ |
| 331 | for (i = 0; i < 2; i++) { |
| 332 | ret = read_code_table(ctx, gb, &vlc[i]); |
| 333 | if (ret < 0) { |
| 334 | for (j = 0; j < i; j++) |
| 335 | ff_vlc_free(&vlc[j]); |
| 336 | |
| 337 | av_log(ctx->avctx, AV_LOG_ERROR, |
| 338 | "Could not read code table %d.\n", i); |
| 339 | return ret; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | /* Read in and restore every line */ |
| 344 | for (i = 0; i < avctx->height; i++) { |
| 345 | read_yuv_component_line(ctx, gb, &pred[0], &vlc[0], dst[0], 0); /* Y */ |
| 346 | read_yuv_component_line(ctx, gb, &pred[1], &vlc[1], dst[1], 1); /* U */ |
| 347 | read_yuv_component_line(ctx, gb, &pred[2], &vlc[1], dst[2], 1); /* V */ |
| 348 | |
| 349 | for (j = 0; j < 3; j++) |
| 350 | dst[j] += pic->linesize[j]; |
| 351 | } |
| 352 | |
| 353 | for (i = 0; i < 2; i++) |
| 354 | ff_vlc_free(&vlc[i]); |
| 355 | |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, |
| 360 | int *got_picture_ptr, AVPacket *avpkt) |
no test coverage detected