Browse code

msvideo1enc: minor cosmetic cleanup, use FFALIGN, avoid calculating value twice and add a missing "const".

Reimar Döffinger authored on 2011/05/05 04:30:56
Showing 1 changed files
... ...
@@ -78,8 +78,8 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
78 78
     *p = *pict;
79 79
     if(!c->prev)
80 80
         c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
81
-    prevptr = c->prev + avctx->width * 3 * (((avctx->height + 3)&~3) - 1);
82
-    src = (uint16_t*)(p->data[0] + p->linesize[0]*(((avctx->height + 3)&~3) - 1));
81
+    prevptr = c->prev + avctx->width * 3 * (FFALIGN(avctx->height, 4) - 1);
82
+    src = (uint16_t*)(p->data[0] + p->linesize[0]*(FFALIGN(avctx->height, 4) - 1));
83 83
     if(c->keyint >= avctx->keyint_min)
84 84
         keyframe = 1;
85 85
 
... ...
@@ -96,7 +96,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
96 96
                 for(i = 0; i < 4; i++){
97 97
                     uint16_t val = src[x + i - j*p->linesize[0]/2];
98 98
                     for(k = 0; k < 3; k++){
99
-                        c->block[(i + j*4)*3 + k] = (val >> (10-k*5)) & 0x1F;
99
+                        c->block[(i + j*4)*3 + k] =
100 100
                         c->block2[remap[i + j*4]*3 + k] = (val >> (10-k*5)) & 0x1F;
101 101
                     }
102 102
                 }
... ...
@@ -293,6 +293,6 @@ AVCodec ff_msvideo1_encoder = {
293 293
     encode_init,
294 294
     encode_frame,
295 295
     encode_end,
296
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
296
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
297 297
     .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video-1"),
298 298
 };