Add a GetBitContext to H263DecContext instead. This is in preparation for removing MpegEncContext.gb. Also move last_resync_gb to H263DecContext.
Unified · Split
| @@ -31,26 +31,26 @@ int ff_flv_decode_picture_header(H263DecContext *const h) · 30 unmodified lines | ||
| 31 | 31 | int format, width, height; |
| 32 | 32 | |
| 33 | 33 | /* picture header */ |
| 34 | − if (get_bits(&h->c.gb, 17) != 1) { | |
| 34 | + if (get_bits(&h->gb, 17) != 1) { | |
| 35 | 35 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture start code\n"); |
| 36 | 36 | return AVERROR_INVALIDDATA; |
| 37 | 37 | } |
| 38 | − format = get_bits(&h->c.gb, 5); | |
| 38 | + format = get_bits(&h->gb, 5); | |
| 39 | 39 | if (format != 0 && format != 1) { |
| 40 | 40 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture format\n"); |
| 41 | 41 | return AVERROR_INVALIDDATA; |
| 42 | 42 | } |
| 43 | 43 | h->c.h263_flv = format + 1; |
| 44 | − h->c.picture_number = get_bits(&h->c.gb, 8); /* picture timestamp */ | |
| 45 | − format = get_bits(&h->c.gb, 3); | |
| 44 | + h->c.picture_number = get_bits(&h->gb, 8); /* picture timestamp */ | |
| 45 | + format = get_bits(&h->gb, 3); | |
| 46 | 46 | switch (format) { |
| 47 | 47 | case 0: |
| 48 | − width = get_bits(&h->c.gb, 8); | |
| 49 | − height = get_bits(&h->c.gb, 8); | |
| 48 | + width = get_bits(&h->gb, 8); | |
| 49 | + height = get_bits(&h->gb, 8); | |
| 50 | 50 | break; |
| 51 | 51 | case 1: |
| 52 | − width = get_bits(&h->c.gb, 16); | |
| 53 | − height = get_bits(&h->c.gb, 16); | |
| 52 | + width = get_bits(&h->gb, 16); | |
| 53 | + height = get_bits(&h->gb, 16); | |
| 54 | 54 | break; |
| 55 | 55 | case 2: |
| 56 | 56 | width = 352; |
| @@ -81,18 +81,18 @@ int ff_flv_decode_picture_header(H263DecContext *const h) · 24 unmodified lines | ||
| 81 | 81 | h->c.width = width; |
| 82 | 82 | h->c.height = height; |
| 83 | 83 | |
| 84 | − h->c.pict_type = AV_PICTURE_TYPE_I + get_bits(&h->c.gb, 2); | |
| 84 | + h->c.pict_type = AV_PICTURE_TYPE_I + get_bits(&h->gb, 2); | |
| 85 | 85 | h->c.droppable = h->c.pict_type > AV_PICTURE_TYPE_P; |
| 86 | 86 | if (h->c.droppable) |
| 87 | 87 | h->c.pict_type = AV_PICTURE_TYPE_P; |
| 88 | 88 | |
| 89 | − skip_bits1(&h->c.gb); /* deblocking flag */ | |
| 90 | − h->c.chroma_qscale = h->c.qscale = get_bits(&h->c.gb, 5); | |
| 89 | + skip_bits1(&h->gb); /* deblocking flag */ | |
| 90 | + h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); | |
| 91 | 91 | |
| 92 | 92 | h->c.h263_long_vectors = 0; |
| 93 | 93 | |
| 94 | 94 | /* PEI */ |
| 95 | − if (skip_1stop_8data_bits(&h->c.gb) < 0) | |
| 95 | + if (skip_1stop_8data_bits(&h->gb) < 0) | |
| 96 | 96 | return AVERROR_INVALIDDATA; |
| 97 | 97 | |
| 98 | 98 | if (h->c.ehc_mode) |
| @@ -187,7 +187,7 @@ static int decode_slice(H263DecContext *const h) · 186 unmodified lines | ||
| 187 | 187 | const int mb_size = 16 >> h->c.avctx->lowres; |
| 188 | 188 | int ret; |
| 189 | 189 | |
| 190 | − h->c.last_resync_gb = h->c.gb; | |
| 190 | + h->last_resync_gb = h->gb; | |
| 191 | 191 | h->c.first_slice_line = 1; |
| 192 | 192 | h->c.resync_mb_x = h->c.mb_x; |
| 193 | 193 | h->c.resync_mb_y = h->c.mb_y; |
| @@ -200,8 +200,8 @@ static int decode_slice(H263DecContext *const h) · 6 unmodified lines | ||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (h->c.avctx->hwaccel) { |
| 203 | − const uint8_t *start = h->c.gb.buffer + get_bits_count(&h->c.gb) / 8; | |
| 204 | − ret = FF_HW_CALL(h->c.avctx, decode_slice, start, h->c.gb.buffer_end - start); | |
| 203 | + const uint8_t *start = h->gb.buffer + get_bits_count(&h->gb) / 8; | |
| 204 | + ret = FF_HW_CALL(h->c.avctx, decode_slice, start, h->gb.buffer_end - start); | |
| 205 | 205 | // ensure we exit decode loop |
| 206 | 206 | h->c.mb_y = h->c.mb_height; |
| 207 | 207 | return ret; |
| @@ -253,7 +253,7 @@ static int decode_slice(H263DecContext *const h) · 45 unmodified lines | ||
| 253 | 253 | h->c.mv_dir = MV_DIR_FORWARD; |
| 254 | 254 | h->c.mv_type = MV_TYPE_16X16; |
| 255 | 255 | ff_dlog(h->c.avctx, "%d %06X\n", |
| 256 | − get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24)); | |
| 256 | + get_bits_count(&h->gb), show_bits(&h->gb, 24)); | |
| 257 | 257 | |
| 258 | 258 | ff_tlog(NULL, "Decoding MB at %dx%d\n", h->c.mb_x, h->c.mb_y); |
| 259 | 259 | ret = h->decode_mb(h); |
| @@ -300,7 +300,7 @@ static int decode_slice(H263DecContext *const h) · 40 unmodified lines | ||
| 300 | 300 | ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, |
| 301 | 301 | h->c.mb_x, h->c.mb_y, ER_MB_ERROR & part_mask); |
| 302 | 302 | |
| 303 | − if ((h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) && get_bits_left(&h->c.gb) > 0) | |
| 303 | + if ((h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) && get_bits_left(&h->gb) > 0) | |
| 304 | 304 | continue; |
| 305 | 305 | return AVERROR_INVALIDDATA; |
| 306 | 306 | } |
| @@ -321,29 +321,29 @@ static int decode_slice(H263DecContext *const h) · 14 unmodified lines | ||
| 321 | 321 | // Detect incorrect padding with wrong stuffing codes used by NEC N-02B |
| 322 | 322 | if (h->c.codec_id == AV_CODEC_ID_MPEG4 && |
| 323 | 323 | (h->c.workaround_bugs & FF_BUG_AUTODETECT) && |
| 324 | − get_bits_left(&h->c.gb) >= 48 && | |
| 325 | − show_bits(&h->c.gb, 24) == 0x4010 && | |
| 324 | + get_bits_left(&h->gb) >= 48 && | |
| 325 | + show_bits(&h->gb, 24) == 0x4010 && | |
| 326 | 326 | !h->c.data_partitioning) |
| 327 | 327 | h->c.padding_bug_score += 32; |
| 328 | 328 | |
| 329 | 329 | /* try to detect the padding bug */ |
| 330 | 330 | if (h->c.codec_id == AV_CODEC_ID_MPEG4 && |
| 331 | 331 | (h->c.workaround_bugs & FF_BUG_AUTODETECT) && |
| 332 | − get_bits_left(&h->c.gb) >= 0 && | |
| 333 | − get_bits_left(&h->c.gb) < 137 && | |
| 332 | + get_bits_left(&h->gb) >= 0 && | |
| 333 | + get_bits_left(&h->gb) < 137 && | |
| 334 | 334 | !h->c.data_partitioning) { |
| 335 | − const int bits_count = get_bits_count(&h->c.gb); | |
| 336 | − const int bits_left = h->c.gb.size_in_bits - bits_count; | |
| 335 | + const int bits_count = get_bits_count(&h->gb); | |
| 336 | + const int bits_left = h->gb.size_in_bits - bits_count; | |
| 337 | 337 | |
| 338 | 338 | if (bits_left == 0) { |
| 339 | 339 | h->c.padding_bug_score += 16; |
| 340 | 340 | } else if (bits_left != 1) { |
| 341 | − int v = show_bits(&h->c.gb, 8); | |
| 341 | + int v = show_bits(&h->gb, 8); | |
| 342 | 342 | v |= 0x7F >> (7 - (bits_count & 7)); |
| 343 | 343 | |
| 344 | 344 | if (v == 0x7F && bits_left <= 8) |
| 345 | 345 | h->c.padding_bug_score--; |
| 346 | − else if (v == 0x7F && ((get_bits_count(&h->c.gb) + 8) & 8) && | |
| 346 | + else if (v == 0x7F && ((get_bits_count(&h->gb) + 8) & 8) && | |
| 347 | 347 | bits_left <= 16) |
| 348 | 348 | h->c.padding_bug_score += 4; |
| 349 | 349 | else |
| @@ -353,10 +353,10 @@ static int decode_slice(H263DecContext *const h) · 3 unmodified lines | ||
| 353 | 353 | |
| 354 | 354 | if (h->c.codec_id == AV_CODEC_ID_H263 && |
| 355 | 355 | (h->c.workaround_bugs & FF_BUG_AUTODETECT) && |
| 356 | − get_bits_left(&h->c.gb) >= 8 && | |
| 357 | − get_bits_left(&h->c.gb) < 300 && | |
| 356 | + get_bits_left(&h->gb) >= 8 && | |
| 357 | + get_bits_left(&h->gb) < 300 && | |
| 358 | 358 | h->c.pict_type == AV_PICTURE_TYPE_I && |
| 359 | − show_bits(&h->c.gb, 8) == 0 && | |
| 359 | + show_bits(&h->gb, 8) == 0 && | |
| 360 | 360 | !h->c.data_partitioning) { |
| 361 | 361 | |
| 362 | 362 | h->c.padding_bug_score += 32; |
| @@ -364,8 +364,8 @@ static int decode_slice(H263DecContext *const h) · 1 unmodified line | ||
| 364 | 364 | |
| 365 | 365 | if (h->c.codec_id == AV_CODEC_ID_H263 && |
| 366 | 366 | (h->c.workaround_bugs & FF_BUG_AUTODETECT) && |
| 367 | − get_bits_left(&h->c.gb) >= 64 && | |
| 368 | − AV_RB64(h->c.gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) { | |
| 367 | + get_bits_left(&h->gb) >= 64 && | |
| 368 | + AV_RB64(h->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) { | |
| 369 | 369 | |
| 370 | 370 | h->c.padding_bug_score += 32; |
| 371 | 371 | } |
| @@ -380,7 +380,7 @@ static int decode_slice(H263DecContext *const h) · 8 unmodified lines | ||
| 380 | 380 | |
| 381 | 381 | // handle formats which don't have unique end markers |
| 382 | 382 | if (h->c.msmpeg4_version != MSMP4_UNUSED || (h->c.workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly |
| 383 | − int left = get_bits_left(&h->c.gb); | |
| 383 | + int left = get_bits_left(&h->gb); | |
| 384 | 384 | int max_extra = 7; |
| 385 | 385 | |
| 386 | 386 | /* no markers in M$ crap */ |
| @@ -398,7 +398,7 @@ static int decode_slice(H263DecContext *const h) · 11 unmodified lines | ||
| 398 | 398 | if (left > max_extra) |
| 399 | 399 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 400 | 400 | "discarding %d junk bits at end, next would be %X\n", |
| 401 | − left, show_bits(&h->c.gb, 24)); | |
| 401 | + left, show_bits(&h->gb, 24)); | |
| 402 | 402 | else if (left < 0) |
| 403 | 403 | av_log(h->c.avctx, AV_LOG_ERROR, "overreading %d bits\n", -left); |
| 404 | 404 | else |
| @@ -410,7 +410,7 @@ static int decode_slice(H263DecContext *const h) · 5 unmodified lines | ||
| 410 | 410 | |
| 411 | 411 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 412 | 412 | "slice end not reached but screenspace end (%d left %06X, score= %d)\n", |
| 413 | − get_bits_left(&h->c.gb), show_bits(&h->c.gb, 24), h->c.padding_bug_score); | |
| 413 | + get_bits_left(&h->gb), show_bits(&h->gb, 24), h->c.padding_bug_score); | |
| 414 | 414 | |
| 415 | 415 | ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, h->c.mb_x, h->c.mb_y, |
| 416 | 416 | ER_MB_END & part_mask); |
| @@ -452,8 +452,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 35 unmodified lines | ||
| 452 | 452 | return 0; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | − // h->c.gb might be overridden in ff_mpeg4_decode_picture_header() below. | |
| 456 | − ret = init_get_bits8(&h->c.gb, buf, buf_size); | |
| 455 | + // h->gb might be overridden in ff_mpeg4_decode_picture_header() below. | |
| 456 | + ret = init_get_bits8(&h->gb, buf, buf_size); | |
| 457 | 457 | if (ret < 0) |
| 458 | 458 | return ret; |
| 459 | 459 | |
| @@ -504,7 +504,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 44 unmodified lines | ||
| 504 | 504 | avctx->has_b_frames = !h->c.low_delay; |
| 505 | 505 | |
| 506 | 506 | if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { |
| 507 | − if (h->c.pict_type != AV_PICTURE_TYPE_B && h->c.mb_num/2 > get_bits_left(&h->c.gb)) | |
| 507 | + if (h->c.pict_type != AV_PICTURE_TYPE_B && h->c.mb_num/2 > get_bits_left(&h->gb)) | |
| 508 | 508 | return AVERROR_INVALIDDATA; |
| 509 | 509 | ff_mpeg4_workaround_bugs(avctx); |
| 510 | 510 | if (h->c.studio_profile != (h->c.idsp.idct == NULL)) |
| @@ -554,7 +554,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 43 unmodified lines | ||
| 554 | 554 | |
| 555 | 555 | if (avctx->hwaccel) { |
| 556 | 556 | ret = FF_HW_CALL(avctx, start_frame, NULL, |
| 557 | − h->c.gb.buffer, h->c.gb.buffer_end - h->c.gb.buffer); | |
| 557 | + h->gb.buffer, h->gb.buffer_end - h->gb.buffer); | |
| 558 | 558 | if (ret < 0 ) |
| 559 | 559 | return ret; |
| 560 | 560 | } |
| @@ -582,7 +582,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 21 unmodified lines | ||
| 582 | 582 | while (h->c.mb_y < h->c.mb_height) { |
| 583 | 583 | if (h->c.msmpeg4_version != MSMP4_UNUSED) { |
| 584 | 584 | if (h->c.slice_height == 0 || h->c.mb_x != 0 || slice_ret < 0 || |
| 585 | − (h->c.mb_y % h->c.slice_height) != 0 || get_bits_left(&h->c.gb) < 0) | |
| 585 | + (h->c.mb_y % h->c.slice_height) != 0 || get_bits_left(&h->gb) < 0) | |
| 586 | 586 | break; |
| 587 | 587 | } else { |
| 588 | 588 | int prev_x = h->c.mb_x, prev_y = h->c.mb_y; |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #ifndef AVCODEC_H263DEC_H |
| 21 | 21 | #define AVCODEC_H263DEC_H |
| 22 | 22 | |
| 23 | +#include "get_bits.h" | |
| 23 | 24 | #include "mpegvideo.h" |
| 24 | 25 | #include "vlc.h" |
| 25 | 26 | #include "libavutil/mem_internal.h" |
| @@ -47,8 +48,12 @@ extern VLCElem ff_h263_mv_vlc[]; · 21 unmodified lines | ||
| 47 | 48 | typedef struct H263DecContext { |
| 48 | 49 | MPVContext c; |
| 49 | 50 | |
| 51 | + GetBitContext gb; | |
| 52 | + | |
| 50 | 53 | int (*decode_mb)(struct H263DecContext *h); |
| 51 | 54 | |
| 55 | + GetBitContext last_resync_gb; ///< used to search for the next resync marker | |
| 56 | + | |
| 52 | 57 | DECLARE_ALIGNED_32(int16_t, block)[6][64]; |
| 53 | 58 | } H263DecContext; |
| 54 | 59 | |
| @@ -30,44 +30,44 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 29 unmodified lines | ||
| 30 | 30 | { |
| 31 | 31 | int format; |
| 32 | 32 | |
| 33 | − if (get_bits_left(&h->c.gb) == 64) { /* special dummy frames */ | |
| 33 | + if (get_bits_left(&h->gb) == 64) { /* special dummy frames */ | |
| 34 | 34 | return FRAME_SKIPPED; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /* picture header */ |
| 38 | − if (get_bits(&h->c.gb, 22) != 0x20) { | |
| 38 | + if (get_bits(&h->gb, 22) != 0x20) { | |
| 39 | 39 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture start code\n"); |
| 40 | 40 | return -1; |
| 41 | 41 | } |
| 42 | − h->c.picture_number = get_bits(&h->c.gb, 8); /* picture timestamp */ | |
| 42 | + h->c.picture_number = get_bits(&h->gb, 8); /* picture timestamp */ | |
| 43 | 43 | |
| 44 | − if (check_marker(h->c.avctx, &h->c.gb, "after picture_number") != 1) { | |
| 44 | + if (check_marker(h->c.avctx, &h->gb, "after picture_number") != 1) { | |
| 45 | 45 | return -1; /* marker */ |
| 46 | 46 | } |
| 47 | − if (get_bits1(&h->c.gb) != 0) { | |
| 47 | + if (get_bits1(&h->gb) != 0) { | |
| 48 | 48 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad H.263 id\n"); |
| 49 | 49 | return -1; /* H.263 id */ |
| 50 | 50 | } |
| 51 | − skip_bits1(&h->c.gb); /* split screen off */ | |
| 52 | − skip_bits1(&h->c.gb); /* camera off */ | |
| 53 | − skip_bits1(&h->c.gb); /* freeze picture release off */ | |
| 51 | + skip_bits1(&h->gb); /* split screen off */ | |
| 52 | + skip_bits1(&h->gb); /* camera off */ | |
| 53 | + skip_bits1(&h->gb); /* freeze picture release off */ | |
| 54 | 54 | |
| 55 | − format = get_bits(&h->c.gb, 3); | |
| 55 | + format = get_bits(&h->gb, 3); | |
| 56 | 56 | if (format == 0 || format == 6) { |
| 57 | 57 | av_log(h->c.avctx, AV_LOG_ERROR, "Intel H.263 free format not supported\n"); |
| 58 | 58 | return -1; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | − h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->c.gb); | |
| 61 | + h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb); | |
| 62 | 62 | |
| 63 | − h->c.h263_long_vectors = get_bits1(&h->c.gb); | |
| 63 | + h->c.h263_long_vectors = get_bits1(&h->gb); | |
| 64 | 64 | |
| 65 | − if (get_bits1(&h->c.gb) != 0) { | |
| 65 | + if (get_bits1(&h->gb) != 0) { | |
| 66 | 66 | av_log(h->c.avctx, AV_LOG_ERROR, "SAC not supported\n"); |
| 67 | 67 | return -1; /* SAC: off */ |
| 68 | 68 | } |
| 69 | − h->c.obmc = get_bits1(&h->c.gb); | |
| 70 | − h->c.pb_frame = get_bits1(&h->c.gb); | |
| 69 | + h->c.obmc = get_bits1(&h->gb); | |
| 70 | + h->c.pb_frame = get_bits1(&h->gb); | |
| 71 | 71 | |
| 72 | 72 | if (format < 6) { |
| 73 | 73 | h->c.width = ff_h263_format[format][0]; |
| @@ -75,31 +75,31 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 75 | 75 | h->c.avctx->sample_aspect_ratio.num = 12; |
| 76 | 76 | h->c.avctx->sample_aspect_ratio.den = 11; |
| 77 | 77 | } else { |
| 78 | − format = get_bits(&h->c.gb, 3); | |
| 78 | + format = get_bits(&h->gb, 3); | |
| 79 | 79 | if(format == 0 || format == 7){ |
| 80 | 80 | av_log(h->c.avctx, AV_LOG_ERROR, "Wrong Intel H.263 format\n"); |
| 81 | 81 | return -1; |
| 82 | 82 | } |
| 83 | − if (get_bits(&h->c.gb, 2)) | |
| 83 | + if (get_bits(&h->gb, 2)) | |
| 84 | 84 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); |
| 85 | − h->c.loop_filter = get_bits1(&h->c.gb) * !h->c.avctx->lowres; | |
| 86 | − if (get_bits1(&h->c.gb)) | |
| 85 | + h->c.loop_filter = get_bits1(&h->gb) * !h->c.avctx->lowres; | |
| 86 | + if (get_bits1(&h->gb)) | |
| 87 | 87 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); |
| 88 | − if (get_bits1(&h->c.gb)) | |
| 88 | + if (get_bits1(&h->gb)) | |
| 89 | 89 | h->c.pb_frame = 2; |
| 90 | − if (get_bits(&h->c.gb, 5)) | |
| 90 | + if (get_bits(&h->gb, 5)) | |
| 91 | 91 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); |
| 92 | − if (get_bits(&h->c.gb, 5) != 1) | |
| 92 | + if (get_bits(&h->gb, 5) != 1) | |
| 93 | 93 | av_log(h->c.avctx, AV_LOG_ERROR, "Invalid marker\n"); |
| 94 | 94 | } |
| 95 | 95 | if(format == 6){ |
| 96 | − int ar = get_bits(&h->c.gb, 4); | |
| 97 | − skip_bits(&h->c.gb, 9); // display width | |
| 98 | − check_marker(h->c.avctx, &h->c.gb, "in dimensions"); | |
| 99 | − skip_bits(&h->c.gb, 9); // display height | |
| 96 | + int ar = get_bits(&h->gb, 4); | |
| 97 | + skip_bits(&h->gb, 9); // display width | |
| 98 | + check_marker(h->c.avctx, &h->gb, "in dimensions"); | |
| 99 | + skip_bits(&h->gb, 9); // display height | |
| 100 | 100 | if (ar == 15) { |
| 101 | − h->c.avctx->sample_aspect_ratio.num = get_bits(&h->c.gb, 8); // aspect ratio - width | |
| 102 | − h->c.avctx->sample_aspect_ratio.den = get_bits(&h->c.gb, 8); // aspect ratio - height | |
| 101 | + h->c.avctx->sample_aspect_ratio.num = get_bits(&h->gb, 8); // aspect ratio - width | |
| 102 | + h->c.avctx->sample_aspect_ratio.den = get_bits(&h->gb, 8); // aspect ratio - height | |
| 103 | 103 | } else { |
| 104 | 104 | h->c.avctx->sample_aspect_ratio = ff_h263_pixel_aspect[ar]; |
| 105 | 105 | } |
| @@ -107,16 +107,16 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 107 | 107 | av_log(h->c.avctx, AV_LOG_ERROR, "Invalid aspect ratio.\n"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | − h->c.chroma_qscale = h->c.qscale = get_bits(&h->c.gb, 5); | |
| 111 | − skip_bits1(&h->c.gb); /* Continuous Presence Multipoint mode: off */ | |
| 110 | + h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); | |
| 111 | + skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */ | |
| 112 | 112 | |
| 113 | 113 | if (h->c.pb_frame) { |
| 114 | − skip_bits(&h->c.gb, 3); //temporal reference for B-frame | |
| 115 | − skip_bits(&h->c.gb, 2); //dbquant | |
| 114 | + skip_bits(&h->gb, 3); //temporal reference for B-frame | |
| 115 | + skip_bits(&h->gb, 2); //dbquant | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /* PEI */ |
| 119 | − if (skip_1stop_8data_bits(&h->c.gb) < 0) | |
| 119 | + if (skip_1stop_8data_bits(&h->gb) < 0) | |
| 120 | 120 | return AVERROR_INVALIDDATA; |
| 121 | 121 | |
| 122 | 122 | h->c.gob_index = H263_GOB_HEIGHT(h->c.height); |
| @@ -82,7 +82,7 @@ void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus) · 81 unmodified lines | ||
| 82 | 82 | if (h->c.avctx->debug&FF_DEBUG_PICT_INFO) { |
| 83 | 83 | av_log(h->c.avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n", |
| 84 | 84 | h->c.qscale, av_get_picture_type_char(h->c.pict_type), |
| 85 | − h->c.gb.size_in_bits, 1-h->c.no_rounding, | |
| 85 | + h->gb.size_in_bits, 1-h->c.no_rounding, | |
| 86 | 86 | h->c.obmc ? " AP" : "", |
| 87 | 87 | h->c.umvplus ? " UMV" : "", |
| 88 | 88 | h->c.h263_long_vectors ? " LONG" : "", |
| @@ -146,7 +146,7 @@ int ff_h263_decode_mba(H263DecContext *const h) · 57 unmodified lines | ||
| 146 | 146 | for (i = 0; i < 6; i++) |
| 147 | 147 | if (h->c.mb_num - 1 <= ff_mba_max[i]) |
| 148 | 148 | break; |
| 149 | − mb_pos = get_bits(&h->c.gb, ff_mba_length[i]); | |
| 149 | + mb_pos = get_bits(&h->gb, ff_mba_length[i]); | |
| 150 | 150 | h->c.mb_x = mb_pos % h->c.mb_width; |
| 151 | 151 | h->c.mb_y = mb_pos / h->c.mb_width; |
| 152 | 152 | |
| @@ -163,41 +163,42 @@ static int h263_decode_gob_header(H263DecContext *const h) · 10 unmodified lines | ||
| 163 | 163 | int left; |
| 164 | 164 | |
| 165 | 165 | /* Check for GOB Start Code */ |
| 166 | − val = show_bits(&h->c.gb, 16); | |
| 166 | + val = show_bits(&h->gb, 16); | |
| 167 | 167 | if(val) |
| 168 | 168 | return -1; |
| 169 | 169 | |
| 170 | 170 | /* We have a GBSC probably with GSTUFF */ |
| 171 | − skip_bits(&h->c.gb, 16); /* Drop the zeros */ | |
| 172 | − left = get_bits_left(&h->c.gb); | |
| 171 | + skip_bits(&h->gb, 16); /* Drop the zeros */ | |
| 172 | + left = get_bits_left(&h->gb); | |
| 173 | 173 | left = FFMIN(left, 32); |
| 174 | 174 | //MN: we must check the bits left or we might end in an infinite loop (or segfault) |
| 175 | 175 | for(;left>13; left--){ |
| 176 | − if (get_bits1(&h->c.gb)) break; /* Seek the '1' bit */ | |
| 176 | + if (get_bits1(&h->gb)) | |
| 177 | + break; /* Seek the '1' bit */ | |
| 177 | 178 | } |
| 178 | 179 | if(left<=13) |
| 179 | 180 | return -1; |
| 180 | 181 | |
| 181 | 182 | if (h->c.h263_slice_structured) { |
| 182 | − if (check_marker(h->c.avctx, &h->c.gb, "before MBA")==0) | |
| 183 | + if (check_marker(h->c.avctx, &h->gb, "before MBA")==0) | |
| 183 | 184 | return -1; |
| 184 | 185 | |
| 185 | 186 | ff_h263_decode_mba(h); |
| 186 | 187 | |
| 187 | 188 | if (h->c.mb_num > 1583) |
| 188 | − if (check_marker(h->c.avctx, &h->c.gb, "after MBA")==0) | |
| 189 | + if (check_marker(h->c.avctx, &h->gb, "after MBA")==0) | |
| 189 | 190 | return -1; |
| 190 | 191 | |
| 191 | − h->c.qscale = get_bits(&h->c.gb, 5); /* SQUANT */ | |
| 192 | − if (check_marker(h->c.avctx, &h->c.gb, "after SQUANT")==0) | |
| 192 | + h->c.qscale = get_bits(&h->gb, 5); /* SQUANT */ | |
| 193 | + if (check_marker(h->c.avctx, &h->gb, "after SQUANT")==0) | |
| 193 | 194 | return -1; |
| 194 | − skip_bits(&h->c.gb, 2); /* GFID */ | |
| 195 | + skip_bits(&h->gb, 2); /* GFID */ | |
| 195 | 196 | }else{ |
| 196 | − gob_number = get_bits(&h->c.gb, 5); /* GN */ | |
| 197 | + gob_number = get_bits(&h->gb, 5); /* GN */ | |
| 197 | 198 | h->c.mb_x = 0; |
| 198 | 199 | h->c.mb_y = h->c.gob_index* gob_number; |
| 199 | − skip_bits(&h->c.gb, 2); /* GFID */ | |
| 200 | − h->c.qscale = get_bits(&h->c.gb, 5); /* GQUANT */ | |
| 200 | + skip_bits(&h->gb, 2); /* GFID */ | |
| 201 | + h->c.qscale = get_bits(&h->gb, 5); /* GQUANT */ | |
| 201 | 202 | } |
| 202 | 203 | |
| 203 | 204 | if (h->c.mb_y >= h->c.mb_height) |
| @@ -220,25 +221,25 @@ int ff_h263_resync(H263DecContext *const h) · 16 unmodified lines | ||
| 220 | 221 | /* In MPEG-4 studio mode look for a new slice startcode |
| 221 | 222 | * and decode slice header */ |
| 222 | 223 | if (h->c.codec_id==AV_CODEC_ID_MPEG4 && h->c.studio_profile) { |
| 223 | − align_get_bits(&h->c.gb); | |
| 224 | + align_get_bits(&h->gb); | |
| 224 | 225 | |
| 225 | − while (get_bits_left(&h->c.gb) >= 32 && show_bits_long(&h->c.gb, 32) != SLICE_STARTCODE) { | |
| 226 | − get_bits(&h->c.gb, 8); | |
| 226 | + while (get_bits_left(&h->gb) >= 32 && show_bits_long(&h->gb, 32) != SLICE_STARTCODE) { | |
| 227 | + get_bits(&h->gb, 8); | |
| 227 | 228 | } |
| 228 | 229 | |
| 229 | − if (get_bits_left(&h->c.gb) >= 32 && show_bits_long(&h->c.gb, 32) == SLICE_STARTCODE) | |
| 230 | − return get_bits_count(&h->c.gb); | |
| 230 | + if (get_bits_left(&h->gb) >= 32 && show_bits_long(&h->gb, 32) == SLICE_STARTCODE) | |
| 231 | + return get_bits_count(&h->gb); | |
| 231 | 232 | else |
| 232 | 233 | return -1; |
| 233 | 234 | } |
| 234 | 235 | |
| 235 | 236 | if (h->c.codec_id==AV_CODEC_ID_MPEG4){ |
| 236 | − skip_bits1(&h->c.gb); | |
| 237 | − align_get_bits(&h->c.gb); | |
| 237 | + skip_bits1(&h->gb); | |
| 238 | + align_get_bits(&h->gb); | |
| 238 | 239 | } |
| 239 | 240 | |
| 240 | − if (show_bits(&h->c.gb, 16) ==0) { | |
| 241 | − pos = get_bits_count(&h->c.gb); | |
| 241 | + if (show_bits(&h->gb, 16) ==0) { | |
| 242 | + pos = get_bits_count(&h->gb); | |
| 242 | 243 | if(CONFIG_MPEG4_DECODER && h->c.codec_id==AV_CODEC_ID_MPEG4) |
| 243 | 244 | ret = ff_mpeg4_decode_video_packet_header(h); |
| 244 | 245 | else |
| @@ -247,15 +248,15 @@ int ff_h263_resync(H263DecContext *const h) · 2 unmodified lines | ||
| 247 | 248 | return pos; |
| 248 | 249 | } |
| 249 | 250 | //OK, it's not where it is supposed to be ... |
| 250 | − h->c.gb = h->c.last_resync_gb; | |
| 251 | − align_get_bits(&h->c.gb); | |
| 252 | − left = get_bits_left(&h->c.gb); | |
| 251 | + h->gb = h->last_resync_gb; | |
| 252 | + align_get_bits(&h->gb); | |
| 253 | + left = get_bits_left(&h->gb); | |
| 253 | 254 | |
| 254 | 255 | for(;left>16+1+5+5; left-=8){ |
| 255 | − if (show_bits(&h->c.gb, 16) == 0){ | |
| 256 | − GetBitContext bak = h->c.gb; | |
| 256 | + if (show_bits(&h->gb, 16) == 0){ | |
| 257 | + GetBitContext bak = h->gb; | |
| 257 | 258 | |
| 258 | − pos = get_bits_count(&h->c.gb); | |
| 259 | + pos = get_bits_count(&h->gb); | |
| 259 | 260 | if(CONFIG_MPEG4_DECODER && h->c.codec_id==AV_CODEC_ID_MPEG4) |
| 260 | 261 | ret = ff_mpeg4_decode_video_packet_header(h); |
| 261 | 262 | else |
| @@ -263,9 +264,9 @@ int ff_h263_resync(H263DecContext *const h) · 1 unmodified line | ||
| 263 | 264 | if(ret>=0) |
| 264 | 265 | return pos; |
| 265 | 266 | |
| 266 | − h->c.gb = bak; | |
| 267 | + h->gb = bak; | |
| 267 | 268 | } |
| 268 | − skip_bits(&h->c.gb, 8); | |
| 269 | + skip_bits(&h->gb, 8); | |
| 269 | 270 | } |
| 270 | 271 | |
| 271 | 272 | return -1; |
| @@ -274,19 +275,19 @@ int ff_h263_resync(H263DecContext *const h) · 2 unmodified lines | ||
| 274 | 275 | int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code) |
| 275 | 276 | { |
| 276 | 277 | int code, val, sign, shift; |
| 277 | − code = get_vlc2(&h->c.gb, ff_h263_mv_vlc, H263_MV_VLC_BITS, 2); | |
| 278 | + code = get_vlc2(&h->gb, ff_h263_mv_vlc, H263_MV_VLC_BITS, 2); | |
| 278 | 279 | |
| 279 | 280 | if (code == 0) |
| 280 | 281 | return pred; |
| 281 | 282 | if (code < 0) |
| 282 | 283 | return 0xffff; |
| 283 | 284 | |
| 284 | − sign = get_bits1(&h->c.gb); | |
| 285 | + sign = get_bits1(&h->gb); | |
| 285 | 286 | shift = f_code - 1; |
| 286 | 287 | val = code; |
| 287 | 288 | if (shift) { |
| 288 | 289 | val = (val - 1) << shift; |
| 289 | − val |= get_bits(&h->c.gb, shift); | |
| 290 | + val |= get_bits(&h->gb, shift); | |
| 290 | 291 | val++; |
| 291 | 292 | } |
| 292 | 293 | if (sign) |
| @@ -313,15 +314,15 @@ static int h263p_decode_umotion(H263DecContext *const h, int pred) · 20 unmodified lines | ||
| 313 | 314 | { |
| 314 | 315 | int code = 0, sign; |
| 315 | 316 | |
| 316 | − if (get_bits1(&h->c.gb)) /* Motion difference = 0 */ | |
| 317 | + if (get_bits1(&h->gb)) /* Motion difference = 0 */ | |
| 317 | 318 | return pred; |
| 318 | 319 | |
| 319 | − code = 2 + get_bits1(&h->c.gb); | |
| 320 | + code = 2 + get_bits1(&h->gb); | |
| 320 | 321 | |
| 321 | − while (get_bits1(&h->c.gb)) | |
| 322 | + while (get_bits1(&h->gb)) | |
| 322 | 323 | { |
| 323 | 324 | code <<= 1; |
| 324 | − code += get_bits1(&h->c.gb); | |
| 325 | + code += get_bits1(&h->gb); | |
| 325 | 326 | if (code >= 32768) { |
| 326 | 327 | avpriv_request_sample(h->c.avctx, "Huge DMV"); |
| 327 | 328 | return 0xffff; |
| @@ -341,7 +342,7 @@ static int h263p_decode_umotion(H263DecContext *const h, int pred) · 13 unmodified lines | ||
| 341 | 342 | */ |
| 342 | 343 | static void preview_obmc(H263DecContext *const h) |
| 343 | 344 | { |
| 344 | − GetBitContext gb = h->c.gb; | |
| 345 | + GetBitContext gb = h->gb; | |
| 345 | 346 | |
| 346 | 347 | int cbpc, i, pred_x, pred_y, mx, my; |
| 347 | 348 | int16_t *mot_val; |
| @@ -357,7 +358,7 @@ static void preview_obmc(H263DecContext *const h) · 9 unmodified lines | ||
| 357 | 358 | av_assert2(h->c.pict_type == AV_PICTURE_TYPE_P); |
| 358 | 359 | |
| 359 | 360 | do{ |
| 360 | − if (get_bits1(&h->c.gb)) { | |
| 361 | + if (get_bits1(&h->gb)) { | |
| 361 | 362 | /* skip mb */ |
| 362 | 363 | mot_val = h->c.cur_pic.motion_val[0][h->c.block_index[0]]; |
| 363 | 364 | mot_val[0 ]= mot_val[2 ]= |
| @@ -368,15 +369,15 @@ static void preview_obmc(H263DecContext *const h) · 4 unmodified lines | ||
| 368 | 369 | h->c.cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; |
| 369 | 370 | goto end; |
| 370 | 371 | } |
| 371 | − cbpc = get_vlc2(&h->c.gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 372 | + cbpc = get_vlc2(&h->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 372 | 373 | }while(cbpc == 20); |
| 373 | 374 | |
| 374 | 375 | if(cbpc & 4){ |
| 375 | 376 | h->c.cur_pic.mb_type[xy] = MB_TYPE_INTRA; |
| 376 | 377 | }else{ |
| 377 | − get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 378 | + get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 378 | 379 | if (cbpc & 8) { |
| 379 | − skip_bits(&h->c.gb, h->c.modified_quant ? (get_bits1(&h->c.gb) ? 1 : 5) : 2); | |
| 380 | + skip_bits(&h->gb, h->c.modified_quant ? (get_bits1(&h->gb) ? 1 : 5) : 2); | |
| 380 | 381 | } |
| 381 | 382 | |
| 382 | 383 | if ((cbpc & 16) == 0) { |
| @@ -411,7 +412,7 @@ static void preview_obmc(H263DecContext *const h) · 28 unmodified lines | ||
| 411 | 412 | else |
| 412 | 413 | my = ff_h263_decode_motion(h, pred_y, 1); |
| 413 | 414 | if (h->c.umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 414 | − skip_bits1(&h->c.gb); /* Bit stuffing to prevent PSC */ | |
| 415 | + skip_bits1(&h->gb); /* Bit stuffing to prevent PSC */ | |
| 415 | 416 | mot_val[0] = mx; |
| 416 | 417 | mot_val[1] = my; |
| 417 | 418 | } |
| @@ -425,7 +426,7 @@ end: · 7 unmodified lines | ||
| 425 | 426 | h->c.block_index[i] -= 1; |
| 426 | 427 | h->c.mb_x--; |
| 427 | 428 | |
| 428 | − h->c.gb = gb; | |
| 429 | + h->gb = gb; | |
| 429 | 430 | } |
| 430 | 431 | |
| 431 | 432 | static void h263_decode_dquant(H263DecContext *const h) |
| @@ -434,12 +435,12 @@ static void h263_decode_dquant(H263DecContext *const h) · 2 unmodified lines | ||
| 434 | 435 | int qscale; |
| 435 | 436 | |
| 436 | 437 | if (h->c.modified_quant) { |
| 437 | − if (get_bits1(&h->c.gb)) | |
| 438 | − qscale = ff_modified_quant_tab[get_bits1(&h->c.gb)][h->c.qscale]; | |
| 438 | + if (get_bits1(&h->gb)) | |
| 439 | + qscale = ff_modified_quant_tab[get_bits1(&h->gb)][h->c.qscale]; | |
| 439 | 440 | else |
| 440 | − qscale = get_bits(&h->c.gb, 5); | |
| 441 | + qscale = get_bits(&h->gb, 5); | |
| 441 | 442 | }else |
| 442 | − qscale = h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]; | |
| 443 | + qscale = h->c.qscale + quant_tab[get_bits(&h->gb, 2)]; | |
| 443 | 444 | ff_set_qscale(&h->c, qscale); |
| 444 | 445 | } |
| 445 | 446 | |
| @@ -527,7 +528,7 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 81 unmodified lines | ||
| 527 | 528 | int level, i, j, run; |
| 528 | 529 | const RLTable *rl = &ff_h263_rl_inter; |
| 529 | 530 | const uint8_t *scan_table; |
| 530 | − GetBitContext gb = h->c.gb; | |
| 531 | + GetBitContext gb = h->gb; | |
| 531 | 532 | |
| 532 | 533 | scan_table = h->c.intra_scantable.permutated; |
| 533 | 534 | if (h->c.h263_aic && h->c.mb_intra) { |
| @@ -558,12 +559,12 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 24 unmodified lines | ||
| 558 | 559 | h->c.rv10_first_dc_coded[component] = 1; |
| 559 | 560 | } |
| 560 | 561 | } else { |
| 561 | − level = get_bits(&h->c.gb, 8); | |
| 562 | + level = get_bits(&h->gb, 8); | |
| 562 | 563 | if (level == 255) |
| 563 | 564 | level = 128; |
| 564 | 565 | } |
| 565 | 566 | }else{ |
| 566 | − level = get_bits(&h->c.gb, 8); | |
| 567 | + level = get_bits(&h->gb, 8); | |
| 567 | 568 | if((level&0x7F) == 0){ |
| 568 | 569 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", |
| 569 | 570 | level, h->c.mb_x, h->c.mb_y); |
| @@ -584,60 +585,60 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 14 unmodified lines | ||
| 584 | 585 | } |
| 585 | 586 | retry: |
| 586 | 587 | { |
| 587 | − OPEN_READER(re, &h->c.gb); | |
| 588 | + OPEN_READER(re, &h->gb); | |
| 588 | 589 | i--; // offset by -1 to allow direct indexing of scan_table |
| 589 | 590 | for(;;) { |
| 590 | − UPDATE_CACHE(re, &h->c.gb); | |
| 591 | − GET_RL_VLC(level, run, re, &h->c.gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); | |
| 591 | + UPDATE_CACHE(re, &h->gb); | |
| 592 | + GET_RL_VLC(level, run, re, &h->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); | |
| 592 | 593 | if (run == 66) { |
| 593 | 594 | if (level){ |
| 594 | − CLOSE_READER(re, &h->c.gb); | |
| 595 | + CLOSE_READER(re, &h->gb); | |
| 595 | 596 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", |
| 596 | 597 | h->c.mb_x, h->c.mb_y); |
| 597 | 598 | return -1; |
| 598 | 599 | } |
| 599 | 600 | /* escape */ |
| 600 | 601 | if (CONFIG_FLV_DECODER && h->c.h263_flv > 1) { |
| 601 | − int is11 = SHOW_UBITS(re, &h->c.gb, 1); | |
| 602 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 603 | − run = SHOW_UBITS(re, &h->c.gb, 7) + 1; | |
| 602 | + int is11 = SHOW_UBITS(re, &h->gb, 1); | |
| 603 | + SKIP_CACHE(re, &h->gb, 1); | |
| 604 | + run = SHOW_UBITS(re, &h->gb, 7) + 1; | |
| 604 | 605 | if (is11) { |
| 605 | − SKIP_COUNTER(re, &h->c.gb, 1 + 7); | |
| 606 | − UPDATE_CACHE(re, &h->c.gb); | |
| 607 | − level = SHOW_SBITS(re, &h->c.gb, 11); | |
| 608 | − SKIP_COUNTER(re, &h->c.gb, 11); | |
| 606 | + SKIP_COUNTER(re, &h->gb, 1 + 7); | |
| 607 | + UPDATE_CACHE(re, &h->gb); | |
| 608 | + level = SHOW_SBITS(re, &h->gb, 11); | |
| 609 | + SKIP_COUNTER(re, &h->gb, 11); | |
| 609 | 610 | } else { |
| 610 | − SKIP_CACHE(re, &h->c.gb, 7); | |
| 611 | − level = SHOW_SBITS(re, &h->c.gb, 7); | |
| 612 | − SKIP_COUNTER(re, &h->c.gb, 1 + 7 + 7); | |
| 611 | + SKIP_CACHE(re, &h->gb, 7); | |
| 612 | + level = SHOW_SBITS(re, &h->gb, 7); | |
| 613 | + SKIP_COUNTER(re, &h->gb, 1 + 7 + 7); | |
| 613 | 614 | } |
| 614 | 615 | } else { |
| 615 | − run = SHOW_UBITS(re, &h->c.gb, 7) + 1; | |
| 616 | − SKIP_CACHE(re, &h->c.gb, 7); | |
| 617 | − level = (int8_t)SHOW_UBITS(re, &h->c.gb, 8); | |
| 618 | − SKIP_COUNTER(re, &h->c.gb, 7 + 8); | |
| 616 | + run = SHOW_UBITS(re, &h->gb, 7) + 1; | |
| 617 | + SKIP_CACHE(re, &h->gb, 7); | |
| 618 | + level = (int8_t)SHOW_UBITS(re, &h->gb, 8); | |
| 619 | + SKIP_COUNTER(re, &h->gb, 7 + 8); | |
| 619 | 620 | if(level == -128){ |
| 620 | − UPDATE_CACHE(re, &h->c.gb); | |
| 621 | + UPDATE_CACHE(re, &h->gb); | |
| 621 | 622 | if (h->c.codec_id == AV_CODEC_ID_RV10) { |
| 622 | 623 | /* XXX: should patch encoder too */ |
| 623 | − level = SHOW_SBITS(re, &h->c.gb, 12); | |
| 624 | − SKIP_COUNTER(re, &h->c.gb, 12); | |
| 624 | + level = SHOW_SBITS(re, &h->gb, 12); | |
| 625 | + SKIP_COUNTER(re, &h->gb, 12); | |
| 625 | 626 | }else{ |
| 626 | − level = SHOW_UBITS(re, &h->c.gb, 5); | |
| 627 | − SKIP_CACHE(re, &h->c.gb, 5); | |
| 628 | − level |= SHOW_SBITS(re, &h->c.gb, 6) * (1<<5); | |
| 629 | − SKIP_COUNTER(re, &h->c.gb, 5 + 6); | |
| 627 | + level = SHOW_UBITS(re, &h->gb, 5); | |
| 628 | + SKIP_CACHE(re, &h->gb, 5); | |
| 629 | + level |= SHOW_SBITS(re, &h->gb, 6) * (1<<5); | |
| 630 | + SKIP_COUNTER(re, &h->gb, 5 + 6); | |
| 630 | 631 | } |
| 631 | 632 | } |
| 632 | 633 | } |
| 633 | 634 | } else { |
| 634 | − if (SHOW_UBITS(re, &h->c.gb, 1)) | |
| 635 | + if (SHOW_UBITS(re, &h->gb, 1)) | |
| 635 | 636 | level = -level; |
| 636 | − SKIP_COUNTER(re, &h->c.gb, 1); | |
| 637 | + SKIP_COUNTER(re, &h->gb, 1); | |
| 637 | 638 | } |
| 638 | 639 | i += run; |
| 639 | 640 | if (i >= 64){ |
| 640 | − CLOSE_READER(re, &h->c.gb); | |
| 641 | + CLOSE_READER(re, &h->gb); | |
| 641 | 642 | // redo update without last flag, revert -1 offset |
| 642 | 643 | i = i - run + ((run-1)&63) + 1; |
| 643 | 644 | if (i < 64) { |
| @@ -649,7 +650,7 @@ retry: · 5 unmodified lines | ||
| 649 | 650 | //Looks like a hack but no, it's the way it is supposed to work ... |
| 650 | 651 | rl = &ff_rl_intra_aic; |
| 651 | 652 | i = 0; |
| 652 | − h->c.gb = gb; | |
| 653 | + h->gb = gb; | |
| 653 | 654 | h->c.bdsp.clear_block(block); |
| 654 | 655 | goto retry; |
| 655 | 656 | } |
| @@ -787,7 +788,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 131 unmodified lines | ||
| 787 | 788 | |
| 788 | 789 | if (h->c.pict_type == AV_PICTURE_TYPE_P) { |
| 789 | 790 | do{ |
| 790 | − if (get_bits1(&h->c.gb)) { | |
| 791 | + if (get_bits1(&h->gb)) { | |
| 791 | 792 | /* skip mb */ |
| 792 | 793 | h->c.mb_intra = 0; |
| 793 | 794 | for(i=0;i<6;i++) |
| @@ -800,7 +801,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 6 unmodified lines | ||
| 800 | 801 | h->c.mb_skipped = !(h->c.obmc | h->c.loop_filter); |
| 801 | 802 | goto end; |
| 802 | 803 | } |
| 803 | − cbpc = get_vlc2(&h->c.gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 804 | + cbpc = get_vlc2(&h->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 804 | 805 | if (cbpc < 0){ |
| 805 | 806 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", |
| 806 | 807 | h->c.mb_x, h->c.mb_y); |
| @@ -815,9 +816,9 @@ int ff_h263_decode_mb(H263DecContext *const h) · 8 unmodified lines | ||
| 815 | 816 | if (h->c.mb_intra) |
| 816 | 817 | goto intra; |
| 817 | 818 | |
| 818 | − if(h->c.pb_frame && get_bits1(&h->c.gb)) | |
| 819 | − pb_mv_count = h263_get_modb(&h->c.gb, h->c.pb_frame, &cbpb); | |
| 820 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 819 | + if (h->c.pb_frame && get_bits1(&h->gb)) | |
| 820 | + pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb); | |
| 821 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 821 | 822 | |
| 822 | 823 | if (cbpy < 0) { |
| 823 | 824 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpy damaged at %d %d\n", |
| @@ -858,7 +859,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 34 unmodified lines | ||
| 858 | 859 | h->c.mv[0][0][1] = my; |
| 859 | 860 | |
| 860 | 861 | if (h->c.umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 861 | − skip_bits1(&h->c.gb); /* Bit stuffing to prevent PSC */ | |
| 862 | + skip_bits1(&h->gb); /* Bit stuffing to prevent PSC */ | |
| 862 | 863 | } else { |
| 863 | 864 | h->c.cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_FORWARD_MV; |
| 864 | 865 | h->c.mv_type = MV_TYPE_8X8; |
| @@ -880,7 +881,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 15 unmodified lines | ||
| 880 | 881 | h->c.mv[0][i][0] = mx; |
| 881 | 882 | h->c.mv[0][i][1] = my; |
| 882 | 883 | if (h->c.umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 883 | − skip_bits1(&h->c.gb); /* Bit stuffing to prevent PSC */ | |
| 884 | + skip_bits1(&h->gb); /* Bit stuffing to prevent PSC */ | |
| 884 | 885 | mot_val[0] = mx; |
| 885 | 886 | mot_val[1] = my; |
| 886 | 887 | } |
| @@ -899,7 +900,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 12 unmodified lines | ||
| 899 | 900 | mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0; |
| 900 | 901 | |
| 901 | 902 | do{ |
| 902 | − mb_type = get_vlc2(&h->c.gb, h263_mbtype_b_vlc, | |
| 903 | + mb_type = get_vlc2(&h->gb, h263_mbtype_b_vlc, | |
| 903 | 904 | H263_MBTYPE_B_VLC_BITS, 2); |
| 904 | 905 | if (mb_type < 0){ |
| 905 | 906 | av_log(h->c.avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", |
| @@ -911,13 +912,13 @@ int ff_h263_decode_mb(H263DecContext *const h) · 5 unmodified lines | ||
| 911 | 912 | h->c.mb_intra = IS_INTRA(mb_type); |
| 912 | 913 | if(HAS_CBP(mb_type)){ |
| 913 | 914 | h->c.bdsp.clear_blocks(h->block[0]); |
| 914 | − cbpc = get_vlc2(&h->c.gb, cbpc_b_vlc, CBPC_B_VLC_BITS, 1); | |
| 915 | + cbpc = get_vlc2(&h->gb, cbpc_b_vlc, CBPC_B_VLC_BITS, 1); | |
| 915 | 916 | if (h->c.mb_intra) { |
| 916 | 917 | dquant = IS_QUANT(mb_type); |
| 917 | 918 | goto intra; |
| 918 | 919 | } |
| 919 | 920 | |
| 920 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 921 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 921 | 922 | |
| 922 | 923 | if (cbpy < 0){ |
| 923 | 924 | av_log(h->c.avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", |
| @@ -965,7 +966,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 41 unmodified lines | ||
| 965 | 966 | return SLICE_ERROR; |
| 966 | 967 | |
| 967 | 968 | if (h->c.umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 968 | − skip_bits1(&h->c.gb); /* Bit stuffing to prevent PSC */ | |
| 969 | + skip_bits1(&h->gb); /* Bit stuffing to prevent PSC */ | |
| 969 | 970 | |
| 970 | 971 | h->c.mv[0][0][0] = mx; |
| 971 | 972 | h->c.mv[0][0][1] = my; |
| @@ -992,7 +993,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 20 unmodified lines | ||
| 992 | 993 | return SLICE_ERROR; |
| 993 | 994 | |
| 994 | 995 | if (h->c.umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 995 | − skip_bits1(&h->c.gb); /* Bit stuffing to prevent PSC */ | |
| 996 | + skip_bits1(&h->gb); /* Bit stuffing to prevent PSC */ | |
| 996 | 997 | |
| 997 | 998 | h->c.mv[1][0][0] = mx; |
| 998 | 999 | h->c.mv[1][0][1] = my; |
| @@ -1004,7 +1005,7 @@ int ff_h263_decode_mb(H263DecContext *const h) · 5 unmodified lines | ||
| 1004 | 1005 | h->c.cur_pic.mb_type[xy] = mb_type; |
| 1005 | 1006 | } else { /* I-Frame */ |
| 1006 | 1007 | do{ |
| 1007 | − cbpc = get_vlc2(&h->c.gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 1008 | + cbpc = get_vlc2(&h->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 1008 | 1009 | if (cbpc < 0){ |
| 1009 | 1010 | av_log(h->c.avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", |
| 1010 | 1011 | h->c.mb_x, h->c.mb_y); |
| @@ -1019,18 +1020,18 @@ int ff_h263_decode_mb(H263DecContext *const h) · 8 unmodified lines | ||
| 1019 | 1020 | intra: |
| 1020 | 1021 | h->c.cur_pic.mb_type[xy] = MB_TYPE_INTRA; |
| 1021 | 1022 | if (h->c.h263_aic) { |
| 1022 | − h->c.ac_pred = get_bits1(&h->c.gb); | |
| 1023 | + h->c.ac_pred = get_bits1(&h->gb); | |
| 1023 | 1024 | if (h->c.ac_pred) { |
| 1024 | 1025 | h->c.cur_pic.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; |
| 1025 | 1026 | |
| 1026 | − h->c.h263_aic_dir = get_bits1(&h->c.gb); | |
| 1027 | + h->c.h263_aic_dir = get_bits1(&h->gb); | |
| 1027 | 1028 | } |
| 1028 | 1029 | }else |
| 1029 | 1030 | h->c.ac_pred = 0; |
| 1030 | 1031 | |
| 1031 | − if (h->c.pb_frame && get_bits1(&h->c.gb)) | |
| 1032 | − pb_mv_count = h263_get_modb(&h->c.gb, h->c.pb_frame, &cbpb); | |
| 1033 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1032 | + if (h->c.pb_frame && get_bits1(&h->gb)) | |
| 1033 | + pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb); | |
| 1034 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1034 | 1035 | if(cbpy<0){ |
| 1035 | 1036 | av_log(h->c.avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", |
| 1036 | 1037 | h->c.mb_x, h->c.mb_y); |
| @@ -1065,15 +1066,15 @@ intra: · 28 unmodified lines | ||
| 1065 | 1066 | } |
| 1066 | 1067 | end: |
| 1067 | 1068 | |
| 1068 | − if (get_bits_left(&h->c.gb) < 0) | |
| 1069 | + if (get_bits_left(&h->gb) < 0) | |
| 1069 | 1070 | return AVERROR_INVALIDDATA; |
| 1070 | 1071 | |
| 1071 | 1072 | /* per-MB end of slice check */ |
| 1072 | 1073 | { |
| 1073 | − int v = show_bits(&h->c.gb, 16); | |
| 1074 | + int v = show_bits(&h->gb, 16); | |
| 1074 | 1075 | |
| 1075 | − if (get_bits_left(&h->c.gb) < 16) { | |
| 1076 | − v >>= 16 - get_bits_left(&h->c.gb); | |
| 1076 | + if (get_bits_left(&h->gb) < 16) { | |
| 1077 | + v >>= 16 - get_bits_left(&h->gb); | |
| 1077 | 1078 | } |
| 1078 | 1079 | |
| 1079 | 1080 | if(v==0) |
| @@ -1089,16 +1090,16 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 9 unmodified lines | ||
| 1089 | 1090 | int width, height, i, ret; |
| 1090 | 1091 | int h263_plus; |
| 1091 | 1092 | |
| 1092 | − align_get_bits(&h->c.gb); | |
| 1093 | + align_get_bits(&h->gb); | |
| 1093 | 1094 | |
| 1094 | − if (show_bits(&h->c.gb, 2) == 2 && h->c.avctx->frame_num == 0) { | |
| 1095 | + if (show_bits(&h->gb, 2) == 2 && h->c.avctx->frame_num == 0) { | |
| 1095 | 1096 | av_log(h->c.avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); |
| 1096 | 1097 | } |
| 1097 | 1098 | |
| 1098 | − uint32_t startcode = get_bits(&h->c.gb, 22-8); | |
| 1099 | + uint32_t startcode = get_bits(&h->gb, 22-8); | |
| 1099 | 1100 | |
| 1100 | − for (i = get_bits_left(&h->c.gb); i>24; i -= 8) { | |
| 1101 | − startcode = ((startcode << 8) | get_bits(&h->c.gb, 8)) & 0x003FFFFF; | |
| 1101 | + for (i = get_bits_left(&h->gb); i>24; i -= 8) { | |
| 1102 | + startcode = ((startcode << 8) | get_bits(&h->gb, 8)) & 0x003FFFFF; | |
| 1102 | 1103 | |
| 1103 | 1104 | if(startcode == 0x20) |
| 1104 | 1105 | break; |
| @@ -1109,25 +1110,25 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 4 unmodified lines | ||
| 1109 | 1110 | return -1; |
| 1110 | 1111 | } |
| 1111 | 1112 | /* temporal reference */ |
| 1112 | − i = get_bits(&h->c.gb, 8); /* picture timestamp */ | |
| 1113 | + i = get_bits(&h->gb, 8); /* picture timestamp */ | |
| 1113 | 1114 | |
| 1114 | 1115 | i -= (i - (h->c.picture_number & 0xFF) + 128) & ~0xFF; |
| 1115 | 1116 | |
| 1116 | 1117 | h->c.picture_number = (h->c.picture_number&~0xFF) + i; |
| 1117 | 1118 | |
| 1118 | 1119 | /* PTYPE starts here */ |
| 1119 | − if (check_marker(h->c.avctx, &h->c.gb, "in PTYPE") != 1) { | |
| 1120 | + if (check_marker(h->c.avctx, &h->gb, "in PTYPE") != 1) { | |
| 1120 | 1121 | return -1; |
| 1121 | 1122 | } |
| 1122 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1123 | + if (get_bits1(&h->gb) != 0) { | |
| 1123 | 1124 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad H.263 id\n"); |
| 1124 | 1125 | return -1; /* H.263 id */ |
| 1125 | 1126 | } |
| 1126 | − skip_bits1(&h->c.gb); /* split screen off */ | |
| 1127 | − skip_bits1(&h->c.gb); /* camera off */ | |
| 1128 | − skip_bits1(&h->c.gb); /* freeze picture release off */ | |
| 1127 | + skip_bits1(&h->gb); /* split screen off */ | |
| 1128 | + skip_bits1(&h->gb); /* camera off */ | |
| 1129 | + skip_bits1(&h->gb); /* freeze picture release off */ | |
| 1129 | 1130 | |
| 1130 | − int format = get_bits(&h->c.gb, 3); | |
| 1131 | + int format = get_bits(&h->gb, 3); | |
| 1131 | 1132 | /* |
| 1132 | 1133 | 0 forbidden |
| 1133 | 1134 | 1 sub-QCIF |
| @@ -1143,19 +1144,19 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 9 unmodified lines | ||
| 1143 | 1144 | if (!width) |
| 1144 | 1145 | return -1; |
| 1145 | 1146 | |
| 1146 | − h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->c.gb); | |
| 1147 | + h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb); | |
| 1147 | 1148 | |
| 1148 | − h->c.h263_long_vectors = get_bits1(&h->c.gb); | |
| 1149 | + h->c.h263_long_vectors = get_bits1(&h->gb); | |
| 1149 | 1150 | |
| 1150 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1151 | + if (get_bits1(&h->gb) != 0) { | |
| 1151 | 1152 | av_log(h->c.avctx, AV_LOG_ERROR, "H.263 SAC not supported\n"); |
| 1152 | 1153 | return -1; /* SAC: off */ |
| 1153 | 1154 | } |
| 1154 | − h->c.obmc = get_bits1(&h->c.gb); /* Advanced prediction mode */ | |
| 1155 | + h->c.obmc = get_bits1(&h->gb); /* Advanced prediction mode */ | |
| 1155 | 1156 | |
| 1156 | − h->c.pb_frame = get_bits1(&h->c.gb); | |
| 1157 | − h->c.chroma_qscale = h->c.qscale = get_bits(&h->c.gb, 5); | |
| 1158 | − skip_bits1(&h->c.gb); /* Continuous Presence Multipoint mode: off */ | |
| 1157 | + h->c.pb_frame = get_bits1(&h->gb); | |
| 1158 | + h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); | |
| 1159 | + skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */ | |
| 1159 | 1160 | |
| 1160 | 1161 | h->c.width = width; |
| 1161 | 1162 | h->c.height = height; |
| @@ -1166,46 +1167,46 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 4 unmodified lines | ||
| 1166 | 1167 | |
| 1167 | 1168 | /* H.263v2 */ |
| 1168 | 1169 | h263_plus = 1; |
| 1169 | − ufep = get_bits(&h->c.gb, 3); /* Update Full Extended PTYPE */ | |
| 1170 | + ufep = get_bits(&h->gb, 3); /* Update Full Extended PTYPE */ | |
| 1170 | 1171 | |
| 1171 | 1172 | /* ufep other than 0 and 1 are reserved */ |
| 1172 | 1173 | if (ufep == 1) { |
| 1173 | 1174 | /* OPPTYPE */ |
| 1174 | − format = get_bits(&h->c.gb, 3); | |
| 1175 | + format = get_bits(&h->gb, 3); | |
| 1175 | 1176 | ff_dlog(h->c.avctx, "ufep=1, format: %d\n", format); |
| 1176 | − h->c.custom_pcf = get_bits1(&h->c.gb); | |
| 1177 | − h->c.umvplus = get_bits1(&h->c.gb); /* Unrestricted Motion Vector */ | |
| 1178 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1177 | + h->c.custom_pcf = get_bits1(&h->gb); | |
| 1178 | + h->c.umvplus = get_bits1(&h->gb); /* Unrestricted Motion Vector */ | |
| 1179 | + if (get_bits1(&h->gb) != 0) { | |
| 1179 | 1180 | av_log(h->c.avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); |
| 1180 | 1181 | } |
| 1181 | − h->c.obmc = get_bits1(&h->c.gb); /* Advanced prediction mode */ | |
| 1182 | − h->c.h263_aic = get_bits1(&h->c.gb); /* Advanced Intra Coding (AIC) */ | |
| 1183 | − h->c.loop_filter = get_bits1(&h->c.gb); | |
| 1182 | + h->c.obmc = get_bits1(&h->gb); /* Advanced prediction mode */ | |
| 1183 | + h->c.h263_aic = get_bits1(&h->gb); /* Advanced Intra Coding (AIC) */ | |
| 1184 | + h->c.loop_filter = get_bits1(&h->gb); | |
| 1184 | 1185 | if (h->c.avctx->lowres) |
| 1185 | 1186 | h->c.loop_filter = 0; |
| 1186 | 1187 | |
| 1187 | − h->c.h263_slice_structured= get_bits1(&h->c.gb); | |
| 1188 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1188 | + h->c.h263_slice_structured = get_bits1(&h->gb); | |
| 1189 | + if (get_bits1(&h->gb) != 0) { | |
| 1189 | 1190 | av_log(h->c.avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); |
| 1190 | 1191 | } |
| 1191 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1192 | + if (get_bits1(&h->gb) != 0) { | |
| 1192 | 1193 | av_log(h->c.avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); |
| 1193 | 1194 | } |
| 1194 | − h->c.alt_inter_vlc = get_bits1(&h->c.gb); | |
| 1195 | − h->c.modified_quant = get_bits1(&h->c.gb); | |
| 1195 | + h->c.alt_inter_vlc = get_bits1(&h->gb); | |
| 1196 | + h->c.modified_quant = get_bits1(&h->gb); | |
| 1196 | 1197 | if (h->c.modified_quant) |
| 1197 | 1198 | h->c.chroma_qscale_table= ff_h263_chroma_qscale_table; |
| 1198 | 1199 | |
| 1199 | − skip_bits(&h->c.gb, 1); /* Prevent start code emulation */ | |
| 1200 | + skip_bits(&h->gb, 1); /* Prevent start code emulation */ | |
| 1200 | 1201 | |
| 1201 | − skip_bits(&h->c.gb, 3); /* Reserved */ | |
| 1202 | + skip_bits(&h->gb, 3); /* Reserved */ | |
| 1202 | 1203 | } else if (ufep != 0) { |
| 1203 | 1204 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep); |
| 1204 | 1205 | return -1; |
| 1205 | 1206 | } |
| 1206 | 1207 | |
| 1207 | 1208 | /* MPPTYPE */ |
| 1208 | − h->c.pict_type = get_bits(&h->c.gb, 3); | |
| 1209 | + h->c.pict_type = get_bits(&h->gb, 3); | |
| 1209 | 1210 | switch (h->c.pict_type) { |
| 1210 | 1211 | case 0: h->c.pict_type = AV_PICTURE_TYPE_I; break; |
| 1211 | 1212 | case 1: h->c.pict_type = AV_PICTURE_TYPE_P; break; |
| @@ -1215,15 +1216,15 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 3 unmodified lines | ||
| 1215 | 1216 | default: |
| 1216 | 1217 | return -1; |
| 1217 | 1218 | } |
| 1218 | − skip_bits(&h->c.gb, 2); | |
| 1219 | − h->c.no_rounding = get_bits1(&h->c.gb); | |
| 1220 | − skip_bits(&h->c.gb, 4); | |
| 1219 | + skip_bits(&h->gb, 2); | |
| 1220 | + h->c.no_rounding = get_bits1(&h->gb); | |
| 1221 | + skip_bits(&h->gb, 4); | |
| 1221 | 1222 | |
| 1222 | 1223 | /* Get the picture dimensions */ |
| 1223 | 1224 | if (ufep) { |
| 1224 | 1225 | if (format == 6) { |
| 1225 | 1226 | /* Custom Picture Format (CPFMT) */ |
| 1226 | − int aspect_ratio_info = get_bits(&h->c.gb, 4); | |
| 1227 | + int aspect_ratio_info = get_bits(&h->gb, 4); | |
| 1227 | 1228 | ff_dlog(h->c.avctx, "aspect: %d\n", aspect_ratio_info); |
| 1228 | 1229 | /* aspect ratios: |
| 1229 | 1230 | 0 - forbidden |
| @@ -1234,14 +1235,14 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 4 unmodified lines | ||
| 1234 | 1235 | 5 - 40:33 (525-type 16:9) |
| 1235 | 1236 | 6-14 - reserved |
| 1236 | 1237 | */ |
| 1237 | − width = (get_bits(&h->c.gb, 9) + 1) * 4; | |
| 1238 | − check_marker(h->c.avctx, &h->c.gb, "in dimensions"); | |
| 1239 | − height = get_bits(&h->c.gb, 9) * 4; | |
| 1238 | + width = (get_bits(&h->gb, 9) + 1) * 4; | |
| 1239 | + check_marker(h->c.avctx, &h->gb, "in dimensions"); | |
| 1240 | + height = get_bits(&h->gb, 9) * 4; | |
| 1240 | 1241 | ff_dlog(h->c.avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); |
| 1241 | 1242 | if (aspect_ratio_info == FF_ASPECT_EXTENDED) { |
| 1242 | 1243 | /* expected dimensions */ |
| 1243 | − h->c.avctx->sample_aspect_ratio.num = get_bits(&h->c.gb, 8); | |
| 1244 | − h->c.avctx->sample_aspect_ratio.den = get_bits(&h->c.gb, 8); | |
| 1244 | + h->c.avctx->sample_aspect_ratio.num = get_bits(&h->gb, 8); | |
| 1245 | + h->c.avctx->sample_aspect_ratio.den = get_bits(&h->gb, 8); | |
| 1245 | 1246 | }else{ |
| 1246 | 1247 | h->c.avctx->sample_aspect_ratio= ff_h263_pixel_aspect[aspect_ratio_info]; |
| 1247 | 1248 | } |
| @@ -1258,8 +1259,8 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 10 unmodified lines | ||
| 1258 | 1259 | |
| 1259 | 1260 | if (h->c.custom_pcf) { |
| 1260 | 1261 | h->c.avctx->framerate.num = 1800000; |
| 1261 | − h->c.avctx->framerate.den = 1000 + get_bits1(&h->c.gb); | |
| 1262 | − h->c.avctx->framerate.den *= get_bits(&h->c.gb, 7); | |
| 1262 | + h->c.avctx->framerate.den = 1000 + get_bits1(&h->gb); | |
| 1263 | + h->c.avctx->framerate.den *= get_bits(&h->gb, 7); | |
| 1263 | 1264 | if (h->c.avctx->framerate.den == 0) { |
| 1264 | 1265 | av_log(h->c.avctx, AV_LOG_ERROR, "zero framerate\n"); |
| 1265 | 1266 | return -1; |
| @@ -1273,30 +1274,30 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 7 unmodified lines | ||
| 1273 | 1274 | } |
| 1274 | 1275 | |
| 1275 | 1276 | if (h->c.custom_pcf) |
| 1276 | − skip_bits(&h->c.gb, 2); //extended Temporal reference | |
| 1277 | + skip_bits(&h->gb, 2); //extended Temporal reference | |
| 1277 | 1278 | |
| 1278 | 1279 | if (ufep) { |
| 1279 | 1280 | if (h->c.umvplus) { |
| 1280 | − if(get_bits1(&h->c.gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */ | |
| 1281 | − skip_bits1(&h->c.gb); | |
| 1281 | + if (get_bits1(&h->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */ | |
| 1282 | + skip_bits1(&h->gb); | |
| 1282 | 1283 | } |
| 1283 | 1284 | if (h->c.h263_slice_structured) { |
| 1284 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1285 | + if (get_bits1(&h->gb) != 0) { | |
| 1285 | 1286 | av_log(h->c.avctx, AV_LOG_ERROR, "rectangular slices not supported\n"); |
| 1286 | 1287 | } |
| 1287 | − if (get_bits1(&h->c.gb) != 0) { | |
| 1288 | + if (get_bits1(&h->gb) != 0) { | |
| 1288 | 1289 | av_log(h->c.avctx, AV_LOG_ERROR, "unordered slices not supported\n"); |
| 1289 | 1290 | } |
| 1290 | 1291 | } |
| 1291 | 1292 | if (h->c.pict_type == AV_PICTURE_TYPE_B) { |
| 1292 | − skip_bits(&h->c.gb, 4); //ELNUM | |
| 1293 | + skip_bits(&h->gb, 4); //ELNUM | |
| 1293 | 1294 | if (ufep == 1) { |
| 1294 | − skip_bits(&h->c.gb, 4); // RLNUM | |
| 1295 | + skip_bits(&h->gb, 4); // RLNUM | |
| 1295 | 1296 | } |
| 1296 | 1297 | } |
| 1297 | 1298 | } |
| 1298 | 1299 | |
| 1299 | − h->c.qscale = get_bits(&h->c.gb, 5); | |
| 1300 | + h->c.qscale = get_bits(&h->gb, 5); | |
| 1300 | 1301 | } |
| 1301 | 1302 | |
| 1302 | 1303 | ret = av_image_check_size(h->c.width, h->c.height, 0, h->c.avctx); |
| @@ -1304,7 +1305,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 1304 | 1305 | return ret; |
| 1305 | 1306 | |
| 1306 | 1307 | if (!(h->c.avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { |
| 1307 | − if ((h->c.width * h->c.height / 256 / 8) > get_bits_left(&h->c.gb)) | |
| 1308 | + if ((h->c.width * h->c.height / 256 / 8) > get_bits_left(&h->gb)) | |
| 1308 | 1309 | return AVERROR_INVALIDDATA; |
| 1309 | 1310 | } |
| 1310 | 1311 | |
| @@ -1315,10 +1316,10 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 4 unmodified lines | ||
| 1315 | 1316 | h->c.gob_index = H263_GOB_HEIGHT(h->c.height); |
| 1316 | 1317 | |
| 1317 | 1318 | if (h->c.pb_frame) { |
| 1318 | − skip_bits(&h->c.gb, 3); /* Temporal reference for B-pictures */ | |
| 1319 | + skip_bits(&h->gb, 3); /* Temporal reference for B-pictures */ | |
| 1319 | 1320 | if (h->c.custom_pcf) |
| 1320 | − skip_bits(&h->c.gb, 2); //extended Temporal reference | |
| 1321 | − skip_bits(&h->c.gb, 2); /* Quantization information for B-pictures */ | |
| 1321 | + skip_bits(&h->gb, 2); //extended Temporal reference | |
| 1322 | + skip_bits(&h->gb, 2); /* Quantization information for B-pictures */ | |
| 1322 | 1323 | } |
| 1323 | 1324 | |
| 1324 | 1325 | if (h->c.pict_type!=AV_PICTURE_TYPE_B) { |
| @@ -1338,17 +1339,17 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 13 unmodified lines | ||
| 1338 | 1339 | } |
| 1339 | 1340 | |
| 1340 | 1341 | /* PEI */ |
| 1341 | − if (skip_1stop_8data_bits(&h->c.gb) < 0) | |
| 1342 | + if (skip_1stop_8data_bits(&h->gb) < 0) | |
| 1342 | 1343 | return AVERROR_INVALIDDATA; |
| 1343 | 1344 | |
| 1344 | 1345 | if (h->c.h263_slice_structured) { |
| 1345 | − if (check_marker(h->c.avctx, &h->c.gb, "SEPB1") != 1) { | |
| 1346 | + if (check_marker(h->c.avctx, &h->gb, "SEPB1") != 1) { | |
| 1346 | 1347 | return -1; |
| 1347 | 1348 | } |
| 1348 | 1349 | |
| 1349 | 1350 | ff_h263_decode_mba(h); |
| 1350 | 1351 | |
| 1351 | − if (check_marker(h->c.avctx, &h->c.gb, "SEPB2") != 1) { | |
| 1352 | + if (check_marker(h->c.avctx, &h->gb, "SEPB2") != 1) { | |
| 1352 | 1353 | return -1; |
| 1353 | 1354 | } |
| 1354 | 1355 | } |
| @@ -1366,19 +1367,19 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 11 unmodified lines | ||
| 1366 | 1367 | |
| 1367 | 1368 | ff_h263_show_pict_info(h, h263_plus); |
| 1368 | 1369 | |
| 1369 | − if (h->c.pict_type == AV_PICTURE_TYPE_I && h->c.codec_tag == AV_RL32("ZYGO") && get_bits_left(&h->c.gb) >= 85 + 13*3*16 + 50){ | |
| 1370 | + if (h->c.pict_type == AV_PICTURE_TYPE_I && h->c.codec_tag == AV_RL32("ZYGO") && get_bits_left(&h->gb) >= 85 + 13*3*16 + 50){ | |
| 1370 | 1371 | int i,j; |
| 1371 | − for(i=0; i<85; i++) av_log(h->c.avctx, AV_LOG_DEBUG, "%d", get_bits1(&h->c.gb)); | |
| 1372 | + for(i=0; i<85; i++) av_log(h->c.avctx, AV_LOG_DEBUG, "%d", get_bits1(&h->gb)); | |
| 1372 | 1373 | av_log(h->c.avctx, AV_LOG_DEBUG, "\n"); |
| 1373 | 1374 | for(i=0; i<13; i++){ |
| 1374 | 1375 | for(j=0; j<3; j++){ |
| 1375 | − int v= get_bits(&h->c.gb, 8); | |
| 1376 | − v |= get_sbits(&h->c.gb, 8) * (1 << 8); | |
| 1376 | + int v= get_bits(&h->gb, 8); | |
| 1377 | + v |= get_sbits(&h->gb, 8) * (1 << 8); | |
| 1377 | 1378 | av_log(h->c.avctx, AV_LOG_DEBUG, " %5d", v); |
| 1378 | 1379 | } |
| 1379 | 1380 | av_log(h->c.avctx, AV_LOG_DEBUG, "\n"); |
| 1380 | 1381 | } |
| 1381 | − for(i=0; i<50; i++) av_log(h->c.avctx, AV_LOG_DEBUG, "%d", get_bits1(&h->c.gb)); | |
| 1382 | + for(i=0; i<50; i++) av_log(h->c.avctx, AV_LOG_DEBUG, "%d", get_bits1(&h->gb)); | |
| 1382 | 1383 | } |
| 1383 | 1384 | |
| 1384 | 1385 | return 0; |
| @@ -479,7 +479,7 @@ static int mpeg_decode_mb(MPVContext *const s) · 478 unmodified lines | ||
| 479 | 479 | s->interlaced_dct = get_bits1(&s->gb); |
| 480 | 480 | |
| 481 | 481 | if (IS_QUANT(mb_type)) |
| 482 | − s->qscale = mpeg_get_qscale(s); | |
| 482 | + s->qscale = mpeg_get_qscale(&s->gb, s->q_scale_type); | |
| 483 | 483 | |
| 484 | 484 | if (s->concealment_motion_vectors) { |
| 485 | 485 | /* just parse them */ |
| @@ -537,7 +537,7 @@ static int mpeg_decode_mb(MPVContext *const s) · 51 unmodified lines | ||
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | if (IS_QUANT(mb_type)) |
| 540 | − s->qscale = mpeg_get_qscale(s); | |
| 540 | + s->qscale = mpeg_get_qscale(&s->gb, s->q_scale_type); | |
| 541 | 541 | |
| 542 | 542 | s->last_mv[0][0][0] = 0; |
| 543 | 543 | s->last_mv[0][0][1] = 0; |
| @@ -558,7 +558,7 @@ static int mpeg_decode_mb(MPVContext *const s) · 14 unmodified lines | ||
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | if (IS_QUANT(mb_type)) |
| 561 | − s->qscale = mpeg_get_qscale(s); | |
| 561 | + s->qscale = mpeg_get_qscale(&s->gb, s->q_scale_type); | |
| 562 | 562 | |
| 563 | 563 | /* motion vectors */ |
| 564 | 564 | s->mv_dir = MB_TYPE_MV_2_MV_DIR(mb_type); |
| @@ -1370,7 +1370,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 805 unmodified lines | ||
| 1370 | 1370 | ff_mpeg1_clean_buffers(s); |
| 1371 | 1371 | s->interlaced_dct = 0; |
| 1372 | 1372 | |
| 1373 | − s->qscale = mpeg_get_qscale(s); | |
| 1373 | + s->qscale = mpeg_get_qscale(&s->gb, s->q_scale_type); | |
| 1374 | 1374 | |
| 1375 | 1375 | if (s->qscale == 0) { |
| 1376 | 1376 | av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n"); |
| @@ -2805,7 +2805,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1428 unmodified lines | ||
| 2805 | 2805 | skip_bits1(gb); |
| 2806 | 2806 | |
| 2807 | 2807 | if (intraquant) |
| 2808 | − m->qscale = mpeg_get_qscale(m); | |
| 2808 | + m->qscale = mpeg_get_qscale(&m->gb, m->q_scale_type); | |
| 2809 | 2809 | |
| 2810 | 2810 | memset(s->block, 0, sizeof(s->block)); |
| 2811 | 2811 | |
| @@ -383,8 +383,8 @@ void ff_mpeg4_pred_ac(H263DecContext *const h, int16_t *block, int n, int dir) · 382 unmodified lines | ||
| 383 | 383 | static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) |
| 384 | 384 | { |
| 385 | 385 | H263DecContext *const h = &ctx->h; |
| 386 | − int bits_count = get_bits_count(&h->c.gb); | |
| 387 | − int v = show_bits(&h->c.gb, 16); | |
| 386 | + int bits_count = get_bits_count(&h->gb); | |
| 387 | + int v = show_bits(&h->gb, 16); | |
| 388 | 388 | |
| 389 | 389 | if (h->c.workaround_bugs & FF_BUG_NO_PADDING && !ctx->resync_marker) |
| 390 | 390 | return 0; |
| @@ -393,12 +393,12 @@ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) · 2 unmodified lines | ||
| 393 | 393 | if (h->c.pict_type == AV_PICTURE_TYPE_B || |
| 394 | 394 | (v >> (8 - h->c.pict_type) != 1) || h->c.partitioned_frame) |
| 395 | 395 | break; |
| 396 | − skip_bits(&h->c.gb, 8 + h->c.pict_type); | |
| 396 | + skip_bits(&h->gb, 8 + h->c.pict_type); | |
| 397 | 397 | bits_count += 8 + h->c.pict_type; |
| 398 | − v = show_bits(&h->c.gb, 16); | |
| 398 | + v = show_bits(&h->gb, 16); | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | − if (bits_count + 8 >= h->c.gb.size_in_bits) { | |
| 401 | + if (bits_count + 8 >= h->gb.size_in_bits) { | |
| 402 | 402 | v >>= 8; |
| 403 | 403 | v |= 0x7F >> (7 - (bits_count & 7)); |
| 404 | 404 | |
| @@ -412,20 +412,20 @@ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx) · 7 unmodified lines | ||
| 412 | 412 | if (v == mpeg4_resync_prefix[bits_count & 7]) { |
| 413 | 413 | int len, mb_num; |
| 414 | 414 | int mb_num_bits = av_log2(h->c.mb_num - 1) + 1; |
| 415 | − GetBitContext gb = h->c.gb; | |
| 415 | + GetBitContext gb = h->gb; | |
| 416 | 416 | |
| 417 | − skip_bits(&h->c.gb, 1); | |
| 418 | − align_get_bits(&h->c.gb); | |
| 417 | + skip_bits(&h->gb, 1); | |
| 418 | + align_get_bits(&h->gb); | |
| 419 | 419 | |
| 420 | 420 | for (len = 0; len < 32; len++) |
| 421 | − if (get_bits1(&h->c.gb)) | |
| 421 | + if (get_bits1(&h->gb)) | |
| 422 | 422 | break; |
| 423 | 423 | |
| 424 | − mb_num = get_bits(&h->c.gb, mb_num_bits); | |
| 425 | − if (!mb_num || mb_num > h->c.mb_num || get_bits_count(&h->c.gb) + 6 > h->c.gb.size_in_bits) | |
| 424 | + mb_num = get_bits(&h->gb, mb_num_bits); | |
| 425 | + if (!mb_num || mb_num > h->c.mb_num || get_bits_count(&h->gb) + 6 > h->gb.size_in_bits) | |
| 426 | 426 | mb_num= -1; |
| 427 | 427 | |
| 428 | − h->c.gb = gb; | |
| 428 | + h->gb = gb; | |
| 429 | 429 | |
| 430 | 430 | if (len >= ff_mpeg4_get_video_packet_prefix_length(h->c.pict_type, ctx->f_code, ctx->b_code)) |
| 431 | 431 | return mb_num; |
| @@ -713,11 +713,11 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h) · 281 unmodified lines | ||
| 713 | 713 | int header_extension = 0, mb_num, len; |
| 714 | 714 | |
| 715 | 715 | /* is there enough space left for a video packet + header */ |
| 716 | − if (get_bits_count(&h->c.gb) > h->c.gb.size_in_bits - 20) | |
| 716 | + if (get_bits_count(&h->gb) > h->gb.size_in_bits - 20) | |
| 717 | 717 | return AVERROR_INVALIDDATA; |
| 718 | 718 | |
| 719 | 719 | for (len = 0; len < 32; len++) |
| 720 | − if (get_bits1(&h->c.gb)) | |
| 720 | + if (get_bits1(&h->gb)) | |
| 721 | 721 | break; |
| 722 | 722 | |
| 723 | 723 | if (len != ff_mpeg4_get_video_packet_prefix_length(h->c.pict_type, ctx->f_code, ctx->b_code)) { |
| @@ -726,11 +726,11 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h) · 2 unmodified lines | ||
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | if (ctx->shape != RECT_SHAPE) { |
| 729 | − header_extension = get_bits1(&h->c.gb); | |
| 729 | + header_extension = get_bits1(&h->gb); | |
| 730 | 730 | // FIXME more stuff here |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | − mb_num = get_bits(&h->c.gb, mb_num_bits); | |
| 733 | + mb_num = get_bits(&h->gb, mb_num_bits); | |
| 734 | 734 | if (mb_num >= h->c.mb_num || !mb_num) { |
| 735 | 735 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 736 | 736 | "illegal mb_num in video packet (%d %d) \n", mb_num, h->c.mb_num); |
| @@ -741,31 +741,31 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h) · 4 unmodified lines | ||
| 741 | 741 | h->c.mb_y = mb_num / h->c.mb_width; |
| 742 | 742 | |
| 743 | 743 | if (ctx->shape != BIN_ONLY_SHAPE) { |
| 744 | − int qscale = get_bits(&h->c.gb, ctx->quant_precision); | |
| 744 | + int qscale = get_bits(&h->gb, ctx->quant_precision); | |
| 745 | 745 | if (qscale) |
| 746 | 746 | h->c.chroma_qscale = h->c.qscale = qscale; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | if (ctx->shape == RECT_SHAPE) |
| 750 | − header_extension = get_bits1(&h->c.gb); | |
| 750 | + header_extension = get_bits1(&h->gb); | |
| 751 | 751 | |
| 752 | 752 | if (header_extension) { |
| 753 | − while (get_bits1(&h->c.gb) != 0) | |
| 753 | + while (get_bits1(&h->gb) != 0) | |
| 754 | 754 | ; |
| 755 | 755 | |
| 756 | − check_marker(h->c.avctx, &h->c.gb, "before time_increment in video packed header"); | |
| 757 | − skip_bits(&h->c.gb, ctx->time_increment_bits); /* time_increment */ | |
| 758 | − check_marker(h->c.avctx, &h->c.gb, "before vop_coding_type in video packed header"); | |
| 756 | + check_marker(h->c.avctx, &h->gb, "before time_increment in video packed header"); | |
| 757 | + skip_bits(&h->gb, ctx->time_increment_bits); /* time_increment */ | |
| 758 | + check_marker(h->c.avctx, &h->gb, "before vop_coding_type in video packed header"); | |
| 759 | 759 | |
| 760 | − skip_bits(&h->c.gb, 2); /* vop coding type */ | |
| 760 | + skip_bits(&h->gb, 2); /* vop coding type */ | |
| 761 | 761 | // FIXME not rect stuff here |
| 762 | 762 | |
| 763 | 763 | if (ctx->shape != BIN_ONLY_SHAPE) { |
| 764 | − skip_bits(&h->c.gb, 3); /* intra dc vlc threshold */ | |
| 764 | + skip_bits(&h->gb, 3); /* intra dc vlc threshold */ | |
| 765 | 765 | // FIXME don't just ignore everything |
| 766 | 766 | if (h->c.pict_type == AV_PICTURE_TYPE_S && |
| 767 | 767 | ctx->vol_sprite_usage == GMC_SPRITE) { |
| 768 | − if (mpeg4_decode_sprite_trajectory(ctx, &h->c.gb) < 0) | |
| 768 | + if (mpeg4_decode_sprite_trajectory(ctx, &h->gb) < 0) | |
| 769 | 769 | return AVERROR_INVALIDDATA; |
| 770 | 770 | av_log(h->c.avctx, AV_LOG_ERROR, "untested\n"); |
| 771 | 771 | } |
| @@ -773,13 +773,13 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h) · 1 unmodified line | ||
| 773 | 773 | // FIXME reduced res stuff here |
| 774 | 774 | |
| 775 | 775 | if (h->c.pict_type != AV_PICTURE_TYPE_I) { |
| 776 | − int f_code = get_bits(&h->c.gb, 3); /* fcode_for */ | |
| 776 | + int f_code = get_bits(&h->gb, 3); /* fcode_for */ | |
| 777 | 777 | if (f_code == 0) |
| 778 | 778 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 779 | 779 | "Error, video packet header damaged (f_code=0)\n"); |
| 780 | 780 | } |
| 781 | 781 | if (h->c.pict_type == AV_PICTURE_TYPE_B) { |
| 782 | − int b_code = get_bits(&h->c.gb, 3); | |
| 782 | + int b_code = get_bits(&h->gb, 3); | |
| 783 | 783 | if (b_code == 0) |
| 784 | 784 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 785 | 785 | "Error, video packet header damaged (b_code=0)\n"); |
| @@ -787,7 +787,7 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h) · 1 unmodified line | ||
| 787 | 787 | } |
| 788 | 788 | } |
| 789 | 789 | if (ctx->new_pred) |
| 790 | − decode_new_pred(ctx, &h->c.gb); | |
| 790 | + decode_new_pred(ctx, &h->gb); | |
| 791 | 791 | |
| 792 | 792 | return 0; |
| 793 | 793 | } |
| @@ -808,7 +808,7 @@ static void reset_studio_dc_predictors(Mpeg4DecContext *const ctx) · 14 unmodified lines | ||
| 808 | 808 | int ff_mpeg4_decode_studio_slice_header(H263DecContext *const h) |
| 809 | 809 | { |
| 810 | 810 | Mpeg4DecContext *const ctx = h263_to_mpeg4(h); |
| 811 | − GetBitContext *gb = &h->c.gb; | |
| 811 | + GetBitContext *gb = &h->gb; | |
| 812 | 812 | unsigned vlc_len; |
| 813 | 813 | uint16_t mb_num; |
| 814 | 814 | |
| @@ -823,7 +823,7 @@ int ff_mpeg4_decode_studio_slice_header(H263DecContext *const h) · 8 unmodified lines | ||
| 823 | 823 | h->c.mb_y = mb_num / h->c.mb_width; |
| 824 | 824 | |
| 825 | 825 | if (ctx->shape != BIN_ONLY_SHAPE) |
| 826 | − h->c.qscale = mpeg_get_qscale(&h->c); | |
| 826 | + h->c.qscale = mpeg_get_qscale(&h->gb, h->c.q_scale_type); | |
| 827 | 827 | |
| 828 | 828 | if (get_bits1(gb)) { /* slice_extension_flag */ |
| 829 | 829 | skip_bits1(gb); /* intra_slice */ |
| @@ -985,9 +985,9 @@ static inline int mpeg4_decode_dc(H263DecContext *const h, int n, int *dir_ptr) · 155 unmodified lines | ||
| 985 | 985 | int level, code, pred; |
| 986 | 986 | |
| 987 | 987 | if (n < 4) |
| 988 | − code = get_vlc2(&h->c.gb, dc_lum, DC_VLC_BITS, 1); | |
| 988 | + code = get_vlc2(&h->gb, dc_lum, DC_VLC_BITS, 1); | |
| 989 | 989 | else |
| 990 | − code = get_vlc2(&h->c.gb, dc_chrom, DC_VLC_BITS, 1); | |
| 990 | + code = get_vlc2(&h->gb, dc_chrom, DC_VLC_BITS, 1); | |
| 991 | 991 | |
| 992 | 992 | if (code < 0) { |
| 993 | 993 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal dc vlc\n"); |
| @@ -999,19 +999,19 @@ static inline int mpeg4_decode_dc(H263DecContext *const h, int n, int *dir_ptr) · 5 unmodified lines | ||
| 999 | 999 | } else { |
| 1000 | 1000 | if (IS_3IV1) { |
| 1001 | 1001 | if (code == 1) |
| 1002 | − level = 2 * get_bits1(&h->c.gb) - 1; | |
| 1002 | + level = 2 * get_bits1(&h->gb) - 1; | |
| 1003 | 1003 | else { |
| 1004 | − if (get_bits1(&h->c.gb)) | |
| 1005 | − level = get_bits(&h->c.gb, code - 1) + (1 << (code - 1)); | |
| 1004 | + if (get_bits1(&h->gb)) | |
| 1005 | + level = get_bits(&h->gb, code - 1) + (1 << (code - 1)); | |
| 1006 | 1006 | else |
| 1007 | − level = -get_bits(&h->c.gb, code - 1) - (1 << (code - 1)); | |
| 1007 | + level = -get_bits(&h->gb, code - 1) - (1 << (code - 1)); | |
| 1008 | 1008 | } |
| 1009 | 1009 | } else { |
| 1010 | − level = get_xbits(&h->c.gb, code); | |
| 1010 | + level = get_xbits(&h->gb, code); | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | if (code > 8) { |
| 1014 | − if (get_bits1(&h->c.gb) == 0) { /* marker */ | |
| 1014 | + if (get_bits1(&h->gb) == 0) { /* marker */ | |
| 1015 | 1015 | if (h->c.avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) { |
| 1016 | 1016 | av_log(h->c.avctx, AV_LOG_ERROR, "dc marker bit missing\n"); |
| 1017 | 1017 | return AVERROR_INVALIDDATA; |
| @@ -1052,10 +1052,10 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) · 34 unmodified lines | ||
| 1052 | 1052 | int i; |
| 1053 | 1053 | |
| 1054 | 1054 | do { |
| 1055 | − if (show_bits(&h->c.gb, 19) == DC_MARKER) | |
| 1055 | + if (show_bits(&h->gb, 19) == DC_MARKER) | |
| 1056 | 1056 | return mb_num - 1; |
| 1057 | 1057 | |
| 1058 | − cbpc = get_vlc2(&h->c.gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 1058 | + cbpc = get_vlc2(&h->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 1059 | 1059 | if (cbpc < 0) { |
| 1060 | 1060 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1061 | 1061 | "mcbpc corrupted at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -1068,7 +1068,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) · 6 unmodified lines | ||
| 1068 | 1068 | h->c.mb_intra = 1; |
| 1069 | 1069 | |
| 1070 | 1070 | if (cbpc & 4) |
| 1071 | − ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]); | |
| 1071 | + ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->gb, 2)]); | |
| 1072 | 1072 | |
| 1073 | 1073 | h->c.cur_pic.qscale_table[xy] = h->c.qscale; |
| 1074 | 1074 | |
| @@ -1092,11 +1092,11 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) · 17 unmodified lines | ||
| 1092 | 1092 | const int stride = h->c.b8_stride * 2; |
| 1093 | 1093 | |
| 1094 | 1094 | try_again: |
| 1095 | − bits = show_bits(&h->c.gb, 17); | |
| 1095 | + bits = show_bits(&h->gb, 17); | |
| 1096 | 1096 | if (bits == MOTION_MARKER) |
| 1097 | 1097 | return mb_num - 1; |
| 1098 | 1098 | |
| 1099 | − skip_bits1(&h->c.gb); | |
| 1099 | + skip_bits1(&h->gb); | |
| 1100 | 1100 | if (bits & 0x10000) { |
| 1101 | 1101 | /* skip mb */ |
| 1102 | 1102 | if (h->c.pict_type == AV_PICTURE_TYPE_S && |
| @@ -1126,7 +1126,7 @@ try_again: · 23 unmodified lines | ||
| 1126 | 1126 | continue; |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | − cbpc = get_vlc2(&h->c.gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 1129 | + cbpc = get_vlc2(&h->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 1130 | 1130 | if (cbpc < 0) { |
| 1131 | 1131 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1132 | 1132 | "mcbpc corrupted at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -1156,7 +1156,7 @@ try_again: · 23 unmodified lines | ||
| 1156 | 1156 | if (h->c.pict_type == AV_PICTURE_TYPE_S && |
| 1157 | 1157 | ctx->vol_sprite_usage == GMC_SPRITE && |
| 1158 | 1158 | (cbpc & 16) == 0) |
| 1159 | − h->c.mcsel = get_bits1(&h->c.gb); | |
| 1159 | + h->c.mcsel = get_bits1(&h->gb); | |
| 1160 | 1160 | else |
| 1161 | 1161 | h->c.mcsel = 0; |
| 1162 | 1162 | |
| @@ -1238,8 +1238,8 @@ static int mpeg4_decode_partition_b(H263DecContext *const h, int mb_count) · 75 unmodified lines | ||
| 1238 | 1238 | h->c.first_slice_line = 0; |
| 1239 | 1239 | |
| 1240 | 1240 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 1241 | − int ac_pred = get_bits1(&h->c.gb); | |
| 1242 | − int cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1241 | + int ac_pred = get_bits1(&h->gb); | |
| 1242 | + int cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1243 | 1243 | if (cbpy < 0) { |
| 1244 | 1244 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1245 | 1245 | "cbpy corrupted at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -1252,8 +1252,8 @@ static int mpeg4_decode_partition_b(H263DecContext *const h, int mb_count) · 6 unmodified lines | ||
| 1252 | 1252 | if (IS_INTRA(h->c.cur_pic.mb_type[xy])) { |
| 1253 | 1253 | int i; |
| 1254 | 1254 | int dir = 0; |
| 1255 | − int ac_pred = get_bits1(&h->c.gb); | |
| 1256 | − int cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1255 | + int ac_pred = get_bits1(&h->gb); | |
| 1256 | + int cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1257 | 1257 | |
| 1258 | 1258 | if (cbpy < 0) { |
| 1259 | 1259 | av_log(h->c.avctx, AV_LOG_ERROR, |
| @@ -1262,7 +1262,7 @@ static int mpeg4_decode_partition_b(H263DecContext *const h, int mb_count) · 2 unmodified lines | ||
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | if (h->c.cbp_table[xy] & 8) |
| 1265 | − ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]); | |
| 1265 | + ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->gb, 2)]); | |
| 1266 | 1266 | h->c.cur_pic.qscale_table[xy] = h->c.qscale; |
| 1267 | 1267 | |
| 1268 | 1268 | for (i = 0; i < 6; i++) { |
| @@ -1285,7 +1285,7 @@ static int mpeg4_decode_partition_b(H263DecContext *const h, int mb_count) · 16 unmodified lines | ||
| 1285 | 1285 | h->c.cur_pic.qscale_table[xy] = h->c.qscale; |
| 1286 | 1286 | h->c.cbp_table[xy] = 0; |
| 1287 | 1287 | } else { |
| 1288 | − int cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1288 | + int cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 1289 | 1289 | |
| 1290 | 1290 | if (cbpy < 0) { |
| 1291 | 1291 | av_log(h->c.avctx, AV_LOG_ERROR, |
| @@ -1294,7 +1294,7 @@ static int mpeg4_decode_partition_b(H263DecContext *const h, int mb_count) · 2 unmodified lines | ||
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | if (h->c.cbp_table[xy] & 8) |
| 1297 | − ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]); | |
| 1297 | + ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->gb, 2)]); | |
| 1298 | 1298 | h->c.cur_pic.qscale_table[xy] = h->c.qscale; |
| 1299 | 1299 | |
| 1300 | 1300 | h->c.cbp_table[xy] &= 3; // remove dquant |
| @@ -1338,18 +1338,18 @@ int ff_mpeg4_decode_partitions(H263DecContext *const h) · 37 unmodified lines | ||
| 1338 | 1338 | h->c.mb_num_left = mb_num; |
| 1339 | 1339 | |
| 1340 | 1340 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 1341 | − while (show_bits(&h->c.gb, 9) == 1) | |
| 1342 | − skip_bits(&h->c.gb, 9); | |
| 1343 | − if (get_bits(&h->c.gb, 19) != DC_MARKER) { | |
| 1341 | + while (show_bits(&h->gb, 9) == 1) | |
| 1342 | + skip_bits(&h->gb, 9); | |
| 1343 | + if (get_bits(&h->gb, 19) != DC_MARKER) { | |
| 1344 | 1344 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1345 | 1345 | "marker missing after first I partition at %d %d\n", |
| 1346 | 1346 | h->c.mb_x, h->c.mb_y); |
| 1347 | 1347 | return AVERROR_INVALIDDATA; |
| 1348 | 1348 | } |
| 1349 | 1349 | } else { |
| 1350 | − while (show_bits(&h->c.gb, 10) == 1) | |
| 1351 | − skip_bits(&h->c.gb, 10); | |
| 1352 | − if (get_bits(&h->c.gb, 17) != MOTION_MARKER) { | |
| 1350 | + while (show_bits(&h->gb, 10) == 1) | |
| 1351 | + skip_bits(&h->gb, 10); | |
| 1352 | + if (get_bits(&h->gb, 17) != MOTION_MARKER) { | |
| 1353 | 1353 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1354 | 1354 | "marker missing after first P partition at %d %d\n", |
| 1355 | 1355 | h->c.mb_x, h->c.mb_y); |
| @@ -1463,52 +1463,52 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 107 unmodified lines | ||
| 1463 | 1463 | } |
| 1464 | 1464 | } |
| 1465 | 1465 | { |
| 1466 | − OPEN_READER(re, &h->c.gb); | |
| 1466 | + OPEN_READER(re, &h->gb); | |
| 1467 | 1467 | for (;;) { |
| 1468 | − UPDATE_CACHE(re, &h->c.gb); | |
| 1469 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 0); | |
| 1468 | + UPDATE_CACHE(re, &h->gb); | |
| 1469 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 0); | |
| 1470 | 1470 | if (level == 0) { |
| 1471 | 1471 | /* escape */ |
| 1472 | 1472 | if (rvlc) { |
| 1473 | − if (SHOW_UBITS(re, &h->c.gb, 1) == 0) { | |
| 1473 | + if (SHOW_UBITS(re, &h->gb, 1) == 0) { | |
| 1474 | 1474 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1475 | 1475 | "1. marker bit missing in rvlc esc\n"); |
| 1476 | 1476 | return AVERROR_INVALIDDATA; |
| 1477 | 1477 | } |
| 1478 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 1478 | + SKIP_CACHE(re, &h->gb, 1); | |
| 1479 | 1479 | |
| 1480 | − last = SHOW_UBITS(re, &h->c.gb, 1); | |
| 1481 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 1482 | − run = SHOW_UBITS(re, &h->c.gb, 6); | |
| 1483 | − SKIP_COUNTER(re, &h->c.gb, 1 + 1 + 6); | |
| 1484 | − UPDATE_CACHE(re, &h->c.gb); | |
| 1480 | + last = SHOW_UBITS(re, &h->gb, 1); | |
| 1481 | + SKIP_CACHE(re, &h->gb, 1); | |
| 1482 | + run = SHOW_UBITS(re, &h->gb, 6); | |
| 1483 | + SKIP_COUNTER(re, &h->gb, 1 + 1 + 6); | |
| 1484 | + UPDATE_CACHE(re, &h->gb); | |
| 1485 | 1485 | |
| 1486 | − if (SHOW_UBITS(re, &h->c.gb, 1) == 0) { | |
| 1486 | + if (SHOW_UBITS(re, &h->gb, 1) == 0) { | |
| 1487 | 1487 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1488 | 1488 | "2. marker bit missing in rvlc esc\n"); |
| 1489 | 1489 | return AVERROR_INVALIDDATA; |
| 1490 | 1490 | } |
| 1491 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 1491 | + SKIP_CACHE(re, &h->gb, 1); | |
| 1492 | 1492 | |
| 1493 | − level = SHOW_UBITS(re, &h->c.gb, 11); | |
| 1494 | − SKIP_CACHE(re, &h->c.gb, 11); | |
| 1493 | + level = SHOW_UBITS(re, &h->gb, 11); | |
| 1494 | + SKIP_CACHE(re, &h->gb, 11); | |
| 1495 | 1495 | |
| 1496 | − if (SHOW_UBITS(re, &h->c.gb, 5) != 0x10) { | |
| 1496 | + if (SHOW_UBITS(re, &h->gb, 5) != 0x10) { | |
| 1497 | 1497 | av_log(h->c.avctx, AV_LOG_ERROR, "reverse esc missing\n"); |
| 1498 | 1498 | return AVERROR_INVALIDDATA; |
| 1499 | 1499 | } |
| 1500 | − SKIP_CACHE(re, &h->c.gb, 5); | |
| 1500 | + SKIP_CACHE(re, &h->gb, 5); | |
| 1501 | 1501 | |
| 1502 | 1502 | level = level * qmul + qadd; |
| 1503 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 1504 | − SKIP_COUNTER(re, &h->c.gb, 1 + 11 + 5 + 1); | |
| 1503 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 1504 | + SKIP_COUNTER(re, &h->gb, 1 + 11 + 5 + 1); | |
| 1505 | 1505 | |
| 1506 | 1506 | i += run + 1; |
| 1507 | 1507 | if (last) |
| 1508 | 1508 | i += 192; |
| 1509 | 1509 | } else { |
| 1510 | 1510 | int cache; |
| 1511 | − cache = GET_CACHE(re, &h->c.gb); | |
| 1511 | + cache = GET_CACHE(re, &h->gb); | |
| 1512 | 1512 | |
| 1513 | 1513 | if (IS_3IV1) |
| 1514 | 1514 | cache ^= 0xC0000000; |
| @@ -1516,36 +1516,36 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 1 unmodified line | ||
| 1516 | 1516 | if (cache & 0x80000000) { |
| 1517 | 1517 | if (cache & 0x40000000) { |
| 1518 | 1518 | /* third escape */ |
| 1519 | − SKIP_CACHE(re, &h->c.gb, 2); | |
| 1520 | − last = SHOW_UBITS(re, &h->c.gb, 1); | |
| 1521 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 1522 | − run = SHOW_UBITS(re, &h->c.gb, 6); | |
| 1523 | − SKIP_COUNTER(re, &h->c.gb, 2 + 1 + 6); | |
| 1524 | − UPDATE_CACHE(re, &h->c.gb); | |
| 1519 | + SKIP_CACHE(re, &h->gb, 2); | |
| 1520 | + last = SHOW_UBITS(re, &h->gb, 1); | |
| 1521 | + SKIP_CACHE(re, &h->gb, 1); | |
| 1522 | + run = SHOW_UBITS(re, &h->gb, 6); | |
| 1523 | + SKIP_COUNTER(re, &h->gb, 2 + 1 + 6); | |
| 1524 | + UPDATE_CACHE(re, &h->gb); | |
| 1525 | 1525 | |
| 1526 | 1526 | if (IS_3IV1) { |
| 1527 | − level = SHOW_SBITS(re, &h->c.gb, 12); | |
| 1528 | − LAST_SKIP_BITS(re, &h->c.gb, 12); | |
| 1527 | + level = SHOW_SBITS(re, &h->gb, 12); | |
| 1528 | + LAST_SKIP_BITS(re, &h->gb, 12); | |
| 1529 | 1529 | } else { |
| 1530 | − if (SHOW_UBITS(re, &h->c.gb, 1) == 0) { | |
| 1530 | + if (SHOW_UBITS(re, &h->gb, 1) == 0) { | |
| 1531 | 1531 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1532 | 1532 | "1. marker bit missing in 3. esc\n"); |
| 1533 | − if (!(h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&h->c.gb) <= 0) | |
| 1533 | + if (!(h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&h->gb) <= 0) | |
| 1534 | 1534 | return AVERROR_INVALIDDATA; |
| 1535 | 1535 | } |
| 1536 | − SKIP_CACHE(re, &h->c.gb, 1); | |
| 1536 | + SKIP_CACHE(re, &h->gb, 1); | |
| 1537 | 1537 | |
| 1538 | − level = SHOW_SBITS(re, &h->c.gb, 12); | |
| 1539 | − SKIP_CACHE(re, &h->c.gb, 12); | |
| 1538 | + level = SHOW_SBITS(re, &h->gb, 12); | |
| 1539 | + SKIP_CACHE(re, &h->gb, 12); | |
| 1540 | 1540 | |
| 1541 | − if (SHOW_UBITS(re, &h->c.gb, 1) == 0) { | |
| 1541 | + if (SHOW_UBITS(re, &h->gb, 1) == 0) { | |
| 1542 | 1542 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1543 | 1543 | "2. marker bit missing in 3. esc\n"); |
| 1544 | − if (!(h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&h->c.gb) <= 0) | |
| 1544 | + if (!(h->c.avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&h->gb) <= 0) | |
| 1545 | 1545 | return AVERROR_INVALIDDATA; |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | − SKIP_COUNTER(re, &h->c.gb, 1 + 12 + 1); | |
| 1548 | + SKIP_COUNTER(re, &h->gb, 1 + 12 + 1); | |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | #if 0 |
| @@ -1592,26 +1592,26 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 40 unmodified lines | ||
| 1592 | 1592 | i += 192; |
| 1593 | 1593 | } else { |
| 1594 | 1594 | /* second escape */ |
| 1595 | − SKIP_BITS(re, &h->c.gb, 2); | |
| 1596 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 1595 | + SKIP_BITS(re, &h->gb, 2); | |
| 1596 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 1597 | 1597 | i += run + rl->max_run[run >> 7][level / qmul] + 1; // FIXME opt indexing |
| 1598 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 1599 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 1598 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 1599 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 1600 | 1600 | } |
| 1601 | 1601 | } else { |
| 1602 | 1602 | /* first escape */ |
| 1603 | − SKIP_BITS(re, &h->c.gb, 1); | |
| 1604 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 1603 | + SKIP_BITS(re, &h->gb, 1); | |
| 1604 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 1605 | 1605 | i += run; |
| 1606 | 1606 | level = level + rl->max_level[run >> 7][(run - 1) & 63] * qmul; // FIXME opt indexing |
| 1607 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 1608 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 1607 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 1608 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| 1611 | 1611 | } else { |
| 1612 | 1612 | i += run; |
| 1613 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 1614 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 1613 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 1614 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 1615 | 1615 | } |
| 1616 | 1616 | ff_tlog(h->c.avctx, "dct[%d][%d] = %- 4d end?:%d\n", scan_table[i&63]&7, scan_table[i&63] >> 3, level, i>62); |
| 1617 | 1617 | if (i > 62) { |
| @@ -1628,7 +1628,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 10 unmodified lines | ||
| 1628 | 1628 | |
| 1629 | 1629 | block[scan_table[i]] = level; |
| 1630 | 1630 | } |
| 1631 | − CLOSE_READER(re, &h->c.gb); | |
| 1631 | + CLOSE_READER(re, &h->gb); | |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | not_coded: |
| @@ -1751,7 +1751,7 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 116 unmodified lines | ||
| 1751 | 1751 | if (h->c.pict_type == AV_PICTURE_TYPE_P || |
| 1752 | 1752 | h->c.pict_type == AV_PICTURE_TYPE_S) { |
| 1753 | 1753 | do { |
| 1754 | − if (get_bits1(&h->c.gb)) { | |
| 1754 | + if (get_bits1(&h->gb)) { | |
| 1755 | 1755 | /* skip mb */ |
| 1756 | 1756 | h->c.mb_intra = 0; |
| 1757 | 1757 | for (i = 0; i < 6; i++) |
| @@ -1780,7 +1780,7 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 22 unmodified lines | ||
| 1780 | 1780 | } |
| 1781 | 1781 | goto end; |
| 1782 | 1782 | } |
| 1783 | − cbpc = get_vlc2(&h->c.gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 1783 | + cbpc = get_vlc2(&h->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 1784 | 1784 | if (cbpc < 0) { |
| 1785 | 1785 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1786 | 1786 | "mcbpc damaged at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -1796,10 +1796,10 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 9 unmodified lines | ||
| 1796 | 1796 | |
| 1797 | 1797 | if (h->c.pict_type == AV_PICTURE_TYPE_S && |
| 1798 | 1798 | ctx->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0) |
| 1799 | − h->c.mcsel = get_bits1(&h->c.gb); | |
| 1799 | + h->c.mcsel = get_bits1(&h->gb); | |
| 1800 | 1800 | else |
| 1801 | 1801 | h->c.mcsel = 0; |
| 1802 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1) ^ 0x0F; | |
| 1802 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1) ^ 0x0F; | |
| 1803 | 1803 | if (cbpy < 0) { |
| 1804 | 1804 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 1805 | 1805 | "P cbpy damaged at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -1808,10 +1808,10 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 2 unmodified lines | ||
| 1808 | 1808 | |
| 1809 | 1809 | cbp = (cbpc & 3) | (cbpy << 2); |
| 1810 | 1810 | if (dquant) |
| 1811 | − ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]); | |
| 1811 | + ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->gb, 2)]); | |
| 1812 | 1812 | if ((!h->c.progressive_sequence) && |
| 1813 | 1813 | (cbp || (h->c.workaround_bugs & FF_BUG_XVID_ILACE))) |
| 1814 | − h->c.interlaced_dct = get_bits1(&h->c.gb); | |
| 1814 | + h->c.interlaced_dct = get_bits1(&h->gb); | |
| 1815 | 1815 | |
| 1816 | 1816 | h->c.mv_dir = MV_DIR_FORWARD; |
| 1817 | 1817 | if ((cbpc & 16) == 0) { |
| @@ -1824,14 +1824,14 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 6 unmodified lines | ||
| 1824 | 1824 | my = get_amv(ctx, 1); |
| 1825 | 1825 | h->c.mv[0][0][0] = mx; |
| 1826 | 1826 | h->c.mv[0][0][1] = my; |
| 1827 | − } else if ((!h->c.progressive_sequence) && get_bits1(&h->c.gb)) { | |
| 1827 | + } else if ((!h->c.progressive_sequence) && get_bits1(&h->gb)) { | |
| 1828 | 1828 | h->c.cur_pic.mb_type[xy] = MB_TYPE_16x8 | MB_TYPE_FORWARD_MV | |
| 1829 | 1829 | MB_TYPE_INTERLACED; |
| 1830 | 1830 | /* 16x8 field motion prediction */ |
| 1831 | 1831 | h->c.mv_type = MV_TYPE_FIELD; |
| 1832 | 1832 | |
| 1833 | − h->c.field_select[0][0] = get_bits1(&h->c.gb); | |
| 1834 | − h->c.field_select[0][1] = get_bits1(&h->c.gb); | |
| 1833 | + h->c.field_select[0][0] = get_bits1(&h->gb); | |
| 1834 | + h->c.field_select[0][1] = get_bits1(&h->gb); | |
| 1835 | 1835 | |
| 1836 | 1836 | ff_h263_pred_motion(&h->c, 0, 0, &pred_x, &pred_y); |
| 1837 | 1837 | |
| @@ -1921,14 +1921,14 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 83 unmodified lines | ||
| 1921 | 1921 | goto end; |
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | − modb1 = get_bits1(&h->c.gb); | |
| 1924 | + modb1 = get_bits1(&h->gb); | |
| 1925 | 1925 | if (modb1) { |
| 1926 | 1926 | // like MB_TYPE_B_DIRECT but no vectors coded |
| 1927 | 1927 | mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_BIDIR_MV; |
| 1928 | 1928 | cbp = 0; |
| 1929 | 1929 | } else { |
| 1930 | − modb2 = get_bits1(&h->c.gb); | |
| 1931 | − mb_type = get_vlc2(&h->c.gb, mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 1); | |
| 1930 | + modb2 = get_bits1(&h->gb); | |
| 1931 | + mb_type = get_vlc2(&h->gb, mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 1); | |
| 1932 | 1932 | if (mb_type < 0) { |
| 1933 | 1933 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal MB_type\n"); |
| 1934 | 1934 | return AVERROR_INVALIDDATA; |
| @@ -1937,29 +1937,29 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 2 unmodified lines | ||
| 1937 | 1937 | cbp = 0; |
| 1938 | 1938 | } else { |
| 1939 | 1939 | h->c.bdsp.clear_blocks(h->block[0]); |
| 1940 | − cbp = get_bits(&h->c.gb, 6); | |
| 1940 | + cbp = get_bits(&h->gb, 6); | |
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | 1943 | if ((!IS_DIRECT(mb_type)) && cbp) { |
| 1944 | − if (get_bits1(&h->c.gb)) | |
| 1945 | − ff_set_qscale(&h->c, h->c.qscale + get_bits1(&h->c.gb) * 4 - 2); | |
| 1944 | + if (get_bits1(&h->gb)) | |
| 1945 | + ff_set_qscale(&h->c, h->c.qscale + get_bits1(&h->gb) * 4 - 2); | |
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | if (!h->c.progressive_sequence) { |
| 1949 | 1949 | if (cbp) |
| 1950 | − h->c.interlaced_dct = get_bits1(&h->c.gb); | |
| 1950 | + h->c.interlaced_dct = get_bits1(&h->gb); | |
| 1951 | 1951 | |
| 1952 | − if (!IS_DIRECT(mb_type) && get_bits1(&h->c.gb)) { | |
| 1952 | + if (!IS_DIRECT(mb_type) && get_bits1(&h->gb)) { | |
| 1953 | 1953 | mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
| 1954 | 1954 | mb_type &= ~MB_TYPE_16x16; |
| 1955 | 1955 | |
| 1956 | 1956 | if (HAS_FORWARD_MV(mb_type)) { |
| 1957 | − h->c.field_select[0][0] = get_bits1(&h->c.gb); | |
| 1958 | − h->c.field_select[0][1] = get_bits1(&h->c.gb); | |
| 1957 | + h->c.field_select[0][0] = get_bits1(&h->gb); | |
| 1958 | + h->c.field_select[0][1] = get_bits1(&h->gb); | |
| 1959 | 1959 | } |
| 1960 | 1960 | if (HAS_BACKWARD_MV(mb_type)) { |
| 1961 | − h->c.field_select[1][0] = get_bits1(&h->c.gb); | |
| 1962 | − h->c.field_select[1][1] = get_bits1(&h->c.gb); | |
| 1961 | + h->c.field_select[1][0] = get_bits1(&h->gb); | |
| 1962 | + h->c.field_select[1][1] = get_bits1(&h->gb); | |
| 1963 | 1963 | } |
| 1964 | 1964 | } |
| 1965 | 1965 | } |
| @@ -2039,7 +2039,7 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 73 unmodified lines | ||
| 2039 | 2039 | int use_intra_dc_vlc; |
| 2040 | 2040 | |
| 2041 | 2041 | do { |
| 2042 | − cbpc = get_vlc2(&h->c.gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 2042 | + cbpc = get_vlc2(&h->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 2043 | 2043 | if (cbpc < 0) { |
| 2044 | 2044 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 2045 | 2045 | "I cbpc damaged at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -2051,13 +2051,13 @@ static int mpeg4_decode_mb(H263DecContext *const h) · 5 unmodified lines | ||
| 2051 | 2051 | h->c.mb_intra = 1; |
| 2052 | 2052 | |
| 2053 | 2053 | intra: |
| 2054 | − h->c.ac_pred = get_bits1(&h->c.gb); | |
| 2054 | + h->c.ac_pred = get_bits1(&h->gb); | |
| 2055 | 2055 | if (h->c.ac_pred) |
| 2056 | 2056 | h->c.cur_pic.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; |
| 2057 | 2057 | else |
| 2058 | 2058 | h->c.cur_pic.mb_type[xy] = MB_TYPE_INTRA; |
| 2059 | 2059 | |
| 2060 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 2060 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 2061 | 2061 | if (cbpy < 0) { |
| 2062 | 2062 | av_log(h->c.avctx, AV_LOG_ERROR, |
| 2063 | 2063 | "I cbpy damaged at %d %d\n", h->c.mb_x, h->c.mb_y); |
| @@ -2068,10 +2068,10 @@ intra: · 4 unmodified lines | ||
| 2068 | 2068 | use_intra_dc_vlc = h->c.qscale < ctx->intra_dc_threshold; |
| 2069 | 2069 | |
| 2070 | 2070 | if (dquant) |
| 2071 | − ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->c.gb, 2)]); | |
| 2071 | + ff_set_qscale(&h->c, h->c.qscale + quant_tab[get_bits(&h->gb, 2)]); | |
| 2072 | 2072 | |
| 2073 | 2073 | if (!h->c.progressive_sequence) |
| 2074 | − h->c.interlaced_dct = get_bits1(&h->c.gb); | |
| 2074 | + h->c.interlaced_dct = get_bits1(&h->gb); | |
| 2075 | 2075 | |
| 2076 | 2076 | h->c.bdsp.clear_blocks(h->block[0]); |
| 2077 | 2077 | /* decode each block */ |
| @@ -2173,24 +2173,24 @@ static int mpeg4_decode_studio_block(Mpeg4DecContext *const ctx, int32_t block[6 · 95 unmodified lines | ||
| 2173 | 2173 | |
| 2174 | 2174 | if (n < 4) { |
| 2175 | 2175 | cc = 0; |
| 2176 | − dct_dc_size = get_vlc2(&h->c.gb, studio_luma_dc, STUDIO_INTRA_BITS, 2); | |
| 2176 | + dct_dc_size = get_vlc2(&h->gb, studio_luma_dc, STUDIO_INTRA_BITS, 2); | |
| 2177 | 2177 | quant_matrix = h->c.intra_matrix; |
| 2178 | 2178 | } else { |
| 2179 | 2179 | cc = (n & 1) + 1; |
| 2180 | 2180 | if (ctx->rgb) |
| 2181 | − dct_dc_size = get_vlc2(&h->c.gb, studio_luma_dc, STUDIO_INTRA_BITS, 2); | |
| 2181 | + dct_dc_size = get_vlc2(&h->gb, studio_luma_dc, STUDIO_INTRA_BITS, 2); | |
| 2182 | 2182 | else |
| 2183 | − dct_dc_size = get_vlc2(&h->c.gb, studio_chroma_dc, STUDIO_INTRA_BITS, 2); | |
| 2183 | + dct_dc_size = get_vlc2(&h->gb, studio_chroma_dc, STUDIO_INTRA_BITS, 2); | |
| 2184 | 2184 | quant_matrix = h->c.chroma_intra_matrix; |
| 2185 | 2185 | } |
| 2186 | 2186 | |
| 2187 | 2187 | if (dct_dc_size == 0) { |
| 2188 | 2188 | dct_diff = 0; |
| 2189 | 2189 | } else { |
| 2190 | − dct_diff = get_xbits(&h->c.gb, dct_dc_size); | |
| 2190 | + dct_diff = get_xbits(&h->gb, dct_dc_size); | |
| 2191 | 2191 | |
| 2192 | 2192 | if (dct_dc_size > 8) { |
| 2193 | − if(!check_marker(h->c.avctx, &h->c.gb, "dct_dc_size > 8")) | |
| 2193 | + if(!check_marker(h->c.avctx, &h->gb, "dct_dc_size > 8")) | |
| 2194 | 2194 | return AVERROR_INVALIDDATA; |
| 2195 | 2195 | } |
| 2196 | 2196 | |
| @@ -2209,7 +2209,7 @@ static int mpeg4_decode_studio_block(Mpeg4DecContext *const ctx, int32_t block[6 · 12 unmodified lines | ||
| 2209 | 2209 | |
| 2210 | 2210 | /* AC Coefficients */ |
| 2211 | 2211 | while (1) { |
| 2212 | − group = get_vlc2(&h->c.gb, cur_vlc, STUDIO_INTRA_BITS, 2); | |
| 2212 | + group = get_vlc2(&h->gb, cur_vlc, STUDIO_INTRA_BITS, 2); | |
| 2213 | 2213 | |
| 2214 | 2214 | if (group < 0) { |
| 2215 | 2215 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal ac coefficient group vlc\n"); |
| @@ -2226,12 +2226,12 @@ static int mpeg4_decode_studio_block(Mpeg4DecContext *const ctx, int32_t block[6 · 10 unmodified lines | ||
| 2226 | 2226 | /* Zero run length (Table B.47) */ |
| 2227 | 2227 | run = 1 << additional_code_len; |
| 2228 | 2228 | if (additional_code_len) |
| 2229 | − run += get_bits(&h->c.gb, additional_code_len); | |
| 2229 | + run += get_bits(&h->gb, additional_code_len); | |
| 2230 | 2230 | idx += run; |
| 2231 | 2231 | continue; |
| 2232 | 2232 | } else if (group >= 7 && group <= 12) { |
| 2233 | 2233 | /* Zero run length and +/-1 level (Table B.48) */ |
| 2234 | − code = get_bits(&h->c.gb, additional_code_len); | |
| 2234 | + code = get_bits(&h->gb, additional_code_len); | |
| 2235 | 2235 | sign = code & 1; |
| 2236 | 2236 | code >>= 1; |
| 2237 | 2237 | run = (1 << (additional_code_len - 1)) + code; |
| @@ -2245,14 +2245,14 @@ static int mpeg4_decode_studio_block(Mpeg4DecContext *const ctx, int32_t block[6 · 7 unmodified lines | ||
| 2245 | 2245 | if (idx > 63) |
| 2246 | 2246 | return AVERROR_INVALIDDATA; |
| 2247 | 2247 | j = scantable[idx++]; |
| 2248 | − block[j] = get_xbits(&h->c.gb, additional_code_len); | |
| 2248 | + block[j] = get_xbits(&h->gb, additional_code_len); | |
| 2249 | 2249 | } else if (group == 21) { |
| 2250 | 2250 | /* Escape */ |
| 2251 | 2251 | if (idx > 63) |
| 2252 | 2252 | return AVERROR_INVALIDDATA; |
| 2253 | 2253 | j = scantable[idx++]; |
| 2254 | 2254 | additional_code_len = h->c.avctx->bits_per_raw_sample + ctx->dct_precision + 4; |
| 2255 | − flc = get_bits(&h->c.gb, additional_code_len); | |
| 2255 | + flc = get_bits(&h->gb, additional_code_len); | |
| 2256 | 2256 | if (flc >> (additional_code_len-1)) |
| 2257 | 2257 | block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1); |
| 2258 | 2258 | else |
| @@ -2278,14 +2278,14 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx, · 19 unmodified lines | ||
| 2278 | 2278 | height = 16 >> (n ? h->c.chroma_y_shift : 0); |
| 2279 | 2279 | w = 16 >> (n ? h->c.chroma_x_shift : 0); |
| 2280 | 2280 | |
| 2281 | − block_mean = get_bits(&h->c.gb, h->c.avctx->bits_per_raw_sample); | |
| 2281 | + block_mean = get_bits(&h->gb, h->c.avctx->bits_per_raw_sample); | |
| 2282 | 2282 | if (block_mean == 0){ |
| 2283 | 2283 | av_log(h->c.avctx, AV_LOG_ERROR, "Forbidden block_mean\n"); |
| 2284 | 2284 | return AVERROR_INVALIDDATA; |
| 2285 | 2285 | } |
| 2286 | 2286 | h->c.last_dc[n] = block_mean * (1 << (ctx->dct_precision + h->c.intra_dc_precision)); |
| 2287 | 2287 | |
| 2288 | − rice_parameter = get_bits(&h->c.gb, 4); | |
| 2288 | + rice_parameter = get_bits(&h->gb, 4); | |
| 2289 | 2289 | if (rice_parameter == 0) { |
| 2290 | 2290 | av_log(h->c.avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n"); |
| 2291 | 2291 | return AVERROR_INVALIDDATA; |
| @@ -2307,17 +2307,17 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx, · 15 unmodified lines | ||
| 2307 | 2307 | left = output; |
| 2308 | 2308 | topleft = top; |
| 2309 | 2309 | |
| 2310 | − rice_prefix_code = get_unary(&h->c.gb, 1, 12); | |
| 2310 | + rice_prefix_code = get_unary(&h->gb, 1, 12); | |
| 2311 | 2311 | |
| 2312 | 2312 | /* Escape */ |
| 2313 | 2313 | if (rice_prefix_code == 11) |
| 2314 | − dpcm_residual = get_bits(&h->c.gb, h->c.avctx->bits_per_raw_sample); | |
| 2314 | + dpcm_residual = get_bits(&h->gb, h->c.avctx->bits_per_raw_sample); | |
| 2315 | 2315 | else { |
| 2316 | 2316 | if (rice_prefix_code == 12) { |
| 2317 | 2317 | av_log(h->c.avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n"); |
| 2318 | 2318 | return AVERROR_INVALIDDATA; |
| 2319 | 2319 | } |
| 2320 | − rice_suffix_code = get_bitsz(&h->c.gb, rice_parameter); | |
| 2320 | + rice_suffix_code = get_bitsz(&h->gb, rice_parameter); | |
| 2321 | 2321 | dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code; |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| @@ -2363,12 +2363,12 @@ static int mpeg4_decode_studio_mb(H263DecContext *const h) · 39 unmodified lines | ||
| 2363 | 2363 | /* StudioMacroblock */ |
| 2364 | 2364 | /* Assumes I-VOP */ |
| 2365 | 2365 | h->c.mb_intra = 1; |
| 2366 | − if (get_bits1(&h->c.gb)) { /* compression_mode */ | |
| 2366 | + if (get_bits1(&h->gb)) { /* compression_mode */ | |
| 2367 | 2367 | /* DCT */ |
| 2368 | 2368 | /* macroblock_type, 1 or 2-bit VLC */ |
| 2369 | − if (!get_bits1(&h->c.gb)) { | |
| 2370 | − skip_bits1(&h->c.gb); | |
| 2371 | − h->c.qscale = mpeg_get_qscale(&h->c); | |
| 2369 | + if (!get_bits1(&h->gb)) { | |
| 2370 | + skip_bits1(&h->gb); | |
| 2371 | + h->c.qscale = mpeg_get_qscale(&h->gb, h->c.q_scale_type); | |
| 2372 | 2372 | } |
| 2373 | 2373 | |
| 2374 | 2374 | for (i = 0; i < mpeg4_block_count[h->c.chroma_format]; i++) { |
| @@ -2377,25 +2377,25 @@ static int mpeg4_decode_studio_mb(H263DecContext *const h) · 2 unmodified lines | ||
| 2377 | 2377 | } |
| 2378 | 2378 | } else { |
| 2379 | 2379 | /* DPCM */ |
| 2380 | − check_marker(h->c.avctx, &h->c.gb, "DPCM block start"); | |
| 2381 | − ctx->dpcm_direction = get_bits1(&h->c.gb) ? -1 : 1; | |
| 2380 | + check_marker(h->c.avctx, &h->gb, "DPCM block start"); | |
| 2381 | + ctx->dpcm_direction = get_bits1(&h->gb) ? -1 : 1; | |
| 2382 | 2382 | for (i = 0; i < 3; i++) { |
| 2383 | 2383 | if (mpeg4_decode_dpcm_macroblock(ctx, ctx->dpcm_macroblock[i], i) < 0) |
| 2384 | 2384 | return AVERROR_INVALIDDATA; |
| 2385 | 2385 | } |
| 2386 | 2386 | } |
| 2387 | 2387 | |
| 2388 | − if (get_bits_left(&h->c.gb) >= 24 && show_bits(&h->c.gb, 23) == 0) { | |
| 2389 | − next_start_code_studio(&h->c.gb); | |
| 2388 | + if (get_bits_left(&h->gb) >= 24 && show_bits(&h->gb, 23) == 0) { | |
| 2389 | + next_start_code_studio(&h->gb); | |
| 2390 | 2390 | return SLICE_END; |
| 2391 | 2391 | } |
| 2392 | 2392 | |
| 2393 | 2393 | //vcon-stp9L1.bits (first frame) |
| 2394 | − if (get_bits_left(&h->c.gb) == 0) | |
| 2394 | + if (get_bits_left(&h->gb) == 0) | |
| 2395 | 2395 | return SLICE_END; |
| 2396 | 2396 | |
| 2397 | 2397 | //vcon-stp2L1.bits, vcon-stp3L1.bits, vcon-stp6L1.bits, vcon-stp7L1.bits, vcon-stp8L1.bits, vcon-stp10L1.bits (first frame) |
| 2398 | − if (get_bits_left(&h->c.gb) < 8U && show_bits(&h->c.gb, get_bits_left(&h->c.gb)) == 0) | |
| 2398 | + if (get_bits_left(&h->gb) < 8U && show_bits(&h->gb, get_bits_left(&h->gb)) == 0) | |
| 2399 | 2399 | return SLICE_END; |
| 2400 | 2400 | |
| 2401 | 2401 | return SLICE_OK; |
| @@ -3743,9 +3743,9 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 1341 unmodified lines | ||
| 3743 | 3743 | h->c.skipped_last_frame = 0; |
| 3744 | 3744 | |
| 3745 | 3745 | if (ctx->bitstream_buffer) { |
| 3746 | − int buf_size = get_bits_left(&h->c.gb) / 8U; | |
| 3746 | + int buf_size = get_bits_left(&h->gb) / 8U; | |
| 3747 | 3747 | int bitstream_buffer_size = ctx->bitstream_buffer->size; |
| 3748 | − const uint8_t *buf = h->c.gb.buffer; | |
| 3748 | + const uint8_t *buf = h->gb.buffer; | |
| 3749 | 3749 | |
| 3750 | 3750 | if (h->c.divx_packed) { |
| 3751 | 3751 | for (int i = 0; i < buf_size - 3; i++) { |
| @@ -3760,7 +3760,7 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 8 unmodified lines | ||
| 3760 | 3760 | } |
| 3761 | 3761 | ctx->bitstream_buffer->size = 0; |
| 3762 | 3762 | if (bitstream_buffer_size && (h->c.divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder |
| 3763 | − int ret = init_get_bits8(&h->c.gb, ctx->bitstream_buffer->data, | |
| 3763 | + int ret = init_get_bits8(&h->gb, ctx->bitstream_buffer->data, | |
| 3764 | 3764 | bitstream_buffer_size); |
| 3765 | 3765 | if (ret < 0) |
| 3766 | 3766 | return ret; |
| @@ -3768,7 +3768,7 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 3768 | 3768 | av_buffer_unref(&ctx->bitstream_buffer); |
| 3769 | 3769 | } |
| 3770 | 3770 | |
| 3771 | − return ff_mpeg4_parse_picture_header(ctx, &h->c.gb, 0, 0); | |
| 3771 | + return ff_mpeg4_parse_picture_header(ctx, &h->gb, 0, 0); | |
| 3772 | 3772 | } |
| 3773 | 3773 | |
| 3774 | 3774 | int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt) |
| @@ -3781,7 +3781,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt) · 6 unmodified lines | ||
| 3781 | 3781 | |
| 3782 | 3782 | /* divx 5.01+ bitstream reorder stuff */ |
| 3783 | 3783 | if (h->c.divx_packed) { |
| 3784 | − int current_pos = ctx->bitstream_buffer && h->c.gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&h->c.gb) >> 3); | |
| 3784 | + int current_pos = ctx->bitstream_buffer && h->gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&h->gb) >> 3); | |
| 3785 | 3785 | int startcode_found = 0; |
| 3786 | 3786 | uint8_t *buf = pkt->data; |
| 3787 | 3787 | int buf_size = pkt->size; |
| @@ -219,7 +219,6 @@ typedef struct MpegEncContext { · 218 unmodified lines | ||
| 219 | 219 | /* error concealment / resync */ |
| 220 | 220 | int resync_mb_x; ///< x position of last resync marker |
| 221 | 221 | int resync_mb_y; ///< y position of last resync marker |
| 222 | − GetBitContext last_resync_gb; ///< used to search for the next resync marker | |
| 223 | 222 | int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) |
| 224 | 223 | |
| 225 | 224 | /* H.263 specific */ |
| @@ -77,10 +77,10 @@ int ff_mpv_decode_close(AVCodecContext *avctx); · 76 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict); |
| 79 | 79 | |
| 80 | −static inline int mpeg_get_qscale(MpegEncContext *s) | |
| 80 | +static inline int mpeg_get_qscale(GetBitContext *const gb, int q_scale_type) | |
| 81 | 81 | { |
| 82 | − int qscale = get_bits(&s->gb, 5); | |
| 83 | − if (s->q_scale_type) | |
| 82 | + int qscale = get_bits(gb, 5); | |
| 83 | + if (q_scale_type) | |
| 84 | 84 | return ff_mpeg2_non_linear_qscale[qscale]; |
| 85 | 85 | else |
| 86 | 86 | return qscale << 1; |
| @@ -78,7 +78,7 @@ static int msmpeg4v2_decode_motion(H263DecContext *const h, int pred, int f_code · 77 unmodified lines | ||
| 78 | 78 | { |
| 79 | 79 | int code, val, sign, shift; |
| 80 | 80 | |
| 81 | − code = get_vlc2(&h->c.gb, ff_h263_mv_vlc, H263_MV_VLC_BITS, 2); | |
| 81 | + code = get_vlc2(&h->gb, ff_h263_mv_vlc, H263_MV_VLC_BITS, 2); | |
| 82 | 82 | ff_dlog(h->c.avctx, "MV code %d at %d %d pred: %d\n", |
| 83 | 83 | code, h->c.mb_x,h->c.mb_y, pred); |
| 84 | 84 | if (code < 0) |
| @@ -86,12 +86,12 @@ static int msmpeg4v2_decode_motion(H263DecContext *const h, int pred, int f_code · 1 unmodified line | ||
| 86 | 86 | |
| 87 | 87 | if (code == 0) |
| 88 | 88 | return pred; |
| 89 | − sign = get_bits1(&h->c.gb); | |
| 89 | + sign = get_bits1(&h->gb); | |
| 90 | 90 | shift = f_code - 1; |
| 91 | 91 | val = code; |
| 92 | 92 | if (shift) { |
| 93 | 93 | val = (val - 1) << shift; |
| 94 | − val |= get_bits(&h->c.gb, shift); | |
| 94 | + val |= get_bits(&h->gb, shift); | |
| 95 | 95 | val++; |
| 96 | 96 | } |
| 97 | 97 | if (sign) |
| @@ -114,7 +114,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 16 unmodified lines | ||
| 114 | 114 | |
| 115 | 115 | if (h->c.pict_type == AV_PICTURE_TYPE_P) { |
| 116 | 116 | if (ms->use_skip_mb_code) { |
| 117 | − if (get_bits1(&h->c.gb)) { | |
| 117 | + if (get_bits1(&h->gb)) { | |
| 118 | 118 | /* skip mb */ |
| 119 | 119 | h->c.mb_intra = 0; |
| 120 | 120 | for(i=0;i<6;i++) |
| @@ -130,9 +130,9 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 9 unmodified lines | ||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (h->c.msmpeg4_version == MSMP4_V2) |
| 133 | − code = get_vlc2(&h->c.gb, v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 1); | |
| 133 | + code = get_vlc2(&h->gb, v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 1); | |
| 134 | 134 | else |
| 135 | − code = get_vlc2(&h->c.gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 135 | + code = get_vlc2(&h->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); | |
| 136 | 136 | if(code<0 || code>7){ |
| 137 | 137 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", |
| 138 | 138 | code, h->c.mb_x, h->c.mb_y); |
| @@ -145,9 +145,9 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 6 unmodified lines | ||
| 145 | 145 | } else { |
| 146 | 146 | h->c.mb_intra = 1; |
| 147 | 147 | if (h->c.msmpeg4_version == MSMP4_V2) |
| 148 | − cbp = get_vlc2(&h->c.gb, v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 1); | |
| 148 | + cbp = get_vlc2(&h->gb, v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 1); | |
| 149 | 149 | else |
| 150 | − cbp = get_vlc2(&h->c.gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 150 | + cbp = get_vlc2(&h->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); | |
| 151 | 151 | if(cbp<0 || cbp>3){ |
| 152 | 152 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", |
| 153 | 153 | cbp, h->c.mb_x, h->c.mb_y); |
| @@ -158,7 +158,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 4 unmodified lines | ||
| 158 | 158 | if (!h->c.mb_intra) { |
| 159 | 159 | int mx, my, cbpy; |
| 160 | 160 | |
| 161 | − cbpy = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 161 | + cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 162 | 162 | if(cbpy<0){ |
| 163 | 163 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", |
| 164 | 164 | cbp, h->c.mb_x, h->c.mb_y); |
| @@ -181,8 +181,8 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 16 unmodified lines | ||
| 181 | 181 | } else { |
| 182 | 182 | int v; |
| 183 | 183 | if (h->c.msmpeg4_version == MSMP4_V2) { |
| 184 | − h->c.ac_pred = get_bits1(&h->c.gb); | |
| 185 | − v = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 184 | + h->c.ac_pred = get_bits1(&h->gb); | |
| 185 | + v = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 186 | 186 | if (v < 0) { |
| 187 | 187 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpy vlc invalid\n"); |
| 188 | 188 | return -1; |
| @@ -190,7 +190,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) · 1 unmodified line | ||
| 190 | 190 | cbp|= v<<2; |
| 191 | 191 | } else{ |
| 192 | 192 | h->c.ac_pred = 0; |
| 193 | − v = get_vlc2(&h->c.gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 193 | + v = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); | |
| 194 | 194 | if (v < 0) { |
| 195 | 195 | av_log(h->c.avctx, AV_LOG_ERROR, "cbpy vlc invalid\n"); |
| 196 | 196 | return -1; |
| @@ -220,12 +220,12 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h) · 23 unmodified lines | ||
| 220 | 220 | uint8_t *coded_val; |
| 221 | 221 | uint32_t * const mb_type_ptr = &h->c.cur_pic.mb_type[h->c.mb_x + h->c.mb_y*h->c.mb_stride]; |
| 222 | 222 | |
| 223 | − if (get_bits_left(&h->c.gb) <= 0) | |
| 223 | + if (get_bits_left(&h->gb) <= 0) | |
| 224 | 224 | return AVERROR_INVALIDDATA; |
| 225 | 225 | |
| 226 | 226 | if (h->c.pict_type == AV_PICTURE_TYPE_P) { |
| 227 | 227 | if (ms->use_skip_mb_code) { |
| 228 | − if (get_bits1(&h->c.gb)) { | |
| 228 | + if (get_bits1(&h->gb)) { | |
| 229 | 229 | /* skip mb */ |
| 230 | 230 | h->c.mb_intra = 0; |
| 231 | 231 | for(i=0;i<6;i++) |
| @@ -241,14 +241,14 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h) · 9 unmodified lines | ||
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | − code = get_vlc2(&h->c.gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX], MB_NON_INTRA_VLC_BITS, 3); | |
| 244 | + code = get_vlc2(&h->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX], MB_NON_INTRA_VLC_BITS, 3); | |
| 245 | 245 | //h->c.mb_intra = (code & 0x40) ? 0 : 1; |
| 246 | 246 | h->c.mb_intra = (~code & 0x40) >> 6; |
| 247 | 247 | |
| 248 | 248 | cbp = code & 0x3f; |
| 249 | 249 | } else { |
| 250 | 250 | h->c.mb_intra = 1; |
| 251 | − code = get_vlc2(&h->c.gb, ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 2); | |
| 251 | + code = get_vlc2(&h->gb, ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 2); | |
| 252 | 252 | /* predict coded block pattern */ |
| 253 | 253 | cbp = 0; |
| 254 | 254 | for(i=0;i<6;i++) { |
| @@ -265,7 +265,7 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h) · 10 unmodified lines | ||
| 265 | 265 | if (!h->c.mb_intra) { |
| 266 | 266 | int mx, my; |
| 267 | 267 | if (ms->per_mb_rl_table && cbp) { |
| 268 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 268 | + ms->rl_table_index = decode012(&h->gb); | |
| 269 | 269 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 270 | 270 | } |
| 271 | 271 | ff_h263_pred_motion(&h->c, 0, 0, &mx, &my); |
| @@ -278,16 +278,16 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h) · 6 unmodified lines | ||
| 278 | 278 | } else { |
| 279 | 279 | ff_dlog(h->c.avctx, "I at %d %d %d %06X\n", h->c.mb_x, h->c.mb_y, |
| 280 | 280 | ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0), |
| 281 | − show_bits(&h->c.gb, 24)); | |
| 282 | − h->c.ac_pred = get_bits1(&h->c.gb); | |
| 281 | + show_bits(&h->gb, 24)); | |
| 282 | + h->c.ac_pred = get_bits1(&h->gb); | |
| 283 | 283 | *mb_type_ptr = MB_TYPE_INTRA; |
| 284 | 284 | if (h->c.inter_intra_pred) { |
| 285 | − h->c.h263_aic_dir = get_vlc2(&h->c.gb, ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 1); | |
| 285 | + h->c.h263_aic_dir = get_vlc2(&h->gb, ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 1); | |
| 286 | 286 | ff_dlog(h->c.avctx, "%d%d %d %d/", |
| 287 | 287 | h->c.ac_pred, h->c.h263_aic_dir, h->c.mb_x, h->c.mb_y); |
| 288 | 288 | } |
| 289 | 289 | if (ms->per_mb_rl_table && cbp) { |
| 290 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 290 | + ms->rl_table_index = decode012(&h->gb); | |
| 291 | 291 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 292 | 292 | } |
| 293 | 293 | } |
| @@ -409,33 +409,33 @@ int ff_msmpeg4_decode_picture_header(H263DecContext *const h) · 115 unmodified lines | ||
| 409 | 409 | // smallest "black/skip" frame generally contain not much recoverable content |
| 410 | 410 | // while at the same time they have the highest computational requirements |
| 411 | 411 | // per byte |
| 412 | − if (get_bits_left(&h->c.gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16)) | |
| 412 | + if (get_bits_left(&h->gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16)) | |
| 413 | 413 | return AVERROR_INVALIDDATA; |
| 414 | 414 | |
| 415 | 415 | if (h->c.msmpeg4_version == MSMP4_V1) { |
| 416 | − int start_code = get_bits_long(&h->c.gb, 32); | |
| 416 | + int start_code = get_bits_long(&h->gb, 32); | |
| 417 | 417 | if(start_code!=0x00000100){ |
| 418 | 418 | av_log(h->c.avctx, AV_LOG_ERROR, "invalid startcode\n"); |
| 419 | 419 | return -1; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | − skip_bits(&h->c.gb, 5); // frame number */ | |
| 422 | + skip_bits(&h->gb, 5); // frame number */ | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | − h->c.pict_type = get_bits(&h->c.gb, 2) + 1; | |
| 425 | + h->c.pict_type = get_bits(&h->gb, 2) + 1; | |
| 426 | 426 | if (h->c.pict_type != AV_PICTURE_TYPE_I && |
| 427 | 427 | h->c.pict_type != AV_PICTURE_TYPE_P){ |
| 428 | 428 | av_log(h->c.avctx, AV_LOG_ERROR, "invalid picture type\n"); |
| 429 | 429 | return -1; |
| 430 | 430 | } |
| 431 | − h->c.chroma_qscale = h->c.qscale = get_bits(&h->c.gb, 5); | |
| 431 | + h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); | |
| 432 | 432 | if (h->c.qscale == 0) { |
| 433 | 433 | av_log(h->c.avctx, AV_LOG_ERROR, "invalid qscale\n"); |
| 434 | 434 | return -1; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 438 | − code = get_bits(&h->c.gb, 5); | |
| 438 | + code = get_bits(&h->gb, 5); | |
| 439 | 439 | if (h->c.msmpeg4_version == MSMP4_V1) { |
| 440 | 440 | if(code==0 || code>h->c.mb_height) { |
| 441 | 441 | av_log(h->c.avctx, AV_LOG_ERROR, "invalid slice height %d\n", code); |
| @@ -462,25 +462,25 @@ int ff_msmpeg4_decode_picture_header(H263DecContext *const h) · 20 unmodified lines | ||
| 462 | 462 | ms->dc_table_index = 0; //not used |
| 463 | 463 | break; |
| 464 | 464 | case MSMP4_V3: |
| 465 | − ms->rl_chroma_table_index = decode012(&h->c.gb); | |
| 466 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 465 | + ms->rl_chroma_table_index = decode012(&h->gb); | |
| 466 | + ms->rl_table_index = decode012(&h->gb); | |
| 467 | 467 | |
| 468 | − ms->dc_table_index = get_bits1(&h->c.gb); | |
| 468 | + ms->dc_table_index = get_bits1(&h->gb); | |
| 469 | 469 | break; |
| 470 | 470 | case MSMP4_WMV1: |
| 471 | 471 | ff_msmpeg4_decode_ext_header(h, (2+5+5+17+7)/8); |
| 472 | 472 | |
| 473 | 473 | if (ms->bit_rate > MBAC_BITRATE) |
| 474 | − ms->per_mb_rl_table = get_bits1(&h->c.gb); | |
| 474 | + ms->per_mb_rl_table = get_bits1(&h->gb); | |
| 475 | 475 | else |
| 476 | 476 | ms->per_mb_rl_table = 0; |
| 477 | 477 | |
| 478 | 478 | if (!ms->per_mb_rl_table) { |
| 479 | − ms->rl_chroma_table_index = decode012(&h->c.gb); | |
| 480 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 479 | + ms->rl_chroma_table_index = decode012(&h->gb); | |
| 480 | + ms->rl_table_index = decode012(&h->gb); | |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | − ms->dc_table_index = get_bits1(&h->c.gb); | |
| 483 | + ms->dc_table_index = get_bits1(&h->gb); | |
| 484 | 484 | h->c.inter_intra_pred= 0; |
| 485 | 485 | break; |
| 486 | 486 | default: |
| @@ -502,37 +502,37 @@ int ff_msmpeg4_decode_picture_header(H263DecContext *const h) · 15 unmodified lines | ||
| 502 | 502 | if (h->c.msmpeg4_version == MSMP4_V1) |
| 503 | 503 | ms->use_skip_mb_code = 1; |
| 504 | 504 | else |
| 505 | − ms->use_skip_mb_code = get_bits1(&h->c.gb); | |
| 505 | + ms->use_skip_mb_code = get_bits1(&h->gb); | |
| 506 | 506 | ms->rl_table_index = 2; |
| 507 | 507 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 508 | 508 | ms->dc_table_index = 0; //not used |
| 509 | 509 | ms->mv_table_index = 0; |
| 510 | 510 | break; |
| 511 | 511 | case MSMP4_V3: |
| 512 | − ms->use_skip_mb_code = get_bits1(&h->c.gb); | |
| 513 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 512 | + ms->use_skip_mb_code = get_bits1(&h->gb); | |
| 513 | + ms->rl_table_index = decode012(&h->gb); | |
| 514 | 514 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 515 | 515 | |
| 516 | − ms->dc_table_index = get_bits1(&h->c.gb); | |
| 516 | + ms->dc_table_index = get_bits1(&h->gb); | |
| 517 | 517 | |
| 518 | − ms->mv_table_index = get_bits1(&h->c.gb); | |
| 518 | + ms->mv_table_index = get_bits1(&h->gb); | |
| 519 | 519 | break; |
| 520 | 520 | case MSMP4_WMV1: |
| 521 | − ms->use_skip_mb_code = get_bits1(&h->c.gb); | |
| 521 | + ms->use_skip_mb_code = get_bits1(&h->gb); | |
| 522 | 522 | |
| 523 | 523 | if (ms->bit_rate > MBAC_BITRATE) |
| 524 | − ms->per_mb_rl_table = get_bits1(&h->c.gb); | |
| 524 | + ms->per_mb_rl_table = get_bits1(&h->gb); | |
| 525 | 525 | else |
| 526 | 526 | ms->per_mb_rl_table = 0; |
| 527 | 527 | |
| 528 | 528 | if (!ms->per_mb_rl_table) { |
| 529 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 529 | + ms->rl_table_index = decode012(&h->gb); | |
| 530 | 530 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | − ms->dc_table_index = get_bits1(&h->c.gb); | |
| 533 | + ms->dc_table_index = get_bits1(&h->gb); | |
| 534 | 534 | |
| 535 | − ms->mv_table_index = get_bits1(&h->c.gb); | |
| 535 | + ms->mv_table_index = get_bits1(&h->gb); | |
| 536 | 536 | h->c.inter_intra_pred = h->c.width*h->c.height < 320*240 && |
| 537 | 537 | ms->bit_rate <= II_BITRATE; |
| 538 | 538 | break; |
| @@ -568,15 +568,15 @@ int ff_msmpeg4_decode_picture_header(H263DecContext *const h) · 29 unmodified lines | ||
| 568 | 568 | int ff_msmpeg4_decode_ext_header(H263DecContext *const h, int buf_size) |
| 569 | 569 | { |
| 570 | 570 | MSMP4DecContext *const ms = mpv_to_msmpeg4(h); |
| 571 | − int left= buf_size*8 - get_bits_count(&h->c.gb); | |
| 571 | + int left = buf_size*8 - get_bits_count(&h->gb); | |
| 572 | 572 | int length = h->c.msmpeg4_version >= MSMP4_V3 ? 17 : 16; |
| 573 | 573 | /* the alt_bitstream reader could read over the end so we need to check it */ |
| 574 | 574 | if(left>=length && left<length+8) |
| 575 | 575 | { |
| 576 | − skip_bits(&h->c.gb, 5); /* fps */ | |
| 577 | − ms->bit_rate = get_bits(&h->c.gb, 11) * 1024; | |
| 576 | + skip_bits(&h->gb, 5); /* fps */ | |
| 577 | + ms->bit_rate = get_bits(&h->gb, 11) * 1024; | |
| 578 | 578 | if (h->c.msmpeg4_version >= MSMP4_V3) |
| 579 | − ms->flipflop_rounding = get_bits1(&h->c.gb); | |
| 579 | + ms->flipflop_rounding = get_bits1(&h->gb); | |
| 580 | 580 | else |
| 581 | 581 | ms->flipflop_rounding = 0; |
| 582 | 582 | } |
| @@ -601,9 +601,9 @@ static int msmpeg4_decode_dc(MSMP4DecContext *const ms, int n, int *dir_ptr) · 18 unmodified lines | ||
| 601 | 601 | |
| 602 | 602 | if (h->c.msmpeg4_version <= MSMP4_V2) { |
| 603 | 603 | if (n < 4) { |
| 604 | − level = get_vlc2(&h->c.gb, v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 3); | |
| 604 | + level = get_vlc2(&h->gb, v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 3); | |
| 605 | 605 | } else { |
| 606 | − level = get_vlc2(&h->c.gb, v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 3); | |
| 606 | + level = get_vlc2(&h->gb, v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 3); | |
| 607 | 607 | } |
| 608 | 608 | if (level < 0) { |
| 609 | 609 | av_log(h->c.avctx, AV_LOG_ERROR, "illegal dc vlc\n"); |
| @@ -612,15 +612,15 @@ static int msmpeg4_decode_dc(MSMP4DecContext *const ms, int n, int *dir_ptr) · 2 unmodified lines | ||
| 612 | 612 | } |
| 613 | 613 | level-=256; |
| 614 | 614 | } else { |
| 615 | − level = get_vlc2(&h->c.gb, ff_msmp4_dc_vlc[ms->dc_table_index][n >= 4], | |
| 615 | + level = get_vlc2(&h->gb, ff_msmp4_dc_vlc[ms->dc_table_index][n >= 4], | |
| 616 | 616 | MSMP4_DC_VLC_BITS, 3); |
| 617 | 617 | |
| 618 | 618 | if (level == DC_MAX) { |
| 619 | − level = get_bits(&h->c.gb, 8); | |
| 620 | − if (get_bits1(&h->c.gb)) | |
| 619 | + level = get_bits(&h->gb, 8); | |
| 620 | + if (get_bits1(&h->gb)) | |
| 621 | 621 | level = -level; |
| 622 | 622 | } else if (level != 0) { |
| 623 | − if (get_bits1(&h->c.gb)) | |
| 623 | + if (get_bits1(&h->gb)) | |
| 624 | 624 | level = -level; |
| 625 | 625 | } |
| 626 | 626 | } |
| @@ -721,58 +721,58 @@ int ff_msmpeg4_decode_block(MSMP4DecContext *const ms, int16_t * block, · 94 unmodified lines | ||
| 721 | 721 | rl_vlc= rl->rl_vlc[h->c.qscale]; |
| 722 | 722 | } |
| 723 | 723 | { |
| 724 | − OPEN_READER(re, &h->c.gb); | |
| 724 | + OPEN_READER(re, &h->gb); | |
| 725 | 725 | for(;;) { |
| 726 | − UPDATE_CACHE(re, &h->c.gb); | |
| 727 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 0); | |
| 726 | + UPDATE_CACHE(re, &h->gb); | |
| 727 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 0); | |
| 728 | 728 | if (level==0) { |
| 729 | 729 | int cache; |
| 730 | − cache= GET_CACHE(re, &h->c.gb); | |
| 730 | + cache= GET_CACHE(re, &h->gb); | |
| 731 | 731 | /* escape */ |
| 732 | 732 | if (h->c.msmpeg4_version == MSMP4_V1 || (cache&0x80000000)==0) { |
| 733 | 733 | if (h->c.msmpeg4_version == MSMP4_V1 || (cache&0x40000000)==0) { |
| 734 | 734 | /* third escape */ |
| 735 | 735 | if (h->c.msmpeg4_version != MSMP4_V1) |
| 736 | − LAST_SKIP_BITS(re, &h->c.gb, 2); | |
| 737 | − UPDATE_CACHE(re, &h->c.gb); | |
| 736 | + LAST_SKIP_BITS(re, &h->gb, 2); | |
| 737 | + UPDATE_CACHE(re, &h->gb); | |
| 738 | 738 | if (h->c.msmpeg4_version <= MSMP4_V3) { |
| 739 | − last = SHOW_UBITS(re, &h->c.gb, 1); SKIP_CACHE(re, &h->c.gb, 1); | |
| 740 | − run = SHOW_UBITS(re, &h->c.gb, 6); SKIP_CACHE(re, &h->c.gb, 6); | |
| 741 | − level = SHOW_SBITS(re, &h->c.gb, 8); | |
| 742 | − SKIP_COUNTER(re, &h->c.gb, 1 + 6 + 8); | |
| 739 | + last = SHOW_UBITS(re, &h->gb, 1); SKIP_CACHE(re, &h->gb, 1); | |
| 740 | + run = SHOW_UBITS(re, &h->gb, 6); SKIP_CACHE(re, &h->gb, 6); | |
| 741 | + level = SHOW_SBITS(re, &h->gb, 8); | |
| 742 | + SKIP_COUNTER(re, &h->gb, 1 + 6 + 8); | |
| 743 | 743 | }else{ |
| 744 | 744 | int sign; |
| 745 | − last = SHOW_UBITS(re, &h->c.gb, 1); SKIP_BITS(re, &h->c.gb, 1); | |
| 745 | + last = SHOW_UBITS(re, &h->gb, 1); SKIP_BITS(re, &h->gb, 1); | |
| 746 | 746 | if (!ms->esc3_level_length) { |
| 747 | 747 | int ll; |
| 748 | 748 | ff_dlog(h->c.avctx, "ESC-3 %X at %d %d\n", |
| 749 | − show_bits(&h->c.gb, 24), h->c.mb_x, h->c.mb_y); | |
| 749 | + show_bits(&h->gb, 24), h->c.mb_x, h->c.mb_y); | |
| 750 | 750 | if (h->c.qscale < 8) { |
| 751 | − ll = SHOW_UBITS(re, &h->c.gb, 3); SKIP_BITS(re, &h->c.gb, 3); | |
| 751 | + ll = SHOW_UBITS(re, &h->gb, 3); SKIP_BITS(re, &h->gb, 3); | |
| 752 | 752 | if(ll==0){ |
| 753 | − ll = 8+SHOW_UBITS(re, &h->c.gb, 1); SKIP_BITS(re, &h->c.gb, 1); | |
| 753 | + ll = 8+SHOW_UBITS(re, &h->gb, 1); SKIP_BITS(re, &h->gb, 1); | |
| 754 | 754 | } |
| 755 | 755 | }else{ |
| 756 | 756 | ll=2; |
| 757 | − while (ll < 8 && SHOW_UBITS(re, &h->c.gb, 1) == 0) { | |
| 757 | + while (ll < 8 && SHOW_UBITS(re, &h->gb, 1) == 0) { | |
| 758 | 758 | ll++; |
| 759 | − SKIP_BITS(re, &h->c.gb, 1); | |
| 759 | + SKIP_BITS(re, &h->gb, 1); | |
| 760 | 760 | } |
| 761 | − if (ll<8) SKIP_BITS(re, &h->c.gb, 1); | |
| 761 | + if (ll<8) SKIP_BITS(re, &h->gb, 1); | |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | ms->esc3_level_length = ll; |
| 765 | − ms->esc3_run_length = SHOW_UBITS(re, &h->c.gb, 2) + 3; SKIP_BITS(re, &h->c.gb, 2); | |
| 766 | − UPDATE_CACHE(re, &h->c.gb); | |
| 765 | + ms->esc3_run_length = SHOW_UBITS(re, &h->gb, 2) + 3; SKIP_BITS(re, &h->gb, 2); | |
| 766 | + UPDATE_CACHE(re, &h->gb); | |
| 767 | 767 | } |
| 768 | − run = SHOW_UBITS(re, &h->c.gb, ms->esc3_run_length); | |
| 769 | − SKIP_BITS(re, &h->c.gb, ms->esc3_run_length); | |
| 768 | + run = SHOW_UBITS(re, &h->gb, ms->esc3_run_length); | |
| 769 | + SKIP_BITS(re, &h->gb, ms->esc3_run_length); | |
| 770 | 770 | |
| 771 | − sign= SHOW_UBITS(re, &h->c.gb, 1); | |
| 772 | − SKIP_BITS(re, &h->c.gb, 1); | |
| 771 | + sign= SHOW_UBITS(re, &h->gb, 1); | |
| 772 | + SKIP_BITS(re, &h->gb, 1); | |
| 773 | 773 | |
| 774 | − level = SHOW_UBITS(re, &h->c.gb, ms->esc3_level_length); | |
| 775 | − SKIP_BITS(re, &h->c.gb, ms->esc3_level_length); | |
| 774 | + level = SHOW_UBITS(re, &h->gb, ms->esc3_level_length); | |
| 775 | + SKIP_BITS(re, &h->gb, ms->esc3_level_length); | |
| 776 | 776 | if(sign) level= -level; |
| 777 | 777 | } |
| 778 | 778 | |
| @@ -783,30 +783,30 @@ int ff_msmpeg4_decode_block(MSMP4DecContext *const ms, int16_t * block, · 4 unmodified lines | ||
| 783 | 783 | if(last) i+=192; |
| 784 | 784 | } else { |
| 785 | 785 | /* second escape */ |
| 786 | − SKIP_BITS(re, &h->c.gb, 2); | |
| 787 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 786 | + SKIP_BITS(re, &h->gb, 2); | |
| 787 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 788 | 788 | i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing |
| 789 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 790 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 789 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 790 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 791 | 791 | } |
| 792 | 792 | } else { |
| 793 | 793 | /* first escape */ |
| 794 | − SKIP_BITS(re, &h->c.gb, 1); | |
| 795 | − GET_RL_VLC(level, run, re, &h->c.gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 794 | + SKIP_BITS(re, &h->gb, 1); | |
| 795 | + GET_RL_VLC(level, run, re, &h->gb, rl_vlc, TEX_VLC_BITS, 2, 1); | |
| 796 | 796 | i+= run; |
| 797 | 797 | level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing |
| 798 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 799 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 798 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 799 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 800 | 800 | } |
| 801 | 801 | } else { |
| 802 | 802 | i+= run; |
| 803 | − level = (level ^ SHOW_SBITS(re, &h->c.gb, 1)) - SHOW_SBITS(re, &h->c.gb, 1); | |
| 804 | − LAST_SKIP_BITS(re, &h->c.gb, 1); | |
| 803 | + level = (level ^ SHOW_SBITS(re, &h->gb, 1)) - SHOW_SBITS(re, &h->gb, 1); | |
| 804 | + LAST_SKIP_BITS(re, &h->gb, 1); | |
| 805 | 805 | } |
| 806 | 806 | if (i > 62){ |
| 807 | 807 | i-= 192; |
| 808 | 808 | if(i&(~63)){ |
| 809 | − const int left = get_bits_left(&h->c.gb); | |
| 809 | + const int left = get_bits_left(&h->gb); | |
| 810 | 810 | if (((i + 192 == 64 && level / qmul == -1) || |
| 811 | 811 | !(h->c.avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && |
| 812 | 812 | left >= 0) { |
| @@ -827,7 +827,7 @@ int ff_msmpeg4_decode_block(MSMP4DecContext *const ms, int16_t * block, · 14 unmodified lines | ||
| 827 | 827 | |
| 828 | 828 | block[scan_table[i]] = level; |
| 829 | 829 | } |
| 830 | − CLOSE_READER(re, &h->c.gb); | |
| 830 | + CLOSE_READER(re, &h->gb); | |
| 831 | 831 | } |
| 832 | 832 | if (h->c.mb_intra) { |
| 833 | 833 | not_coded: |
| @@ -844,14 +844,14 @@ void ff_msmpeg4_decode_motion(MSMP4DecContext *const ms, int *mx_ptr, int *my_pt · 10 unmodified lines | ||
| 844 | 844 | H263DecContext *const h = &ms->h; |
| 845 | 845 | int sym, mx, my; |
| 846 | 846 | |
| 847 | − sym = get_vlc2(&h->c.gb, mv_vlc, MV_VLC_BITS, 2); | |
| 847 | + sym = get_vlc2(&h->gb, mv_vlc, MV_VLC_BITS, 2); | |
| 848 | 848 | if (sym) { |
| 849 | 849 | mx = sym >> 8; |
| 850 | 850 | my = sym & 0xFF; |
| 851 | 851 | } else { |
| 852 | 852 | /* Escape */ |
| 853 | − mx = get_bits(&h->c.gb, 6); | |
| 854 | − my = get_bits(&h->c.gb, 6); | |
| 853 | + mx = get_bits(&h->gb, 6); | |
| 854 | + my = get_bits(&h->gb, 6); | |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | mx += *mx_ptr - 32; |
| @@ -85,9 +85,9 @@ int ff_rv_decode_dc(H263DecContext *const h, int n) · 84 unmodified lines | ||
| 85 | 85 | int code; |
| 86 | 86 | |
| 87 | 87 | if (n < 4) { |
| 88 | − code = get_vlc2(&h->c.gb, rv_dc_lum, DC_VLC_BITS, 2); | |
| 88 | + code = get_vlc2(&h->gb, rv_dc_lum, DC_VLC_BITS, 2); | |
| 89 | 89 | } else { |
| 90 | − code = get_vlc2(&h->c.gb, rv_dc_chrom, DC_VLC_BITS, 2); | |
| 90 | + code = get_vlc2(&h->gb, rv_dc_chrom, DC_VLC_BITS, 2); | |
| 91 | 91 | if (code < 0) { |
| 92 | 92 | av_log(h->c.avctx, AV_LOG_ERROR, "chroma dc error\n"); |
| 93 | 93 | return -1; |
| @@ -101,9 +101,9 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 7 unmodified lines | ||
| 101 | 101 | { |
| 102 | 102 | int mb_count, pb_frame, marker, mb_xy; |
| 103 | 103 | |
| 104 | − marker = get_bits1(&h->c.gb); | |
| 104 | + marker = get_bits1(&h->gb); | |
| 105 | 105 | |
| 106 | − if (get_bits1(&h->c.gb)) | |
| 106 | + if (get_bits1(&h->gb)) | |
| 107 | 107 | h->c.pict_type = AV_PICTURE_TYPE_P; |
| 108 | 108 | else |
| 109 | 109 | h->c.pict_type = AV_PICTURE_TYPE_I; |
| @@ -111,7 +111,7 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 1 unmodified line | ||
| 111 | 111 | if (!marker) |
| 112 | 112 | av_log(h->c.avctx, AV_LOG_ERROR, "marker missing\n"); |
| 113 | 113 | |
| 114 | − pb_frame = get_bits1(&h->c.gb); | |
| 114 | + pb_frame = get_bits1(&h->gb); | |
| 115 | 115 | |
| 116 | 116 | ff_dlog(h->c.avctx, "pict_type=%d pb_frame=%d\n", h->c.pict_type, pb_frame); |
| 117 | 117 | |
| @@ -120,7 +120,7 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 2 unmodified lines | ||
| 120 | 120 | return AVERROR_PATCHWELCOME; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | − h->c.qscale = get_bits(&h->c.gb, 5); | |
| 123 | + h->c.qscale = get_bits(&h->gb, 5); | |
| 124 | 124 | if (h->c.qscale == 0) { |
| 125 | 125 | av_log(h->c.avctx, AV_LOG_ERROR, "Invalid qscale value: 0\n"); |
| 126 | 126 | return AVERROR_INVALIDDATA; |
| @@ -129,9 +129,9 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 2 unmodified lines | ||
| 129 | 129 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 130 | 130 | if (h->c.rv10_version == 3) { |
| 131 | 131 | /* specific MPEG like DC coding not used */ |
| 132 | − h->c.last_dc[0] = get_bits(&h->c.gb, 8); | |
| 133 | − h->c.last_dc[1] = get_bits(&h->c.gb, 8); | |
| 134 | − h->c.last_dc[2] = get_bits(&h->c.gb, 8); | |
| 132 | + h->c.last_dc[0] = get_bits(&h->gb, 8); | |
| 133 | + h->c.last_dc[1] = get_bits(&h->gb, 8); | |
| 134 | + h->c.last_dc[2] = get_bits(&h->gb, 8); | |
| 135 | 135 | ff_dlog(h->c.avctx, "DC:%d %d %d\n", h->c.last_dc[0], |
| 136 | 136 | h->c.last_dc[1], h->c.last_dc[2]); |
| 137 | 137 | } |
| @@ -140,16 +140,16 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 2 unmodified lines | ||
| 140 | 140 | * to display the macroblocks is coded here */ |
| 141 | 141 | |
| 142 | 142 | mb_xy = h->c.mb_x + h->c.mb_y * h->c.mb_width; |
| 143 | − if (show_bits(&h->c.gb, 12) == 0 || (mb_xy && mb_xy < h->c.mb_num)) { | |
| 144 | − h->c.mb_x = get_bits(&h->c.gb, 6); /* mb_x */ | |
| 145 | − h->c.mb_y = get_bits(&h->c.gb, 6); /* mb_y */ | |
| 146 | − mb_count = get_bits(&h->c.gb, 12); | |
| 143 | + if (show_bits(&h->gb, 12) == 0 || (mb_xy && mb_xy < h->c.mb_num)) { | |
| 144 | + h->c.mb_x = get_bits(&h->gb, 6); /* mb_x */ | |
| 145 | + h->c.mb_y = get_bits(&h->gb, 6); /* mb_y */ | |
| 146 | + mb_count = get_bits(&h->gb, 12); | |
| 147 | 147 | } else { |
| 148 | 148 | h->c.mb_x = 0; |
| 149 | 149 | h->c.mb_y = 0; |
| 150 | 150 | mb_count = h->c.mb_width * h->c.mb_height; |
| 151 | 151 | } |
| 152 | − skip_bits(&h->c.gb, 3); /* ignored */ | |
| 152 | + skip_bits(&h->gb, 3); /* ignored */ | |
| 153 | 153 | |
| 154 | 154 | return mb_count; |
| 155 | 155 | } |
| @@ -163,7 +163,7 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) · 7 unmodified lines | ||
| 163 | 163 | int seq, mb_pos, ret; |
| 164 | 164 | int rpr_max; |
| 165 | 165 | |
| 166 | − h->c.pict_type = pict_types[get_bits(&h->c.gb, 2)]; | |
| 166 | + h->c.pict_type = pict_types[get_bits(&h->gb, 2)]; | |
| 167 | 167 | |
| 168 | 168 | if (h->c.low_delay && h->c.pict_type == AV_PICTURE_TYPE_B) { |
| 169 | 169 | av_log(h->c.avctx, AV_LOG_ERROR, "low delay B\n"); |
| @@ -174,31 +174,31 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) · 4 unmodified lines | ||
| 174 | 174 | return AVERROR_INVALIDDATA; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | − if (get_bits1(&h->c.gb)) { | |
| 177 | + if (get_bits1(&h->gb)) { | |
| 178 | 178 | av_log(h->c.avctx, AV_LOG_ERROR, "reserved bit set\n"); |
| 179 | 179 | return AVERROR_INVALIDDATA; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | − h->c.qscale = get_bits(&h->c.gb, 5); | |
| 182 | + h->c.qscale = get_bits(&h->gb, 5); | |
| 183 | 183 | if (h->c.qscale == 0) { |
| 184 | 184 | av_log(h->c.avctx, AV_LOG_ERROR, "Invalid qscale value: 0\n"); |
| 185 | 185 | return AVERROR_INVALIDDATA; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (RV_GET_MINOR_VER(rv->sub_id) >= 2) |
| 189 | − h->c.loop_filter = get_bits1(&h->c.gb) && !h->c.avctx->lowres; | |
| 189 | + h->c.loop_filter = get_bits1(&h->gb) && !h->c.avctx->lowres; | |
| 190 | 190 | |
| 191 | 191 | if (RV_GET_MINOR_VER(rv->sub_id) <= 1) |
| 192 | − seq = get_bits(&h->c.gb, 8) << 7; | |
| 192 | + seq = get_bits(&h->gb, 8) << 7; | |
| 193 | 193 | else |
| 194 | − seq = get_bits(&h->c.gb, 13) << 2; | |
| 194 | + seq = get_bits(&h->gb, 13) << 2; | |
| 195 | 195 | |
| 196 | 196 | rpr_max = h->c.avctx->extradata[1] & 7; |
| 197 | 197 | if (rpr_max) { |
| 198 | 198 | int f, new_w, new_h; |
| 199 | 199 | int rpr_bits = av_log2(rpr_max) + 1; |
| 200 | 200 | |
| 201 | − f = get_bits(&h->c.gb, rpr_bits); | |
| 201 | + f = get_bits(&h->gb, rpr_bits); | |
| 202 | 202 | |
| 203 | 203 | if (f) { |
| 204 | 204 | if (h->c.avctx->extradata_size < 8 + 2 * f) { |
| @@ -277,11 +277,11 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) · 72 unmodified lines | ||
| 277 | 277 | ff_mpeg4_init_direct_mv(&h->c); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | − h->c.no_rounding = get_bits1(&h->c.gb); | |
| 280 | + h->c.no_rounding = get_bits1(&h->gb); | |
| 281 | 281 | |
| 282 | 282 | if (RV_GET_MINOR_VER(rv->sub_id) <= 1 && h->c.pict_type == AV_PICTURE_TYPE_B) |
| 283 | 283 | // binary decoder reads 3+2 bits here but they don't seem to be used |
| 284 | − skip_bits(&h->c.gb, 5); | |
| 284 | + skip_bits(&h->gb, 5); | |
| 285 | 285 | |
| 286 | 286 | h->c.h263_aic = h->c.pict_type == AV_PICTURE_TYPE_I; |
| 287 | 287 | if (h->c.h263_aic) { |
| @@ -416,7 +416,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 128 unmodified lines | ||
| 416 | 416 | int mb_count, mb_pos, left, start_mb_x, active_bits_size, ret; |
| 417 | 417 | |
| 418 | 418 | active_bits_size = buf_size * 8; |
| 419 | − init_get_bits(&h->c.gb, buf, FFMAX(buf_size, buf_size2) * 8); | |
| 419 | + init_get_bits(&h->gb, buf, FFMAX(buf_size, buf_size2) * 8); | |
| 420 | 420 | if (h->c.codec_id == AV_CODEC_ID_RV10) |
| 421 | 421 | mb_count = rv10_decode_picture_header(h); |
| 422 | 422 | else |
| @@ -492,24 +492,24 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 69 unmodified lines | ||
| 492 | 492 | |
| 493 | 493 | // Repeat the slice end check from ff_h263_decode_mb with our active |
| 494 | 494 | // bitstream size |
| 495 | − if (ret != SLICE_ERROR && active_bits_size >= get_bits_count(&h->c.gb)) { | |
| 496 | − int v = show_bits(&h->c.gb, 16); | |
| 495 | + if (ret != SLICE_ERROR && active_bits_size >= get_bits_count(&h->gb)) { | |
| 496 | + int v = show_bits(&h->gb, 16); | |
| 497 | 497 | |
| 498 | − if (get_bits_count(&h->c.gb) + 16 > active_bits_size) | |
| 499 | − v >>= get_bits_count(&h->c.gb) + 16 - active_bits_size; | |
| 498 | + if (get_bits_count(&h->gb) + 16 > active_bits_size) | |
| 499 | + v >>= get_bits_count(&h->gb) + 16 - active_bits_size; | |
| 500 | 500 | |
| 501 | 501 | if (!v) |
| 502 | 502 | ret = SLICE_END; |
| 503 | 503 | } |
| 504 | − if (ret != SLICE_ERROR && active_bits_size < get_bits_count(&h->c.gb) && | |
| 505 | − 8 * buf_size2 >= get_bits_count(&h->c.gb)) { | |
| 504 | + if (ret != SLICE_ERROR && active_bits_size < get_bits_count(&h->gb) && | |
| 505 | + 8 * buf_size2 >= get_bits_count(&h->gb)) { | |
| 506 | 506 | active_bits_size = buf_size2 * 8; |
| 507 | 507 | av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", |
| 508 | 508 | 8 * buf_size, active_bits_size); |
| 509 | 509 | ret = SLICE_OK; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | − if (ret == SLICE_ERROR || active_bits_size < get_bits_count(&h->c.gb)) { | |
| 512 | + if (ret == SLICE_ERROR || active_bits_size < get_bits_count(&h->gb)) { | |
| 513 | 513 | av_log(h->c.avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", h->c.mb_x, |
| 514 | 514 | h->c.mb_y); |
| 515 | 515 | return AVERROR_INVALIDDATA; |
| @@ -157,8 +157,8 @@ fail: · 156 unmodified lines | ||
| 157 | 157 | |
| 158 | 158 | static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) |
| 159 | 159 | { |
| 160 | − MpegEncContext *s = avctx->priv_data; | |
| 161 | − VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; | |
| 160 | + H263DecContext *const h = avctx->priv_data; | |
| 161 | + VAAPIDecodePicture *pic = h->c.cur_pic.ptr->hwaccel_picture_private; | |
| 162 | 162 | VASliceParameterBufferMPEG4 slice_param; |
| 163 | 163 | int err; |
| 164 | 164 | |
| @@ -166,9 +166,9 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer · 1 unmodified line | ||
| 166 | 166 | .slice_data_size = size, |
| 167 | 167 | .slice_data_offset = 0, |
| 168 | 168 | .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, |
| 169 | − .macroblock_offset = get_bits_count(&s->gb) % 8, | |
| 169 | + .macroblock_offset = get_bits_count(&h->gb) % 8, | |
| 170 | 170 | .macroblock_number = 0, |
| 171 | − .quant_scale = s->qscale, | |
| 171 | + .quant_scale = h->c.qscale, | |
| 172 | 172 | }; |
| 173 | 173 | |
| 174 | 174 | err = ff_vaapi_decode_make_slice_buffer(avctx, pic, |
| @@ -105,7 +105,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 104 unmodified lines | ||
| 105 | 105 | int coded_mb_count = 0; |
| 106 | 106 | uint32_t *const mb_type = h->c.cur_pic.mb_type; |
| 107 | 107 | |
| 108 | − w->skip_type = get_bits(&h->c.gb, 2); | |
| 108 | + w->skip_type = get_bits(&h->gb, 2); | |
| 109 | 109 | switch (w->skip_type) { |
| 110 | 110 | case SKIP_TYPE_NONE: |
| 111 | 111 | for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) |
| @@ -114,40 +114,40 @@ static int parse_mb_skip(WMV2DecContext *w) · 2 unmodified lines | ||
| 114 | 114 | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; |
| 115 | 115 | break; |
| 116 | 116 | case SKIP_TYPE_MPEG: |
| 117 | − if (get_bits_left(&h->c.gb) < h->c.mb_height * h->c.mb_width) | |
| 117 | + if (get_bits_left(&h->gb) < h->c.mb_height * h->c.mb_width) | |
| 118 | 118 | return AVERROR_INVALIDDATA; |
| 119 | 119 | for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) |
| 120 | 120 | for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) |
| 121 | 121 | mb_type[mb_y * h->c.mb_stride + mb_x] = |
| 122 | − (get_bits1(&h->c.gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 122 | + (get_bits1(&h->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 123 | 123 | break; |
| 124 | 124 | case SKIP_TYPE_ROW: |
| 125 | 125 | for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) { |
| 126 | − if (get_bits_left(&h->c.gb) < 1) | |
| 126 | + if (get_bits_left(&h->gb) < 1) | |
| 127 | 127 | return AVERROR_INVALIDDATA; |
| 128 | − if (get_bits1(&h->c.gb)) { | |
| 128 | + if (get_bits1(&h->gb)) { | |
| 129 | 129 | for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) |
| 130 | 130 | mb_type[mb_y * h->c.mb_stride + mb_x] = |
| 131 | 131 | MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; |
| 132 | 132 | } else { |
| 133 | 133 | for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) |
| 134 | 134 | mb_type[mb_y * h->c.mb_stride + mb_x] = |
| 135 | − (get_bits1(&h->c.gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 135 | + (get_bits1(&h->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | break; |
| 139 | 139 | case SKIP_TYPE_COL: |
| 140 | 140 | for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) { |
| 141 | − if (get_bits_left(&h->c.gb) < 1) | |
| 141 | + if (get_bits_left(&h->gb) < 1) | |
| 142 | 142 | return AVERROR_INVALIDDATA; |
| 143 | − if (get_bits1(&h->c.gb)) { | |
| 143 | + if (get_bits1(&h->gb)) { | |
| 144 | 144 | for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) |
| 145 | 145 | mb_type[mb_y * h->c.mb_stride + mb_x] = |
| 146 | 146 | MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; |
| 147 | 147 | } else { |
| 148 | 148 | for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) |
| 149 | 149 | mb_type[mb_y * h->c.mb_stride + mb_x] = |
| 150 | − (get_bits1(&h->c.gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 150 | + (get_bits1(&h->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | break; |
| @@ -157,7 +157,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 3 unmodified lines | ||
| 157 | 157 | for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) |
| 158 | 158 | coded_mb_count += !IS_SKIP(mb_type[mb_y * h->c.mb_stride + mb_x]); |
| 159 | 159 | |
| 160 | − if (coded_mb_count > get_bits_left(&h->c.gb)) | |
| 160 | + if (coded_mb_count > get_bits_left(&h->gb)) | |
| 161 | 161 | return AVERROR_INVALIDDATA; |
| 162 | 162 | |
| 163 | 163 | return 0; |
| @@ -205,17 +205,17 @@ int ff_wmv2_decode_picture_header(H263DecContext *const h) · 41 unmodified lines | ||
| 205 | 205 | { |
| 206 | 206 | int code; |
| 207 | 207 | |
| 208 | − h->c.pict_type = get_bits1(&h->c.gb) + 1; | |
| 208 | + h->c.pict_type = get_bits1(&h->gb) + 1; | |
| 209 | 209 | if (h->c.pict_type == AV_PICTURE_TYPE_I) { |
| 210 | − code = get_bits(&h->c.gb, 7); | |
| 210 | + code = get_bits(&h->gb, 7); | |
| 211 | 211 | av_log(h->c.avctx, AV_LOG_DEBUG, "I7:%X/\n", code); |
| 212 | 212 | } |
| 213 | − h->c.chroma_qscale = h->c.qscale = get_bits(&h->c.gb, 5); | |
| 213 | + h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5); | |
| 214 | 214 | if (h->c.qscale <= 0) |
| 215 | 215 | return AVERROR_INVALIDDATA; |
| 216 | 216 | |
| 217 | − if (h->c.pict_type != AV_PICTURE_TYPE_I && show_bits(&h->c.gb, 1)) { | |
| 218 | − GetBitContext gb = h->c.gb; | |
| 217 | + if (h->c.pict_type != AV_PICTURE_TYPE_I && show_bits(&h->gb, 1)) { | |
| 218 | + GetBitContext gb = h->gb; | |
| 219 | 219 | int skip_type = get_bits(&gb, 2); |
| 220 | 220 | int run = skip_type == SKIP_TYPE_COL ? h->c.mb_width : h->c.mb_height; |
| 221 | 221 | |
| @@ -241,29 +241,29 @@ int ff_wmv2_decode_secondary_picture_header(H263DecContext *const h) · 19 unmodified lines | ||
| 241 | 241 | memset(h->c.cur_pic.mb_type, 0, |
| 242 | 242 | sizeof(*h->c.cur_pic.mb_type) * h->c.mb_height * h->c.mb_stride); |
| 243 | 243 | if (w->j_type_bit) |
| 244 | − w->j_type = get_bits1(&h->c.gb); | |
| 244 | + w->j_type = get_bits1(&h->gb); | |
| 245 | 245 | else |
| 246 | 246 | w->j_type = 0; // FIXME check |
| 247 | 247 | |
| 248 | 248 | if (!w->j_type) { |
| 249 | 249 | if (w->per_mb_rl_bit) |
| 250 | − w->ms.per_mb_rl_table = get_bits1(&h->c.gb); | |
| 250 | + w->ms.per_mb_rl_table = get_bits1(&h->gb); | |
| 251 | 251 | else |
| 252 | 252 | w->ms.per_mb_rl_table = 0; |
| 253 | 253 | |
| 254 | 254 | if (!w->ms.per_mb_rl_table) { |
| 255 | − w->ms.rl_chroma_table_index = decode012(&h->c.gb); | |
| 256 | − w->ms.rl_table_index = decode012(&h->c.gb); | |
| 255 | + w->ms.rl_chroma_table_index = decode012(&h->gb); | |
| 256 | + w->ms.rl_table_index = decode012(&h->gb); | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | − w->ms.dc_table_index = get_bits1(&h->c.gb); | |
| 259 | + w->ms.dc_table_index = get_bits1(&h->gb); | |
| 260 | 260 | |
| 261 | 261 | // at minimum one bit per macroblock is required at least in a valid frame, |
| 262 | 262 | // we discard frames much smaller than this. Frames smaller than 1/8 of the |
| 263 | 263 | // smallest "black/skip" frame generally contain not much recoverable content |
| 264 | 264 | // while at the same time they have the highest computational requirements |
| 265 | 265 | // per byte |
| 266 | − if (get_bits_left(&h->c.gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16)) | |
| 266 | + if (get_bits_left(&h->gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16)) | |
| 267 | 267 | return AVERROR_INVALIDDATA; |
| 268 | 268 | } |
| 269 | 269 | h->c.inter_intra_pred = 0; |
| @@ -282,35 +282,35 @@ int ff_wmv2_decode_secondary_picture_header(H263DecContext *const h) · 12 unmodified lines | ||
| 282 | 282 | ret = parse_mb_skip(w); |
| 283 | 283 | if (ret < 0) |
| 284 | 284 | return ret; |
| 285 | − cbp_index = decode012(&h->c.gb); | |
| 285 | + cbp_index = decode012(&h->gb); | |
| 286 | 286 | w->cbp_table_index = wmv2_get_cbp_table_index(h->c.qscale, cbp_index); |
| 287 | 287 | |
| 288 | 288 | if (w->mspel_bit) |
| 289 | − h->c.mspel = get_bits1(&h->c.gb); | |
| 289 | + h->c.mspel = get_bits1(&h->gb); | |
| 290 | 290 | else |
| 291 | 291 | h->c.mspel = 0; // FIXME check |
| 292 | 292 | |
| 293 | 293 | if (w->abt_flag) { |
| 294 | − w->per_mb_abt = get_bits1(&h->c.gb) ^ 1; | |
| 294 | + w->per_mb_abt = get_bits1(&h->gb) ^ 1; | |
| 295 | 295 | if (!w->per_mb_abt) |
| 296 | − w->abt_type = decode012(&h->c.gb); | |
| 296 | + w->abt_type = decode012(&h->gb); | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (w->per_mb_rl_bit) |
| 300 | − w->ms.per_mb_rl_table = get_bits1(&h->c.gb); | |
| 300 | + w->ms.per_mb_rl_table = get_bits1(&h->gb); | |
| 301 | 301 | else |
| 302 | 302 | w->ms.per_mb_rl_table = 0; |
| 303 | 303 | |
| 304 | 304 | if (!w->ms.per_mb_rl_table) { |
| 305 | − w->ms.rl_table_index = decode012(&h->c.gb); | |
| 305 | + w->ms.rl_table_index = decode012(&h->gb); | |
| 306 | 306 | w->ms.rl_chroma_table_index = w->ms.rl_table_index; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | − if (get_bits_left(&h->c.gb) < 2) | |
| 309 | + if (get_bits_left(&h->gb) < 2) | |
| 310 | 310 | return AVERROR_INVALIDDATA; |
| 311 | 311 | |
| 312 | − w->ms.dc_table_index = get_bits1(&h->c.gb); | |
| 313 | − w->ms.mv_table_index = get_bits1(&h->c.gb); | |
| 312 | + w->ms.dc_table_index = get_bits1(&h->gb); | |
| 313 | + w->ms.mv_table_index = get_bits1(&h->gb); | |
| 314 | 314 | |
| 315 | 315 | h->c.inter_intra_pred = 0; // (h->c.width * h->c.height < 320 * 240 && w->ms.bit_rate <= II_BITRATE); |
| 316 | 316 | h->c.no_rounding ^= 1; |
| @@ -331,7 +331,7 @@ int ff_wmv2_decode_secondary_picture_header(H263DecContext *const h) · 14 unmodified lines | ||
| 331 | 331 | |
| 332 | 332 | if (w->j_type) { |
| 333 | 333 | ff_intrax8_decode_picture(&w->x8, h->c.cur_pic.ptr, |
| 334 | − &h->c.gb, &h->c.mb_x, &h->c.mb_y, | |
| 334 | + &h->gb, &h->c.mb_x, &h->c.mb_y, | |
| 335 | 335 | 2 * h->c.qscale, (h->c.qscale - 1) | 1, |
| 336 | 336 | h->c.loop_filter, h->c.low_delay); |
| 337 | 337 | |
| @@ -351,7 +351,7 @@ static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_pt · 13 unmodified lines | ||
| 351 | 351 | ff_msmpeg4_decode_motion(&w->ms, mx_ptr, my_ptr); |
| 352 | 352 | |
| 353 | 353 | if ((((*mx_ptr) | (*my_ptr)) & 1) && h->c.mspel) |
| 354 | − w->common.hshift = get_bits1(&h->c.gb); | |
| 354 | + w->common.hshift = get_bits1(&h->gb); | |
| 355 | 355 | else |
| 356 | 356 | w->common.hshift = 0; |
| 357 | 357 | } |
| @@ -376,7 +376,7 @@ static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py) · 18 unmodified lines | ||
| 376 | 376 | diff = 0; |
| 377 | 377 | |
| 378 | 378 | if (diff >= 8) |
| 379 | − type = get_bits1(&h->c.gb); | |
| 379 | + type = get_bits1(&h->gb); | |
| 380 | 380 | else |
| 381 | 381 | type = 2; |
| 382 | 382 | |
| @@ -413,13 +413,13 @@ static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, · 30 unmodified lines | ||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | if (w->per_block_abt) |
| 416 | − w->abt_type = decode012(&h->c.gb); | |
| 416 | + w->abt_type = decode012(&h->gb); | |
| 417 | 417 | w->abt_type_table[n] = w->abt_type; |
| 418 | 418 | |
| 419 | 419 | if (w->abt_type) { |
| 420 | 420 | const uint8_t *scantable = w->abt_type == 1 ? ff_wmv2_scantableA : ff_wmv2_scantableB; |
| 421 | 421 | |
| 422 | − sub_cbp = sub_cbp_table[decode012(&h->c.gb)]; | |
| 422 | + sub_cbp = sub_cbp_table[decode012(&h->gb)]; | |
| 423 | 423 | |
| 424 | 424 | if (sub_cbp & 1) { |
| 425 | 425 | ret = ff_msmpeg4_decode_block(&w->ms, block, n, 1, scantable); |
| @@ -468,19 +468,19 @@ static int wmv2_decode_mb(H263DecContext *const h) · 42 unmodified lines | ||
| 468 | 468 | w->common.hshift = 0; |
| 469 | 469 | return 0; |
| 470 | 470 | } |
| 471 | − if (get_bits_left(&h->c.gb) <= 0) | |
| 471 | + if (get_bits_left(&h->gb) <= 0) | |
| 472 | 472 | return AVERROR_INVALIDDATA; |
| 473 | 473 | |
| 474 | − code = get_vlc2(&h->c.gb, ff_mb_non_intra_vlc[w->cbp_table_index], | |
| 474 | + code = get_vlc2(&h->gb, ff_mb_non_intra_vlc[w->cbp_table_index], | |
| 475 | 475 | MB_NON_INTRA_VLC_BITS, 3); |
| 476 | 476 | h->c.mb_intra = (~code & 0x40) >> 6; |
| 477 | 477 | |
| 478 | 478 | cbp = code & 0x3f; |
| 479 | 479 | } else { |
| 480 | 480 | h->c.mb_intra = 1; |
| 481 | − if (get_bits_left(&h->c.gb) <= 0) | |
| 481 | + if (get_bits_left(&h->gb) <= 0) | |
| 482 | 482 | return AVERROR_INVALIDDATA; |
| 483 | − code = get_vlc2(&h->c.gb, ff_msmp4_mb_i_vlc, | |
| 483 | + code = get_vlc2(&h->gb, ff_msmp4_mb_i_vlc, | |
| 484 | 484 | MSMP4_MB_INTRA_VLC_BITS, 2); |
| 485 | 485 | /* predict coded block pattern */ |
| 486 | 486 | cbp = 0; |
| @@ -502,14 +502,14 @@ static int wmv2_decode_mb(H263DecContext *const h) · 15 unmodified lines | ||
| 502 | 502 | if (cbp) { |
| 503 | 503 | h->c.bdsp.clear_blocks(h->block[0]); |
| 504 | 504 | if (ms->per_mb_rl_table) { |
| 505 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 505 | + ms->rl_table_index = decode012(&h->gb); | |
| 506 | 506 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if (w->abt_flag && w->per_mb_abt) { |
| 510 | − w->per_block_abt = get_bits1(&h->c.gb); | |
| 510 | + w->per_block_abt = get_bits1(&h->gb); | |
| 511 | 511 | if (!w->per_block_abt) |
| 512 | − w->abt_type = decode012(&h->c.gb); | |
| 512 | + w->abt_type = decode012(&h->gb); | |
| 513 | 513 | } else |
| 514 | 514 | w->per_block_abt = 0; |
| 515 | 515 | } |
| @@ -534,16 +534,16 @@ static int wmv2_decode_mb(H263DecContext *const h) · 18 unmodified lines | ||
| 534 | 534 | ff_dlog(h->c.avctx, "%d%d ", h->c.inter_intra_pred, cbp); |
| 535 | 535 | ff_dlog(h->c.avctx, "I at %d %d %d %06X\n", h->c.mb_x, h->c.mb_y, |
| 536 | 536 | ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0), |
| 537 | − show_bits(&h->c.gb, 24)); | |
| 538 | − h->c.ac_pred = get_bits1(&h->c.gb); | |
| 537 | + show_bits(&h->gb, 24)); | |
| 538 | + h->c.ac_pred = get_bits1(&h->gb); | |
| 539 | 539 | if (h->c.inter_intra_pred) { |
| 540 | − h->c.h263_aic_dir = get_vlc2(&h->c.gb, ff_inter_intra_vlc, | |
| 540 | + h->c.h263_aic_dir = get_vlc2(&h->gb, ff_inter_intra_vlc, | |
| 541 | 541 | INTER_INTRA_VLC_BITS, 1); |
| 542 | 542 | ff_dlog(h->c.avctx, "%d%d %d %d/", |
| 543 | 543 | h->c.ac_pred, h->c.h263_aic_dir, h->c.mb_x, h->c.mb_y); |
| 544 | 544 | } |
| 545 | 545 | if (ms->per_mb_rl_table && cbp) { |
| 546 | − ms->rl_table_index = decode012(&h->c.gb); | |
| 546 | + ms->rl_table_index = decode012(&h->gb); | |
| 547 | 547 | ms->rl_chroma_table_index = ms->rl_table_index; |
| 548 | 548 | } |
| 549 | 549 | |