Lines Matching defs:avctx

55 static void do_vflip(AVCodecContext *avctx, AVFrame *pic, int vflip)
62 pic->data[1] += (avctx->height - 1) * pic->linesize[1];
64 pic->data[2] += (avctx->height - 1) * pic->linesize[2];
70 pic->data[0] += (avctx->height - 1) * pic->linesize[0];
74 pic->data[0] += (avctx->height - 1) * pic->linesize[0];
76 pic->data[1] += (AV_CEIL_RSHIFT(avctx->height, 2) - 1) * pic->linesize[1];
78 pic->data[2] += (AV_CEIL_RSHIFT(avctx->height, 2) - 1) * pic->linesize[2];
82 pic->data[0] += (avctx->height - 1) * pic->linesize[0];
84 pic->data[1] += (AV_CEIL_RSHIFT(avctx->height, 1) - 1) * pic->linesize[1];
86 pic->data[2] += (AV_CEIL_RSHIFT(avctx->height, 1) - 1) * pic->linesize[2];
92 static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
100 if (src_size < get_raw_size(id, avctx->width, avctx->height)) {
101 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
105 avctx->pix_fmt = id;
106 if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
109 do_vflip(avctx, pic, vflipped);
112 for (h = 0; h < avctx->height; h++) {
113 memcpy(dst, src, avctx->width * bpp);
114 src += avctx->width * bpp;
118 do_vflip(avctx, pic, vflipped);
123 static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
133 if (src_size < get_raw_size(AV_PIX_FMT_YUV410P, avctx->width, avctx->height)) {
134 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
138 avctx->pix_fmt = AV_PIX_FMT_YUV410P;
139 if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
142 do_vflip(avctx, pic, vflipped);
144 height = avctx->height & ~3;
145 width = avctx->width & ~3;
146 hmargin = avctx->width - width;
147 vmargin = avctx->height - height;
148 huvborder = AV_CEIL_RSHIFT(avctx->width, 2) - 1;
213 do_vflip(avctx, pic, vflipped);
218 static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
228 if (src_size < get_raw_size(AV_PIX_FMT_YUV420P, avctx->width, avctx->height)) {
229 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
233 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
234 if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
237 do_vflip(avctx, pic, vflipped);
239 height = avctx->height & ~1;
240 width = avctx->width & ~1;
241 hmargin = avctx->width - width;
242 vmargin = avctx->height - height;
243 huvborder = AV_CEIL_RSHIFT(avctx->width, 1) - 1;
285 do_vflip(avctx, pic, vflipped);
290 static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
298 if (src_size < get_raw_size(AV_PIX_FMT_YUV444P, avctx->width, avctx->height)) {
299 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
303 avctx->pix_fmt = AV_PIX_FMT_YUV444P;
304 if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
307 do_vflip(avctx, pic, vflipped);
312 for (h = 0; h < avctx->height; h++) {
313 for (w = 0; w < avctx->width; w++) {
323 do_vflip(avctx, pic, vflipped);
349 static int check_slice_size(AVCodecContext *avctx,
356 av_log(avctx, AV_LOG_ERROR,
362 av_log(avctx, AV_LOG_ERROR, "invalid slice size %d\n",
369 av_log(avctx, AV_LOG_ERROR,
377 static int load_buffer(AVCodecContext *avctx,
386 av_log(avctx, AV_LOG_ERROR, "no slice data\n");
391 avpriv_request_sample(avctx, "%d slices for %dx%d", *nslices,
392 avctx->width, avctx->height);
422 static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
437 ret = load_buffer(avctx, src, src_size, &gb, &nslices, &off);
446 if (slice_size <= 16 + (avctx->height * avctx->width / (8 * nslices)))
451 if (off_check - avctx->discard_damaged_percentage*off_check/100 > src_size)
454 avctx->pix_fmt = fmt;
455 if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
458 do_vflip(avctx, pic, vflipped);
465 ret = check_slice_size(avctx, src, src_size, slice_size, off);
472 line += decode_slice(&gb2, pic, line, avctx->height - line, lru);
477 if (avctx->height - line) {
478 avpriv_request_sample(avctx, "Not enough slice data available");
481 do_vflip(avctx, pic, vflipped);
539 static int dxtory_decode_v2_565(AVCodecContext *avctx, AVFrame *pic,
545 return dxtory_decode_v2(avctx, pic, src, src_size,
550 return dxtory_decode_v2(avctx, pic, src, src_size,
585 static int dxtory_decode_v2_rgb(AVCodecContext *avctx, AVFrame *pic,
589 return dxtory_decode_v2(avctx, pic, src, src_size,
664 static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic,
668 return dxtory_decode_v2(avctx, pic, src, src_size,
736 static int dxtory_decode_v2_420(AVCodecContext *avctx, AVFrame *pic,
740 return dxtory_decode_v2(avctx, pic, src, src_size,
777 static int dxtory_decode_v2_444(AVCodecContext *avctx, AVFrame *pic,
781 return dxtory_decode_v2(avctx, pic, src, src_size,
787 static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
795 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
805 ret = dxtory_decode_v1_rgb(avctx, pic, src + 16, avpkt->size - 16,
810 ret = dxtory_decode_v2_rgb(avctx, pic, src + 16, avpkt->size - 16, vflipped);
814 ret = dxtory_decode_v1_420(avctx, pic, src + 16, avpkt->size - 16, vflipped);
818 ret = dxtory_decode_v2_420(avctx, pic, src + 16, avpkt->size - 16, vflipped);
822 ret = dxtory_decode_v1_410(avctx, pic, src + 16, avpkt->size - 16, vflipped);
826 ret = dxtory_decode_v2_410(avctx, pic, src + 16, avpkt->size - 16, vflipped);
830 ret = dxtory_decode_v1_444(avctx, pic, src + 16, avpkt->size - 16, vflipped);
834 ret = dxtory_decode_v2_444(avctx, pic, src + 16, avpkt->size - 16, vflipped);
838 ret = dxtory_decode_v1_rgb(avctx, pic, src + 16, avpkt->size - 16,
843 ret = dxtory_decode_v2_565(avctx, pic, src + 16, avpkt->size - 16, 1, vflipped);
849 ret = dxtory_decode_v1_rgb(avctx, pic, src + 16, avpkt->size - 16,
856 ret = dxtory_decode_v2_565(avctx, pic, src + 16, avpkt->size - 16, 0, vflipped);
859 avpriv_request_sample(avctx, "Frame header %"PRIX32, type);