• 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 VPX_VP9_ENCODER_VP9_ETHREAD_H_
12 #define VPX_VP9_ENCODER_VP9_ETHREAD_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define MAX_NUM_TILE_COLS (1 << 6)
19 #define MAX_NUM_TILE_ROWS 4
20 #define MAX_NUM_THREADS 80
21 
22 struct VP9_COMP;
23 struct ThreadData;
24 
25 typedef struct EncWorkerData {
26   struct VP9_COMP *cpi;
27   struct ThreadData *td;
28   int start;
29   int thread_id;
30   int tile_completion_status[MAX_NUM_TILE_COLS];
31 } EncWorkerData;
32 
33 // Encoder row synchronization
34 typedef struct VP9RowMTSyncData {
35 #if CONFIG_MULTITHREAD
36   pthread_mutex_t *mutex;
37   pthread_cond_t *cond;
38 #endif
39   // Allocate memory to store the sb/mb block index in each row.
40   int *cur_col;
41   int sync_range;
42   int rows;
43 } VP9RowMTSync;
44 
45 // Frees EncWorkerData related allocations made by vp9_encode_*_mt().
46 // row_mt specific data is freed with vp9_row_mt_mem_dealloc() and is not
47 // called by this function.
48 void vp9_encode_free_mt_data(struct VP9_COMP *cpi);
49 
50 void vp9_encode_tiles_mt(struct VP9_COMP *cpi);
51 
52 void vp9_encode_tiles_row_mt(struct VP9_COMP *cpi);
53 
54 void vp9_encode_fp_row_mt(struct VP9_COMP *cpi);
55 
56 void vp9_row_mt_sync_read(VP9RowMTSync *const row_mt_sync, int r, int c);
57 void vp9_row_mt_sync_write(VP9RowMTSync *const row_mt_sync, int r, int c,
58                            const int cols);
59 
60 void vp9_row_mt_sync_read_dummy(VP9RowMTSync *const row_mt_sync, int r, int c);
61 void vp9_row_mt_sync_write_dummy(VP9RowMTSync *const row_mt_sync, int r, int c,
62                                  const int cols);
63 
64 // Allocate memory for row based multi-threading synchronization.
65 void vp9_row_mt_sync_mem_alloc(VP9RowMTSync *row_mt_sync, struct VP9Common *cm,
66                                int rows);
67 
68 // Deallocate row based multi-threading synchronization related mutex and data.
69 void vp9_row_mt_sync_mem_dealloc(VP9RowMTSync *row_mt_sync);
70 
71 void vp9_temporal_filter_row_mt(struct VP9_COMP *cpi);
72 
73 #ifdef __cplusplus
74 }  // extern "C"
75 #endif
76 
77 #endif  // VPX_VP9_ENCODER_VP9_ETHREAD_H_
78