diff msrle.c @ 1630:586b5c08863c libavcodec

- Add reget_buffer() function to AVCodecContext - Add default reget_buffer implementation in libavcodec/utils.c - Remove AVCodecContext.cr_available, no longer needed - Remove CODEC_CAP_CR, no longer used - Add img_copy() prototype to avcodec.h (function from imgconvert.c) - Rename img_copy() to jpeg_img_copy() in libavformat/jpeg.c to avoid conflict - Updated msrle, msvideo1, rpza, smc to use reget_buffer
author rtognimp
date Wed, 26 Nov 2003 20:57:15 +0000
parents 7f4d1ab4ac17
children 1514fd5d434b
line wrap: on
line diff
--- a/msrle.c	Tue Nov 25 00:35:18 2003 +0000
+++ b/msrle.c	Wed Nov 26 20:57:15 2003 +0000
@@ -41,7 +41,6 @@
 typedef struct MsrleContext {
     AVCodecContext *avctx;
     AVFrame frame;
-    AVFrame prev_frame;
 
     unsigned char *buf;
     int size;
@@ -244,7 +243,7 @@
 
     avctx->pix_fmt = PIX_FMT_PAL8;
     avctx->has_b_frames = 0;
-    s->frame.data[0] = s->prev_frame.data[0] = NULL;
+    s->frame.data[0] = NULL;
 
     return 0;
 }
@@ -263,26 +262,12 @@
     s->size = buf_size;
 
     s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE;
-    if (avctx->cr_available)
-        s->frame.buffer_hints |= FF_BUFFER_HINTS_REUSABLE;
-    else
-        s->frame.buffer_hints |= FF_BUFFER_HINTS_READABLE;
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "  MS RLE: get_buffer() failed\n");
+    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
+    if (avctx->reget_buffer(avctx, &s->frame)) {
+        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
         return -1;
     }
 
-    if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0]))
-        av_log(avctx, AV_LOG_ERROR, "  MS RLE: Buffer linesize changed: current %u, previous %u.\n"
-                "          Expect wrong image and/or crash!\n",
-                s->frame.linesize[0], s->prev_frame.linesize[0]);
-
-    /* grossly inefficient, but...oh well */
-    if (s->prev_frame.data[0] != NULL)
-	memcpy(s->frame.data[0], s->prev_frame.data[0], 
-        s->frame.linesize[0] * s->avctx->height);
-
     switch (avctx->bits_per_sample) {
         case 8:
             msrle_decode_pal8(s);
@@ -295,13 +280,6 @@
                    avctx->bits_per_sample);
     }
 
-    if (s->prev_frame.data[0])
-        avctx->release_buffer(avctx, &s->prev_frame);
-
-    /* shuffle frames */
-  if (!avctx->cr_available)
-    s->prev_frame = s->frame;
-
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = s->frame;
 
@@ -314,8 +292,8 @@
     MsrleContext *s = (MsrleContext *)avctx->priv_data;
 
     /* release the last frame */
-    if (s->prev_frame.data[0])
-        avctx->release_buffer(avctx, &s->prev_frame);
+    if (s->frame.data[0])
+        avctx->release_buffer(avctx, &s->frame);
 
     return 0;
 }
@@ -329,5 +307,5 @@
     NULL,
     msrle_decode_end,
     msrle_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_CR,
+    CODEC_CAP_DR1,
 };