Lines Matching refs:ctx
36 static void draw_horiz_band(AVCodecContext *ctx, const AVFrame *fr, int offset[4],
47 pix_fmt_desc = av_pix_fmt_desc_get(ctx->pix_fmt);
48 chroma_w = -((-ctx->width) >> pix_fmt_desc->log2_chroma_w);
51 shift_height = -((-ctx->height) >> pix_fmt_desc->log2_chroma_h);
54 memcpy(slice_byte_buffer + ctx->width * slice_position + i * ctx->width,
55 fr->data[0] + offset[0] + i * fr->linesize[0], ctx->width);
58 memcpy(slice_byte_buffer + ctx->width * ctx->height + chroma_w * shift_slice_position + i * chroma_w,
62 memcpy(slice_byte_buffer + ctx->width * ctx->height + chroma_w * shift_height + chroma_w * shift_slice_position + i * chroma_w,
70 AVCodecContext *ctx= NULL;
109 ctx = avcodec_alloc_context3(codec);
110 if (!ctx) {
115 result = avcodec_parameters_to_context(ctx, origin_par);
121 ctx->draw_horiz_band = draw_horiz_band;
122 ctx->thread_count = 1;
124 result = avcodec_open2(ctx, codec, NULL);
126 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
147 byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 32);
171 result = avcodec_send_packet(ctx, pkt);
181 result = avcodec_receive_frame(ctx, fr);
194 ctx->pix_fmt, ctx->width, ctx->height, 1);
216 avcodec_free_context(&ctx);