Lines Matching defs:avctx

134 static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, int offset, int expected)
136 LclDecContext *c = avctx->priv_data;
140 av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
149 av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
153 av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
164 static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
169 LclDecContext * const c = avctx->priv_data;
174 int width = avctx->width; // Real image width
175 int height = avctx->height; // Real image height
183 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
189 switch (avctx->codec_id) {
199 av_log(avctx, AV_LOG_ERROR, "len %d is too small\n", len);
206 av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
213 av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n",
222 av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
257 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n");
279 ret = zlib_decomp(avctx, buf + 8, mthread_inlen, 0, mthread_outlen);
281 ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
286 int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
294 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n");
300 if (avctx->codec_id == AV_CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) {
378 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n");
478 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n");
491 static av_cold int decode_init(AVCodecContext *avctx)
493 LclDecContext * const c = avctx->priv_data;
494 unsigned int basesize = avctx->width * avctx->height;
495 unsigned int max_basesize = FFALIGN(avctx->width, 4) *
496 FFALIGN(avctx->height, 4);
501 if (avctx->extradata_size < 8) {
502 av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
507 if ((avctx->codec_id == AV_CODEC_ID_MSZH && avctx->extradata[7] != CODEC_MSZH) ||
508 (avctx->codec_id == AV_CODEC_ID_ZLIB && avctx->extradata[7] != CODEC_ZLIB)) {
509 av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n");
513 switch (c->imgtype = avctx->extradata[4]) {
517 avctx->pix_fmt = AV_PIX_FMT_YUV444P;
518 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
521 c->decomp_size = (avctx->width & ~3) * avctx->height * 2;
523 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
524 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
528 c->decomp_size = FFALIGN(avctx->width*3, 4) * avctx->height;
530 avctx->pix_fmt = AV_PIX_FMT_BGR24;
531 av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
534 c->decomp_size = (avctx->width & ~3) * avctx->height / 2 * 3;
536 avctx->pix_fmt = AV_PIX_FMT_YUV411P;
537 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
543 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
544 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 2:1:1.\n");
549 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
550 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:0.\n");
553 av_log(avctx, AV_LOG_ERROR, "Unsupported image format %d.\n", c->imgtype);
557 av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v);
558 if ((avctx->width % (1<<subsample_h) && !partial_h_supported) || avctx->height % (1<<subsample_v)) {
559 avpriv_request_sample(avctx, "Unsupported dimensions");
564 c->compression = (int8_t)avctx->extradata[5];
565 switch (avctx->codec_id) {
569 av_log(avctx, AV_LOG_DEBUG, "Compression enabled.\n");
573 av_log(avctx, AV_LOG_DEBUG, "No compression.\n");
576 av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression);
584 av_log(avctx, AV_LOG_DEBUG, "High speed compression.\n");
587 av_log(avctx, AV_LOG_DEBUG, "High compression.\n");
590 av_log(avctx, AV_LOG_DEBUG, "Normal compression.\n");
594 av_log(avctx, AV_LOG_ERROR, "Unsupported compression level for ZLIB: (%d).\n", c->compression);
597 av_log(avctx, AV_LOG_DEBUG, "Compression level for ZLIB: (%d).\n", c->compression);
602 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in compression switch.\n");
609 av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
615 c->flags = avctx->extradata[6];
617 av_log(avctx, AV_LOG_DEBUG, "Multithread encoder flag set.\n");
619 av_log(avctx, AV_LOG_DEBUG, "Nullframe insertion flag set.\n");
620 if (avctx->codec_id == AV_CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER))
621 av_log(avctx, AV_LOG_DEBUG, "PNG filter flag set.\n");
623 av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags);
627 if (avctx->codec_id == AV_CODEC_ID_ZLIB)
628 return ff_inflate_init(&c->zstream, avctx);
634 static av_cold int decode_end(AVCodecContext *avctx)
636 LclDecContext * const c = avctx->priv_data;