| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 xd->fullpixel_mask = 0xfffffff8; | 693 xd->fullpixel_mask = 0xfffffff8; |
| 694 | 694 |
| 695 vp8_zero(x->coef_counts); | 695 vp8_zero(x->coef_counts); |
| 696 vp8_zero(x->ymode_count); | 696 vp8_zero(x->ymode_count); |
| 697 vp8_zero(x->uv_mode_count) | 697 vp8_zero(x->uv_mode_count) |
| 698 x->prediction_error = 0; | 698 x->prediction_error = 0; |
| 699 x->intra_error = 0; | 699 x->intra_error = 0; |
| 700 vp8_zero(x->count_mb_ref_frame_usage); | 700 vp8_zero(x->count_mb_ref_frame_usage); |
| 701 } | 701 } |
| 702 | 702 |
| 703 #if CONFIG_MULTITHREAD |
| 703 static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread) | 704 static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread) |
| 704 { | 705 { |
| 705 int i = 0; | 706 int i = 0; |
| 706 do | 707 do |
| 707 { | 708 { |
| 708 int j = 0; | 709 int j = 0; |
| 709 do | 710 do |
| 710 { | 711 { |
| 711 int k = 0; | 712 int k = 0; |
| 712 do | 713 do |
| 713 { | 714 { |
| 714 /* at every context */ | 715 /* at every context */ |
| 715 | 716 |
| 716 /* calc probs and branch cts for this frame only */ | 717 /* calc probs and branch cts for this frame only */ |
| 717 int t = 0; /* token/prob index */ | 718 int t = 0; /* token/prob index */ |
| 718 | 719 |
| 719 do | 720 do |
| 720 { | 721 { |
| 721 x->coef_counts [i][j][k][t] += | 722 x->coef_counts [i][j][k][t] += |
| 722 x_thread->coef_counts [i][j][k][t]; | 723 x_thread->coef_counts [i][j][k][t]; |
| 723 } | 724 } |
| 724 while (++t < ENTROPY_NODES); | 725 while (++t < ENTROPY_NODES); |
| 725 } | 726 } |
| 726 while (++k < PREV_COEF_CONTEXTS); | 727 while (++k < PREV_COEF_CONTEXTS); |
| 727 } | 728 } |
| 728 while (++j < COEF_BANDS); | 729 while (++j < COEF_BANDS); |
| 729 } | 730 } |
| 730 while (++i < BLOCK_TYPES); | 731 while (++i < BLOCK_TYPES); |
| 731 } | 732 } |
| 733 #endif // CONFIG_MULTITHREAD |
| 732 | 734 |
| 733 void vp8_encode_frame(VP8_COMP *cpi) | 735 void vp8_encode_frame(VP8_COMP *cpi) |
| 734 { | 736 { |
| 735 int mb_row; | 737 int mb_row; |
| 736 MACROBLOCK *const x = & cpi->mb; | 738 MACROBLOCK *const x = & cpi->mb; |
| 737 VP8_COMMON *const cm = & cpi->common; | 739 VP8_COMMON *const cm = & cpi->common; |
| 738 MACROBLOCKD *const xd = & x->e_mbd; | 740 MACROBLOCKD *const xd = & x->e_mbd; |
| 739 TOKENEXTRA *tp = cpi->tok; | 741 TOKENEXTRA *tp = cpi->tok; |
| 740 int segment_counts[MAX_MB_SEGMENTS]; | 742 int segment_counts[MAX_MB_SEGMENTS]; |
| 741 int totalrate; | 743 int totalrate; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 for(c_idx = 0; c_idx < MAX_ERROR_BINS; c_idx++) | 922 for(c_idx = 0; c_idx < MAX_ERROR_BINS; c_idx++) |
| 921 cpi->mb.error_bins[c_idx] += | 923 cpi->mb.error_bins[c_idx] += |
| 922 cpi->mb_row_ei[i].mb.error_bins[c_idx]; | 924 cpi->mb_row_ei[i].mb.error_bins[c_idx]; |
| 923 | 925 |
| 924 /* add up counts for each thread */ | 926 /* add up counts for each thread */ |
| 925 sum_coef_counts(x, &cpi->mb_row_ei[i].mb); | 927 sum_coef_counts(x, &cpi->mb_row_ei[i].mb); |
| 926 } | 928 } |
| 927 | 929 |
| 928 } | 930 } |
| 929 else | 931 else |
| 930 #endif | 932 #endif // CONFIG_MULTITHREAD |
| 931 { | 933 { |
| 932 | 934 |
| 933 /* for each macroblock row in image */ | 935 /* for each macroblock row in image */ |
| 934 for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) | 936 for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) |
| 935 { | 937 { |
| 936 vp8_zero(cm->left_context) | 938 vp8_zero(cm->left_context) |
| 937 | 939 |
| 938 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING | 940 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING |
| 939 tp = cpi->tok; | 941 tp = cpi->tok; |
| 940 #endif | 942 #endif |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 vp8_fix_contexts(xd); | 1417 vp8_fix_contexts(xd); |
| 1416 } | 1418 } |
| 1417 else | 1419 else |
| 1418 { | 1420 { |
| 1419 vp8_stuff_mb(cpi, x, t); | 1421 vp8_stuff_mb(cpi, x, t); |
| 1420 } | 1422 } |
| 1421 } | 1423 } |
| 1422 | 1424 |
| 1423 return rate; | 1425 return rate; |
| 1424 } | 1426 } |
| OLD | NEW |