Lines Matching defs:avctx
32 AVCodecContext *avctx;
41 static av_cold int xan_decode_end(AVCodecContext *avctx)
43 XanContext *s = avctx->priv_data;
53 static av_cold int xan_decode_init(AVCodecContext *avctx)
55 XanContext *s = avctx->priv_data;
57 s->avctx = avctx;
59 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
61 if (avctx->height < 8) {
62 av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
65 if (avctx->width & 1) {
66 av_log(avctx, AV_LOG_ERROR, "Invalid frame width: %d.\n", avctx->width);
70 s->buffer_size = avctx->width * avctx->height;
180 static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
182 XanContext *s = avctx->priv_data;
193 av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n");
204 av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n");
212 av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n");
221 for (j = 0; j < avctx->height >> 1; j++) {
222 for (i = 0; i < avctx->width >> 1; i++) {
239 if (avctx->height & 1) {
240 memcpy(U, U - s->pic->linesize[1], avctx->width >> 1);
241 memcpy(V, V - s->pic->linesize[2], avctx->width >> 1);
247 for (j = 0; j < avctx->height >> 2; j++) {
248 for (i = 0; i < avctx->width >> 1; i += 2) {
267 if (avctx->height & 3) {
268 int lines = ((avctx->height + 1) >> 1) - (avctx->height >> 2) * 2;
278 static int xan_decode_frame_type0(AVCodecContext *avctx)
280 XanContext *s = avctx->priv_data;
290 if ((ret = xan_decode_chroma(avctx, chroma_off)) != 0)
294 av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
300 av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
307 for (j = 1; j < avctx->width - 1; j += 2) {
315 ybuf += avctx->width;
317 for (i = 1; i < avctx->height; i++) {
320 for (j = 1; j < avctx->width - 1; j += 2) {
328 ybuf += avctx->width;
347 for (j = 0; j < avctx->height; j++) {
348 for (i = 0; i < avctx->width; i++)
350 src += avctx->width;
357 static int xan_decode_frame_type1(AVCodecContext *avctx)
359 XanContext *s = avctx->priv_data;
365 if ((ret = xan_decode_chroma(avctx, bytestream2_get_le32(&s->gb))) != 0)
372 av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
377 for (i = 0; i < avctx->height; i++) {
380 for (j = 1; j < avctx->width - 1; j += 2) {
387 ybuf += avctx->width;
392 for (j = 0; j < avctx->height; j++) {
393 for (i = 0; i < avctx->width; i++)
395 src += avctx->width;
402 static int xan_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
405 XanContext *s = avctx->priv_data;
409 if ((ret = ff_reget_buffer(avctx, s->pic, 0)) < 0)
416 ret = xan_decode_frame_type0(avctx);
419 ret = xan_decode_frame_type1(avctx);
422 av_log(avctx, AV_LOG_ERROR, "Unknown frame type %d\n", ftype);