• 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 void vp9_encode_tiles_mt(struct VP9_COMP *cpi);
46 
47 void vp9_encode_tiles_row_mt(struct VP9_COMP *cpi);
48 
49 void vp9_encode_fp_row_mt(struct VP9_COMP *cpi);
50 
51 void vp9_row_mt_sync_read(VP9RowMTSync *const row_mt_sync, int r, int c);
52 void vp9_row_mt_sync_write(VP9RowMTSync *const row_mt_sync, int r, int c,
53                            const int cols);
54 
55 void vp9_row_mt_sync_read_dummy(VP9RowMTSync *const row_mt_sync, int r, int c);
56 void vp9_row_mt_sync_write_dummy(VP9RowMTSync *const row_mt_sync, int r, int c,
57                                  const int cols);
58 
59 // Allocate memory for row based multi-threading synchronization.
60 void vp9_row_mt_sync_mem_alloc(VP9RowMTSync *row_mt_sync, struct VP9Common *cm,
61                                int rows);
62 
63 // Deallocate row based multi-threading synchronization related mutex and data.
64 void vp9_row_mt_sync_mem_dealloc(VP9RowMTSync *row_mt_sync);
65 
66 void vp9_temporal_filter_row_mt(struct VP9_COMP *cpi);
67 
68 #ifdef __cplusplus
69 }  // extern "C"
70 #endif
71 
72 #endif  // VPX_VP9_ENCODER_VP9_ETHREAD_H_
73