[FFmpeg-cvslog] msvideo1enc: minor cosmetic cleanup, use FFALIGN, avoid calculating value

Reimar Döffinger git at videolan.org
Sat May 7 09:46:39 CEST 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Wed May  4 21:30:56 2011 +0200| [20e5d64a1a4ce0fed3399f4b09e781c52091e854] | committer: Reimar Döffinger

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20e5d64a1a4ce0fed3399f4b09e781c52091e854
---

 libavcodec/msvideo1enc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/msvideo1enc.c b/libavcodec/msvideo1enc.c
index 7f280fc..0b6d474 100644
--- a/libavcodec/msvideo1enc.c
+++ b/libavcodec/msvideo1enc.c
@@ -78,8 +78,8 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
     *p = *pict;
     if(!c->prev)
         c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
-    prevptr = c->prev + avctx->width * 3 * (((avctx->height + 3)&~3) - 1);
-    src = (uint16_t*)(p->data[0] + p->linesize[0]*(((avctx->height + 3)&~3) - 1));
+    prevptr = c->prev + avctx->width * 3 * (FFALIGN(avctx->height, 4) - 1);
+    src = (uint16_t*)(p->data[0] + p->linesize[0]*(FFALIGN(avctx->height, 4) - 1));
     if(c->keyint >= avctx->keyint_min)
         keyframe = 1;
 
@@ -96,7 +96,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
                 for(i = 0; i < 4; i++){
                     uint16_t val = src[x + i - j*p->linesize[0]/2];
                     for(k = 0; k < 3; k++){
-                        c->block[(i + j*4)*3 + k] = (val >> (10-k*5)) & 0x1F;
+                        c->block[(i + j*4)*3 + k] =
                         c->block2[remap[i + j*4]*3 + k] = (val >> (10-k*5)) & 0x1F;
                     }
                 }
@@ -293,6 +293,6 @@ AVCodec ff_msvideo1_encoder = {
     encode_init,
     encode_frame,
     encode_end,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video-1"),
 };



More information about the ffmpeg-cvslog mailing list