Lines Matching defs:avctx
28 static av_cold int m101_decode_init(AVCodecContext *avctx)
30 if (avctx->extradata_size < 6*4) {
31 avpriv_request_sample(avctx, "Missing or too small extradata (size %d)", avctx->extradata_size);
35 if (avctx->extradata[2*4] == 10)
36 avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
37 else if (avctx->extradata[2*4] == 8) {
38 avctx->pix_fmt = AV_PIX_FMT_YUYV422;
40 avpriv_request_sample(avctx, "BPS %d", avctx->extradata[2*4]);
47 static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
53 int min_stride = 2 * avctx->width;
54 int bits = avctx->extradata[2*4];
56 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
61 stride = AV_RL32(avctx->extradata + 5*4);
63 if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
64 min_stride = (avctx->width + 15) / 16 * 40;
66 if (stride < min_stride || avpkt->size < stride * (uint64_t)avctx->height) {
67 av_log(avctx, AV_LOG_ERROR, "stride (%d) is invalid for packet sized %d\n",
72 frame->interlaced_frame = ((avctx->extradata[3*4] & 3) != 3);
74 frame->top_field_first = avctx->extradata[3*4] & 1;
76 for (y = 0; y < avctx->height; y++) {
79 src_y = ((y&1)^frame->top_field_first) ? y/2 : (y/2 + avctx->height/2);
82 memcpy(line, buf + src_y*stride, 2*avctx->width);
88 for (block = 0; 16*block < avctx->width; block ++) {
90 for (x = 0; x < 16 && x + 16*block < avctx->width; x++) {