| 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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 } while (--h); | 1411 } while (--h); |
| 1412 | 1412 |
| 1413 src = s->v_buffer; | 1413 src = s->v_buffer; |
| 1414 h = s->uv_height; | 1414 h = s->uv_height; |
| 1415 | 1415 |
| 1416 do { | 1416 do { |
| 1417 fwrite(src, s->uv_width, 1, yuv_rec_file); | 1417 fwrite(src, s->uv_width, 1, yuv_rec_file); |
| 1418 src += s->uv_stride; | 1418 src += s->uv_stride; |
| 1419 } while (--h); | 1419 } while (--h); |
| 1420 | 1420 |
| 1421 #if CONFIG_ALPHA | |
| 1422 if (s->alpha_buffer) { | |
| 1423 src = s->alpha_buffer; | |
| 1424 h = s->alpha_height; | |
| 1425 do { | |
| 1426 fwrite(src, s->alpha_width, 1, yuv_rec_file); | |
| 1427 src += s->alpha_stride; | |
| 1428 } while (--h); | |
| 1429 } | |
| 1430 #endif | |
| 1431 | |
| 1432 fflush(yuv_rec_file); | 1421 fflush(yuv_rec_file); |
| 1433 } | 1422 } |
| 1434 #endif | 1423 #endif |
| 1435 | 1424 |
| 1436 static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src, | 1425 static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src, |
| 1437 YV12_BUFFER_CONFIG *dst) { | 1426 YV12_BUFFER_CONFIG *dst) { |
| 1438 // TODO(dkovalev): replace YV12_BUFFER_CONFIG with vpx_image_t | 1427 // TODO(dkovalev): replace YV12_BUFFER_CONFIG with vpx_image_t |
| 1439 int i; | 1428 int i; |
| 1440 const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer, | 1429 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; |
| 1441 src->alpha_buffer}; | 1430 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; |
| 1442 const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride, | 1431 const int src_widths[3] = {src->y_crop_width, src->uv_crop_width, |
| 1443 src->alpha_stride}; | 1432 src->uv_crop_width }; |
| 1444 const int src_widths[4] = {src->y_crop_width, src->uv_crop_width, | 1433 const int src_heights[3] = {src->y_crop_height, src->uv_crop_height, |
| 1445 src->uv_crop_width, src->y_crop_width}; | 1434 src->uv_crop_height}; |
| 1446 const int src_heights[4] = {src->y_crop_height, src->uv_crop_height, | 1435 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; |
| 1447 src->uv_crop_height, src->y_crop_height}; | 1436 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; |
| 1448 uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer, | 1437 const int dst_widths[3] = {dst->y_crop_width, dst->uv_crop_width, |
| 1449 dst->alpha_buffer}; | 1438 dst->uv_crop_width}; |
| 1450 const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride, | 1439 const int dst_heights[3] = {dst->y_crop_height, dst->uv_crop_height, |
| 1451 dst->alpha_stride}; | 1440 dst->uv_crop_height}; |
| 1452 const int dst_widths[4] = {dst->y_crop_width, dst->uv_crop_width, | |
| 1453 dst->uv_crop_width, dst->y_crop_width}; | |
| 1454 const int dst_heights[4] = {dst->y_crop_height, dst->uv_crop_height, | |
| 1455 dst->uv_crop_height, dst->y_crop_height}; | |
| 1456 | 1441 |
| 1457 for (i = 0; i < MAX_MB_PLANE; ++i) | 1442 for (i = 0; i < MAX_MB_PLANE; ++i) |
| 1458 vp9_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i], | 1443 vp9_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i], |
| 1459 dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]); | 1444 dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]); |
| 1460 | 1445 |
| 1461 vp9_extend_frame_borders(dst); | 1446 vp9_extend_frame_borders(dst); |
| 1462 } | 1447 } |
| 1463 | 1448 |
| 1464 static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src, | 1449 static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src, |
| 1465 YV12_BUFFER_CONFIG *dst) { | 1450 YV12_BUFFER_CONFIG *dst) { |
| 1466 const int src_w = src->y_crop_width; | 1451 const int src_w = src->y_crop_width; |
| 1467 const int src_h = src->y_crop_height; | 1452 const int src_h = src->y_crop_height; |
| 1468 const int dst_w = dst->y_crop_width; | 1453 const int dst_w = dst->y_crop_width; |
| 1469 const int dst_h = dst->y_crop_height; | 1454 const int dst_h = dst->y_crop_height; |
| 1470 const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer, | 1455 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; |
| 1471 src->alpha_buffer}; | 1456 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; |
| 1472 const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride, | 1457 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; |
| 1473 src->alpha_stride}; | 1458 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; |
| 1474 uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer, | |
| 1475 dst->alpha_buffer}; | |
| 1476 const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride, | |
| 1477 dst->alpha_stride}; | |
| 1478 const InterpKernel *const kernel = vp9_get_interp_kernel(EIGHTTAP); | 1459 const InterpKernel *const kernel = vp9_get_interp_kernel(EIGHTTAP); |
| 1479 int x, y, i; | 1460 int x, y, i; |
| 1480 | 1461 |
| 1481 for (y = 0; y < dst_h; y += 16) { | 1462 for (y = 0; y < dst_h; y += 16) { |
| 1482 for (x = 0; x < dst_w; x += 16) { | 1463 for (x = 0; x < dst_w; x += 16) { |
| 1483 for (i = 0; i < MAX_MB_PLANE; ++i) { | 1464 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 1484 const int factor = (i == 0 || i == 3 ? 1 : 2); | 1465 const int factor = (i == 0 || i == 3 ? 1 : 2); |
| 1485 const int x_q4 = x * (16 / factor) * src_w / dst_w; | 1466 const int x_q4 = x * (16 / factor) * src_w / dst_w; |
| 1486 const int y_q4 = y * (16 / factor) * src_h / dst_h; | 1467 const int y_q4 = y * (16 / factor) * src_h / dst_h; |
| 1487 const int src_stride = src_strides[i]; | 1468 const int src_stride = src_strides[i]; |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 vp9_denoise(cpi->Source, cpi->Source, l); | 2219 vp9_denoise(cpi->Source, cpi->Source, l); |
| 2239 } | 2220 } |
| 2240 #endif | 2221 #endif |
| 2241 | 2222 |
| 2242 #ifdef OUTPUT_YUV_SRC | 2223 #ifdef OUTPUT_YUV_SRC |
| 2243 vp9_write_yuv_frame(cpi->Source, yuv_file); | 2224 vp9_write_yuv_frame(cpi->Source, yuv_file); |
| 2244 #endif | 2225 #endif |
| 2245 | 2226 |
| 2246 set_speed_features(cpi); | 2227 set_speed_features(cpi); |
| 2247 | 2228 |
| 2248 #if CONFIG_DENOISING | |
| 2249 #ifdef OUTPUT_YUV_DENOISED | |
| 2250 if (cpi->oxcf.noise_sensitivity > 0) { | |
| 2251 vp9_write_yuv_frame_420(&cpi->denoiser.running_avg_y[INTRA_FRAME], | |
| 2252 yuv_denoised_file); | |
| 2253 } | |
| 2254 #endif | |
| 2255 #endif | |
| 2256 | |
| 2257 // Decide q and q bounds. | 2229 // Decide q and q bounds. |
| 2258 q = vp9_rc_pick_q_and_bounds(cpi, &bottom_index, &top_index); | 2230 q = vp9_rc_pick_q_and_bounds(cpi, &bottom_index, &top_index); |
| 2259 | 2231 |
| 2260 if (!frame_is_intra_only(cm)) { | 2232 if (!frame_is_intra_only(cm)) { |
| 2261 cm->interp_filter = cpi->sf.default_interp_filter; | 2233 cm->interp_filter = cpi->sf.default_interp_filter; |
| 2262 /* TODO: Decide this more intelligently */ | 2234 /* TODO: Decide this more intelligently */ |
| 2263 vp9_set_high_precision_mv(cpi, q < HIGH_PRECISION_MV_QTHRESH); | 2235 vp9_set_high_precision_mv(cpi, q < HIGH_PRECISION_MV_QTHRESH); |
| 2264 } | 2236 } |
| 2265 | 2237 |
| 2266 if (cpi->sf.recode_loop == DISALLOW_RECODE) { | 2238 if (cpi->sf.recode_loop == DISALLOW_RECODE) { |
| 2267 encode_without_recode_loop(cpi, q); | 2239 encode_without_recode_loop(cpi, q); |
| 2268 } else { | 2240 } else { |
| 2269 encode_with_recode_loop(cpi, size, dest, q, bottom_index, top_index); | 2241 encode_with_recode_loop(cpi, size, dest, q, bottom_index, top_index); |
| 2270 } | 2242 } |
| 2271 | 2243 |
| 2244 #if CONFIG_DENOISING |
| 2245 #ifdef OUTPUT_YUV_DENOISED |
| 2246 if (cpi->oxcf.noise_sensitivity > 0) { |
| 2247 vp9_write_yuv_frame_420(&cpi->denoiser.running_avg_y[INTRA_FRAME], |
| 2248 yuv_denoised_file); |
| 2249 } |
| 2250 #endif |
| 2251 #endif |
| 2252 |
| 2253 |
| 2272 // Special case code to reduce pulsing when key frames are forced at a | 2254 // Special case code to reduce pulsing when key frames are forced at a |
| 2273 // fixed interval. Note the reconstruction error if it is the frame before | 2255 // fixed interval. Note the reconstruction error if it is the frame before |
| 2274 // the force key frame | 2256 // the force key frame |
| 2275 if (cpi->rc.next_key_frame_forced && cpi->rc.frames_to_key == 1) { | 2257 if (cpi->rc.next_key_frame_forced && cpi->rc.frames_to_key == 1) { |
| 2276 cpi->ambient_err = vp9_get_y_sse(cpi->Source, get_frame_new_buffer(cm)); | 2258 cpi->ambient_err = vp9_get_y_sse(cpi->Source, get_frame_new_buffer(cm)); |
| 2277 } | 2259 } |
| 2278 | 2260 |
| 2279 // If the encoder forced a KEY_FRAME decision | 2261 // If the encoder forced a KEY_FRAME decision |
| 2280 if (cm->frame_type == KEY_FRAME) | 2262 if (cm->frame_type == KEY_FRAME) |
| 2281 cpi->refresh_last_frame = 1; | 2263 cpi->refresh_last_frame = 1; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2434 | 2416 |
| 2435 | 2417 |
| 2436 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, | 2418 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, |
| 2437 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, | 2419 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, |
| 2438 int64_t end_time) { | 2420 int64_t end_time) { |
| 2439 VP9_COMMON *cm = &cpi->common; | 2421 VP9_COMMON *cm = &cpi->common; |
| 2440 struct vpx_usec_timer timer; | 2422 struct vpx_usec_timer timer; |
| 2441 int res = 0; | 2423 int res = 0; |
| 2442 const int subsampling_x = sd->uv_width < sd->y_width; | 2424 const int subsampling_x = sd->uv_width < sd->y_width; |
| 2443 const int subsampling_y = sd->uv_height < sd->y_height; | 2425 const int subsampling_y = sd->uv_height < sd->y_height; |
| 2444 const int is_spatial_svc = cpi->use_svc && | |
| 2445 (cpi->svc.number_temporal_layers == 1); | |
| 2446 | 2426 |
| 2447 check_initial_width(cpi, subsampling_x, subsampling_y); | 2427 check_initial_width(cpi, subsampling_x, subsampling_y); |
| 2448 | 2428 |
| 2449 vpx_usec_timer_start(&timer); | 2429 vpx_usec_timer_start(&timer); |
| 2450 | 2430 |
| 2451 #ifdef CONFIG_SPATIAL_SVC | 2431 #if CONFIG_SPATIAL_SVC |
| 2452 if (is_spatial_svc) | 2432 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) |
| 2453 res = vp9_svc_lookahead_push(cpi, cpi->lookahead, sd, time_stamp, end_time, | 2433 res = vp9_svc_lookahead_push(cpi, cpi->lookahead, sd, time_stamp, end_time, |
| 2454 frame_flags); | 2434 frame_flags); |
| 2455 else | 2435 else |
| 2456 #endif | 2436 #endif |
| 2457 res = vp9_lookahead_push(cpi->lookahead, | 2437 res = vp9_lookahead_push(cpi->lookahead, |
| 2458 sd, time_stamp, end_time, frame_flags); | 2438 sd, time_stamp, end_time, frame_flags); |
| 2459 if (res) | 2439 if (res) |
| 2460 res = -1; | 2440 res = -1; |
| 2461 vpx_usec_timer_mark(&timer); | 2441 vpx_usec_timer_mark(&timer); |
| 2462 cpi->time_receive_data += vpx_usec_timer_elapsed(&timer); | 2442 cpi->time_receive_data += vpx_usec_timer_elapsed(&timer); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 MV_REFERENCE_FRAME ref_frame; | 2553 MV_REFERENCE_FRAME ref_frame; |
| 2574 int arf_src_index; | 2554 int arf_src_index; |
| 2575 const int is_spatial_svc = cpi->use_svc && | 2555 const int is_spatial_svc = cpi->use_svc && |
| 2576 (cpi->svc.number_temporal_layers == 1) && | 2556 (cpi->svc.number_temporal_layers == 1) && |
| 2577 (cpi->svc.number_spatial_layers > 1); | 2557 (cpi->svc.number_spatial_layers > 1); |
| 2578 | 2558 |
| 2579 if (!cpi) | 2559 if (!cpi) |
| 2580 return -1; | 2560 return -1; |
| 2581 | 2561 |
| 2582 if (is_spatial_svc && cpi->pass == 2) { | 2562 if (is_spatial_svc && cpi->pass == 2) { |
| 2563 #if CONFIG_SPATIAL_SVC |
| 2583 vp9_svc_lookahead_peek(cpi, cpi->lookahead, 0, 1); | 2564 vp9_svc_lookahead_peek(cpi, cpi->lookahead, 0, 1); |
| 2565 #endif |
| 2584 vp9_restore_layer_context(cpi); | 2566 vp9_restore_layer_context(cpi); |
| 2585 } | 2567 } |
| 2586 | 2568 |
| 2587 vpx_usec_timer_start(&cmptimer); | 2569 vpx_usec_timer_start(&cmptimer); |
| 2588 | 2570 |
| 2589 cpi->source = NULL; | 2571 cpi->source = NULL; |
| 2590 cpi->last_source = NULL; | 2572 cpi->last_source = NULL; |
| 2591 | 2573 |
| 2592 vp9_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV); | 2574 vp9_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV); |
| 2593 | 2575 |
| 2594 // Normal defaults | 2576 // Normal defaults |
| 2595 cm->reset_frame_context = 0; | 2577 cm->reset_frame_context = 0; |
| 2596 cm->refresh_frame_context = 1; | 2578 cm->refresh_frame_context = 1; |
| 2597 cpi->refresh_last_frame = 1; | 2579 cpi->refresh_last_frame = 1; |
| 2598 cpi->refresh_golden_frame = 0; | 2580 cpi->refresh_golden_frame = 0; |
| 2599 cpi->refresh_alt_ref_frame = 0; | 2581 cpi->refresh_alt_ref_frame = 0; |
| 2600 | 2582 |
| 2601 // Should we encode an arf frame. | 2583 // Should we encode an arf frame. |
| 2602 arf_src_index = get_arf_src_index(cpi); | 2584 arf_src_index = get_arf_src_index(cpi); |
| 2603 if (arf_src_index) { | 2585 if (arf_src_index) { |
| 2604 assert(arf_src_index <= rc->frames_to_key); | 2586 assert(arf_src_index <= rc->frames_to_key); |
| 2605 | 2587 |
| 2606 #ifdef CONFIG_SPATIAL_SVC | 2588 #if CONFIG_SPATIAL_SVC |
| 2607 if (is_spatial_svc) | 2589 if (is_spatial_svc) |
| 2608 cpi->source = vp9_svc_lookahead_peek(cpi, cpi->lookahead, | 2590 cpi->source = vp9_svc_lookahead_peek(cpi, cpi->lookahead, |
| 2609 arf_src_index, 0); | 2591 arf_src_index, 0); |
| 2610 else | 2592 else |
| 2611 #endif | 2593 #endif |
| 2612 cpi->source = vp9_lookahead_peek(cpi->lookahead, arf_src_index); | 2594 cpi->source = vp9_lookahead_peek(cpi->lookahead, arf_src_index); |
| 2613 if (cpi->source != NULL) { | 2595 if (cpi->source != NULL) { |
| 2614 cpi->alt_ref_source = cpi->source; | 2596 cpi->alt_ref_source = cpi->source; |
| 2615 | 2597 |
| 2616 #ifdef CONFIG_SPATIAL_SVC | 2598 #if CONFIG_SPATIAL_SVC |
| 2617 if (is_spatial_svc && cpi->svc.spatial_layer_id > 0) { | 2599 if (is_spatial_svc && cpi->svc.spatial_layer_id > 0) { |
| 2618 int i; | 2600 int i; |
| 2619 // Reference a hidden frame from a lower layer | 2601 // Reference a hidden frame from a lower layer |
| 2620 for (i = cpi->svc.spatial_layer_id - 1; i >= 0; --i) { | 2602 for (i = cpi->svc.spatial_layer_id - 1; i >= 0; --i) { |
| 2621 if (cpi->oxcf.ss_play_alternate[i]) { | 2603 if (cpi->oxcf.ss_play_alternate[i]) { |
| 2622 cpi->gld_fb_idx = cpi->svc.layer_context[i].alt_ref_idx; | 2604 cpi->gld_fb_idx = cpi->svc.layer_context[i].alt_ref_idx; |
| 2623 break; | 2605 break; |
| 2624 } | 2606 } |
| 2625 } | 2607 } |
| 2626 } | 2608 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2641 rc->is_src_frame_alt_ref = 0; | 2623 rc->is_src_frame_alt_ref = 0; |
| 2642 rc->source_alt_ref_pending = 0; | 2624 rc->source_alt_ref_pending = 0; |
| 2643 } else { | 2625 } else { |
| 2644 rc->source_alt_ref_pending = 0; | 2626 rc->source_alt_ref_pending = 0; |
| 2645 } | 2627 } |
| 2646 } | 2628 } |
| 2647 | 2629 |
| 2648 if (!cpi->source) { | 2630 if (!cpi->source) { |
| 2649 // Get last frame source. | 2631 // Get last frame source. |
| 2650 if (cm->current_video_frame > 0) { | 2632 if (cm->current_video_frame > 0) { |
| 2651 #ifdef CONFIG_SPATIAL_SVC | 2633 #if CONFIG_SPATIAL_SVC |
| 2652 if (is_spatial_svc) | 2634 if (is_spatial_svc) |
| 2653 cpi->last_source = vp9_svc_lookahead_peek(cpi, cpi->lookahead, -1, 0); | 2635 cpi->last_source = vp9_svc_lookahead_peek(cpi, cpi->lookahead, -1, 0); |
| 2654 else | 2636 else |
| 2655 #endif | 2637 #endif |
| 2656 cpi->last_source = vp9_lookahead_peek(cpi->lookahead, -1); | 2638 cpi->last_source = vp9_lookahead_peek(cpi->lookahead, -1); |
| 2657 if (cpi->last_source == NULL) | 2639 if (cpi->last_source == NULL) |
| 2658 return -1; | 2640 return -1; |
| 2659 } | 2641 } |
| 2660 | 2642 |
| 2661 // Read in the source frame. | 2643 // Read in the source frame. |
| 2662 #ifdef CONFIG_SPATIAL_SVC | 2644 #if CONFIG_SPATIAL_SVC |
| 2663 if (is_spatial_svc) | 2645 if (is_spatial_svc) |
| 2664 cpi->source = vp9_svc_lookahead_pop(cpi, cpi->lookahead, flush); | 2646 cpi->source = vp9_svc_lookahead_pop(cpi, cpi->lookahead, flush); |
| 2665 else | 2647 else |
| 2666 #endif | 2648 #endif |
| 2667 cpi->source = vp9_lookahead_pop(cpi->lookahead, flush); | 2649 cpi->source = vp9_lookahead_pop(cpi->lookahead, flush); |
| 2668 if (cpi->source != NULL) { | 2650 if (cpi->source != NULL) { |
| 2669 cm->show_frame = 1; | 2651 cm->show_frame = 1; |
| 2670 cm->intra_only = 0; | 2652 cm->intra_only = 0; |
| 2671 | 2653 |
| 2672 // Check to see if the frame should be encoded as an arf overlay. | 2654 // Check to see if the frame should be encoded as an arf overlay. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2696 cpi->twopass.first_pass_done = 1; | 2678 cpi->twopass.first_pass_done = 1; |
| 2697 } | 2679 } |
| 2698 return -1; | 2680 return -1; |
| 2699 } | 2681 } |
| 2700 | 2682 |
| 2701 if (cpi->source->ts_start < cpi->first_time_stamp_ever) { | 2683 if (cpi->source->ts_start < cpi->first_time_stamp_ever) { |
| 2702 cpi->first_time_stamp_ever = cpi->source->ts_start; | 2684 cpi->first_time_stamp_ever = cpi->source->ts_start; |
| 2703 cpi->last_end_time_stamp_seen = cpi->source->ts_start; | 2685 cpi->last_end_time_stamp_seen = cpi->source->ts_start; |
| 2704 } | 2686 } |
| 2705 | 2687 |
| 2688 // Clear down mmx registers |
| 2689 vp9_clear_system_state(); |
| 2690 |
| 2706 // adjust frame rates based on timestamps given | 2691 // adjust frame rates based on timestamps given |
| 2707 if (cm->show_frame) { | 2692 if (cm->show_frame) { |
| 2708 adjust_frame_rate(cpi); | 2693 adjust_frame_rate(cpi); |
| 2709 } | 2694 } |
| 2710 | 2695 |
| 2711 if (cpi->svc.number_temporal_layers > 1 && | 2696 if (cpi->svc.number_temporal_layers > 1 && |
| 2712 cpi->oxcf.rc_mode == VPX_CBR) { | 2697 cpi->oxcf.rc_mode == VPX_CBR) { |
| 2713 vp9_update_temporal_layer_framerate(cpi); | 2698 vp9_update_temporal_layer_framerate(cpi); |
| 2714 vp9_restore_layer_context(cpi); | 2699 vp9_restore_layer_context(cpi); |
| 2715 } | 2700 } |
| 2716 | 2701 |
| 2717 // start with a 0 size frame | 2702 // start with a 0 size frame |
| 2718 *size = 0; | 2703 *size = 0; |
| 2719 | 2704 |
| 2720 // Clear down mmx registers | |
| 2721 vp9_clear_system_state(); | |
| 2722 | |
| 2723 /* find a free buffer for the new frame, releasing the reference previously | 2705 /* find a free buffer for the new frame, releasing the reference previously |
| 2724 * held. | 2706 * held. |
| 2725 */ | 2707 */ |
| 2726 cm->frame_bufs[cm->new_fb_idx].ref_count--; | 2708 cm->frame_bufs[cm->new_fb_idx].ref_count--; |
| 2727 cm->new_fb_idx = get_free_fb(cm); | 2709 cm->new_fb_idx = get_free_fb(cm); |
| 2728 | 2710 |
| 2729 if (!cpi->use_svc && cpi->multi_arf_allowed) { | 2711 if (!cpi->use_svc && cpi->multi_arf_allowed) { |
| 2730 if (cm->frame_type == KEY_FRAME) { | 2712 if (cm->frame_type == KEY_FRAME) { |
| 2731 init_buffer_indices(cpi); | 2713 init_buffer_indices(cpi); |
| 2732 } else if (cpi->pass == 2) { | 2714 } else if (cpi->pass == 2) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3055 if (flags & VP8_EFLAG_NO_UPD_ARF) | 3037 if (flags & VP8_EFLAG_NO_UPD_ARF) |
| 3056 upd ^= VP9_ALT_FLAG; | 3038 upd ^= VP9_ALT_FLAG; |
| 3057 | 3039 |
| 3058 vp9_update_reference(cpi, upd); | 3040 vp9_update_reference(cpi, upd); |
| 3059 } | 3041 } |
| 3060 | 3042 |
| 3061 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { | 3043 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { |
| 3062 vp9_update_entropy(cpi, 0); | 3044 vp9_update_entropy(cpi, 0); |
| 3063 } | 3045 } |
| 3064 } | 3046 } |
| OLD | NEW |