| 
																	
																	
																		
																	
																	
																 | 
																@@ -121,6 +121,15 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred) | 
															
														
														
													
														
															
																 | 
																 | 
																    return sign_extend(val, 5 + shift); | 
																 | 
																 | 
																    return sign_extend(val, 5 + shift); | 
															
														
														
													
														
															
																 | 
																 | 
																} | 
																 | 
																 | 
																} | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																#define check_scantable_index(ctx, x)                                     \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    do {                                                                  \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        if ((x) > 63) {                                                   \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            av_log(ctx->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                   ctx->mb_x, ctx->mb_y);                                 \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            return AVERROR_INVALIDDATA;                                   \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        }                                                                 \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    } while (0)                                                           \ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n) | 
																 | 
																 | 
																static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n) | 
															
														
														
													
														
															
																 | 
																 | 
																{ | 
																 | 
																 | 
																{ | 
															
														
														
													
														
															
																 | 
																 | 
																    int level, dc, diff, i, j, run; | 
																 | 
																 | 
																    int level, dc, diff, i, j, run; | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -153,6 +162,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level != 0) { | 
																 | 
																 | 
																            if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level - 1) | 1; | 
																 | 
																 | 
																                level = (level - 1) | 1; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -169,6 +179,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = -level; | 
																 | 
																 | 
																                    level = -level; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -180,10 +191,6 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = (level - 1) | 1; | 
																 | 
																 | 
																                    level = (level - 1) | 1; | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																            if (i > 63) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                return -1; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            block[j] = level; | 
																 | 
																 | 
																            block[j] = level; | 
															
														
														
													
														
															
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -234,6 +241,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level != 0) { | 
																 | 
																 | 
																            if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level - 1) | 1; | 
																 | 
																 | 
																                level = (level - 1) | 1; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -250,6 +258,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = -level; | 
																 | 
																 | 
																                    level = -level; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -261,10 +270,6 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = (level - 1) | 1; | 
																 | 
																 | 
																                    level = (level - 1) | 1; | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																            if (i > 63) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                return -1; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            block[j] = level; | 
																 | 
																 | 
																            block[j] = level; | 
															
														
														
													
														
															
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -314,6 +319,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level != 0) { | 
																 | 
																 | 
																            if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale) >> 1; | 
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale) >> 1; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level - 1) | 1; | 
																 | 
																 | 
																                level = (level - 1) | 1; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -330,6 +336,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
																 | 
																 | 
																                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8); | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = -level; | 
																 | 
																 | 
																                    level = -level; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -343,7 +350,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            block[j] = level; | 
																 | 
																 | 
																            block[j] = level; | 
															
														
														
													
														
															
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF || i >= 64) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
															
														
														
													
														
															
																 | 
																 | 
																                break; | 
																 | 
																 | 
																                break; | 
															
														
														
													
														
															
																 | 
																 | 
																            UPDATE_CACHE(re, &s->gb); | 
																 | 
																 | 
																            UPDATE_CACHE(re, &s->gb); | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																        } | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -395,6 +402,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level != 0) { | 
																 | 
																 | 
																            if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
																 | 
																 | 
																                level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -406,6 +414,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block | 
															
														
														
													
														
															
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j = scantable[i]; | 
																 | 
																 | 
																                j = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
																 | 
																 | 
																                    level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -414,10 +423,6 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
																 | 
																 | 
																                    level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																            if (i > 63) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                return -1; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            mismatch ^= level; | 
																 | 
																 | 
																            mismatch ^= level; | 
															
														
														
													
														
															
																 | 
																 | 
																            block[j]  = level; | 
																 | 
																 | 
																            block[j]  = level; | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -469,6 +474,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																        if (level != 0) { | 
																 | 
																 | 
																        if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																            i += run; | 
																 | 
																 | 
																            i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																            j  = scantable[i]; | 
																 | 
																 | 
																            j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																            level = ((level * 2 + 1) * qscale) >> 1; | 
																 | 
																 | 
																            level = ((level * 2 + 1) * qscale) >> 1; | 
															
														
														
													
														
															
																 | 
																 | 
																            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
																 | 
																 | 
																            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -480,6 +486,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, | 
															
														
														
													
														
															
																 | 
																 | 
																            level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
																 | 
																 | 
																            level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            i += run; | 
																 | 
																 | 
																            i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																            j  = scantable[i]; | 
																 | 
																 | 
																            j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level < 0) { | 
																 | 
																 | 
																            if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                level = ((-level * 2 + 1) * qscale) >> 1; | 
																 | 
																 | 
																                level = ((-level * 2 + 1) * qscale) >> 1; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -490,7 +497,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																        } | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																        block[j] = level; | 
																 | 
																 | 
																        block[j] = level; | 
															
														
														
													
														
															
																 | 
																 | 
																        if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF || i >= 64) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) | 
															
														
														
													
														
															
																 | 
																 | 
																            break; | 
																 | 
																 | 
																            break; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																        UPDATE_CACHE(re, &s->gb); | 
																 | 
																 | 
																        UPDATE_CACHE(re, &s->gb); | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -547,6 +554,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                break; | 
																 | 
																 | 
																                break; | 
															
														
														
													
														
															
																 | 
																 | 
																            } else if (level != 0) { | 
																 | 
																 | 
																            } else if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j  = scantable[i]; | 
																 | 
																 | 
																                j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -557,6 +565,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                UPDATE_CACHE(re, &s->gb); | 
																 | 
																 | 
																                UPDATE_CACHE(re, &s->gb); | 
															
														
														
													
														
															
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
															
														
														
													
														
															
																 | 
																 | 
																                i += run; | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																                j  = scantable[i]; | 
																 | 
																 | 
																                j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = (-level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                    level = (-level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -565,10 +574,6 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = (level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                    level = (level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																            if (i > 63) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                return -1; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																            mismatch ^= level; | 
																 | 
																 | 
																            mismatch ^= level; | 
															
														
														
													
														
															
																 | 
																 | 
																            block[j]  = level; | 
																 | 
																 | 
																            block[j]  = level; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -588,10 +593,10 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, in | 
															
														
														
													
														
															
																 | 
																 | 
																 */ | 
																 | 
																 | 
																 */ | 
															
														
														
													
														
															
																 | 
																 | 
																static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n) | 
																 | 
																 | 
																static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n) | 
															
														
														
													
														
															
																 | 
																 | 
																{ | 
																 | 
																 | 
																{ | 
															
														
														
													
														
															
																 | 
																 | 
																    int level, dc, diff, j, run; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    int level, dc, diff, i, j, run; | 
															
														
														
													
														
															
																 | 
																 | 
																    int component; | 
																 | 
																 | 
																    int component; | 
															
														
														
													
														
															
																 | 
																 | 
																    RLTable *rl; | 
																 | 
																 | 
																    RLTable *rl; | 
															
														
														
													
														
															
																 | 
																 | 
																    uint8_t * scantable = s->intra_scantable.permutated; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    uint8_t * const scantable = s->intra_scantable.permutated; | 
															
														
														
													
														
															
																 | 
																 | 
																    const uint16_t *quant_matrix; | 
																 | 
																 | 
																    const uint16_t *quant_matrix; | 
															
														
														
													
														
															
																 | 
																 | 
																    const int qscale = s->qscale; | 
																 | 
																 | 
																    const int qscale = s->qscale; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -610,6 +615,7 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																    dc += diff; | 
																 | 
																 | 
																    dc += diff; | 
															
														
														
													
														
															
																 | 
																 | 
																    s->last_dc[component] = dc; | 
																 | 
																 | 
																    s->last_dc[component] = dc; | 
															
														
														
													
														
															
																 | 
																 | 
																    block[0] = dc << (3 - s->intra_dc_precision); | 
																 | 
																 | 
																    block[0] = dc << (3 - s->intra_dc_precision); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    i = 0; | 
															
														
														
													
														
															
																 | 
																 | 
																    if (s->intra_vlc_format) | 
																 | 
																 | 
																    if (s->intra_vlc_format) | 
															
														
														
													
														
															
																 | 
																 | 
																        rl = &ff_rl_mpeg2; | 
																 | 
																 | 
																        rl = &ff_rl_mpeg2; | 
															
														
														
													
														
															
																 | 
																 | 
																    else | 
																 | 
																 | 
																    else | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -625,8 +631,9 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																            if (level >= 64) { | 
																 | 
																 | 
																            if (level >= 64) { | 
															
														
														
													
														
															
																 | 
																 | 
																                break; | 
																 | 
																 | 
																                break; | 
															
														
														
													
														
															
																 | 
																 | 
																            } else if (level != 0) { | 
																 | 
																 | 
																            } else if (level != 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                scantable += run; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                j = *scantable; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                level = (level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
														
															
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
																 | 
																 | 
																                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 
															
														
														
													
														
															
																 | 
																 | 
																                LAST_SKIP_BITS(re, &s->gb, 1); | 
																 | 
																 | 
																                LAST_SKIP_BITS(re, &s->gb, 1); | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -635,8 +642,9 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																                run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); | 
																 | 
																 | 
																                run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); | 
															
														
														
													
														
															
																 | 
																 | 
																                UPDATE_CACHE(re, &s->gb); | 
																 | 
																 | 
																                UPDATE_CACHE(re, &s->gb); | 
															
														
														
													
														
															
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
																 | 
																 | 
																                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); | 
															
														
														
													
														
															
																 | 
																 | 
																                scantable += run; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                j = *scantable; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                i += run; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                check_scantable_index(s, i); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                j  = scantable[i]; | 
															
														
														
													
														
															
																 | 
																 | 
																                if (level < 0) { | 
																 | 
																 | 
																                if (level < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = (-level * qscale * quant_matrix[j]) >> 4; | 
																 | 
																 | 
																                    level = (-level * qscale * quant_matrix[j]) >> 4; | 
															
														
														
													
														
															
																 | 
																 | 
																                    level = -level; | 
																 | 
																 | 
																                    level = -level; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -650,7 +658,7 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *bloc | 
															
														
														
													
														
															
																 | 
																 | 
																        CLOSE_READER(re, &s->gb); | 
																 | 
																 | 
																        CLOSE_READER(re, &s->gb); | 
															
														
														
													
														
															
																 | 
																 | 
																    } | 
																 | 
																 | 
																    } | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    s->block_last_index[n] = scantable - s->intra_scantable.permutated; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    s->block_last_index[n] = i; | 
															
														
														
													
														
															
																 | 
																 | 
																    return 0; | 
																 | 
																 | 
																    return 0; | 
															
														
														
													
														
															
																 | 
																 | 
																} | 
																 | 
																 | 
																} | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																	
																 | 
																
  |