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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 VP9_COMMON *const cm = &cpi->common; | 600 VP9_COMMON *const cm = &cpi->common; |
601 | 601 |
602 cpi->oxcf = *oxcf; | 602 cpi->oxcf = *oxcf; |
603 cpi->framerate = oxcf->init_framerate; | 603 cpi->framerate = oxcf->init_framerate; |
604 | 604 |
605 cm->profile = oxcf->profile; | 605 cm->profile = oxcf->profile; |
606 cm->bit_depth = oxcf->bit_depth; | 606 cm->bit_depth = oxcf->bit_depth; |
607 #if CONFIG_VP9_HIGHBITDEPTH | 607 #if CONFIG_VP9_HIGHBITDEPTH |
608 cm->use_highbitdepth = oxcf->use_highbitdepth; | 608 cm->use_highbitdepth = oxcf->use_highbitdepth; |
609 #endif | 609 #endif |
610 cm->color_space = UNKNOWN; | 610 cm->color_space = oxcf->color_space; |
611 | 611 |
612 cm->width = oxcf->width; | 612 cm->width = oxcf->width; |
613 cm->height = oxcf->height; | 613 cm->height = oxcf->height; |
614 vp9_alloc_compressor_data(cpi); | 614 vp9_alloc_compressor_data(cpi); |
615 | 615 |
616 // Single thread case: use counts in common. | 616 // Single thread case: use counts in common. |
617 cpi->td.counts = &cm->counts; | 617 cpi->td.counts = &cm->counts; |
618 | 618 |
619 // Spatial scalability. | 619 // Spatial scalability. |
620 cpi->svc.number_spatial_layers = oxcf->ss_number_layers; | 620 cpi->svc.number_spatial_layers = oxcf->ss_number_layers; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 } | 1257 } |
1258 #endif // CONFIG_VP9_HIGHBITDEPTH | 1258 #endif // CONFIG_VP9_HIGHBITDEPTH |
1259 | 1259 |
1260 void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { | 1260 void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { |
1261 VP9_COMMON *const cm = &cpi->common; | 1261 VP9_COMMON *const cm = &cpi->common; |
1262 RATE_CONTROL *const rc = &cpi->rc; | 1262 RATE_CONTROL *const rc = &cpi->rc; |
1263 | 1263 |
1264 if (cm->profile != oxcf->profile) | 1264 if (cm->profile != oxcf->profile) |
1265 cm->profile = oxcf->profile; | 1265 cm->profile = oxcf->profile; |
1266 cm->bit_depth = oxcf->bit_depth; | 1266 cm->bit_depth = oxcf->bit_depth; |
| 1267 cm->color_space = oxcf->color_space; |
1267 | 1268 |
1268 if (cm->profile <= PROFILE_1) | 1269 if (cm->profile <= PROFILE_1) |
1269 assert(cm->bit_depth == VPX_BITS_8); | 1270 assert(cm->bit_depth == VPX_BITS_8); |
1270 else | 1271 else |
1271 assert(cm->bit_depth > VPX_BITS_8); | 1272 assert(cm->bit_depth > VPX_BITS_8); |
1272 | 1273 |
1273 cpi->oxcf = *oxcf; | 1274 cpi->oxcf = *oxcf; |
1274 #if CONFIG_VP9_HIGHBITDEPTH | 1275 #if CONFIG_VP9_HIGHBITDEPTH |
1275 cpi->td.mb.e_mbd.bd = (int)cm->bit_depth; | 1276 cpi->td.mb.e_mbd.bd = (int)cm->bit_depth; |
1276 #endif // CONFIG_VP9_HIGHBITDEPTH | 1277 #endif // CONFIG_VP9_HIGHBITDEPTH |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 } | 1779 } |
1779 #endif | 1780 #endif |
1780 } | 1781 } |
1781 | 1782 |
1782 #if CONFIG_VP9_TEMPORAL_DENOISING | 1783 #if CONFIG_VP9_TEMPORAL_DENOISING |
1783 vp9_denoiser_free(&(cpi->denoiser)); | 1784 vp9_denoiser_free(&(cpi->denoiser)); |
1784 #endif | 1785 #endif |
1785 | 1786 |
1786 for (t = 0; t < cpi->num_workers; ++t) { | 1787 for (t = 0; t < cpi->num_workers; ++t) { |
1787 VP9Worker *const worker = &cpi->workers[t]; | 1788 VP9Worker *const worker = &cpi->workers[t]; |
1788 EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; | 1789 EncWorkerData *const thread_data = &cpi->tile_thr_data[t]; |
1789 | 1790 |
1790 // Deallocate allocated threads. | 1791 // Deallocate allocated threads. |
1791 vp9_get_worker_interface()->end(worker); | 1792 vp9_get_worker_interface()->end(worker); |
1792 | 1793 |
1793 // Deallocate allocated thread data. | 1794 // Deallocate allocated thread data. |
1794 if (t < cpi->num_workers - 1) { | 1795 if (t < cpi->num_workers - 1) { |
1795 vpx_free(thread_data->td->counts); | 1796 vpx_free(thread_data->td->counts); |
1796 vp9_free_pc_tree(thread_data->td); | 1797 vp9_free_pc_tree(thread_data->td); |
1797 vpx_free(thread_data->td); | 1798 vpx_free(thread_data->td); |
1798 } | 1799 } |
| 1800 } |
| 1801 vpx_free(cpi->tile_thr_data); |
| 1802 vpx_free(cpi->workers); |
1799 | 1803 |
1800 vpx_free(worker->data1); | 1804 if (cpi->num_workers > 1) |
1801 } | 1805 vp9_loop_filter_dealloc(&cpi->lf_row_sync); |
1802 vpx_free(cpi->workers); | |
1803 | 1806 |
1804 dealloc_compressor_data(cpi); | 1807 dealloc_compressor_data(cpi); |
1805 | 1808 |
1806 for (i = 0; i < sizeof(cpi->mbgraph_stats) / | 1809 for (i = 0; i < sizeof(cpi->mbgraph_stats) / |
1807 sizeof(cpi->mbgraph_stats[0]); ++i) { | 1810 sizeof(cpi->mbgraph_stats[0]); ++i) { |
1808 vpx_free(cpi->mbgraph_stats[i].mb_stats); | 1811 vpx_free(cpi->mbgraph_stats[i].mb_stats); |
1809 } | 1812 } |
1810 | 1813 |
1811 #if CONFIG_FP_MB_STATS | 1814 #if CONFIG_FP_MB_STATS |
1812 if (cpi->use_fp_mb_stats) { | 1815 if (cpi->use_fp_mb_stats) { |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 | 2432 |
2430 vpx_usec_timer_start(&timer); | 2433 vpx_usec_timer_start(&timer); |
2431 | 2434 |
2432 vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.lpf_pick); | 2435 vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.lpf_pick); |
2433 | 2436 |
2434 vpx_usec_timer_mark(&timer); | 2437 vpx_usec_timer_mark(&timer); |
2435 cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); | 2438 cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); |
2436 } | 2439 } |
2437 | 2440 |
2438 if (lf->filter_level > 0) { | 2441 if (lf->filter_level > 0) { |
2439 vp9_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0); | 2442 if (cpi->num_workers > 1) |
| 2443 vp9_loop_filter_frame_mt(cm->frame_to_show, cm, xd->plane, |
| 2444 lf->filter_level, 0, 0, |
| 2445 cpi->workers, cpi->num_workers, |
| 2446 &cpi->lf_row_sync); |
| 2447 else |
| 2448 vp9_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0); |
2440 } | 2449 } |
2441 | 2450 |
2442 vp9_extend_frame_inner_borders(cm->frame_to_show); | 2451 vp9_extend_frame_inner_borders(cm->frame_to_show); |
2443 } | 2452 } |
2444 | 2453 |
2445 void vp9_scale_references(VP9_COMP *cpi) { | 2454 void vp9_scale_references(VP9_COMP *cpi) { |
2446 VP9_COMMON *cm = &cpi->common; | 2455 VP9_COMMON *cm = &cpi->common; |
2447 MV_REFERENCE_FRAME ref_frame; | 2456 MV_REFERENCE_FRAME ref_frame; |
2448 const VP9_REFFRAME ref_mask[3] = {VP9_LAST_FLAG, VP9_GOLD_FLAG, VP9_ALT_FLAG}; | 2457 const VP9_REFFRAME ref_mask[3] = {VP9_LAST_FLAG, VP9_GOLD_FLAG, VP9_ALT_FLAG}; |
2449 | 2458 |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3429 vpx_usec_timer_start(&timer); | 3438 vpx_usec_timer_start(&timer); |
3430 | 3439 |
3431 if (vp9_lookahead_push(cpi->lookahead, sd, time_stamp, end_time, frame_flags)) | 3440 if (vp9_lookahead_push(cpi->lookahead, sd, time_stamp, end_time, frame_flags)) |
3432 res = -1; | 3441 res = -1; |
3433 vpx_usec_timer_mark(&timer); | 3442 vpx_usec_timer_mark(&timer); |
3434 cpi->time_receive_data += vpx_usec_timer_elapsed(&timer); | 3443 cpi->time_receive_data += vpx_usec_timer_elapsed(&timer); |
3435 | 3444 |
3436 if ((cm->profile == PROFILE_0 || cm->profile == PROFILE_2) && | 3445 if ((cm->profile == PROFILE_0 || cm->profile == PROFILE_2) && |
3437 (subsampling_x != 1 || subsampling_y != 1)) { | 3446 (subsampling_x != 1 || subsampling_y != 1)) { |
3438 vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM, | 3447 vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM, |
3439 "Non-4:2:0 color space requires profile 1 or 3"); | 3448 "Non-4:2:0 color format requires profile 1 or 3"); |
3440 res = -1; | 3449 res = -1; |
3441 } | 3450 } |
3442 if ((cm->profile == PROFILE_1 || cm->profile == PROFILE_3) && | 3451 if ((cm->profile == PROFILE_1 || cm->profile == PROFILE_3) && |
3443 (subsampling_x == 1 && subsampling_y == 1)) { | 3452 (subsampling_x == 1 && subsampling_y == 1)) { |
3444 vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM, | 3453 vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM, |
3445 "4:2:0 color space requires profile 0 or 2"); | 3454 "4:2:0 color format requires profile 0 or 2"); |
3446 res = -1; | 3455 res = -1; |
3447 } | 3456 } |
3448 | 3457 |
3449 return res; | 3458 return res; |
3450 } | 3459 } |
3451 | 3460 |
3452 | 3461 |
3453 static int frame_is_reference(const VP9_COMP *cpi) { | 3462 static int frame_is_reference(const VP9_COMP *cpi) { |
3454 const VP9_COMMON *cm = &cpi->common; | 3463 const VP9_COMMON *cm = &cpi->common; |
3455 | 3464 |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 if (flags & VP8_EFLAG_NO_UPD_ARF) | 4098 if (flags & VP8_EFLAG_NO_UPD_ARF) |
4090 upd ^= VP9_ALT_FLAG; | 4099 upd ^= VP9_ALT_FLAG; |
4091 | 4100 |
4092 vp9_update_reference(cpi, upd); | 4101 vp9_update_reference(cpi, upd); |
4093 } | 4102 } |
4094 | 4103 |
4095 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { | 4104 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { |
4096 vp9_update_entropy(cpi, 0); | 4105 vp9_update_entropy(cpi, 0); |
4097 } | 4106 } |
4098 } | 4107 } |
OLD | NEW |