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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 unsigned int i,j; | 148 unsigned int i,j; |
149 unsigned int * sortlist; | 149 unsigned int * sortlist; |
150 unsigned int tmp; | 150 unsigned int tmp; |
151 | 151 |
152 /* Create a list to sort to */ | 152 /* Create a list to sort to */ |
153 CHECK_MEM_ERROR(sortlist, | 153 CHECK_MEM_ERROR(sortlist, |
154 vpx_calloc(sizeof(unsigned int), | 154 vpx_calloc(sizeof(unsigned int), |
155 cpi->common.MBs)); | 155 cpi->common.MBs)); |
156 | 156 |
157 /* Copy map to sort list */ | 157 /* Copy map to sort list */ |
158 vpx_memcpy( sortlist, cpi->mb_activity_map, | 158 memcpy( sortlist, cpi->mb_activity_map, |
159 sizeof(unsigned int) * cpi->common.MBs ); | 159 sizeof(unsigned int) * cpi->common.MBs ); |
160 | 160 |
161 | 161 |
162 /* Ripple each value down to its correct position */ | 162 /* Ripple each value down to its correct position */ |
163 for ( i = 1; i < cpi->common.MBs; i ++ ) | 163 for ( i = 1; i < cpi->common.MBs; i ++ ) |
164 { | 164 { |
165 for ( j = i; j > 0; j -- ) | 165 for ( j = i; j > 0; j -- ) |
166 { | 166 { |
167 if ( sortlist[j] < sortlist[j-1] ) | 167 if ( sortlist[j] < sortlist[j-1] ) |
168 { | 168 { |
169 /* Swap values */ | 169 /* Swap values */ |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 658 |
659 vp8_build_block_offsets(x); | 659 vp8_build_block_offsets(x); |
660 | 660 |
661 xd->mode_info_context->mbmi.mode = DC_PRED; | 661 xd->mode_info_context->mbmi.mode = DC_PRED; |
662 xd->mode_info_context->mbmi.uv_mode = DC_PRED; | 662 xd->mode_info_context->mbmi.uv_mode = DC_PRED; |
663 | 663 |
664 xd->left_context = &cm->left_context; | 664 xd->left_context = &cm->left_context; |
665 | 665 |
666 x->mvc = cm->fc.mvc; | 666 x->mvc = cm->fc.mvc; |
667 | 667 |
668 vpx_memset(cm->above_context, 0, | 668 memset(cm->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * cm->mb_cols); |
669 sizeof(ENTROPY_CONTEXT_PLANES) * cm->mb_cols); | |
670 | 669 |
671 /* Special case treatment when GF and ARF are not sensible options | 670 /* Special case treatment when GF and ARF are not sensible options |
672 * for reference | 671 * for reference |
673 */ | 672 */ |
674 if (cpi->ref_frame_flags == VP8_LAST_FRAME) | 673 if (cpi->ref_frame_flags == VP8_LAST_FRAME) |
675 vp8_calc_ref_frame_costs(x->ref_frame_cost, | 674 vp8_calc_ref_frame_costs(x->ref_frame_cost, |
676 cpi->prob_intra_coded,255,128); | 675 cpi->prob_intra_coded,255,128); |
677 else if ((cpi->oxcf.number_of_layers > 1) && | 676 else if ((cpi->oxcf.number_of_layers > 1) && |
678 (cpi->ref_frame_flags == VP8_GOLD_FRAME)) | 677 (cpi->ref_frame_flags == VP8_GOLD_FRAME)) |
679 vp8_calc_ref_frame_costs(x->ref_frame_cost, | 678 vp8_calc_ref_frame_costs(x->ref_frame_cost, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 VP8_COMMON *const cm = & cpi->common; | 736 VP8_COMMON *const cm = & cpi->common; |
738 MACROBLOCKD *const xd = & x->e_mbd; | 737 MACROBLOCKD *const xd = & x->e_mbd; |
739 TOKENEXTRA *tp = cpi->tok; | 738 TOKENEXTRA *tp = cpi->tok; |
740 int segment_counts[MAX_MB_SEGMENTS]; | 739 int segment_counts[MAX_MB_SEGMENTS]; |
741 int totalrate; | 740 int totalrate; |
742 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING | 741 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING |
743 BOOL_CODER * bc = &cpi->bc[1]; /* bc[0] is for control partition */ | 742 BOOL_CODER * bc = &cpi->bc[1]; /* bc[0] is for control partition */ |
744 const int num_part = (1 << cm->multi_token_partition); | 743 const int num_part = (1 << cm->multi_token_partition); |
745 #endif | 744 #endif |
746 | 745 |
747 vpx_memset(segment_counts, 0, sizeof(segment_counts)); | 746 memset(segment_counts, 0, sizeof(segment_counts)); |
748 totalrate = 0; | 747 totalrate = 0; |
749 | 748 |
750 if (cpi->compressor_speed == 2) | 749 if (cpi->compressor_speed == 2) |
751 { | 750 { |
752 if (cpi->oxcf.cpu_used < 0) | 751 if (cpi->oxcf.cpu_used < 0) |
753 cpi->Speed = -(cpi->oxcf.cpu_used); | 752 cpi->Speed = -(cpi->oxcf.cpu_used); |
754 else | 753 else |
755 vp8_auto_select_speed(cpi); | 754 vp8_auto_select_speed(cpi); |
756 } | 755 } |
757 | 756 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 | 966 |
968 | 967 |
969 // Work out the segment probabilities if segmentation is enabled | 968 // Work out the segment probabilities if segmentation is enabled |
970 // and needs to be updated | 969 // and needs to be updated |
971 if (xd->segmentation_enabled && xd->update_mb_segmentation_map) | 970 if (xd->segmentation_enabled && xd->update_mb_segmentation_map) |
972 { | 971 { |
973 int tot_count; | 972 int tot_count; |
974 int i; | 973 int i; |
975 | 974 |
976 /* Set to defaults */ | 975 /* Set to defaults */ |
977 vpx_memset(xd->mb_segment_tree_probs, 255 , sizeof(xd->mb_segment_tree_p
robs)); | 976 memset(xd->mb_segment_tree_probs, 255 , sizeof(xd->mb_segment_tree_probs
)); |
978 | 977 |
979 tot_count = segment_counts[0] + segment_counts[1] + segment_counts[2] +
segment_counts[3]; | 978 tot_count = segment_counts[0] + segment_counts[1] + segment_counts[2] +
segment_counts[3]; |
980 | 979 |
981 if (tot_count) | 980 if (tot_count) |
982 { | 981 { |
983 xd->mb_segment_tree_probs[0] = ((segment_counts[0] + segment_counts[
1]) * 255) / tot_count; | 982 xd->mb_segment_tree_probs[0] = ((segment_counts[0] + segment_counts[
1]) * 255) / tot_count; |
984 | 983 |
985 tot_count = segment_counts[0] + segment_counts[1]; | 984 tot_count = segment_counts[0] + segment_counts[1]; |
986 | 985 |
987 if (tot_count > 0) | 986 if (tot_count > 0) |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 vp8_fix_contexts(xd); | 1414 vp8_fix_contexts(xd); |
1416 } | 1415 } |
1417 else | 1416 else |
1418 { | 1417 { |
1419 vp8_stuff_mb(cpi, x, t); | 1418 vp8_stuff_mb(cpi, x, t); |
1420 } | 1419 } |
1421 } | 1420 } |
1422 | 1421 |
1423 return rate; | 1422 return rate; |
1424 } | 1423 } |
OLD | NEW |