if (((unsigned int)avctx->width > 32000) || ((unsigned int)avctx->height > 32000)) { av_log(avctx, AV_LOG_ERROR, "Bad image size (w = %d, h = %d).\n", avctx->width, avctx->height); return 1; }
static int decode_init(AVCodecContext *avctx){	EightBpsContext * const c = (EightBpsContext *)avctx->priv_data;	c->avctx = avctx;	avctx->has_b_frames = 0;	c->pic.data[0] = NULL;	switch (avctx->bits_per_sample) {		case 8:			avctx->pix_fmt = PIX_FMT_PAL8;			c->planes = 1;			c->planemap[0] = 0; // 1st plane is palette indexes			if (avctx->palctrl == NULL) {				av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n");				return -1;			}			break;		case 24:			avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);			c->planes = 3;			c->planemap[0] = 2; // 1st plane is red			c->planemap[1] = 1; // 2nd plane is green			c->planemap[2] = 0; // 3rd plane is blue			break;		case 32:			avctx->pix_fmt = PIX_FMT_RGBA32;			c->planes = 4;#ifdef WORDS_BIGENDIAN			c->planemap[0] = 1; // 1st plane is red			c->planemap[1] = 2; // 2nd plane is green			c->planemap[2] = 3; // 3rd plane is blue			c->planemap[3] = 0; // 4th plane is alpha???#else			c->planemap[0] = 2; // 1st plane is red			c->planemap[1] = 1; // 2nd plane is green			c->planemap[2] = 0; // 3rd plane is blue			c->planemap[3] = 3; // 4th plane is alpha???#endif			break;		default:			av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_sample);			return -1;	}  return 0;}