| 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 cm->bit_depth = oxcf->bit_depth; | 749 cm->bit_depth = oxcf->bit_depth; |
| 750 #if CONFIG_VP9_HIGHBITDEPTH | 750 #if CONFIG_VP9_HIGHBITDEPTH |
| 751 cm->use_highbitdepth = oxcf->use_highbitdepth; | 751 cm->use_highbitdepth = oxcf->use_highbitdepth; |
| 752 #endif | 752 #endif |
| 753 cm->color_space = oxcf->color_space; | 753 cm->color_space = oxcf->color_space; |
| 754 | 754 |
| 755 cm->width = oxcf->width; | 755 cm->width = oxcf->width; |
| 756 cm->height = oxcf->height; | 756 cm->height = oxcf->height; |
| 757 vp9_alloc_compressor_data(cpi); | 757 vp9_alloc_compressor_data(cpi); |
| 758 | 758 |
| 759 cpi->svc.temporal_layering_mode = oxcf->temporal_layering_mode; |
| 760 |
| 759 // Single thread case: use counts in common. | 761 // Single thread case: use counts in common. |
| 760 cpi->td.counts = &cm->counts; | 762 cpi->td.counts = &cm->counts; |
| 761 | 763 |
| 762 // Spatial scalability. | 764 // Spatial scalability. |
| 763 cpi->svc.number_spatial_layers = oxcf->ss_number_layers; | 765 cpi->svc.number_spatial_layers = oxcf->ss_number_layers; |
| 764 // Temporal scalability. | 766 // Temporal scalability. |
| 765 cpi->svc.number_temporal_layers = oxcf->ts_number_layers; | 767 cpi->svc.number_temporal_layers = oxcf->ts_number_layers; |
| 766 | 768 |
| 767 if ((cpi->svc.number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) || | 769 if ((cpi->svc.number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) || |
| 768 ((cpi->svc.number_temporal_layers > 1 || | 770 ((cpi->svc.number_temporal_layers > 1 || |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 | 2049 |
| 2048 if (framepsnr) | 2050 if (framepsnr) |
| 2049 fclose(framepsnr); | 2051 fclose(framepsnr); |
| 2050 | 2052 |
| 2051 if (kf_list) | 2053 if (kf_list) |
| 2052 fclose(kf_list); | 2054 fclose(kf_list); |
| 2053 | 2055 |
| 2054 #endif | 2056 #endif |
| 2055 } | 2057 } |
| 2056 | 2058 |
| 2059 /* TODO(yaowu): The block_variance calls the unoptimized versions of variance() |
| 2060 * and highbd_8_variance(). It should not. |
| 2061 */ |
| 2062 static void encoder_variance(const uint8_t *a, int a_stride, |
| 2063 const uint8_t *b, int b_stride, |
| 2064 int w, int h, unsigned int *sse, int *sum) { |
| 2065 int i, j; |
| 2066 |
| 2067 *sum = 0; |
| 2068 *sse = 0; |
| 2069 |
| 2070 for (i = 0; i < h; i++) { |
| 2071 for (j = 0; j < w; j++) { |
| 2072 const int diff = a[j] - b[j]; |
| 2073 *sum += diff; |
| 2074 *sse += diff * diff; |
| 2075 } |
| 2076 |
| 2077 a += a_stride; |
| 2078 b += b_stride; |
| 2079 } |
| 2080 } |
| 2081 |
| 2082 #if CONFIG_VP9_HIGHBITDEPTH |
| 2083 static void encoder_highbd_variance64(const uint8_t *a8, int a_stride, |
| 2084 const uint8_t *b8, int b_stride, |
| 2085 int w, int h, uint64_t *sse, |
| 2086 uint64_t *sum) { |
| 2087 int i, j; |
| 2088 |
| 2089 uint16_t *a = CONVERT_TO_SHORTPTR(a8); |
| 2090 uint16_t *b = CONVERT_TO_SHORTPTR(b8); |
| 2091 *sum = 0; |
| 2092 *sse = 0; |
| 2093 |
| 2094 for (i = 0; i < h; i++) { |
| 2095 for (j = 0; j < w; j++) { |
| 2096 const int diff = a[j] - b[j]; |
| 2097 *sum += diff; |
| 2098 *sse += diff * diff; |
| 2099 } |
| 2100 a += a_stride; |
| 2101 b += b_stride; |
| 2102 } |
| 2103 } |
| 2104 |
| 2105 static void encoder_highbd_8_variance(const uint8_t *a8, int a_stride, |
| 2106 const uint8_t *b8, int b_stride, |
| 2107 int w, int h, |
| 2108 unsigned int *sse, int *sum) { |
| 2109 uint64_t sse_long = 0; |
| 2110 uint64_t sum_long = 0; |
| 2111 encoder_highbd_variance64(a8, a_stride, b8, b_stride, w, h, |
| 2112 &sse_long, &sum_long); |
| 2113 *sse = (unsigned int)sse_long; |
| 2114 *sum = (int)sum_long; |
| 2115 } |
| 2116 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 2117 |
| 2057 static int64_t get_sse(const uint8_t *a, int a_stride, | 2118 static int64_t get_sse(const uint8_t *a, int a_stride, |
| 2058 const uint8_t *b, int b_stride, | 2119 const uint8_t *b, int b_stride, |
| 2059 int width, int height) { | 2120 int width, int height) { |
| 2060 const int dw = width % 16; | 2121 const int dw = width % 16; |
| 2061 const int dh = height % 16; | 2122 const int dh = height % 16; |
| 2062 int64_t total_sse = 0; | 2123 int64_t total_sse = 0; |
| 2063 unsigned int sse = 0; | 2124 unsigned int sse = 0; |
| 2064 int sum = 0; | 2125 int sum = 0; |
| 2065 int x, y; | 2126 int x, y; |
| 2066 | 2127 |
| 2067 if (dw > 0) { | 2128 if (dw > 0) { |
| 2068 variance(&a[width - dw], a_stride, &b[width - dw], b_stride, | 2129 encoder_variance(&a[width - dw], a_stride, &b[width - dw], b_stride, |
| 2069 dw, height, &sse, &sum); | 2130 dw, height, &sse, &sum); |
| 2070 total_sse += sse; | 2131 total_sse += sse; |
| 2071 } | 2132 } |
| 2072 | 2133 |
| 2073 if (dh > 0) { | 2134 if (dh > 0) { |
| 2074 variance(&a[(height - dh) * a_stride], a_stride, | 2135 encoder_variance(&a[(height - dh) * a_stride], a_stride, |
| 2075 &b[(height - dh) * b_stride], b_stride, | 2136 &b[(height - dh) * b_stride], b_stride, |
| 2076 width - dw, dh, &sse, &sum); | 2137 width - dw, dh, &sse, &sum); |
| 2077 total_sse += sse; | 2138 total_sse += sse; |
| 2078 } | 2139 } |
| 2079 | 2140 |
| 2080 for (y = 0; y < height / 16; ++y) { | 2141 for (y = 0; y < height / 16; ++y) { |
| 2081 const uint8_t *pa = a; | 2142 const uint8_t *pa = a; |
| 2082 const uint8_t *pb = b; | 2143 const uint8_t *pb = b; |
| 2083 for (x = 0; x < width / 16; ++x) { | 2144 for (x = 0; x < width / 16; ++x) { |
| 2084 vpx_mse16x16(pa, a_stride, pb, b_stride, &sse); | 2145 vpx_mse16x16(pa, a_stride, pb, b_stride, &sse); |
| 2085 total_sse += sse; | 2146 total_sse += sse; |
| 2086 | 2147 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 static int64_t highbd_get_sse(const uint8_t *a, int a_stride, | 2180 static int64_t highbd_get_sse(const uint8_t *a, int a_stride, |
| 2120 const uint8_t *b, int b_stride, | 2181 const uint8_t *b, int b_stride, |
| 2121 int width, int height) { | 2182 int width, int height) { |
| 2122 int64_t total_sse = 0; | 2183 int64_t total_sse = 0; |
| 2123 int x, y; | 2184 int x, y; |
| 2124 const int dw = width % 16; | 2185 const int dw = width % 16; |
| 2125 const int dh = height % 16; | 2186 const int dh = height % 16; |
| 2126 unsigned int sse = 0; | 2187 unsigned int sse = 0; |
| 2127 int sum = 0; | 2188 int sum = 0; |
| 2128 if (dw > 0) { | 2189 if (dw > 0) { |
| 2129 highbd_8_variance(&a[width - dw], a_stride, &b[width - dw], b_stride, | 2190 encoder_highbd_8_variance(&a[width - dw], a_stride, |
| 2130 dw, height, &sse, &sum); | 2191 &b[width - dw], b_stride, |
| 2192 dw, height, &sse, &sum); |
| 2131 total_sse += sse; | 2193 total_sse += sse; |
| 2132 } | 2194 } |
| 2133 if (dh > 0) { | 2195 if (dh > 0) { |
| 2134 highbd_8_variance(&a[(height - dh) * a_stride], a_stride, | 2196 encoder_highbd_8_variance(&a[(height - dh) * a_stride], a_stride, |
| 2135 &b[(height - dh) * b_stride], b_stride, | 2197 &b[(height - dh) * b_stride], b_stride, |
| 2136 width - dw, dh, &sse, &sum); | 2198 width - dw, dh, &sse, &sum); |
| 2137 total_sse += sse; | 2199 total_sse += sse; |
| 2138 } | 2200 } |
| 2139 for (y = 0; y < height / 16; ++y) { | 2201 for (y = 0; y < height / 16; ++y) { |
| 2140 const uint8_t *pa = a; | 2202 const uint8_t *pa = a; |
| 2141 const uint8_t *pb = b; | 2203 const uint8_t *pb = b; |
| 2142 for (x = 0; x < width / 16; ++x) { | 2204 for (x = 0; x < width / 16; ++x) { |
| 2143 vpx_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse); | 2205 vpx_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse); |
| 2144 total_sse += sse; | 2206 total_sse += sse; |
| 2145 pa += 16; | 2207 pa += 16; |
| 2146 pb += 16; | 2208 pb += 16; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 #else | 2320 #else |
| 2259 calc_psnr(cpi->Source, cpi->common.frame_to_show, &psnr); | 2321 calc_psnr(cpi->Source, cpi->common.frame_to_show, &psnr); |
| 2260 #endif | 2322 #endif |
| 2261 | 2323 |
| 2262 for (i = 0; i < 4; ++i) { | 2324 for (i = 0; i < 4; ++i) { |
| 2263 pkt.data.psnr.samples[i] = psnr.samples[i]; | 2325 pkt.data.psnr.samples[i] = psnr.samples[i]; |
| 2264 pkt.data.psnr.sse[i] = psnr.sse[i]; | 2326 pkt.data.psnr.sse[i] = psnr.sse[i]; |
| 2265 pkt.data.psnr.psnr[i] = psnr.psnr[i]; | 2327 pkt.data.psnr.psnr[i] = psnr.psnr[i]; |
| 2266 } | 2328 } |
| 2267 pkt.kind = VPX_CODEC_PSNR_PKT; | 2329 pkt.kind = VPX_CODEC_PSNR_PKT; |
| 2268 if (is_two_pass_svc(cpi)) | 2330 if (cpi->use_svc) |
| 2269 cpi->svc.layer_context[cpi->svc.spatial_layer_id].psnr_pkt = pkt.data.psnr; | 2331 cpi->svc.layer_context[cpi->svc.spatial_layer_id * |
| 2332 cpi->svc.number_temporal_layers].psnr_pkt = pkt.data.psnr; |
| 2270 else | 2333 else |
| 2271 vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt); | 2334 vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt); |
| 2272 } | 2335 } |
| 2273 | 2336 |
| 2274 int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags) { | 2337 int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags) { |
| 2275 if (ref_frame_flags > 7) | 2338 if (ref_frame_flags > 7) |
| 2276 return -1; | 2339 return -1; |
| 2277 | 2340 |
| 2278 cpi->ref_frame_flags = ref_frame_flags; | 2341 cpi->ref_frame_flags = ref_frame_flags; |
| 2279 return 0; | 2342 return 0; |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3660 if (cm->show_frame) { | 3723 if (cm->show_frame) { |
| 3661 vp9_swap_mi_and_prev_mi(cm); | 3724 vp9_swap_mi_and_prev_mi(cm); |
| 3662 // Don't increment frame counters if this was an altref buffer | 3725 // Don't increment frame counters if this was an altref buffer |
| 3663 // update not a real frame | 3726 // update not a real frame |
| 3664 ++cm->current_video_frame; | 3727 ++cm->current_video_frame; |
| 3665 if (cpi->use_svc) | 3728 if (cpi->use_svc) |
| 3666 vp9_inc_frame_in_layer(cpi); | 3729 vp9_inc_frame_in_layer(cpi); |
| 3667 } | 3730 } |
| 3668 cm->prev_frame = cm->cur_frame; | 3731 cm->prev_frame = cm->cur_frame; |
| 3669 | 3732 |
| 3670 if (is_two_pass_svc(cpi)) | 3733 if (cpi->use_svc) |
| 3671 cpi->svc.layer_context[cpi->svc.spatial_layer_id].last_frame_type = | 3734 cpi->svc.layer_context[cpi->svc.spatial_layer_id * |
| 3672 cm->frame_type; | 3735 cpi->svc.number_temporal_layers + |
| 3736 cpi->svc.temporal_layer_id].last_frame_type = |
| 3737 cm->frame_type; |
| 3673 } | 3738 } |
| 3674 | 3739 |
| 3675 static void SvcEncode(VP9_COMP *cpi, size_t *size, uint8_t *dest, | 3740 static void SvcEncode(VP9_COMP *cpi, size_t *size, uint8_t *dest, |
| 3676 unsigned int *frame_flags) { | 3741 unsigned int *frame_flags) { |
| 3677 vp9_rc_get_svc_params(cpi); | 3742 vp9_rc_get_svc_params(cpi); |
| 3678 encode_frame_to_data_rate(cpi, size, dest, frame_flags); | 3743 encode_frame_to_data_rate(cpi, size, dest, frame_flags); |
| 3679 } | 3744 } |
| 3680 | 3745 |
| 3681 static void Pass0Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest, | 3746 static void Pass0Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest, |
| 3682 unsigned int *frame_flags) { | 3747 unsigned int *frame_flags) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 | 3988 |
| 3924 if (is_two_pass_svc(cpi)) { | 3989 if (is_two_pass_svc(cpi)) { |
| 3925 #if CONFIG_SPATIAL_SVC | 3990 #if CONFIG_SPATIAL_SVC |
| 3926 vp9_svc_start_frame(cpi); | 3991 vp9_svc_start_frame(cpi); |
| 3927 // Use a small empty frame instead of a real frame | 3992 // Use a small empty frame instead of a real frame |
| 3928 if (cpi->svc.encode_empty_frame_state == ENCODING) | 3993 if (cpi->svc.encode_empty_frame_state == ENCODING) |
| 3929 source = &cpi->svc.empty_frame; | 3994 source = &cpi->svc.empty_frame; |
| 3930 #endif | 3995 #endif |
| 3931 if (oxcf->pass == 2) | 3996 if (oxcf->pass == 2) |
| 3932 vp9_restore_layer_context(cpi); | 3997 vp9_restore_layer_context(cpi); |
| 3998 } else if (is_one_pass_cbr_svc(cpi)) { |
| 3999 vp9_one_pass_cbr_svc_start_layer(cpi); |
| 3933 } | 4000 } |
| 3934 | 4001 |
| 3935 vpx_usec_timer_start(&cmptimer); | 4002 vpx_usec_timer_start(&cmptimer); |
| 3936 | 4003 |
| 3937 vp9_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV); | 4004 vp9_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV); |
| 3938 | 4005 |
| 3939 // Is multi-arf enabled. | 4006 // Is multi-arf enabled. |
| 3940 // Note that at the moment multi_arf is only configured for 2 pass VBR and | 4007 // Note that at the moment multi_arf is only configured for 2 pass VBR and |
| 3941 // will not work properly with svc. | 4008 // will not work properly with svc. |
| 3942 if ((oxcf->pass == 2) && !cpi->use_svc && | 4009 if ((oxcf->pass == 2) && !cpi->use_svc && |
| 3943 (cpi->oxcf.enable_auto_arf > 1)) | 4010 (cpi->oxcf.enable_auto_arf > 1)) |
| 3944 cpi->multi_arf_allowed = 1; | 4011 cpi->multi_arf_allowed = 1; |
| 3945 else | 4012 else |
| 3946 cpi->multi_arf_allowed = 0; | 4013 cpi->multi_arf_allowed = 0; |
| 3947 | 4014 |
| 3948 // Normal defaults | 4015 // Normal defaults |
| 3949 cm->reset_frame_context = 0; | 4016 cm->reset_frame_context = 0; |
| 3950 cm->refresh_frame_context = 1; | 4017 cm->refresh_frame_context = 1; |
| 3951 cpi->refresh_last_frame = 1; | 4018 if (!is_one_pass_cbr_svc(cpi)) { |
| 3952 cpi->refresh_golden_frame = 0; | 4019 cpi->refresh_last_frame = 1; |
| 3953 cpi->refresh_alt_ref_frame = 0; | 4020 cpi->refresh_golden_frame = 0; |
| 4021 cpi->refresh_alt_ref_frame = 0; |
| 4022 } |
| 3954 | 4023 |
| 3955 // Should we encode an arf frame. | 4024 // Should we encode an arf frame. |
| 3956 arf_src_index = get_arf_src_index(cpi); | 4025 arf_src_index = get_arf_src_index(cpi); |
| 3957 | 4026 |
| 3958 // Skip alt frame if we encode the empty frame | 4027 // Skip alt frame if we encode the empty frame |
| 3959 if (is_two_pass_svc(cpi) && source != NULL) | 4028 if (is_two_pass_svc(cpi) && source != NULL) |
| 3960 arf_src_index = 0; | 4029 arf_src_index = 0; |
| 3961 | 4030 |
| 3962 if (arf_src_index) { | 4031 if (arf_src_index) { |
| 3963 assert(arf_src_index <= rc->frames_to_key); | 4032 assert(arf_src_index <= rc->frames_to_key); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3999 } | 4068 } |
| 4000 | 4069 |
| 4001 if (!source) { | 4070 if (!source) { |
| 4002 // Get last frame source. | 4071 // Get last frame source. |
| 4003 if (cm->current_video_frame > 0) { | 4072 if (cm->current_video_frame > 0) { |
| 4004 if ((last_source = vp9_lookahead_peek(cpi->lookahead, -1)) == NULL) | 4073 if ((last_source = vp9_lookahead_peek(cpi->lookahead, -1)) == NULL) |
| 4005 return -1; | 4074 return -1; |
| 4006 } | 4075 } |
| 4007 | 4076 |
| 4008 // Read in the source frame. | 4077 // Read in the source frame. |
| 4009 #if CONFIG_SPATIAL_SVC | 4078 if (cpi->use_svc) |
| 4010 if (is_two_pass_svc(cpi)) | |
| 4011 source = vp9_svc_lookahead_pop(cpi, cpi->lookahead, flush); | 4079 source = vp9_svc_lookahead_pop(cpi, cpi->lookahead, flush); |
| 4012 else | 4080 else |
| 4013 #endif | |
| 4014 source = vp9_lookahead_pop(cpi->lookahead, flush); | 4081 source = vp9_lookahead_pop(cpi->lookahead, flush); |
| 4082 |
| 4015 if (source != NULL) { | 4083 if (source != NULL) { |
| 4016 cm->show_frame = 1; | 4084 cm->show_frame = 1; |
| 4017 cm->intra_only = 0; | 4085 cm->intra_only = 0; |
| 4018 // if the flags indicate intra frame, but if the current picture is for | 4086 // if the flags indicate intra frame, but if the current picture is for |
| 4019 // non-zero spatial layer, it should not be an intra picture. | 4087 // non-zero spatial layer, it should not be an intra picture. |
| 4020 // TODO(Won Kap): this needs to change if per-layer intra frame is | 4088 // TODO(Won Kap): this needs to change if per-layer intra frame is |
| 4021 // allowed. | 4089 // allowed. |
| 4022 if ((source->flags & VPX_EFLAG_FORCE_KF) && cpi->svc.spatial_layer_id) { | 4090 if ((source->flags & VPX_EFLAG_FORCE_KF) && cpi->svc.spatial_layer_id) { |
| 4023 source->flags &= ~(unsigned int)(VPX_EFLAG_FORCE_KF); | 4091 source->flags &= ~(unsigned int)(VPX_EFLAG_FORCE_KF); |
| 4024 } | 4092 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4053 } | 4121 } |
| 4054 | 4122 |
| 4055 // Clear down mmx registers | 4123 // Clear down mmx registers |
| 4056 vp9_clear_system_state(); | 4124 vp9_clear_system_state(); |
| 4057 | 4125 |
| 4058 // adjust frame rates based on timestamps given | 4126 // adjust frame rates based on timestamps given |
| 4059 if (cm->show_frame) { | 4127 if (cm->show_frame) { |
| 4060 adjust_frame_rate(cpi, source); | 4128 adjust_frame_rate(cpi, source); |
| 4061 } | 4129 } |
| 4062 | 4130 |
| 4063 if (cpi->svc.number_temporal_layers > 1 && | 4131 if (is_one_pass_cbr_svc(cpi)) { |
| 4064 oxcf->rc_mode == VPX_CBR) { | |
| 4065 vp9_update_temporal_layer_framerate(cpi); | 4132 vp9_update_temporal_layer_framerate(cpi); |
| 4066 vp9_restore_layer_context(cpi); | 4133 vp9_restore_layer_context(cpi); |
| 4067 } | 4134 } |
| 4068 | 4135 |
| 4069 // Find a free buffer for the new frame, releasing the reference previously | 4136 // Find a free buffer for the new frame, releasing the reference previously |
| 4070 // held. | 4137 // held. |
| 4071 if (cm->new_fb_idx != INVALID_IDX) { | 4138 if (cm->new_fb_idx != INVALID_IDX) { |
| 4072 --pool->frame_bufs[cm->new_fb_idx].ref_count; | 4139 --pool->frame_bufs[cm->new_fb_idx].ref_count; |
| 4073 } | 4140 } |
| 4074 cm->new_fb_idx = get_free_fb(cm); | 4141 cm->new_fb_idx = get_free_fb(cm); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4136 // No frame encoded, or frame was dropped, release scaled references. | 4203 // No frame encoded, or frame was dropped, release scaled references. |
| 4137 if ((*size == 0) && (frame_is_intra_only(cm) == 0)) { | 4204 if ((*size == 0) && (frame_is_intra_only(cm) == 0)) { |
| 4138 release_scaled_references(cpi); | 4205 release_scaled_references(cpi); |
| 4139 } | 4206 } |
| 4140 | 4207 |
| 4141 if (*size > 0) { | 4208 if (*size > 0) { |
| 4142 cpi->droppable = !frame_is_reference(cpi); | 4209 cpi->droppable = !frame_is_reference(cpi); |
| 4143 } | 4210 } |
| 4144 | 4211 |
| 4145 // Save layer specific state. | 4212 // Save layer specific state. |
| 4146 if ((cpi->svc.number_temporal_layers > 1 && | 4213 if (is_one_pass_cbr_svc(cpi) || |
| 4147 oxcf->rc_mode == VPX_CBR) || | 4214 ((cpi->svc.number_temporal_layers > 1 || |
| 4148 ((cpi->svc.number_temporal_layers > 1 || | 4215 cpi->svc.number_spatial_layers > 1) && |
| 4149 cpi->svc.number_spatial_layers > 1) && | 4216 oxcf->pass == 2)) { |
| 4150 oxcf->pass == 2)) { | |
| 4151 vp9_save_layer_context(cpi); | 4217 vp9_save_layer_context(cpi); |
| 4152 } | 4218 } |
| 4153 | 4219 |
| 4154 vpx_usec_timer_mark(&cmptimer); | 4220 vpx_usec_timer_mark(&cmptimer); |
| 4155 cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer); | 4221 cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer); |
| 4156 | 4222 |
| 4157 if (cpi->b_calculate_psnr && oxcf->pass != 1 && cm->show_frame) | 4223 if (cpi->b_calculate_psnr && oxcf->pass != 1 && cm->show_frame) |
| 4158 generate_psnr_packet(cpi); | 4224 generate_psnr_packet(cpi); |
| 4159 | 4225 |
| 4160 #if CONFIG_INTERNAL_STATS | 4226 #if CONFIG_INTERNAL_STATS |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4336 } | 4402 } |
| 4337 | 4403 |
| 4338 if (cm->show_frame) { | 4404 if (cm->show_frame) { |
| 4339 ++cpi->svc.spatial_layer_to_encode; | 4405 ++cpi->svc.spatial_layer_to_encode; |
| 4340 if (cpi->svc.spatial_layer_to_encode >= cpi->svc.number_spatial_layers) | 4406 if (cpi->svc.spatial_layer_to_encode >= cpi->svc.number_spatial_layers) |
| 4341 cpi->svc.spatial_layer_to_encode = 0; | 4407 cpi->svc.spatial_layer_to_encode = 0; |
| 4342 | 4408 |
| 4343 // May need the empty frame after an visible frame. | 4409 // May need the empty frame after an visible frame. |
| 4344 cpi->svc.encode_empty_frame_state = NEED_TO_ENCODE; | 4410 cpi->svc.encode_empty_frame_state = NEED_TO_ENCODE; |
| 4345 } | 4411 } |
| 4412 } else if (is_one_pass_cbr_svc(cpi)) { |
| 4413 if (cm->show_frame) { |
| 4414 ++cpi->svc.spatial_layer_to_encode; |
| 4415 if (cpi->svc.spatial_layer_to_encode >= cpi->svc.number_spatial_layers) |
| 4416 cpi->svc.spatial_layer_to_encode = 0; |
| 4417 } |
| 4346 } | 4418 } |
| 4347 return 0; | 4419 return 0; |
| 4348 } | 4420 } |
| 4349 | 4421 |
| 4350 int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest, | 4422 int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest, |
| 4351 vp9_ppflags_t *flags) { | 4423 vp9_ppflags_t *flags) { |
| 4352 VP9_COMMON *cm = &cpi->common; | 4424 VP9_COMMON *cm = &cpi->common; |
| 4353 #if !CONFIG_VP9_POSTPROC | 4425 #if !CONFIG_VP9_POSTPROC |
| 4354 (void)flags; | 4426 (void)flags; |
| 4355 #endif | 4427 #endif |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4497 if (flags & VP8_EFLAG_NO_UPD_ARF) | 4569 if (flags & VP8_EFLAG_NO_UPD_ARF) |
| 4498 upd ^= VP9_ALT_FLAG; | 4570 upd ^= VP9_ALT_FLAG; |
| 4499 | 4571 |
| 4500 vp9_update_reference(cpi, upd); | 4572 vp9_update_reference(cpi, upd); |
| 4501 } | 4573 } |
| 4502 | 4574 |
| 4503 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { | 4575 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { |
| 4504 vp9_update_entropy(cpi, 0); | 4576 vp9_update_entropy(cpi, 0); |
| 4505 } | 4577 } |
| 4506 } | 4578 } |
| OLD | NEW |