Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/svq3.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2003 The FFmpeg Project 2 * Copyright (c) 2003 The FFmpeg Project
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 /* fill caches */ 471 /* fill caches */
472 /* note ref_cache should contain here: 472 /* note ref_cache should contain here:
473 ???????? 473 ????????
474 ???11111 474 ???11111
475 N??11111 475 N??11111
476 N??11111 476 N??11111
477 N??11111 477 N??11111
478 */ 478 */
479 479
480 for (m = 0; m < 2; m++) { 480 for (m = 0; m < 2; m++) {
481 if (s->mb_x > 0 && h->intra4x4_pred_mode[mb_xy - 1][0] != -1) { 481 if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] ! = -1) {
482 for (i = 0; i < 4; i++) { 482 for (i = 0; i < 4; i++) {
483 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride]; 483 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
484 } 484 }
485 } else { 485 } else {
486 for (i = 0; i < 4; i++) { 486 for (i = 0; i < 4; i++) {
487 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0; 487 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
488 } 488 }
489 } 489 }
490 if (s->mb_y > 0) { 490 if (s->mb_y > 0) {
491 memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion _val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t)); 491 memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion _val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
492 memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[ mb_xy - s->mb_stride][4] == -1) ? PART_NOT_AVAILABLE : 1, 4); 492 memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[ h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
493 493
494 if (s->mb_x < (s->mb_width - 1)) { 494 if (s->mb_x < (s->mb_width - 1)) {
495 *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4]; 495 *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
496 h->ref_cache[m][scan8[0] + 4 - 1*8] = 496 h->ref_cache[m][scan8[0] + 4 - 1*8] =
497 (h->intra4x4_pred_mode[mb_xy - s->mb_stride + 1][0] == - 1 || 497 (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 ||
498 h->intra4x4_pred_mode[mb_xy - s->mb_stride ][4] == - 1) ? PART_NOT_AVAILABLE : 1; 498 h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1;
499 }else 499 }else
500 h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE; 500 h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
501 if (s->mb_x > 0) { 501 if (s->mb_x > 0) {
502 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1]; 502 *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_ t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
503 h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode [mb_xy - s->mb_stride - 1][3] == -1) ? PART_NOT_AVAILABLE : 1; 503 h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode [h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1;
504 }else 504 }else
505 h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE; 505 h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
506 }else 506 }else
507 memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); 507 memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8);
508 508
509 if (s->pict_type != FF_B_TYPE) 509 if (s->pict_type != FF_B_TYPE)
510 break; 510 break;
511 } 511 }
512 512
513 /* decode motion vector(s) and form prediction(s) */ 513 /* decode motion vector(s) and form prediction(s) */
(...skipping 19 matching lines...) Expand all
533 } 533 }
534 } 534 }
535 535
536 mb_type = MB_TYPE_16x16; 536 mb_type = MB_TYPE_16x16;
537 } else if (mb_type == 8 || mb_type == 33) { /* INTRA4x4 */ 537 } else if (mb_type == 8 || mb_type == 33) { /* INTRA4x4 */
538 memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t)); 538 memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t));
539 539
540 if (mb_type == 8) { 540 if (mb_type == 8) {
541 if (s->mb_x > 0) { 541 if (s->mb_x > 0) {
542 for (i = 0; i < 4; i++) { 542 for (i = 0; i < 4; i++) {
543 h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x 4_pred_mode[mb_xy - 1][i]; 543 h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x 4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i];
544 } 544 }
545 if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) { 545 if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
546 h->left_samples_available = 0x5F5F; 546 h->left_samples_available = 0x5F5F;
547 } 547 }
548 } 548 }
549 if (s->mb_y > 0) { 549 if (s->mb_y > 0) {
550 h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][4]; 550 h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb 2br_xy[mb_xy - s->mb_stride]+0];
551 h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][5]; 551 h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb 2br_xy[mb_xy - s->mb_stride]+1];
552 h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][6]; 552 h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb 2br_xy[mb_xy - s->mb_stride]+2];
553 h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][3]; 553 h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb 2br_xy[mb_xy - s->mb_stride]+3];
554 554
555 if (h->intra4x4_pred_mode_cache[4+8*0] == -1) { 555 if (h->intra4x4_pred_mode_cache[4+8*0] == -1) {
556 h->top_samples_available = 0x33FF; 556 h->top_samples_available = 0x33FF;
557 } 557 }
558 } 558 }
559 559
560 /* decode prediction codes for luma blocks */ 560 /* decode prediction codes for luma blocks */
561 for (i = 0; i < 16; i+=2) { 561 for (i = 0; i < 16; i+=2) {
562 vlc = svq3_get_ue_golomb(&s->gb); 562 vlc = svq3_get_ue_golomb(&s->gb);
563 563
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 for (i = 0; i < 4; i++) { 617 for (i = 0; i < 4; i++) {
618 memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4* 2*sizeof(int16_t)); 618 memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4* 2*sizeof(int16_t));
619 } 619 }
620 if (s->pict_type == FF_B_TYPE) { 620 if (s->pict_type == FF_B_TYPE) {
621 for (i = 0; i < 4; i++) { 621 for (i = 0; i < 4; i++) {
622 memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0 , 4*2*sizeof(int16_t)); 622 memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0 , 4*2*sizeof(int16_t));
623 } 623 }
624 } 624 }
625 } 625 }
626 if (!IS_INTRA4x4(mb_type)) { 626 if (!IS_INTRA4x4(mb_type)) {
627 memset(h->intra4x4_pred_mode[mb_xy], DC_PRED, 8); 627 memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8);
628 } 628 }
629 if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) { 629 if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) {
630 memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t)); 630 memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
631 s->dsp.clear_blocks(h->mb); 631 s->dsp.clear_blocks(h->mb);
632 } 632 }
633 633
634 if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TY PE)) { 634 if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TY PE)) {
635 if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){ 635 if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){
636 av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); 636 av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
637 return -1; 637 return -1;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 767
768 skip_bits1(&s->gb); 768 skip_bits1(&s->gb);
769 skip_bits(&s->gb, 2); 769 skip_bits(&s->gb, 2);
770 770
771 while (get_bits1(&s->gb)) { 771 while (get_bits1(&s->gb)) {
772 skip_bits(&s->gb, 8); 772 skip_bits(&s->gb, 8);
773 } 773 }
774 774
775 /* reset intra predictors and invalidate motion vector references */ 775 /* reset intra predictors and invalidate motion vector references */
776 if (s->mb_x > 0) { 776 if (s->mb_x > 0) {
777 memset(h->intra4x4_pred_mode[mb_xy - 1], -1, 4*sizeof(int8_t)); 777 memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - 1 ]+3, -1, 4*sizeo f(int8_t));
778 memset(h->intra4x4_pred_mode[mb_xy - s->mb_x], -1, 8*sizeof(int8_t)*s->m b_x); 778 memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_x] , -1, 8*sizeo f(int8_t)*s->mb_x);
779 } 779 }
780 if (s->mb_y > 0) { 780 if (s->mb_y > 0) {
781 memset(h->intra4x4_pred_mode[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t) *(s->mb_width - s->mb_x)); 781 memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_stride], -1, 8*si zeof(int8_t)*(s->mb_width - s->mb_x));
782 782
783 if (s->mb_x > 0) { 783 if (s->mb_x > 0) {
784 h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] = -1; 784 h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] = -1;
785 } 785 }
786 } 786 }
787 787
788 return 0; 788 return 0;
789 } 789 }
790 790
791 static av_cold int svq3_decode_init(AVCodecContext *avctx) 791 static av_cold int svq3_decode_init(AVCodecContext *avctx)
792 { 792 {
793 MpegEncContext *const s = avctx->priv_data; 793 MpegEncContext *const s = avctx->priv_data;
794 H264Context *const h = avctx->priv_data; 794 H264Context *const h = avctx->priv_data;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 CODEC_ID_SVQ3, 1075 CODEC_ID_SVQ3,
1076 sizeof(H264Context), 1076 sizeof(H264Context),
1077 svq3_decode_init, 1077 svq3_decode_init,
1078 NULL, 1078 NULL,
1079 ff_h264_decode_end, 1079 ff_h264_decode_end,
1080 svq3_decode_frame, 1080 svq3_decode_frame,
1081 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY, 1081 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
1082 .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Vi deo 3 / SVQ3"), 1082 .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Vi deo 3 / SVQ3"),
1083 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_NONE}, 1083 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_NONE},
1084 }; 1084 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698