2013-12-27 15:25:54 -08:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2015-09-29 09:34:42 -07:00
|
|
|
#ifndef VP9_COMMON_VP9_THREAD_COMMON_H_
|
|
|
|
#define VP9_COMMON_VP9_THREAD_COMMON_H_
|
2013-12-27 15:25:54 -08:00
|
|
|
#include "./vpx_config.h"
|
2015-01-06 14:14:26 -08:00
|
|
|
#include "vp9/common/vp9_loopfilter.h"
|
2015-07-02 10:01:09 -07:00
|
|
|
#include "vpx_util/vpx_thread.h"
|
2013-12-27 15:25:54 -08:00
|
|
|
|
2015-09-09 21:04:27 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-12-27 15:25:54 -08:00
|
|
|
struct VP9Common;
|
2015-02-06 11:37:45 -08:00
|
|
|
struct FRAME_COUNTS;
|
2013-12-27 15:25:54 -08:00
|
|
|
|
|
|
|
// 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;
|
2014-08-28 17:11:31 -07:00
|
|
|
int rows;
|
2014-08-31 13:16:37 -07:00
|
|
|
|
|
|
|
// Row-based parallel loopfilter data
|
|
|
|
LFWorkerData *lfdata;
|
|
|
|
int num_workers;
|
2013-12-27 15:25:54 -08:00
|
|
|
} VP9LfSync;
|
|
|
|
|
|
|
|
// Allocate memory for loopfilter row synchronization.
|
2015-01-06 14:14:26 -08:00
|
|
|
void vp9_loop_filter_alloc(VP9LfSync *lf_sync, struct VP9Common *cm, int rows,
|
2014-08-31 13:16:37 -07:00
|
|
|
int width, int num_workers);
|
2013-12-27 15:25:54 -08:00
|
|
|
|
|
|
|
// Deallocate loopfilter synchronization related mutex and data.
|
2014-08-28 17:11:31 -07:00
|
|
|
void vp9_loop_filter_dealloc(VP9LfSync *lf_sync);
|
2013-12-27 15:25:54 -08:00
|
|
|
|
|
|
|
// Multi-threaded loopfilter that uses the tile threads.
|
2016-07-26 16:52:55 -07:00
|
|
|
void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct VP9Common *cm,
|
2015-01-06 14:14:26 -08:00
|
|
|
struct macroblockd_plane planes[MAX_MB_PLANE],
|
2016-07-26 16:52:55 -07:00
|
|
|
int frame_filter_level, int y_only,
|
|
|
|
int partial_frame, VPxWorker *workers,
|
|
|
|
int num_workers, VP9LfSync *lf_sync);
|
2013-12-27 15:25:54 -08:00
|
|
|
|
2015-08-19 19:25:38 -07:00
|
|
|
void vp9_accumulate_frame_counts(struct FRAME_COUNTS *accum,
|
|
|
|
const struct FRAME_COUNTS *counts, int is_dec);
|
2015-02-06 11:37:45 -08:00
|
|
|
|
2015-09-09 21:04:27 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2015-09-29 09:34:42 -07:00
|
|
|
#endif // VP9_COMMON_VP9_THREAD_COMMON_H_
|