Lines Matching refs:avctx
43 AVCodecContext *avctx;
51 static av_cold int msrle_decode_init(AVCodecContext *avctx)
53 MsrleContext *s = avctx->priv_data;
56 s->avctx = avctx;
58 switch (avctx->bits_per_coded_sample) {
60 avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
64 avctx->pix_fmt = AV_PIX_FMT_PAL8;
67 avctx->pix_fmt = AV_PIX_FMT_BGR24;
70 av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
78 if (avctx->extradata_size >= 4)
79 for (i = 0; i < FFMIN(avctx->extradata_size, AVPALETTE_SIZE)/4; i++)
80 s->pal[i] = 0xFFU<<24 | AV_RL32(avctx->extradata+4*i);
85 static int msrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
90 MsrleContext *s = avctx->priv_data;
91 int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
97 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
100 if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
101 s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
108 if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
109 int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
111 const uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
117 for (i = 0; i < avctx->height; i++) {
118 if (avctx->bits_per_coded_sample == 4) {
119 for (j = 0; j < avctx->width - 1; j += 2) {
123 if (avctx->width & 1)
133 ff_msrle_decode(avctx, s->frame, avctx->bits_per_coded_sample, &s->gb);
145 static void msrle_decode_flush(AVCodecContext *avctx)
147 MsrleContext *s = avctx->priv_data;
152 static av_cold int msrle_decode_end(AVCodecContext *avctx)
154 MsrleContext *s = avctx->priv_data;