* @author Michael Niedermayer <michaelni@gmx.at>
*/
-#define CABAC 0
+#define CABAC(h) 0
#include "internal.h"
#include "avcodec.h"
-#include "mpegvideo.h"
#include "h264.h"
#include "h264data.h" // FIXME FIXME FIXME
#include "h264_mvpred.h"
#include "golomb.h"
+#include "mpegutils.h"
-//#undef NDEBUG
#include <assert.h>
static const uint8_t golomb_to_inter_cbp_gray[16]={
// We assume these blocks are very rare so we do not optimize it.
h->intra_pcm_ptr = align_get_bits(&h->gb);
+ if (get_bits_left(&h->gb) < mb_size) {
+ av_log(h->avctx, AV_LOG_ERROR, "Not enough data for an intra PCM block.\n");
+ return AVERROR_INVALIDDATA;
+ }
skip_bits_long(&h->gb, mb_size);
// In deblocking, the quantizer is 0
return -1;
}
h->cbp_table[mb_xy] |= ret << 12;
- if(CHROMA444){
+ if (CHROMA444(h)) {
if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){
return -1;
}
if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ){
return -1;
}
- } else if (CHROMA422) {
+ } else if (CHROMA422(h)) {
if(cbp&0x30){
for(chroma_idx=0; chroma_idx<2; chroma_idx++)
if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift),