| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright (c) 2014 The WebM project authors. All Rights Reserved. |    2  *  Copyright (c) 2014 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 20 matching lines...) Expand all  Loading... | 
|   31   FrameWorkerData *const worker_data = worker->data1; |   31   FrameWorkerData *const worker_data = worker->data1; | 
|   32   pthread_mutex_unlock(&worker_data->stats_mutex); |   32   pthread_mutex_unlock(&worker_data->stats_mutex); | 
|   33 #else |   33 #else | 
|   34   (void)worker; |   34   (void)worker; | 
|   35 #endif |   35 #endif | 
|   36 } |   36 } | 
|   37  |   37  | 
|   38 void vp9_frameworker_signal_stats(VP9Worker *const worker) { |   38 void vp9_frameworker_signal_stats(VP9Worker *const worker) { | 
|   39 #if CONFIG_MULTITHREAD |   39 #if CONFIG_MULTITHREAD | 
|   40   FrameWorkerData *const worker_data = worker->data1; |   40   FrameWorkerData *const worker_data = worker->data1; | 
|   41   // TODO(hkuang): Investigate using broadcast or signal. |   41  | 
 |   42 // TODO(hkuang): Fix the pthread_cond_broadcast in windows wrapper. | 
 |   43 #if defined(_WIN32) && !HAVE_PTHREAD_H | 
|   42   pthread_cond_signal(&worker_data->stats_cond); |   44   pthread_cond_signal(&worker_data->stats_cond); | 
|   43 #else |   45 #else | 
 |   46   pthread_cond_broadcast(&worker_data->stats_cond); | 
 |   47 #endif | 
 |   48  | 
 |   49 #else | 
|   44   (void)worker; |   50   (void)worker; | 
|   45 #endif |   51 #endif | 
|   46 } |   52 } | 
|   47  |   53  | 
|   48 // This macro prevents thread_sanitizer from reporting known concurrent writes. |   54 // This macro prevents thread_sanitizer from reporting known concurrent writes. | 
|   49 #if defined(__has_feature) |   55 #if defined(__has_feature) | 
|   50 #if __has_feature(thread_sanitizer) |   56 #if __has_feature(thread_sanitizer) | 
|   51 #define BUILDING_WITH_TSAN |   57 #define BUILDING_WITH_TSAN | 
|   52 #endif |   58 #endif | 
|   53 #endif |   59 #endif | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  137   VP9_COMMON *const dst_cm = &dst_worker_data->pbi->common; |  143   VP9_COMMON *const dst_cm = &dst_worker_data->pbi->common; | 
|  138   int i; |  144   int i; | 
|  139  |  145  | 
|  140   // Wait until source frame's context is ready. |  146   // Wait until source frame's context is ready. | 
|  141   vp9_frameworker_lock_stats(src_worker); |  147   vp9_frameworker_lock_stats(src_worker); | 
|  142   while (!src_worker_data->frame_context_ready) { |  148   while (!src_worker_data->frame_context_ready) { | 
|  143     pthread_cond_wait(&src_worker_data->stats_cond, |  149     pthread_cond_wait(&src_worker_data->stats_cond, | 
|  144         &src_worker_data->stats_mutex); |  150         &src_worker_data->stats_mutex); | 
|  145   } |  151   } | 
|  146  |  152  | 
|  147   // src worker may have already finished decoding a frame and swapped the mi. |  | 
|  148   // TODO(hkuang): Remove following code after implenment no ModeInfo decoding. |  | 
|  149   if (src_worker_data->frame_decoded) { |  | 
|  150     dst_cm->prev_mip = src_cm->prev_mip; |  | 
|  151     dst_cm->prev_mi = src_cm->prev_mi; |  | 
|  152   } else { |  | 
|  153     dst_cm->prev_mip = src_cm->mip; |  | 
|  154     dst_cm->prev_mi = src_cm->mi; |  | 
|  155   } |  | 
|  156  |  | 
|  157   dst_cm->last_frame_seg_map = src_cm->seg.enabled ? |  153   dst_cm->last_frame_seg_map = src_cm->seg.enabled ? | 
|  158       src_cm->current_frame_seg_map : src_cm->last_frame_seg_map; |  154       src_cm->current_frame_seg_map : src_cm->last_frame_seg_map; | 
|  159   dst_worker_data->pbi->need_resync = src_worker_data->pbi->need_resync; |  155   dst_worker_data->pbi->need_resync = src_worker_data->pbi->need_resync; | 
|  160   vp9_frameworker_unlock_stats(src_worker); |  156   vp9_frameworker_unlock_stats(src_worker); | 
|  161  |  157  | 
|  162   dst_worker_data->pbi->prev_buf = |  | 
|  163       src_worker_data->pbi->common.show_existing_frame ? |  | 
|  164           NULL : src_worker_data->pbi->cur_buf; |  | 
|  165  |  | 
|  166   dst_cm->prev_frame = src_cm->show_existing_frame ? |  158   dst_cm->prev_frame = src_cm->show_existing_frame ? | 
|  167                        src_cm->prev_frame : src_cm->cur_frame; |  159                        src_cm->prev_frame : src_cm->cur_frame; | 
|  168   dst_cm->last_width = !src_cm->show_existing_frame ? |  160   dst_cm->last_width = !src_cm->show_existing_frame ? | 
|  169                        src_cm->width : src_cm->last_width; |  161                        src_cm->width : src_cm->last_width; | 
|  170   dst_cm->last_height = !src_cm->show_existing_frame ? |  162   dst_cm->last_height = !src_cm->show_existing_frame ? | 
|  171                         src_cm->height : src_cm->last_height; |  163                         src_cm->height : src_cm->last_height; | 
|  172   dst_cm->display_width = src_cm->display_width; |  | 
|  173   dst_cm->display_height = src_cm->display_height; |  | 
|  174   dst_cm->subsampling_x = src_cm->subsampling_x; |  164   dst_cm->subsampling_x = src_cm->subsampling_x; | 
|  175   dst_cm->subsampling_y = src_cm->subsampling_y; |  165   dst_cm->subsampling_y = src_cm->subsampling_y; | 
 |  166   dst_cm->frame_type = src_cm->frame_type; | 
|  176   dst_cm->last_show_frame = !src_cm->show_existing_frame ? |  167   dst_cm->last_show_frame = !src_cm->show_existing_frame ? | 
|  177                             src_cm->show_frame : src_cm->last_show_frame; |  168                             src_cm->show_frame : src_cm->last_show_frame; | 
|  178   dst_cm->last_frame_type = src_cm->last_frame_type; |  | 
|  179   dst_cm->frame_type = src_cm->frame_type; |  | 
|  180   dst_cm->y_dc_delta_q = src_cm->y_dc_delta_q; |  | 
|  181   dst_cm->uv_dc_delta_q = src_cm->uv_dc_delta_q; |  | 
|  182   dst_cm->uv_ac_delta_q = src_cm->uv_ac_delta_q; |  | 
|  183   dst_cm->base_qindex = src_cm->base_qindex; |  | 
|  184  |  | 
|  185   for (i = 0; i < REF_FRAMES; ++i) |  169   for (i = 0; i < REF_FRAMES; ++i) | 
|  186     dst_cm->ref_frame_map[i] = src_cm->next_ref_frame_map[i]; |  170     dst_cm->ref_frame_map[i] = src_cm->next_ref_frame_map[i]; | 
|  187  |  171  | 
|  188   memcpy(dst_cm->lf_info.lfthr, src_cm->lf_info.lfthr, |  172   memcpy(dst_cm->lf_info.lfthr, src_cm->lf_info.lfthr, | 
|  189          (MAX_LOOP_FILTER + 1) * sizeof(loop_filter_thresh)); |  173          (MAX_LOOP_FILTER + 1) * sizeof(loop_filter_thresh)); | 
|  190   dst_cm->lf.last_sharpness_level = src_cm->lf.sharpness_level; |  174   dst_cm->lf.last_sharpness_level = src_cm->lf.sharpness_level; | 
|  191   dst_cm->lf.filter_level = src_cm->lf.filter_level; |  175   dst_cm->lf.filter_level = src_cm->lf.filter_level; | 
|  192   memcpy(dst_cm->lf.ref_deltas, src_cm->lf.ref_deltas, MAX_REF_LF_DELTAS); |  176   memcpy(dst_cm->lf.ref_deltas, src_cm->lf.ref_deltas, MAX_REF_LF_DELTAS); | 
|  193   memcpy(dst_cm->lf.mode_deltas, src_cm->lf.mode_deltas, MAX_MODE_LF_DELTAS); |  177   memcpy(dst_cm->lf.mode_deltas, src_cm->lf.mode_deltas, MAX_MODE_LF_DELTAS); | 
|  194   dst_cm->seg = src_cm->seg; |  178   dst_cm->seg = src_cm->seg; | 
|  195   memcpy(dst_cm->frame_contexts, src_cm->frame_contexts, |  179   memcpy(dst_cm->frame_contexts, src_cm->frame_contexts, | 
|  196          FRAME_CONTEXTS * sizeof(dst_cm->frame_contexts[0])); |  180          FRAME_CONTEXTS * sizeof(dst_cm->frame_contexts[0])); | 
|  197 #else |  181 #else | 
|  198   (void) dst_worker; |  182   (void) dst_worker; | 
|  199   (void) src_worker; |  183   (void) src_worker; | 
|  200 #endif  // CONFIG_MULTITHREAD |  184 #endif  // CONFIG_MULTITHREAD | 
|  201 } |  185 } | 
| OLD | NEW |