typedef struct QtrleContext {
AVCodecContext *avctx;
- AVFrame frame;
+ AVFrame *frame;
GetByteContext g;
uint32_t pal[256];
{
int rle_code;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
uint8_t pi0, pi1; /* 2 8-pixel values */
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int skip;
/* skip & 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
{
int rle_code, i;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
uint8_t pi[16]; /* 16 palette indices */
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int num_pixels = (bpp == 4) ? 8 : 16;
while (lines_to_change--) {
{
int rle_code;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
uint8_t pi1, pi2, pi3, pi4; /* 4 palette indexes */
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
while (lines_to_change--) {
pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->g) - 1));
{
int rle_code;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
uint16_t rgb16;
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
while (lines_to_change--) {
pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 2;
{
int rle_code;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
uint8_t r, g, b;
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
while (lines_to_change--) {
pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 3;
{
int rle_code;
int pixel_ptr;
- int row_inc = s->frame.linesize[0];
+ int row_inc = s->frame->linesize[0];
unsigned int argb;
- uint8_t *rgb = s->frame.data[0];
- int pixel_limit = s->frame.linesize[0] * s->avctx->height;
+ uint8_t *rgb = s->frame->data[0];
+ int pixel_limit = s->frame->linesize[0] * s->avctx->height;
while (lines_to_change--) {
pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 4;
return AVERROR_INVALIDDATA;
}
- avcodec_get_frame_defaults(&s->frame);
+ s->frame = av_frame_alloc();
+ if (!s->frame)
+ return AVERROR(ENOMEM);
return 0;
}
int ret;
bytestream2_init(&s->g, avpkt->data, avpkt->size);
- if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;
/* check if this frame is even supposed to change */
start_line = 0;
height = s->avctx->height;
}
- row_ptr = s->frame.linesize[0] * start_line;
+ row_ptr = s->frame->linesize[0] * start_line;
switch (avctx->bits_per_coded_sample) {
case 1:
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
if (pal) {
- s->frame.palette_has_changed = 1;
+ s->frame->palette_has_changed = 1;
memcpy(s->pal, pal, AVPALETTE_SIZE);
}
/* make the palette available on the way out */
- memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
+ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
}
done:
- if ((ret = av_frame_ref(data, &s->frame)) < 0)
+ if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
*got_frame = 1;
{
QtrleContext *s = avctx->priv_data;
- av_frame_unref(&s->frame);
+ av_frame_free(&s->frame);
return 0;
}