Lines Matching defs:avctx
46 static int rle_uncompress(AVCodecContext *avctx, GetByteContext *gb, PutByteContext *pb)
48 MSCCContext *s = avctx->priv_data;
57 switch (avctx->bits_per_coded_sample) {
73 switch (avctx->bits_per_coded_sample) {
95 bytestream2_seek_p(pb, y * avctx->width * s->bpp, SEEK_SET);
103 bytestream2_seek_p(pb, y * avctx->width * s->bpp + x * s->bpp, SEEK_SET);
106 switch (avctx->bits_per_coded_sample) {
132 static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
135 MSCCContext *s = avctx->priv_data;
146 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
149 if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
158 av_log(avctx, AV_LOG_ERROR,
166 av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret);
171 if (avctx->codec_id == AV_CODEC_ID_MSCC) {
188 av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", ret);
195 ret = rle_uncompress(avctx, &gb, &pb);
199 for (j = 0; j < avctx->height; j++) {
200 memcpy(frame->data[0] + (avctx->height - j - 1) * frame->linesize[0],
201 s->uncomp_buf + s->bpp * j * avctx->width, s->bpp * avctx->width);
212 static av_cold int decode_init(AVCodecContext *avctx)
214 MSCCContext *s = avctx->priv_data;
217 switch (avctx->bits_per_coded_sample) {
218 case 8: avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
219 case 16: avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
220 case 24: avctx->pix_fmt = AV_PIX_FMT_BGR24; break;
221 case 32: avctx->pix_fmt = AV_PIX_FMT_BGRA; break;
223 av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n", avctx->bits_per_coded_sample);
227 s->bpp = avctx->bits_per_coded_sample >> 3;
228 stride = 4 * ((avctx->width * avctx->bits_per_coded_sample + 31) / 32);
230 s->decomp_size = 2 * avctx->height * stride;
234 s->uncomp_size = avctx->height * stride;
238 return ff_inflate_init(&s->zstream, avctx);
241 static av_cold int decode_close(AVCodecContext *avctx)
243 MSCCContext *s = avctx->priv_data;