diff options
Diffstat (limited to 'chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h')
-rw-r--r-- | chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h b/chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h index 05344b6cf03..74a2f5d9573 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h +++ b/chromium/third_party/libvpx/source/libvpx/vp9/encoder/vp9_rd.h @@ -128,6 +128,9 @@ struct TileDataEnc; struct VP9_COMP; struct macroblock; +int64_t vp9_compute_rd_mult_based_on_qindex(const struct VP9_COMP *cpi, + int qindex); + int vp9_compute_rd_mult(const struct VP9_COMP *cpi, int qindex); void vp9_initialize_rd_consts(struct VP9_COMP *cpi); @@ -161,11 +164,32 @@ void vp9_set_rd_speed_thresholds(struct VP9_COMP *cpi); void vp9_set_rd_speed_thresholds_sub8x8(struct VP9_COMP *cpi); void vp9_update_rd_thresh_fact(int (*fact)[MAX_MODES], int rd_thresh, int bsize, +#if CONFIG_MULTITHREAD + pthread_mutex_t *enc_row_mt_mutex, +#endif int best_mode_index); static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh, - int thresh_fact) { - return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX; +#if CONFIG_MULTITHREAD + pthread_mutex_t *enc_row_mt_mutex, +#endif + const int *const thresh_fact) { + int is_rd_less_than_thresh; + +#if CONFIG_MULTITHREAD + // Synchronize to ensure data coherency as thresh_freq_fact is maintained at + // tile level and not thread-safe with row based multi-threading + if (NULL != enc_row_mt_mutex) pthread_mutex_lock(enc_row_mt_mutex); +#endif + + is_rd_less_than_thresh = + best_rd < ((int64_t)thresh * (*thresh_fact) >> 5) || thresh == INT_MAX; + +#if CONFIG_MULTITHREAD + if (NULL != enc_row_mt_mutex) pthread_mutex_unlock(enc_row_mt_mutex); +#endif + + return is_rd_less_than_thresh; } static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { |