Lines Matching defs:avctx
91 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb);
92 static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb);
177 AVCodecContext *avctx;
318 static av_cold void free_tables(AVCodecContext *avctx)
320 Vp3DecodeContext *s = avctx->priv_data;
334 static void vp3_decode_flush(AVCodecContext *avctx)
336 Vp3DecodeContext *s = avctx->priv_data;
339 ff_thread_release_ext_buffer(avctx, &s->golden_frame);
341 ff_thread_release_ext_buffer(avctx, &s->last_frame);
343 ff_thread_release_ext_buffer(avctx, &s->current_frame);
346 static av_cold int vp3_decode_end(AVCodecContext *avctx)
348 Vp3DecodeContext *s = avctx->priv_data;
351 free_tables(avctx);
357 vp3_decode_flush(avctx);
506 av_log(s->avctx, AV_LOG_ERROR,
541 av_log(s->avctx, AV_LOG_ERROR,
663 av_log(s->avctx, AV_LOG_ERROR, "Invalid run length\n");
1203 av_log(s->avctx, AV_LOG_ERROR,
1261 av_log(s->avctx, AV_LOG_DEBUG,
1273 av_log(s->avctx, AV_LOG_ERROR, "Invalid token %d\n", token);
1279 av_log(s->avctx, AV_LOG_ERROR, "More blocks ended than coded!\n");
1346 if (!(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
1435 av_log(s->avctx, AV_LOG_DEBUG,
1452 av_log(s->avctx, AV_LOG_ERROR, "Invalid token %d\n", token);
1585 for (plane = 0; plane < ((s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 1 : 3); plane++) {
1883 av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
1913 if (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_FRAME) {
1925 if (!s->avctx->draw_horiz_band)
1943 s->avctx->draw_horiz_band(s->avctx, s->current_frame.f, offset, y, 3, h);
2106 (s->avctx->active_thread_type & FF_THREAD_FRAME);
2110 if (CONFIG_GRAY && plane && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
2272 static av_cold int allocate_tables(AVCodecContext *avctx)
2274 Vp3DecodeContext *s = avctx->priv_data;
2277 free_tables(avctx);
2327 static av_cold int vp3_decode_init(AVCodecContext *avctx)
2329 Vp3DecodeContext *s = avctx->priv_data;
2342 if (avctx->codec_tag == MKTAG('V', 'P', '4', '0')) {
2345 av_log(avctx, AV_LOG_ERROR, "This build does not support decoding VP4.\n");
2348 } else if (avctx->codec_tag == MKTAG('V', 'P', '3', '0'))
2353 s->avctx = avctx;
2354 s->width = FFALIGN(avctx->coded_width, 16);
2355 s->height = FFALIGN(avctx->coded_height, 16);
2358 if (avctx->codec_id != AV_CODEC_ID_THEORA)
2359 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
2360 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
2361 ff_hpeldsp_init(&s->hdsp, avctx->flags | AV_CODEC_FLAG_BITEXACT);
2363 ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
2377 ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
2444 0, 0, avctx);
2455 0, 0, avctx);
2463 NULL, 0, 0, 1, 0, avctx);
2469 NULL, 0, 0, 0, 0, avctx);
2475 NULL, 0, 0, 0, 0, avctx);
2482 -31, 0, avctx);
2492 0, avctx);
2505 return allocate_tables(avctx);
2509 static int update_frames(AVCodecContext *avctx)
2511 Vp3DecodeContext *s = avctx->priv_data;
2515 ff_thread_release_ext_buffer(avctx, &s->last_frame);
2521 ff_thread_release_ext_buffer(avctx, &s->golden_frame);
2526 ff_thread_release_ext_buffer(avctx, &s->current_frame);
2533 ff_thread_release_ext_buffer(s->avctx, dst);
2591 static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
2596 Vp3DecodeContext *s = avctx->priv_data;
2608 if (s->avctx->active_thread_type&FF_THREAD_FRAME) {
2609 av_log(avctx, AV_LOG_ERROR, "midstream reconfiguration with multithreading is unsupported, try -threads 1\n");
2613 vp3_decode_end(avctx);
2614 ret = theora_decode_header(avctx, &gb);
2617 ret = vp3_decode_init(avctx);
2619 vp3_decode_end(avctx);
2624 vp3_decode_end(avctx);
2625 ret = theora_decode_tables(avctx, &gb);
2627 ret = vp3_decode_init(avctx);
2629 vp3_decode_end(avctx);
2635 av_log(avctx, AV_LOG_ERROR,
2643 av_log(avctx, AV_LOG_ERROR, "Data packet without prior valid headers\n");
2658 if (s->avctx->debug & FF_DEBUG_PICT_INFO)
2659 av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
2660 s->keyframe ? "key" : "", avctx->frame_number + 1, s->qps[0]);
2663 avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL
2675 if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
2681 if ((ret = ff_thread_get_ext_buffer(avctx, &s->current_frame,
2701 av_log(avctx, AV_LOG_ERROR, "This build does not support decoding VP4.\n");
2706 if (avctx->frame_number == 0)
2707 av_log(s->avctx, AV_LOG_DEBUG,
2713 av_log(s->avctx, AV_LOG_ERROR,
2726 avpriv_request_sample(s->avctx, "macroblock dimension mismatch");
2733 avpriv_request_sample(s->avctx, "unexpected macroblock dimension multipler/divider");
2736 avpriv_request_sample(s->avctx, "unknown bits");
2742 av_log(s->avctx, AV_LOG_WARNING,
2746 if ((ret = ff_thread_get_ext_buffer(avctx, &s->golden_frame,
2749 ff_thread_release_ext_buffer(avctx, &s->last_frame);
2758 ff_thread_finish_setup(avctx);
2762 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
2768 av_log(s->avctx, AV_LOG_ERROR, "error in vp4_unpack_macroblocks\n");
2774 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
2778 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
2782 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
2788 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
2794 av_log(s->avctx, AV_LOG_ERROR, "error in vp4_unpack_dct_coeffs\n");
2825 frame->crop_right = avctx->coded_width - avctx->width - s->offset_x;
2827 frame->crop_bottom = avctx->coded_height - avctx->height - s->offset_y;
2831 if (!HAVE_THREADS || !(s->avctx->active_thread_type & FF_THREAD_FRAME)) {
2832 ret = update_frames(avctx);
2842 if (!HAVE_THREADS || !(s->avctx->active_thread_type & FF_THREAD_FRAME))
2849 AVCodecContext *avctx)
2854 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
2858 ff_dlog(avctx, "code length %d, curr entry %d, token %d\n",
2864 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
2868 if (read_huffman_tree(huff, gb, length, avctx))
2870 if (read_huffman_tree(huff, gb, length, avctx))
2881 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
2883 Vp3DecodeContext *s = avctx->priv_data;
2894 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
2897 avpriv_request_sample(s->avctx, "theora 0");
2904 av_log(avctx, AV_LOG_DEBUG,
2922 if (av_image_check_size(visible_width, visible_height, 0, avctx) < 0 ||
2927 av_log(avctx, AV_LOG_ERROR,
2938 av_log(avctx, AV_LOG_ERROR, "Invalid framerate\n");
2941 av_reduce(&avctx->framerate.den, &avctx->framerate.num,
2948 av_reduce(&avctx->sample_aspect_ratio.num,
2949 &avctx->sample_aspect_ratio.den,
2951 ff_set_sar(avctx, avctx->sample_aspect_ratio);
2963 avctx->pix_fmt = theora_pix_fmts[get_bits(gb, 2)];
2964 if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
2965 av_log(avctx, AV_LOG_ERROR, "Invalid pixel format\n");
2970 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
2974 ret = ff_set_dimensions(avctx, s->width, s->height);
2977 if (!(avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP)) {
2978 avctx->width = visible_width;
2979 avctx->height = visible_height;
2987 avctx->color_primaries = AVCOL_PRI_BT470M;
2989 avctx->color_primaries = AVCOL_PRI_BT470BG;
2992 avctx->colorspace = AVCOL_SPC_BT470BG;
2993 avctx->color_trc = AVCOL_TRC_BT709;
3000 static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
3002 Vp3DecodeContext *s = avctx->priv_data;
3039 av_log(avctx, AV_LOG_ERROR, "invalid number of base matrixes\n");
3073 av_log(avctx, AV_LOG_ERROR,
3086 av_log(avctx, AV_LOG_ERROR, "invalid qi %d > 63\n", qi);
3097 if ((ret = read_huffman_tree(&s->huffman_table[i], gb, 0, avctx)) < 0)
3106 static av_cold int theora_decode_init(AVCodecContext *avctx)
3108 Vp3DecodeContext *s = avctx->priv_data;
3116 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
3120 if (!avctx->extradata_size) {
3121 av_log(avctx, AV_LOG_ERROR, "Missing extradata!\n");
3125 if (avpriv_split_xiph_headers(avctx->extradata, avctx->extradata_size,
3127 av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
3141 av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n");
3150 if (theora_decode_header(avctx, &gb) < 0)
3155 // theora_decode_comments(avctx, gb);
3158 if (theora_decode_tables(avctx, &gb))
3162 av_log(avctx, AV_LOG_ERROR,
3167 av_log(avctx, AV_LOG_WARNING,
3174 return vp3_decode_init(avctx);