Lines Matching defs:avctx
149 static av_cold int magy_encode_init(AVCodecContext *avctx)
151 MagicYUVContext *s = avctx->priv_data;
155 switch (avctx->pix_fmt) {
157 avctx->codec_tag = MKTAG('M', '8', 'R', 'G');
162 avctx->codec_tag = MKTAG('M', '8', 'R', 'A');
167 avctx->codec_tag = MKTAG('M', '8', 'Y', '0');
175 avctx->codec_tag = MKTAG('M', '8', 'Y', '2');
181 avctx->codec_tag = MKTAG('M', '8', 'Y', '4');
185 avctx->codec_tag = MKTAG('M', '8', 'Y', 'A');
189 avctx->codec_tag = MKTAG('M', '8', 'G', '0');
194 s->decorrelate_buf[0] = av_calloc(2U * avctx->height, FFALIGN(avctx->width, 16));
197 s->decorrelate_buf[1] = s->decorrelate_buf[0] + avctx->height * FFALIGN(avctx->width, 16);
202 s->planes = av_pix_fmt_count_planes(avctx->pix_fmt);
207 s->slices[i] = av_malloc(avctx->width * (avctx->height + 2) +
210 av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer.\n");
221 avctx->extradata_size = MAGICYUV_EXTRADATA_SIZE;
223 avctx->extradata = av_mallocz(avctx->extradata_size +
226 if (!avctx->extradata) {
227 av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata.\n");
231 bytestream2_init_writer(&pb, avctx->extradata, MAGICYUV_EXTRADATA_SIZE);
244 bytestream2_put_le32(&pb, avctx->width);
245 bytestream2_put_le32(&pb, avctx->height);
246 bytestream2_put_le32(&pb, avctx->width);
247 bytestream2_put_le32(&pb, avctx->height);
355 static int encode_table(AVCodecContext *avctx, uint8_t *dst,
413 static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
416 MagicYUVContext *s = avctx->priv_data;
418 const int width = avctx->width, height = avctx->height;
421 ret = ff_alloc_packet(avctx, pkt, (256 + 4 * s->nb_slices + width * height) *
439 bytestream2_put_le32(&pb, avctx->width);
440 bytestream2_put_le32(&pb, avctx->height);
441 bytestream2_put_le32(&pb, avctx->width);
442 bytestream2_put_le32(&pb, avctx->height);
502 encode_table(avctx, s->slices[i],
537 static av_cold int magy_encode_close(AVCodecContext *avctx)
539 MagicYUVContext *s = avctx->priv_data;