]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/8bps.c
avoid 2 additions (1 cpu cycle) per MB
[ffmpeg] / libavcodec / 8bps.c
index 297465043fe00c2000e7232292e83f1edc975839..64f515971f311503ea88965f11bbf4ce3da97eba 100644 (file)
@@ -17,7 +17,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
 
 /**
  *   http://www.pcisys.net/~melanson/codecs/
  *
  * Supports: PAL8 (RGB 8bpp, paletted)
- *         : BGR24 (RGB 24bpp) (can also output it as RGBA32)
- *         : RGBA32 (RGB 32bpp, 4th plane is probably alpha and it's ignored)
+ *         : BGR24 (RGB 24bpp) (can also output it as RGB32)
+ *         : RGB32 (RGB 32bpp, 4th plane is probably alpha and it's ignored)
  *
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "common.h"
 #include "avcodec.h"
 
 
-static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGBA32, -1};
+static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, -1};
 
 /*
  * Decoder context
@@ -61,7 +59,7 @@ typedef struct EightBpsContext {
  */
 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
 {
-        EightBpsContext * const c = (EightBpsContext *)avctx->priv_data;
+        EightBpsContext * const c = avctx->priv_data;
         unsigned char *encoded = (unsigned char *)buf;
         unsigned char *pixptr, *pixptr_end;
         unsigned int height = avctx->height; // Real image height
@@ -89,7 +87,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
         if (planes == 4)
                 planes--;
 
-        px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGBA32);
+        px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32);
 
         for (p = 0; p < planes; p++) {
                 /* Lines length pointer for this plane */
@@ -152,10 +150,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
  */
 static int decode_init(AVCodecContext *avctx)
 {
-        EightBpsContext * const c = (EightBpsContext *)avctx->priv_data;
+        EightBpsContext * const c = avctx->priv_data;
 
         c->avctx = avctx;
-        avctx->has_b_frames = 0;
 
         c->pic.data[0] = NULL;
 
@@ -181,7 +178,7 @@ static int decode_init(AVCodecContext *avctx)
                         c->planemap[2] = 0; // 3rd plane is blue
                         break;
                 case 32:
-                        avctx->pix_fmt = PIX_FMT_RGBA32;
+                        avctx->pix_fmt = PIX_FMT_RGB32;
                         c->planes = 4;
 #ifdef WORDS_BIGENDIAN
                         c->planemap[0] = 1; // 1st plane is red
@@ -213,7 +210,7 @@ static int decode_init(AVCodecContext *avctx)
  */
 static int decode_end(AVCodecContext *avctx)
 {
-        EightBpsContext * const c = (EightBpsContext *)avctx->priv_data;
+        EightBpsContext * const c = avctx->priv_data;
 
         if (c->pic.data[0])
                 avctx->release_buffer(avctx, &c->pic);