vp9_thread_common.h 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

11 12
#ifndef VP9_COMMON_VP9_LOOPFILTER_THREAD_H_
#define VP9_COMMON_VP9_LOOPFILTER_THREAD_H_
13
#include "./vpx_config.h"
14
#include "vp9/common/vp9_loopfilter.h"
15
#include "vpx_thread/vpx_thread.h"
16 17

struct VP9Common;
18
struct FRAME_COUNTS;
19 20 21 22 23 24 25 26 27 28 29 30

// Loopfilter row synchronization
typedef struct VP9LfSyncData {
#if CONFIG_MULTITHREAD
  pthread_mutex_t *mutex_;
  pthread_cond_t *cond_;
#endif
  // Allocate memory to store the loop-filtered superblock index in each row.
  int *cur_sb_col;
  // The optimal sync_range for different resolution and platform should be
  // determined by testing. Currently, it is chosen to be a power-of-2 number.
  int sync_range;
31
  int rows;
32 33 34 35

  // Row-based parallel loopfilter data
  LFWorkerData *lfdata;
  int num_workers;
36 37 38
} VP9LfSync;

// Allocate memory for loopfilter row synchronization.
39
void vp9_loop_filter_alloc(VP9LfSync *lf_sync, struct VP9Common *cm, int rows,
40
                           int width, int num_workers);
41 42

// Deallocate loopfilter synchronization related mutex and data.
43
void vp9_loop_filter_dealloc(VP9LfSync *lf_sync);
44 45

// Multi-threaded loopfilter that uses the tile threads.
46
void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
47
                              struct VP9Common *cm,
48
                              struct macroblockd_plane planes[MAX_MB_PLANE],
49
                              int frame_filter_level,
50
                              int y_only, int partial_frame,
51
                              VPxWorker *workers, int num_workers,
52
                              VP9LfSync *lf_sync);
53

54 55 56
void vp9_accumulate_frame_counts(struct VP9Common *cm,
                                 struct FRAME_COUNTS *counts, int is_dec);

57
#endif  // VP9_COMMON_VP9_LOOPFILTER_THREAD_H_