]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mimic.c
Simplify vsad16_mmx2().
[ffmpeg] / libavcodec / mimic.c
index 33bba2f1db56d8f770a15aab02f009988857a8a7..bbb92299c9f6c8682be0882878223938f6072beb 100644 (file)
@@ -110,7 +110,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
     ctx->prev_index = 0;
     ctx->cur_index = 15;
 
-    if(init_vlc(&ctx->vlc, 8, sizeof(huffbits)/sizeof(huffbits[0]),
+    if(init_vlc(&ctx->vlc, 11, sizeof(huffbits)/sizeof(huffbits[0]),
                  huffbits, 1, 1, huffcodes, 4, 4, 0)) {
         av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
         return -1;
@@ -172,7 +172,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
         int value;
         int coeff;
 
-        vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 4);
+        vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 3);
         if(!vlc) /* end-of-block code */
             return 1;
         if(vlc == -1)
@@ -282,29 +282,19 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
     int quality, num_coeffs;
     int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
 
-    /*
-     * Header structure:
-     *  uint16_t    I_dont_remember;
-     *  uint16_t    quality;
-     *  uint16_t    width;
-     *  uint16_t    height;
-     *  uint32_t    some_constant;
-     *  uint32_t    is_pframe;
-     *  uint32_t    num_coeffs;
-     */
-
     if(buf_size < MIMIC_HEADER_SIZE) {
         av_log(avctx, AV_LOG_ERROR, "insufficient data\n");
         return -1;
     }
 
-    buf       += 2;
+    buf       += 2; /* some constant (always 256) */
     quality    = bytestream_get_le16(&buf);
     width      = bytestream_get_le16(&buf);
     height     = bytestream_get_le16(&buf);
-    buf       += 4;
+    buf       += 4; /* some constant */
     is_pframe  = bytestream_get_le32(&buf);
-    num_coeffs = bytestream_get_le32(&buf);
+    num_coeffs = bytestream_get_byte(&buf);
+    buf       += 3; /* some constant */
 
     if(!ctx->avctx) {
         int i;
@@ -396,4 +386,5 @@ AVCodec mimic_decoder = {
     mimic_decode_end,
     mimic_decode_frame,
     CODEC_CAP_DR1,
+    .long_name = "Mimic",
 };