[libvpx] Update to v1.12.0

This commit is contained in:
Andrey Volk committed 2026-07-10 19:38:46 +03:00
1 parent 287a71dc66
commit b5046d2a76
572 files changed
+52900 -29493

No files matched your search

+19 -8
View File
@@ -17,17 +17,26 @@
#include "vp9/common/vp9_entropymv.h"
#include "vp9/common/vp9_onyxc_int.h"
void vp9_set_mb_mi(VP9_COMMON *cm, int width, int height) {
void vp9_set_mi_size(int *mi_rows, int *mi_cols, int *mi_stride, int width,
int height) {
const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
*mi_cols = aligned_width >> MI_SIZE_LOG2;
*mi_rows = aligned_height >> MI_SIZE_LOG2;
*mi_stride = calc_mi_size(*mi_cols);
}
cm->mi_cols = aligned_width >> MI_SIZE_LOG2;
cm->mi_rows = aligned_height >> MI_SIZE_LOG2;
cm->mi_stride = calc_mi_size(cm->mi_cols);
void vp9_set_mb_size(int *mb_rows, int *mb_cols, int *mb_num, int mi_rows,
int mi_cols) {
*mb_cols = (mi_cols + 1) >> 1;
*mb_rows = (mi_rows + 1) >> 1;
*mb_num = (*mb_rows) * (*mb_cols);
}
cm->mb_cols = (cm->mi_cols + 1) >> 1;
cm->mb_rows = (cm->mi_rows + 1) >> 1;
cm->MBs = cm->mb_rows * cm->mb_cols;
void vp9_set_mb_mi(VP9_COMMON *cm, int width, int height) {
vp9_set_mi_size(&cm->mi_rows, &cm->mi_cols, &cm->mi_stride, width, height);
vp9_set_mb_size(&cm->mb_rows, &cm->mb_cols, &cm->MBs, cm->mi_rows,
cm->mi_cols);
}
static int alloc_seg_map(VP9_COMMON *cm, int seg_map_size) {
@@ -64,6 +73,8 @@ static void free_seg_map(VP9_COMMON *cm) {
void vp9_free_ref_frame_buffers(BufferPool *pool) {
int i;
if (!pool) return;
for (i = 0; i < FRAME_BUFFERS; ++i) {
if (!pool->frame_bufs[i].released &&
pool->frame_bufs[i].raw_frame_buffer.data != NULL) {
@@ -91,7 +102,7 @@ void vp9_free_postproc_buffers(VP9_COMMON *cm) {
}
void vp9_free_context_buffers(VP9_COMMON *cm) {
cm->free_mi(cm);
if (cm->free_mi) cm->free_mi(cm);
free_seg_map(cm);
vpx_free(cm->above_context);
cm->above_context = NULL;
+5
View File
@@ -33,6 +33,11 @@ void vp9_free_postproc_buffers(struct VP9Common *cm);
int vp9_alloc_state_buffers(struct VP9Common *cm, int width, int height);
void vp9_free_state_buffers(struct VP9Common *cm);
void vp9_set_mi_size(int *mi_rows, int *mi_cols, int *mi_stride, int width,
int height);
void vp9_set_mb_size(int *mb_rows, int *mb_cols, int *mb_num, int mi_rows,
int mi_cols);
void vp9_set_mb_mi(struct VP9Common *cm, int width, int height);
void vp9_swap_current_and_last_seg_map(struct VP9Common *cm);
+7
View File
@@ -60,9 +60,16 @@ typedef struct {
#define GOLDEN_FRAME 2
#define ALTREF_FRAME 3
#define MAX_REF_FRAMES 4
#define MAX_INTER_REF_FRAMES 3
typedef int8_t MV_REFERENCE_FRAME;
static INLINE int mv_ref_frame_to_inter_ref_idx(
MV_REFERENCE_FRAME mv_ref_frame) {
assert(mv_ref_frame >= LAST_FRAME && mv_ref_frame < MAX_REF_FRAMES);
return mv_ref_frame - 1;
}
// This structure now relates to 8x8 block regions.
typedef struct MODE_INFO {
// Common for both INTER and INTRA blocks
+2 -2
View File
@@ -27,10 +27,10 @@ extern "C" {
// Only need this for fixed-size arrays, for structs just assign.
#define vp9_copy(dest, src) \
{ \
do { \
assert(sizeof(dest) == sizeof(src)); \
memcpy(dest, src, sizeof(src)); \
}
} while (0)
// Use this for variably-sized arrays.
#define vp9_copy_array(dest, src, n) \
+9 -5
View File
@@ -14,14 +14,17 @@
#include "vpx_mem/vpx_mem.h"
int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
assert(list != NULL);
vp9_free_internal_frame_buffers(list);
list->num_internal_frame_buffers =
VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
list->int_fb = (InternalFrameBuffer *)vpx_calloc(
list->num_internal_frame_buffers, sizeof(*list->int_fb));
return (list->int_fb == NULL);
list->int_fb =
(InternalFrameBuffer *)vpx_calloc(num_buffers, sizeof(*list->int_fb));
if (list->int_fb) {
list->num_internal_frame_buffers = num_buffers;
return 0;
}
return -1;
}
void vp9_free_internal_frame_buffers(InternalFrameBufferList *list) {
@@ -35,6 +38,7 @@ void vp9_free_internal_frame_buffers(InternalFrameBufferList *list) {
}
vpx_free(list->int_fb);
list->int_fb = NULL;
list->num_internal_frame_buffers = 0;
}
int vp9_get_frame_buffer(void *cb_priv, size_t min_size,
+2
View File
@@ -19,6 +19,8 @@
extern "C" {
#endif
#define INVALID_MV 0x80008000
typedef struct mv {
int16_t row;
int16_t col;
+59 -11
View File
@@ -69,7 +69,16 @@ typedef struct {
int mi_rows;
int mi_cols;
uint8_t released;
int frame_index;
// Note that frame_index/frame_coding_index are only set by set_frame_index()
// on the encoder side.
// TODO(angiebird): Set frame_index/frame_coding_index on the decoder side
// properly.
int frame_index; // Display order in the video, it's equivalent to the
// show_idx defined in EncodeFrameInfo.
int frame_coding_index; // The coding order (starting from zero) of this
// frame.
vpx_codec_frame_buffer_t raw_frame_buffer;
YV12_BUFFER_CONFIG buf;
} RefCntBuffer;
@@ -226,7 +235,14 @@ typedef struct VP9Common {
unsigned int frame_context_idx; /* Context to use/update */
FRAME_COUNTS counts;
// TODO(angiebird): current_video_frame/current_frame_coding_index into a
// structure
unsigned int current_video_frame;
// Each show or no show frame is assigned with a coding index based on its
// coding order (starting from zero).
// Current frame's coding index.
int current_frame_coding_index;
BITSTREAM_PROFILE profile;
// VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3.
@@ -244,14 +260,6 @@ typedef struct VP9Common {
int byte_alignment;
int skip_loop_filter;
// Private data associated with the frame buffer callbacks.
void *cb_priv;
vpx_get_frame_buffer_cb_fn_t get_fb_cb;
vpx_release_frame_buffer_cb_fn_t release_fb_cb;
// Handles memory for the codec.
InternalFrameBufferList int_frame_buffers;
// External BufferPool passed from outside.
BufferPool *buffer_pool;
@@ -262,6 +270,48 @@ typedef struct VP9Common {
int lf_row;
} VP9_COMMON;
static INLINE void init_frame_indexes(VP9_COMMON *cm) {
cm->current_video_frame = 0;
cm->current_frame_coding_index = 0;
}
static INLINE void update_frame_indexes(VP9_COMMON *cm, int show_frame) {
if (show_frame) {
// Don't increment frame counters if this was an altref buffer
// update not a real frame
++cm->current_video_frame;
}
++cm->current_frame_coding_index;
}
typedef struct {
int frame_width;
int frame_height;
int render_frame_width;
int render_frame_height;
int mi_rows;
int mi_cols;
int mb_rows;
int mb_cols;
int num_mbs;
vpx_bit_depth_t bit_depth;
} FRAME_INFO;
static INLINE void init_frame_info(FRAME_INFO *frame_info,
const VP9_COMMON *cm) {
frame_info->frame_width = cm->width;
frame_info->frame_height = cm->height;
frame_info->render_frame_width = cm->render_width;
frame_info->render_frame_height = cm->render_height;
frame_info->mi_cols = cm->mi_cols;
frame_info->mi_rows = cm->mi_rows;
frame_info->mb_cols = cm->mb_cols;
frame_info->mb_rows = cm->mb_rows;
frame_info->num_mbs = cm->MBs;
frame_info->bit_depth = cm->bit_depth;
// TODO(angiebird): Figure out how to get subsampling_x/y here
}
static INLINE YV12_BUFFER_CONFIG *get_buf_frame(VP9_COMMON *cm, int index) {
if (index < 0 || index >= FRAME_BUFFERS) return NULL;
if (cm->error.error_code != VPX_CODEC_OK) return NULL;
@@ -299,8 +349,6 @@ static INLINE int get_free_fb(VP9_COMMON *cm) {
static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) {
const int ref_index = *idx;
if (!bufs) return;
if (ref_index >= 0 && bufs[ref_index].ref_count > 0)
bufs[ref_index].ref_count--;
+15 -14
View File
@@ -183,7 +183,8 @@ void vp9_highbd_mbpost_proc_down_c(uint16_t *dst, int pitch, int rows, int cols,
}
#endif // CONFIG_VP9_HIGHBITDEPTH
static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
static void deblock_and_de_macro_block(VP9_COMMON *cm,
YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *post, int q,
int low_var_thresh, int flag,
uint8_t *limits) {
@@ -216,7 +217,7 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
source->uv_height, source->uv_width, ppl);
} else {
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_deblock(source, post, q, limits);
vp9_deblock(cm, source, post, q, limits);
vpx_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
post->y_width, q2mbl(q));
vpx_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
@@ -226,8 +227,8 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
#endif // CONFIG_VP9_HIGHBITDEPTH
}
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
uint8_t *limits) {
void vp9_deblock(struct VP9Common *cm, const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int q, uint8_t *limits) {
const int ppl =
(int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q + 0.0065 + 0.5);
#if CONFIG_VP9_HIGHBITDEPTH
@@ -252,9 +253,8 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
} else {
#endif // CONFIG_VP9_HIGHBITDEPTH
int mbr;
const int mb_rows = src->y_height / 16;
const int mb_cols = src->y_width / 16;
const int mb_rows = cm->mb_rows;
const int mb_cols = cm->mb_cols;
memset(limits, (unsigned char)ppl, 16 * mb_cols);
for (mbr = 0; mbr < mb_rows; mbr++) {
@@ -276,9 +276,9 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
#endif // CONFIG_VP9_HIGHBITDEPTH
}
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
uint8_t *limits) {
vp9_deblock(src, dst, q, limits);
void vp9_denoise(struct VP9Common *cm, const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int q, uint8_t *limits) {
vp9_deblock(cm, src, dst, q, limits);
}
static void swap_mi_and_prev_mi(VP9_COMMON *cm) {
@@ -360,6 +360,7 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
if (!cm->postproc_state.limits) {
cm->postproc_state.limits =
vpx_calloc(unscaled_width, sizeof(*cm->postproc_state.limits));
if (!cm->postproc_state.limits) return 1;
}
}
@@ -383,21 +384,21 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
vpx_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int);
}
if ((flags & VP9D_DEMACROBLOCK) && cm->post_proc_buffer_int.buffer_alloc) {
deblock_and_de_macro_block(&cm->post_proc_buffer_int, ppbuf,
deblock_and_de_macro_block(cm, &cm->post_proc_buffer_int, ppbuf,
q + (ppflags->deblocking_level - 5) * 10, 1, 0,
cm->postproc_state.limits);
} else if (flags & VP9D_DEBLOCK) {
vp9_deblock(&cm->post_proc_buffer_int, ppbuf, q,
vp9_deblock(cm, &cm->post_proc_buffer_int, ppbuf, q,
cm->postproc_state.limits);
} else {
vpx_yv12_copy_frame(&cm->post_proc_buffer_int, ppbuf);
}
} else if (flags & VP9D_DEMACROBLOCK) {
deblock_and_de_macro_block(cm->frame_to_show, ppbuf,
deblock_and_de_macro_block(cm, cm->frame_to_show, ppbuf,
q + (ppflags->deblocking_level - 5) * 10, 1, 0,
cm->postproc_state.limits);
} else if (flags & VP9D_DEBLOCK) {
vp9_deblock(cm->frame_to_show, ppbuf, q, cm->postproc_state.limits);
vp9_deblock(cm, cm->frame_to_show, ppbuf, q, cm->postproc_state.limits);
} else {
vpx_yv12_copy_frame(cm->frame_to_show, ppbuf);
}
+4 -4
View File
@@ -40,11 +40,11 @@ struct VP9Common;
int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *ppflags, int unscaled_width);
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
uint8_t *limits);
void vp9_denoise(struct VP9Common *cm, const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int q, uint8_t *limits);
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q,
uint8_t *limits);
void vp9_deblock(struct VP9Common *cm, const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int q, uint8_t *limits);
#ifdef __cplusplus
} // extern "C"
+2 -2
View File
@@ -96,8 +96,8 @@ MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, const MV *src_mv, int bw,
const int spel_right = spel_left - SUBPEL_SHIFTS;
const int spel_top = (VP9_INTERP_EXTEND + bh) << SUBPEL_BITS;
const int spel_bottom = spel_top - SUBPEL_SHIFTS;
MV clamped_mv = { src_mv->row * (1 << (1 - ss_y)),
src_mv->col * (1 << (1 - ss_x)) };
MV clamped_mv = { (short)(src_mv->row * (1 << (1 - ss_y))),
(short)(src_mv->col * (1 << (1 - ss_x))) };
assert(ss_x <= 1);
assert(ss_y <= 1);
+1 -5
View File
@@ -12,8 +12,4 @@
#include "./vp9_rtcd.h"
#include "vpx_ports/vpx_once.h"
void vp9_rtcd() {
// TODO(JBB): Remove this once, by insuring that both the encoder and
// decoder setup functions are protected by once();
once(setup_rtcd_internal);
}
void vp9_rtcd() { once(setup_rtcd_internal); }
+7 -7
View File
@@ -128,10 +128,10 @@ add_proto qw/int64_t vp9_block_error/, "const tran_low_t *coeff, const tran_low_
add_proto qw/int64_t vp9_block_error_fp/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, int block_size";
add_proto qw/void vp9_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
add_proto qw/void vp9_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vp9_quantize_fp neon sse2 avx2 vsx/, "$ssse3_x86_64";
add_proto qw/void vp9_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
add_proto qw/void vp9_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vp9_quantize_fp_32x32 neon vsx/, "$ssse3_x86_64";
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
@@ -159,9 +159,9 @@ add_proto qw/void vp9_fwht4x4/, "const int16_t *input, tran_low_t *output, int s
# Note that there are more specializations appended when CONFIG_VP9_HIGHBITDEPTH
# is off.
specialize qw/vp9_fht4x4 sse2/;
specialize qw/vp9_fht8x8 sse2/;
specialize qw/vp9_fht16x16 sse2/;
specialize qw/vp9_fht4x4 sse2 neon/;
specialize qw/vp9_fht8x8 sse2 neon/;
specialize qw/vp9_fht16x16 sse2 neon/;
specialize qw/vp9_fwht4x4 sse2/;
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") ne "yes") {
# Note that these specializations are appended to the above ones.
@@ -195,9 +195,9 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
# ENCODEMB INVOKE
add_proto qw/void vp9_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
add_proto qw/void vp9_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
add_proto qw/void vp9_highbd_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan" ;
add_proto qw/void vp9_highbd_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan" ;
# fdct functions
add_proto qw/void vp9_highbd_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
+5
View File
@@ -25,6 +25,11 @@ extern "C" {
#define PREDICTION_PROBS 3
// Segment ID used to skip background encoding
#define BACKGROUND_SEG_SKIP_ID 3
// Number of frames that don't skip after a key frame
#define FRAMES_NO_SKIPPING_AFTER_KEY 20
// Segment level features.
typedef enum {
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
+48 -42
View File
@@ -298,7 +298,10 @@ void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows,
pthread_cond_init(&lf_sync->cond[i], NULL);
}
}
pthread_mutex_init(&lf_sync->lf_mutex, NULL);
CHECK_MEM_ERROR(cm, lf_sync->lf_mutex,
vpx_malloc(sizeof(*lf_sync->lf_mutex)));
pthread_mutex_init(lf_sync->lf_mutex, NULL);
CHECK_MEM_ERROR(cm, lf_sync->recon_done_mutex,
vpx_malloc(sizeof(*lf_sync->recon_done_mutex) * rows));
@@ -339,47 +342,50 @@ void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows,
// Deallocate lf synchronization related mutex and data
void vp9_loop_filter_dealloc(VP9LfSync *lf_sync) {
if (lf_sync != NULL) {
assert(lf_sync != NULL);
#if CONFIG_MULTITHREAD
if (lf_sync->mutex != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_mutex_destroy(&lf_sync->mutex[i]);
}
vpx_free(lf_sync->mutex);
}
if (lf_sync->cond != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_cond_destroy(&lf_sync->cond[i]);
}
vpx_free(lf_sync->cond);
}
if (lf_sync->recon_done_mutex != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_mutex_destroy(&lf_sync->recon_done_mutex[i]);
}
vpx_free(lf_sync->recon_done_mutex);
}
if (lf_sync->mutex != NULL) {
for (i = 0; i < lf_sync->rows; ++i) {
pthread_mutex_destroy(&lf_sync->mutex[i]);
}
vpx_free(lf_sync->mutex);
}
if (lf_sync->cond != NULL) {
for (i = 0; i < lf_sync->rows; ++i) {
pthread_cond_destroy(&lf_sync->cond[i]);
}
vpx_free(lf_sync->cond);
}
if (lf_sync->recon_done_mutex != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_mutex_destroy(&lf_sync->recon_done_mutex[i]);
}
vpx_free(lf_sync->recon_done_mutex);
}
pthread_mutex_destroy(&lf_sync->lf_mutex);
if (lf_sync->recon_done_cond != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_cond_destroy(&lf_sync->recon_done_cond[i]);
}
vpx_free(lf_sync->recon_done_cond);
if (lf_sync->lf_mutex != NULL) {
pthread_mutex_destroy(lf_sync->lf_mutex);
vpx_free(lf_sync->lf_mutex);
}
if (lf_sync->recon_done_cond != NULL) {
int i;
for (i = 0; i < lf_sync->rows; ++i) {
pthread_cond_destroy(&lf_sync->recon_done_cond[i]);
}
vpx_free(lf_sync->recon_done_cond);
}
#endif // CONFIG_MULTITHREAD
vpx_free(lf_sync->lfdata);
vpx_free(lf_sync->cur_sb_col);
vpx_free(lf_sync->num_tiles_done);
// clear the structure as the source of this call may be a resize in which
// case this call will be followed by an _alloc() which may fail.
vp9_zero(*lf_sync);
}
vpx_free(lf_sync->lfdata);
vpx_free(lf_sync->cur_sb_col);
vpx_free(lf_sync->num_tiles_done);
// clear the structure as the source of this call may be a resize in which
// case this call will be followed by an _alloc() which may fail.
vp9_zero(*lf_sync);
}
static int get_next_row(VP9_COMMON *cm, VP9LfSync *lf_sync) {
@@ -390,7 +396,7 @@ static int get_next_row(VP9_COMMON *cm, VP9LfSync *lf_sync) {
#if CONFIG_MULTITHREAD
const int tile_cols = 1 << cm->log2_tile_cols;
pthread_mutex_lock(&lf_sync->lf_mutex);
pthread_mutex_lock(lf_sync->lf_mutex);
if (cm->lf_row < max_rows) {
cur_row = cm->lf_row >> MI_BLOCK_SIZE_LOG2;
return_val = cm->lf_row;
@@ -401,7 +407,7 @@ static int get_next_row(VP9_COMMON *cm, VP9LfSync *lf_sync) {
cur_row += 1;
}
}
pthread_mutex_unlock(&lf_sync->lf_mutex);
pthread_mutex_unlock(lf_sync->lf_mutex);
if (return_val == -1) return return_val;
@@ -411,7 +417,7 @@ static int get_next_row(VP9_COMMON *cm, VP9LfSync *lf_sync) {
&lf_sync->recon_done_mutex[cur_row]);
}
pthread_mutex_unlock(&lf_sync->recon_done_mutex[cur_row]);
pthread_mutex_lock(&lf_sync->lf_mutex);
pthread_mutex_lock(lf_sync->lf_mutex);
if (lf_sync->corrupted) {
int row = return_val >> MI_BLOCK_SIZE_LOG2;
pthread_mutex_lock(&lf_sync->mutex[row]);
@@ -420,7 +426,7 @@ static int get_next_row(VP9_COMMON *cm, VP9LfSync *lf_sync) {
pthread_mutex_unlock(&lf_sync->mutex[row]);
return_val = -1;
}
pthread_mutex_unlock(&lf_sync->lf_mutex);
pthread_mutex_unlock(lf_sync->lf_mutex);
#else
(void)lf_sync;
if (cm->lf_row < max_rows) {
@@ -455,9 +461,9 @@ void vp9_loopfilter_rows(LFWorkerData *lf_data, VP9LfSync *lf_sync) {
void vp9_set_row(VP9LfSync *lf_sync, int num_tiles, int row, int is_last_row,
int corrupted) {
#if CONFIG_MULTITHREAD
pthread_mutex_lock(&lf_sync->lf_mutex);
pthread_mutex_lock(lf_sync->lf_mutex);
lf_sync->corrupted |= corrupted;
pthread_mutex_unlock(&lf_sync->lf_mutex);
pthread_mutex_unlock(lf_sync->lf_mutex);
pthread_mutex_lock(&lf_sync->recon_done_mutex[row]);
lf_sync->num_tiles_done[row] += 1;
if (num_tiles == lf_sync->num_tiles_done[row]) {
+1 -1
View File
@@ -40,7 +40,7 @@ typedef struct VP9LfSyncData {
int num_active_workers; // number of scheduled workers.
#if CONFIG_MULTITHREAD
pthread_mutex_t lf_mutex;
pthread_mutex_t *lf_mutex;
pthread_mutex_t *recon_done_mutex;
pthread_cond_t *recon_done_cond;
#endif
+3 -3
View File
@@ -22,7 +22,7 @@ SECTION .text
; int dst_stride,
; int src_weight
;)
global sym(vp9_filter_by_weight16x16_sse2) PRIVATE
globalsym(vp9_filter_by_weight16x16_sse2)
sym(vp9_filter_by_weight16x16_sse2):
push rbp
mov rbp, rsp
@@ -100,7 +100,7 @@ sym(vp9_filter_by_weight16x16_sse2):
; int dst_stride,
; int src_weight
;)
global sym(vp9_filter_by_weight8x8_sse2) PRIVATE
globalsym(vp9_filter_by_weight8x8_sse2)
sym(vp9_filter_by_weight8x8_sse2):
push rbp
mov rbp, rsp
@@ -168,7 +168,7 @@ sym(vp9_filter_by_weight8x8_sse2):
; unsigned int *variance, 4
; unsigned int *sad, 5
;)
global sym(vp9_variance_and_sad_16x16_sse2) PRIVATE
globalsym(vp9_variance_and_sad_16x16_sse2)
sym(vp9_variance_and_sad_16x16_sse2):
push rbp
mov rbp, rsp