]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/zmbvenc.c
Remove dead nested assignment found by CSA
[frescor/ffmpeg.git] / libavcodec / zmbvenc.c
index 0bf1dff1926e9ff7d9ac0e69399a47fdda2d8337..5268b939d9fa9a2db499291b89474882b65ccdfc 100644 (file)
  */
 
 /**
- * @file zmbvenc.c
+ * @file libavcodec/zmbvenc.c
  * Zip Motion Blocks Video encoder
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 
 #include <zlib.h>
@@ -116,7 +117,6 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
     AVFrame * const p = &c->pic;
     uint8_t *src, *prev;
     uint32_t *palptr;
-    int zret = Z_OK;
     int len = 0;
     int keyframe, chpal;
     int fl;
@@ -225,7 +225,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
     c->zstream.next_out = c->comp_buf;
     c->zstream.avail_out = c->comp_size;
     c->zstream.total_out = 0;
-    if((zret = deflate(&c->zstream, Z_SYNC_FLUSH)) != Z_OK){
+    if(deflate(&c->zstream, Z_SYNC_FLUSH) != Z_OK){
         av_log(avctx, AV_LOG_ERROR, "Error compressing data\n");
         return -1;
     }
@@ -246,11 +246,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
     int lvl = 9;
 
     for(i=1; i<256; i++)
-        score_tab[i]= -i * log2(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 256;
+        score_tab[i]= -i * log(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * (256/M_LN2);
 
     c->avctx = avctx;
 
-    c->pic.data[0] = NULL;
     c->curfrm = 0;
     c->keyint = avctx->keyint_min;
     c->range = 8;
@@ -300,6 +299,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return -1;
     }
 
+    avctx->coded_frame = (AVFrame*)&c->pic;
+
     return 0;
 }
 
@@ -329,6 +330,6 @@ AVCodec zmbv_encoder = {
     encode_init,
     encode_frame,
     encode_end,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_PAL8, -1},
-    .long_name = "Zip Motion Blocks Video",
+    .pix_fmts = (enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
 };