Lines Matching defs:avctx
67 av_log (s->avctx, AV_LOG_ERROR, "Invalid pixel_ptr = %d > pixel_limit = %d\n", \
73 AVCodecContext *avctx;
81 static av_cold int flic_decode_init(AVCodecContext *avctx)
83 FlicDecodeContext *s = avctx->priv_data;
84 unsigned char *fli_header = (unsigned char *)avctx->extradata;
87 if (avctx->extradata_size != 0 &&
88 avctx->extradata_size != 12 &&
89 avctx->extradata_size != 128 &&
90 avctx->extradata_size != 256 &&
91 avctx->extradata_size != 904 &&
92 avctx->extradata_size != 1024) {
93 av_log(avctx, AV_LOG_ERROR, "Unexpected extradata size %d\n", avctx->extradata_size);
97 s->avctx = avctx;
99 if (s->avctx->extradata_size == 12) {
103 } else if (avctx->extradata_size == 1024) {
104 uint8_t *ptr = avctx->extradata;
113 } else if (avctx->extradata_size == 0 ||
114 avctx->extradata_size == 256 ||
116 avctx->extradata_size == 904) {
133 case 8 : avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
134 case 15 : avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
135 case 16 : avctx->pix_fmt = AV_PIX_FMT_RGB565; break;
136 case 24 : avctx->pix_fmt = AV_PIX_FMT_BGR24; break;
138 av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
151 static int flic_decode_frame_8BPP(AVCodecContext *avctx,
155 FlicDecodeContext *s = avctx->priv_data;
189 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
193 pixel_limit = s->avctx->height * s->frame->linesize[0];
214 av_log(avctx, AV_LOG_WARNING,
282 if (line_packets > s->avctx->height)
286 av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
296 pixel_countdown = s->avctx->width;
332 if (starting_line >= s->avctx->height)
341 pixel_countdown = s->avctx->width;
380 s->frame->linesize[0] * s->avctx->height);
387 for (lines = 0; lines < s->avctx->height; lines++) {
392 pixel_countdown = s->avctx->width;
398 av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
409 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
421 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
433 if (chunk_size - 6 != FFALIGN(s->avctx->width, 4) * s->avctx->height) {
434 av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
438 for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
441 s->avctx->width);
442 if (s->avctx->width & 3)
443 bytestream2_skip(&g2, 4 - (s->avctx->width & 3));
453 av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
460 av_log(avctx, AV_LOG_ERROR, "Chunk overread\n");
471 av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
490 static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
496 FlicDecodeContext *s = avctx->priv_data;
523 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
527 pixel_limit = s->avctx->height * s->frame->linesize[0];
546 av_log(avctx, AV_LOG_WARNING,
561 ff_dlog(avctx,
579 if (line_packets > s->avctx->height)
586 pixel_countdown = s->avctx->width;
620 av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n");
627 s->frame->linesize[0] * s->avctx->height);
632 for (lines = 0; lines < s->avctx->height; lines++) {
637 pixel_countdown = (s->avctx->width * 2);
650 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n",
663 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
676 pixel_countdown = s->avctx->width;
688 for (lines = 0; lines < s->avctx->height; lines++) {
693 pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */
707 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
720 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
733 if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*2) {
734 av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
739 if (bytestream2_get_bytes_left(&g2) < 2 * s->avctx->width * s->avctx->height )
741 for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
744 pixel_countdown = s->avctx->width;
751 if (s->avctx->width & 1)
763 av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
770 av_log(avctx, AV_LOG_ERROR, "Chunk overread\n");
781 av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
792 static int flic_decode_frame_24BPP(AVCodecContext *avctx,
796 FlicDecodeContext *s = avctx->priv_data;
823 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
827 pixel_limit = s->avctx->height * s->frame->linesize[0];
846 av_log(avctx, AV_LOG_WARNING,
861 ff_dlog(avctx,
879 if (line_packets > s->avctx->height)
886 pixel_countdown = s->avctx->width;
921 av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n");
928 s->frame->linesize[0] * s->avctx->height);
933 for (lines = 0; lines < s->avctx->height; lines++) {
938 pixel_countdown = (s->avctx->width * 3);
951 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n",
964 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
976 for (lines = 0; lines < s->avctx->height; lines++) {
981 pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */
995 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
1009 av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
1022 if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*3) {
1023 av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
1027 for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
1030 bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width);
1031 if (s->avctx->width & 1)
1043 av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
1050 av_log(avctx, AV_LOG_ERROR, "Chunk overread\n");
1061 av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
1072 static int flic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
1077 if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
1078 return flic_decode_frame_8BPP(avctx, frame, got_frame,
1080 } else if ((avctx->pix_fmt == AV_PIX_FMT_RGB555) ||
1081 (avctx->pix_fmt == AV_PIX_FMT_RGB565)) {
1082 return flic_decode_frame_15_16BPP(avctx, frame, got_frame,
1084 } else if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
1085 return flic_decode_frame_24BPP(avctx, frame, got_frame,
1093 av_log(avctx, AV_LOG_ERROR, "Unknown FLC format, my science cannot explain how this happened.\n");
1098 static av_cold int flic_decode_end(AVCodecContext *avctx)
1100 FlicDecodeContext *s = avctx->priv_data;