• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef VP9_COMMON_VP9_THREAD_COMMON_H_
12 #define VP9_COMMON_VP9_THREAD_COMMON_H_
13 #include "./vpx_config.h"
14 #include "vp9/common/vp9_loopfilter.h"
15 #include "vpx_util/vpx_thread.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 struct VP9Common;
22 struct FRAME_COUNTS;
23 
24 // Loopfilter row synchronization
25 typedef struct VP9LfSyncData {
26 #if CONFIG_MULTITHREAD
27   pthread_mutex_t *mutex_;
28   pthread_cond_t *cond_;
29 #endif
30   // Allocate memory to store the loop-filtered superblock index in each row.
31   int *cur_sb_col;
32   // The optimal sync_range for different resolution and platform should be
33   // determined by testing. Currently, it is chosen to be a power-of-2 number.
34   int sync_range;
35   int rows;
36 
37   // Row-based parallel loopfilter data
38   LFWorkerData *lfdata;
39   int num_workers;
40 } VP9LfSync;
41 
42 // Allocate memory for loopfilter row synchronization.
43 void vp9_loop_filter_alloc(VP9LfSync *lf_sync, struct VP9Common *cm, int rows,
44                            int width, int num_workers);
45 
46 // Deallocate loopfilter synchronization related mutex and data.
47 void vp9_loop_filter_dealloc(VP9LfSync *lf_sync);
48 
49 // Multi-threaded loopfilter that uses the tile threads.
50 void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct VP9Common *cm,
51                               struct macroblockd_plane planes[MAX_MB_PLANE],
52                               int frame_filter_level, int y_only,
53                               int partial_frame, VPxWorker *workers,
54                               int num_workers, VP9LfSync *lf_sync);
55 
56 void vp9_accumulate_frame_counts(struct FRAME_COUNTS *accum,
57                                  const struct FRAME_COUNTS *counts, int is_dec);
58 
59 #ifdef __cplusplus
60 }  // extern "C"
61 #endif
62 
63 #endif  // VP9_COMMON_VP9_THREAD_COMMON_H_
64