Merge commit '249827f736db4c94dfcb24a3883aa4c04f9b119b'
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 16 Feb 2016 19:05:26 +0000 (19:05 +0000)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 16 Feb 2016 19:05:26 +0000 (19:05 +0000)
* commit '249827f736db4c94dfcb24a3883aa4c04f9b119b':
  mpeg12dec: Refactor mpeg1_decode_block_intra()

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
1  2 
libavcodec/mpeg12dec.c

@@@ -152,17 -157,16 +153,19 @@@ static inline int mpeg1_decode_block_in
      dc  = s->last_dc[component];
      dc += diff;
      s->last_dc[component] = dc;
      block[0] = dc * quant_matrix[0];
-     ff_tlog(s->avctx, "dc=%d diff=%d\n", dc, diff);
-     i = 0;
      {
          OPEN_READER(re, &s->gb);
 +        UPDATE_CACHE(re, &s->gb);
 +        if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
 +            goto end;
 +
          /* now quantify & encode AC coefficients */
-         for (;;) {
+         while (1) {
+             int level, run, j;
 -            UPDATE_CACHE(re, &s->gb);
              GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0],
                         TEX_VLC_BITS, 2, 0);
  
                  UPDATE_CACHE(re, &s->gb);
                  level = SHOW_SBITS(re, &s->gb, 8);
                  SKIP_BITS(re, &s->gb, 8);
                  if (level == -128) {
                      level = SHOW_UBITS(re, &s->gb, 8) - 256;
 -                    LAST_SKIP_BITS(re, &s->gb, 8);
 +                    SKIP_BITS(re, &s->gb, 8);
                  } else if (level == 0) {
                      level = SHOW_UBITS(re, &s->gb, 8);
 -                    LAST_SKIP_BITS(re, &s->gb, 8);
 +                    SKIP_BITS(re, &s->gb, 8);
                  }
                  i += run;
                  if (i > MAX_INDEX)
                      break;