mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 14:58:34 +00:00
update libvpx to hash 133f83e2c tag v1.7.0 from https://chromium.googlesource.com/webm/libvpx
This commit is contained in:
1 parent
9bfd5255b2
commit
731ee28fe7
599 files changed
+103887
-65579
No files matched your search
@@ -189,21 +189,22 @@ static void inverse_transform_block_inter(MACROBLOCKD *xd, int plane,
|
||||
assert(eob > 0);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
uint16_t *const dst16 = CONVERT_TO_SHORTPTR(dst);
|
||||
if (xd->lossless) {
|
||||
vp9_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_iwht4x4_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
} else {
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
vp9_highbd_idct4x4_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_idct4x4_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_8X8:
|
||||
vp9_highbd_idct8x8_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_idct8x8_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_16X16:
|
||||
vp9_highbd_idct16x16_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_idct16x16_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_32X32:
|
||||
vp9_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_idct32x32_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
default: assert(0 && "Invalid transform size");
|
||||
}
|
||||
@@ -256,21 +257,22 @@ static void inverse_transform_block_intra(MACROBLOCKD *xd, int plane,
|
||||
assert(eob > 0);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
uint16_t *const dst16 = CONVERT_TO_SHORTPTR(dst);
|
||||
if (xd->lossless) {
|
||||
vp9_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_iwht4x4_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
} else {
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
vp9_highbd_iht4x4_add(tx_type, dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_iht4x4_add(tx_type, dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_8X8:
|
||||
vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_16X16:
|
||||
vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
case TX_32X32:
|
||||
vp9_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd);
|
||||
vp9_highbd_idct32x32_add(dqcoeff, dst16, stride, eob, xd->bd);
|
||||
break;
|
||||
default: assert(0 && "Invalid transform size");
|
||||
}
|
||||
@@ -451,24 +453,19 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride,
|
||||
const struct scale_factors *sf, MACROBLOCKD *xd,
|
||||
int w, int h, int ref, int xs, int ys) {
|
||||
DECLARE_ALIGNED(16, uint16_t, mc_buf_high[80 * 2 * 80 * 2]);
|
||||
const uint8_t *buf_ptr;
|
||||
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
high_build_mc_border(buf_ptr1, pre_buf_stride, mc_buf_high, b_w, x0, y0,
|
||||
b_w, b_h, frame_width, frame_height);
|
||||
buf_ptr = CONVERT_TO_BYTEPTR(mc_buf_high) + border_offset;
|
||||
highbd_inter_predictor(mc_buf_high + border_offset, b_w,
|
||||
CONVERT_TO_SHORTPTR(dst), dst_buf_stride, subpel_x,
|
||||
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
|
||||
} else {
|
||||
build_mc_border(buf_ptr1, pre_buf_stride, (uint8_t *)mc_buf_high, b_w, x0,
|
||||
y0, b_w, b_h, frame_width, frame_height);
|
||||
buf_ptr = ((uint8_t *)mc_buf_high) + border_offset;
|
||||
}
|
||||
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
highbd_inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x,
|
||||
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
|
||||
} else {
|
||||
inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x, subpel_y, sf,
|
||||
w, h, ref, kernel, xs, ys);
|
||||
inter_predictor(((uint8_t *)mc_buf_high) + border_offset, b_w, dst,
|
||||
dst_buf_stride, subpel_x, subpel_y, sf, w, h, ref, kernel,
|
||||
xs, ys);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -493,8 +490,8 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride,
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
static void dec_build_inter_predictors(
|
||||
VPxWorker *const worker, MACROBLOCKD *xd, int plane, int bw, int bh, int x,
|
||||
int y, int w, int h, int mi_x, int mi_y, const InterpKernel *kernel,
|
||||
MACROBLOCKD *xd, int plane, int bw, int bh, int x, int y, int w, int h,
|
||||
int mi_x, int mi_y, const InterpKernel *kernel,
|
||||
const struct scale_factors *sf, struct buf_2d *pre_buf,
|
||||
struct buf_2d *dst_buf, const MV *mv, RefCntBuffer *ref_frame_buf,
|
||||
int is_scaled, int ref) {
|
||||
@@ -596,12 +593,6 @@ static void dec_build_inter_predictors(
|
||||
y_pad = 1;
|
||||
}
|
||||
|
||||
// Wait until reference block is ready. Pad 7 more pixels as last 7
|
||||
// pixels of each superblock row can be changed by next superblock row.
|
||||
if (worker != NULL)
|
||||
vp9_frameworker_wait(worker, ref_frame_buf, VPXMAX(0, (y1 + 7))
|
||||
<< (plane == 0 ? 0 : 1));
|
||||
|
||||
// Skip border extension if block is inside the frame.
|
||||
if (x0 < 0 || x0 > frame_width - 1 || x1 < 0 || x1 > frame_width - 1 ||
|
||||
y0 < 0 || y0 > frame_height - 1 || y1 < 0 || y1 > frame_height - 1) {
|
||||
@@ -620,18 +611,11 @@ static void dec_build_inter_predictors(
|
||||
w, h, ref, xs, ys);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Wait until reference block is ready. Pad 7 more pixels as last 7
|
||||
// pixels of each superblock row can be changed by next superblock row.
|
||||
if (worker != NULL) {
|
||||
const int y1 = (y0_16 + (h - 1) * ys) >> SUBPEL_BITS;
|
||||
vp9_frameworker_wait(worker, ref_frame_buf, VPXMAX(0, (y1 + 7))
|
||||
<< (plane == 0 ? 0 : 1));
|
||||
}
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
highbd_inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x,
|
||||
highbd_inter_predictor(CONVERT_TO_SHORTPTR(buf_ptr), buf_stride,
|
||||
CONVERT_TO_SHORTPTR(dst), dst_buf->stride, subpel_x,
|
||||
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
|
||||
} else {
|
||||
inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x,
|
||||
@@ -655,8 +639,6 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
|
||||
const int is_compound = has_second_ref(mi);
|
||||
int ref;
|
||||
int is_scaled;
|
||||
VPxWorker *const fwo =
|
||||
pbi->frame_parallel_decode ? pbi->frame_worker_owner : NULL;
|
||||
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
const MV_REFERENCE_FRAME frame = mi->ref_frame[ref];
|
||||
@@ -688,10 +670,10 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
|
||||
for (y = 0; y < num_4x4_h; ++y) {
|
||||
for (x = 0; x < num_4x4_w; ++x) {
|
||||
const MV mv = average_split_mvs(pd, mi, ref, i++);
|
||||
dec_build_inter_predictors(fwo, xd, plane, n4w_x4, n4h_x4, 4 * x,
|
||||
4 * y, 4, 4, mi_x, mi_y, kernel, sf,
|
||||
pre_buf, dst_buf, &mv, ref_frame_buf,
|
||||
is_scaled, ref);
|
||||
dec_build_inter_predictors(xd, plane, n4w_x4, n4h_x4, 4 * x, 4 * y,
|
||||
4, 4, mi_x, mi_y, kernel, sf, pre_buf,
|
||||
dst_buf, &mv, ref_frame_buf, is_scaled,
|
||||
ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,7 +687,7 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
|
||||
const int n4w_x4 = 4 * num_4x4_w;
|
||||
const int n4h_x4 = 4 * num_4x4_h;
|
||||
struct buf_2d *const pre_buf = &pd->pre[ref];
|
||||
dec_build_inter_predictors(fwo, xd, plane, n4w_x4, n4h_x4, 0, 0, n4w_x4,
|
||||
dec_build_inter_predictors(xd, plane, n4w_x4, n4h_x4, 0, 0, n4w_x4,
|
||||
n4h_x4, mi_x, mi_y, kernel, sf, pre_buf,
|
||||
dst_buf, &mv, ref_frame_buf, is_scaled, ref);
|
||||
}
|
||||
@@ -838,8 +820,9 @@ static void decode_block(TileWorkerData *twd, VP9Decoder *const pbi, int mi_row,
|
||||
: xd->mb_to_right_edge >> (5 + pd->subsampling_x));
|
||||
const int max_blocks_high =
|
||||
num_4x4_h +
|
||||
(xd->mb_to_bottom_edge >= 0 ? 0 : xd->mb_to_bottom_edge >>
|
||||
(5 + pd->subsampling_y));
|
||||
(xd->mb_to_bottom_edge >= 0
|
||||
? 0
|
||||
: xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
|
||||
|
||||
xd->max_blocks_wide = xd->mb_to_right_edge >= 0 ? 0 : max_blocks_wide;
|
||||
xd->max_blocks_high = xd->mb_to_bottom_edge >= 0 ? 0 : max_blocks_high;
|
||||
@@ -1188,7 +1171,6 @@ static void setup_frame_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
|
||||
resize_context_buffers(cm, width, height);
|
||||
setup_render_size(cm, rb);
|
||||
|
||||
lock_buffer_pool(pool);
|
||||
if (vpx_realloc_frame_buffer(
|
||||
get_frame_new_buffer(cm), cm->width, cm->height, cm->subsampling_x,
|
||||
cm->subsampling_y,
|
||||
@@ -1198,12 +1180,11 @@ static void setup_frame_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
|
||||
VP9_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
|
||||
&pool->frame_bufs[cm->new_fb_idx].raw_frame_buffer, pool->get_fb_cb,
|
||||
pool->cb_priv)) {
|
||||
unlock_buffer_pool(pool);
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate frame buffer");
|
||||
}
|
||||
unlock_buffer_pool(pool);
|
||||
|
||||
pool->frame_bufs[cm->new_fb_idx].released = 0;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.subsampling_x = cm->subsampling_x;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
|
||||
@@ -1274,7 +1255,6 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
||||
resize_context_buffers(cm, width, height);
|
||||
setup_render_size(cm, rb);
|
||||
|
||||
lock_buffer_pool(pool);
|
||||
if (vpx_realloc_frame_buffer(
|
||||
get_frame_new_buffer(cm), cm->width, cm->height, cm->subsampling_x,
|
||||
cm->subsampling_y,
|
||||
@@ -1284,12 +1264,11 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
||||
VP9_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
|
||||
&pool->frame_bufs[cm->new_fb_idx].raw_frame_buffer, pool->get_fb_cb,
|
||||
pool->cb_priv)) {
|
||||
unlock_buffer_pool(pool);
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate frame buffer");
|
||||
}
|
||||
unlock_buffer_pool(pool);
|
||||
|
||||
pool->frame_bufs[cm->new_fb_idx].released = 0;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.subsampling_x = cm->subsampling_x;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y;
|
||||
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
|
||||
@@ -1385,7 +1364,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, const uint8_t *data,
|
||||
pbi->lf_worker.data1 == NULL) {
|
||||
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
|
||||
vpx_memalign(32, sizeof(LFWorkerData)));
|
||||
pbi->lf_worker.hook = (VPxWorkerHook)vp9_loop_filter_worker;
|
||||
pbi->lf_worker.hook = vp9_loop_filter_worker;
|
||||
if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
"Loop filter thread creation failed");
|
||||
@@ -1474,11 +1453,6 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, const uint8_t *data,
|
||||
winterface->execute(&pbi->lf_worker);
|
||||
}
|
||||
}
|
||||
// After loopfiltering, the last 7 row pixels in each superblock row may
|
||||
// still be changed by the longest loopfilter of the next superblock
|
||||
// row.
|
||||
if (pbi->frame_parallel_decode)
|
||||
vp9_frameworker_broadcast(pbi->cur_buf, mi_row << MI_BLOCK_SIZE_LOG2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,16 +1468,16 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, const uint8_t *data,
|
||||
// Get last tile data.
|
||||
tile_data = pbi->tile_worker_data + tile_cols * tile_rows - 1;
|
||||
|
||||
if (pbi->frame_parallel_decode)
|
||||
vp9_frameworker_broadcast(pbi->cur_buf, INT_MAX);
|
||||
return vpx_reader_find_end(&tile_data->bit_reader);
|
||||
}
|
||||
|
||||
// On entry 'tile_data->data_end' points to the end of the input frame, on exit
|
||||
// it is updated to reflect the bitreader position of the final tile column if
|
||||
// present in the tile buffer group or NULL otherwise.
|
||||
static int tile_worker_hook(TileWorkerData *const tile_data,
|
||||
VP9Decoder *const pbi) {
|
||||
static int tile_worker_hook(void *arg1, void *arg2) {
|
||||
TileWorkerData *const tile_data = (TileWorkerData *)arg1;
|
||||
VP9Decoder *const pbi = (VP9Decoder *)arg2;
|
||||
|
||||
TileInfo *volatile tile = &tile_data->xd.tile;
|
||||
const int final_col = (1 << pbi->common.log2_tile_cols) - 1;
|
||||
const uint8_t *volatile bit_reader_end = NULL;
|
||||
@@ -1517,7 +1491,6 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
tile_data->xd.error_info = &tile_data->error_info;
|
||||
tile_data->xd.corrupted = 0;
|
||||
|
||||
do {
|
||||
@@ -1529,6 +1502,8 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
|
||||
&tile_data->error_info, &tile_data->bit_reader,
|
||||
pbi->decrypt_cb, pbi->decrypt_state);
|
||||
vp9_init_macroblockd(&pbi->common, &tile_data->xd, tile_data->dqcoeff);
|
||||
// init resets xd.error_info
|
||||
tile_data->xd.error_info = &tile_data->error_info;
|
||||
|
||||
for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
|
||||
mi_row += MI_BLOCK_SIZE) {
|
||||
@@ -1596,7 +1571,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, const uint8_t *data,
|
||||
tile_data->xd = pbi->mb;
|
||||
tile_data->xd.counts =
|
||||
cm->frame_parallel_decoding_mode ? NULL : &tile_data->counts;
|
||||
worker->hook = (VPxWorkerHook)tile_worker_hook;
|
||||
worker->hook = tile_worker_hook;
|
||||
worker->data1 = tile_data;
|
||||
worker->data2 = pbi;
|
||||
}
|
||||
@@ -1779,24 +1754,17 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
if (cm->show_existing_frame) {
|
||||
// Show an existing frame directly.
|
||||
const int frame_to_show = cm->ref_frame_map[vpx_rb_read_literal(rb, 3)];
|
||||
lock_buffer_pool(pool);
|
||||
if (frame_to_show < 0 || frame_bufs[frame_to_show].ref_count < 1) {
|
||||
unlock_buffer_pool(pool);
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Buffer %d does not contain a decoded frame",
|
||||
frame_to_show);
|
||||
}
|
||||
|
||||
ref_cnt_fb(frame_bufs, &cm->new_fb_idx, frame_to_show);
|
||||
unlock_buffer_pool(pool);
|
||||
pbi->refresh_frame_flags = 0;
|
||||
cm->lf.filter_level = 0;
|
||||
cm->show_frame = 1;
|
||||
|
||||
if (pbi->frame_parallel_decode) {
|
||||
for (i = 0; i < REF_FRAMES; ++i)
|
||||
cm->next_ref_frame_map[i] = cm->ref_frame_map[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1913,7 +1881,6 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
cm->frame_context_idx = vpx_rb_read_literal(rb, FRAME_CONTEXTS_LOG2);
|
||||
|
||||
// Generate next_ref_frame_map.
|
||||
lock_buffer_pool(pool);
|
||||
for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) {
|
||||
if (mask & 1) {
|
||||
cm->next_ref_frame_map[ref_index] = cm->new_fb_idx;
|
||||
@@ -1933,7 +1900,6 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
if (cm->ref_frame_map[ref_index] >= 0)
|
||||
++frame_bufs[cm->ref_frame_map[ref_index]].ref_count;
|
||||
}
|
||||
unlock_buffer_pool(pool);
|
||||
pbi->hold_ref_buf = 1;
|
||||
|
||||
if (frame_is_intra_only(cm) || cm->error_resilient_mode)
|
||||
@@ -2090,24 +2056,6 @@ void vp9_decode_frame(VP9Decoder *pbi, const uint8_t *data,
|
||||
vp9_loop_filter_frame_init(cm, cm->lf.filter_level);
|
||||
}
|
||||
|
||||
// If encoded in frame parallel mode, frame context is ready after decoding
|
||||
// the frame header.
|
||||
if (pbi->frame_parallel_decode && cm->frame_parallel_decoding_mode) {
|
||||
VPxWorker *const worker = pbi->frame_worker_owner;
|
||||
FrameWorkerData *const frame_worker_data = worker->data1;
|
||||
if (cm->refresh_frame_context) {
|
||||
context_updated = 1;
|
||||
cm->frame_contexts[cm->frame_context_idx] = *cm->fc;
|
||||
}
|
||||
vp9_frameworker_lock_stats(worker);
|
||||
pbi->cur_buf->row = -1;
|
||||
pbi->cur_buf->col = -1;
|
||||
frame_worker_data->frame_context_ready = 1;
|
||||
// Signal the main thread that context is ready.
|
||||
vp9_frameworker_signal_stats(worker);
|
||||
vp9_frameworker_unlock_stats(worker);
|
||||
}
|
||||
|
||||
if (pbi->tile_worker_data == NULL ||
|
||||
(tile_cols * tile_rows) != pbi->total_tiles) {
|
||||
const int num_tile_workers =
|
||||
|
||||
@@ -455,12 +455,6 @@ static void dec_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *best_mv,
|
||||
}
|
||||
}
|
||||
|
||||
static void fpm_sync(void *const data, int mi_row) {
|
||||
VP9Decoder *const pbi = (VP9Decoder *)data;
|
||||
vp9_frameworker_wait(pbi->frame_worker_owner, pbi->common.prev_frame,
|
||||
mi_row << MI_BLOCK_SIZE_LOG2);
|
||||
}
|
||||
|
||||
// This macro is used to add a motion vector mv_ref list if it isn't
|
||||
// already in the list. If it's the second motion vector or early_break
|
||||
// it will also skip all additional processing and jump to Done!
|
||||
@@ -500,8 +494,7 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
PREDICTION_MODE mode, MV_REFERENCE_FRAME ref_frame,
|
||||
const POSITION *const mv_ref_search,
|
||||
int_mv *mv_ref_list, int mi_row, int mi_col,
|
||||
int block, int is_sub8x8, find_mv_refs_sync sync,
|
||||
void *const data) {
|
||||
int block, int is_sub8x8) {
|
||||
const int *ref_sign_bias = cm->ref_frame_sign_bias;
|
||||
int i, refmv_count = 0;
|
||||
int different_ref_found = 0;
|
||||
@@ -557,23 +550,8 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(hkuang): Remove this sync after fixing pthread_cond_broadcast
|
||||
// on windows platform. The sync here is unnecessary if use_prev_frame_mvs
|
||||
// is 0. But after removing it, there will be hang in the unit test on windows
|
||||
// due to several threads waiting for a thread's signal.
|
||||
#if defined(_WIN32) && !HAVE_PTHREAD_H
|
||||
if (cm->frame_parallel_decode && sync != NULL) {
|
||||
sync(data, mi_row);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the last frame's mode and mv info.
|
||||
if (prev_frame_mvs) {
|
||||
// Synchronize here for frame parallel decode if sync function is provided.
|
||||
if (cm->frame_parallel_decode && sync != NULL) {
|
||||
sync(data, mi_row);
|
||||
}
|
||||
|
||||
if (prev_frame_mvs->ref_frame[0] == ref_frame) {
|
||||
ADD_MV_REF_LIST_EB(prev_frame_mvs->mv[0], refmv_count, mv_ref_list, Done);
|
||||
} else if (prev_frame_mvs->ref_frame[1] == ref_frame) {
|
||||
@@ -652,7 +630,7 @@ static void append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
|
||||
refmv_count =
|
||||
dec_find_mv_refs(cm, xd, b_mode, mi->ref_frame[ref], mv_ref_search,
|
||||
mv_list, mi_row, mi_col, block, 1, NULL, NULL);
|
||||
mv_list, mi_row, mi_col, block, 1);
|
||||
|
||||
switch (block) {
|
||||
case 0: best_sub8x8->as_int = mv_list[refmv_count - 1].as_int; break;
|
||||
@@ -750,9 +728,8 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
||||
const MV_REFERENCE_FRAME frame = mi->ref_frame[ref];
|
||||
int refmv_count;
|
||||
|
||||
refmv_count =
|
||||
dec_find_mv_refs(cm, xd, mi->mode, frame, mv_ref_search, tmp_mvs,
|
||||
mi_row, mi_col, -1, 0, fpm_sync, (void *)pbi);
|
||||
refmv_count = dec_find_mv_refs(cm, xd, mi->mode, frame, mv_ref_search,
|
||||
tmp_mvs, mi_row, mi_col, -1, 0);
|
||||
|
||||
dec_find_best_ref_mvs(allow_hp, tmp_mvs, &best_ref_mvs[ref],
|
||||
refmv_count);
|
||||
@@ -770,6 +747,10 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
||||
int idx, idy;
|
||||
PREDICTION_MODE b_mode;
|
||||
int_mv best_sub8x8[2];
|
||||
const uint32_t invalid_mv = 0x80008000;
|
||||
// Initialize the 2nd element as even though it won't be used meaningfully
|
||||
// if is_compound is false, copying/clamping it may trigger a MSan warning.
|
||||
best_sub8x8[1].as_int = invalid_mv;
|
||||
for (idy = 0; idy < 2; idy += num_4x4_h) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_w) {
|
||||
const int j = idy * 2 + idx;
|
||||
|
||||
@@ -139,6 +139,7 @@ void vp9_decoder_remove(VP9Decoder *pbi) {
|
||||
vp9_loop_filter_dealloc(&pbi->lf_row_sync);
|
||||
}
|
||||
|
||||
vp9_remove_common(&pbi->common);
|
||||
vpx_free(pbi);
|
||||
}
|
||||
|
||||
@@ -169,7 +170,7 @@ vpx_codec_err_t vp9_copy_reference_dec(VP9Decoder *pbi,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
"Incorrect buffer dimensions");
|
||||
else
|
||||
vp8_yv12_copy_frame(cfg, sd);
|
||||
vpx_yv12_copy_frame(cfg, sd);
|
||||
} else {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame");
|
||||
}
|
||||
@@ -217,7 +218,7 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
|
||||
"Incorrect buffer dimensions");
|
||||
} else {
|
||||
// Overwrite the reference frame buffer.
|
||||
vp8_yv12_copy_frame(sd, ref_buf);
|
||||
vpx_yv12_copy_frame(sd, ref_buf);
|
||||
}
|
||||
|
||||
return cm->error.error_code;
|
||||
@@ -230,7 +231,6 @@ static void swap_frame_buffers(VP9Decoder *pbi) {
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
|
||||
|
||||
lock_buffer_pool(pool);
|
||||
for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) {
|
||||
const int old_idx = cm->ref_frame_map[ref_index];
|
||||
// Current thread releases the holding of reference frame.
|
||||
@@ -250,15 +250,10 @@ static void swap_frame_buffers(VP9Decoder *pbi) {
|
||||
decrease_ref_count(old_idx, frame_bufs, pool);
|
||||
cm->ref_frame_map[ref_index] = cm->next_ref_frame_map[ref_index];
|
||||
}
|
||||
unlock_buffer_pool(pool);
|
||||
pbi->hold_ref_buf = 0;
|
||||
cm->frame_to_show = get_frame_new_buffer(cm);
|
||||
|
||||
if (!pbi->frame_parallel_decode || !cm->show_frame) {
|
||||
lock_buffer_pool(pool);
|
||||
--frame_bufs[cm->new_fb_idx].ref_count;
|
||||
unlock_buffer_pool(pool);
|
||||
}
|
||||
--frame_bufs[cm->new_fb_idx].ref_count;
|
||||
|
||||
// Invalidate these references until the next frame starts.
|
||||
for (ref_index = 0; ref_index < 3; ref_index++)
|
||||
@@ -292,11 +287,13 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, size_t size,
|
||||
pbi->ready_for_new_data = 0;
|
||||
|
||||
// Check if the previous frame was a frame without any references to it.
|
||||
// Release frame buffer if not decoding in frame parallel mode.
|
||||
if (!pbi->frame_parallel_decode && cm->new_fb_idx >= 0 &&
|
||||
frame_bufs[cm->new_fb_idx].ref_count == 0)
|
||||
if (cm->new_fb_idx >= 0 && frame_bufs[cm->new_fb_idx].ref_count == 0 &&
|
||||
!frame_bufs[cm->new_fb_idx].released) {
|
||||
pool->release_fb_cb(pool->cb_priv,
|
||||
&frame_bufs[cm->new_fb_idx].raw_frame_buffer);
|
||||
frame_bufs[cm->new_fb_idx].released = 1;
|
||||
}
|
||||
|
||||
// Find a free frame buffer. Return error if can not find any.
|
||||
cm->new_fb_idx = get_free_fb(cm);
|
||||
if (cm->new_fb_idx == INVALID_IDX) {
|
||||
@@ -309,18 +306,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, size_t size,
|
||||
cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx];
|
||||
|
||||
pbi->hold_ref_buf = 0;
|
||||
if (pbi->frame_parallel_decode) {
|
||||
VPxWorker *const worker = pbi->frame_worker_owner;
|
||||
vp9_frameworker_lock_stats(worker);
|
||||
frame_bufs[cm->new_fb_idx].frame_worker_owner = worker;
|
||||
// Reset decoding progress.
|
||||
pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
|
||||
pbi->cur_buf->row = -1;
|
||||
pbi->cur_buf->col = -1;
|
||||
vp9_frameworker_unlock_stats(worker);
|
||||
} else {
|
||||
pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
|
||||
}
|
||||
pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
|
||||
|
||||
if (setjmp(cm->error.jmp)) {
|
||||
const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
|
||||
@@ -336,7 +322,6 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, size_t size,
|
||||
winterface->sync(&pbi->tile_workers[i]);
|
||||
}
|
||||
|
||||
lock_buffer_pool(pool);
|
||||
// Release all the reference buffers if worker thread is holding them.
|
||||
if (pbi->hold_ref_buf == 1) {
|
||||
int ref_index = 0, mask;
|
||||
@@ -361,7 +346,6 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, size_t size,
|
||||
}
|
||||
// Release current frame.
|
||||
decrease_ref_count(cm->new_fb_idx, frame_bufs, pool);
|
||||
unlock_buffer_pool(pool);
|
||||
|
||||
vpx_clear_system_state();
|
||||
return -1;
|
||||
@@ -377,31 +361,14 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, size_t size,
|
||||
if (!cm->show_existing_frame) {
|
||||
cm->last_show_frame = cm->show_frame;
|
||||
cm->prev_frame = cm->cur_frame;
|
||||
if (cm->seg.enabled && !pbi->frame_parallel_decode)
|
||||
vp9_swap_current_and_last_seg_map(cm);
|
||||
if (cm->seg.enabled) vp9_swap_current_and_last_seg_map(cm);
|
||||
}
|
||||
|
||||
// Update progress in frame parallel decode.
|
||||
if (pbi->frame_parallel_decode) {
|
||||
// Need to lock the mutex here as another thread may
|
||||
// be accessing this buffer.
|
||||
VPxWorker *const worker = pbi->frame_worker_owner;
|
||||
FrameWorkerData *const frame_worker_data = worker->data1;
|
||||
vp9_frameworker_lock_stats(worker);
|
||||
|
||||
if (cm->show_frame) {
|
||||
cm->current_video_frame++;
|
||||
}
|
||||
frame_worker_data->frame_decoded = 1;
|
||||
frame_worker_data->frame_context_ready = 1;
|
||||
vp9_frameworker_signal_stats(worker);
|
||||
vp9_frameworker_unlock_stats(worker);
|
||||
} else {
|
||||
cm->last_width = cm->width;
|
||||
cm->last_height = cm->height;
|
||||
if (cm->show_frame) {
|
||||
cm->current_video_frame++;
|
||||
}
|
||||
cm->last_width = cm->width;
|
||||
cm->last_height = cm->height;
|
||||
if (cm->show_frame) {
|
||||
cm->current_video_frame++;
|
||||
}
|
||||
|
||||
cm->error.setjmp = 0;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "vp9/common/vp9_thread_common.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vp9/common/vp9_ppflags.h"
|
||||
#include "vp9/decoder/vp9_dthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -53,13 +52,10 @@ typedef struct VP9Decoder {
|
||||
|
||||
int refresh_frame_flags;
|
||||
|
||||
int frame_parallel_decode; // frame-based threading.
|
||||
|
||||
// TODO(hkuang): Combine this with cur_buf in macroblockd as they are
|
||||
// the same.
|
||||
RefCntBuffer *cur_buf; // Current decoding frame buffer.
|
||||
|
||||
VPxWorker *frame_worker_owner; // frame_worker that owns this pbi.
|
||||
VPxWorker lf_worker;
|
||||
VPxWorker *tile_workers;
|
||||
TileWorkerData *tile_worker_data;
|
||||
@@ -121,9 +117,10 @@ static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
|
||||
// But the private buffer is not set up until finish decoding header.
|
||||
// So any error happens during decoding header, the frame_bufs will not
|
||||
// have valid priv buffer.
|
||||
if (frame_bufs[idx].ref_count == 0 &&
|
||||
if (!frame_bufs[idx].released && frame_bufs[idx].ref_count == 0 &&
|
||||
frame_bufs[idx].raw_frame_buffer.priv) {
|
||||
pool->release_fb_cb(pool->cb_priv, &frame_bufs[idx].raw_frame_buffer);
|
||||
frame_bufs[idx].released = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +99,10 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
||||
vp9_cat6_prob;
|
||||
const int cat6_bits =
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
(xd->bd == VPX_BITS_12) ? 18 : (xd->bd == VPX_BITS_10) ? 16 :
|
||||
(xd->bd == VPX_BITS_12) ? 18
|
||||
: (xd->bd == VPX_BITS_10) ? 16 :
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
14;
|
||||
14;
|
||||
// Keep value, range, and count as locals. The compiler produces better
|
||||
// results with the locals than using r directly.
|
||||
BD_VALUE value = r->value;
|
||||
@@ -170,7 +171,12 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
||||
read_coeff(r, vp9_cat1_prob, 1, &value, &count, &range);
|
||||
}
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
// val may use 18-bits
|
||||
v = (int)(((int64_t)val * dqv) >> dq_shift);
|
||||
#else
|
||||
v = (val * dqv) >> dq_shift;
|
||||
#endif
|
||||
} else {
|
||||
if (read_bool(r, p[1], &value, &count, &range)) {
|
||||
token_cache[scan[c]] = 3;
|
||||
@@ -188,9 +194,8 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
||||
}
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
dqcoeff[scan[c]] =
|
||||
highbd_check_range(read_bool(r, 128, &value, &count, &range) ? -v : v),
|
||||
xd->bd);
|
||||
dqcoeff[scan[c]] = highbd_check_range(
|
||||
read_bool(r, 128, &value, &count, &range) ? -v : v, xd->bd);
|
||||
#else
|
||||
dqcoeff[scan[c]] =
|
||||
check_range(read_bool(r, 128, &value, &count, &range) ? -v : v);
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vp9/common/vp9_reconinter.h"
|
||||
#include "vp9/decoder/vp9_dthread.h"
|
||||
#include "vp9/decoder/vp9_decoder.h"
|
||||
|
||||
// #define DEBUG_THREAD
|
||||
|
||||
// TODO(hkuang): Clean up all the #ifdef in this file.
|
||||
void vp9_frameworker_lock_stats(VPxWorker *const worker) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
FrameWorkerData *const worker_data = worker->data1;
|
||||
pthread_mutex_lock(&worker_data->stats_mutex);
|
||||
#else
|
||||
(void)worker;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp9_frameworker_unlock_stats(VPxWorker *const worker) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
FrameWorkerData *const worker_data = worker->data1;
|
||||
pthread_mutex_unlock(&worker_data->stats_mutex);
|
||||
#else
|
||||
(void)worker;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp9_frameworker_signal_stats(VPxWorker *const worker) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
FrameWorkerData *const worker_data = worker->data1;
|
||||
|
||||
// TODO(hkuang): Fix the pthread_cond_broadcast in windows wrapper.
|
||||
#if defined(_WIN32) && !HAVE_PTHREAD_H
|
||||
pthread_cond_signal(&worker_data->stats_cond);
|
||||
#else
|
||||
pthread_cond_broadcast(&worker_data->stats_cond);
|
||||
#endif
|
||||
|
||||
#else
|
||||
(void)worker;
|
||||
#endif
|
||||
}
|
||||
|
||||
// This macro prevents thread_sanitizer from reporting known concurrent writes.
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(thread_sanitizer)
|
||||
#define BUILDING_WITH_TSAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// TODO(hkuang): Remove worker parameter as it is only used in debug code.
|
||||
void vp9_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
|
||||
int row) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
if (!ref_buf) return;
|
||||
|
||||
#ifndef BUILDING_WITH_TSAN
|
||||
// The following line of code will get harmless tsan error but it is the key
|
||||
// to get best performance.
|
||||
if (ref_buf->row >= row && ref_buf->buf.corrupted != 1) return;
|
||||
#endif
|
||||
|
||||
{
|
||||
// Find the worker thread that owns the reference frame. If the reference
|
||||
// frame has been fully decoded, it may not have owner.
|
||||
VPxWorker *const ref_worker = ref_buf->frame_worker_owner;
|
||||
FrameWorkerData *const ref_worker_data =
|
||||
(FrameWorkerData *)ref_worker->data1;
|
||||
const VP9Decoder *const pbi = ref_worker_data->pbi;
|
||||
|
||||
#ifdef DEBUG_THREAD
|
||||
{
|
||||
FrameWorkerData *const worker_data = (FrameWorkerData *)worker->data1;
|
||||
printf("%d %p worker is waiting for %d %p worker (%d) ref %d \r\n",
|
||||
worker_data->worker_id, worker, ref_worker_data->worker_id,
|
||||
ref_buf->frame_worker_owner, row, ref_buf->row);
|
||||
}
|
||||
#endif
|
||||
|
||||
vp9_frameworker_lock_stats(ref_worker);
|
||||
while (ref_buf->row < row && pbi->cur_buf == ref_buf &&
|
||||
ref_buf->buf.corrupted != 1) {
|
||||
pthread_cond_wait(&ref_worker_data->stats_cond,
|
||||
&ref_worker_data->stats_mutex);
|
||||
}
|
||||
|
||||
if (ref_buf->buf.corrupted == 1) {
|
||||
FrameWorkerData *const worker_data = (FrameWorkerData *)worker->data1;
|
||||
vp9_frameworker_unlock_stats(ref_worker);
|
||||
vpx_internal_error(&worker_data->pbi->common.error,
|
||||
VPX_CODEC_CORRUPT_FRAME,
|
||||
"Worker %p failed to decode frame", worker);
|
||||
}
|
||||
vp9_frameworker_unlock_stats(ref_worker);
|
||||
}
|
||||
#else
|
||||
(void)worker;
|
||||
(void)ref_buf;
|
||||
(void)row;
|
||||
(void)ref_buf;
|
||||
#endif // CONFIG_MULTITHREAD
|
||||
}
|
||||
|
||||
void vp9_frameworker_broadcast(RefCntBuffer *const buf, int row) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
VPxWorker *worker = buf->frame_worker_owner;
|
||||
|
||||
#ifdef DEBUG_THREAD
|
||||
{
|
||||
FrameWorkerData *const worker_data = (FrameWorkerData *)worker->data1;
|
||||
printf("%d %p worker decode to (%d) \r\n", worker_data->worker_id,
|
||||
buf->frame_worker_owner, row);
|
||||
}
|
||||
#endif
|
||||
|
||||
vp9_frameworker_lock_stats(worker);
|
||||
buf->row = row;
|
||||
vp9_frameworker_signal_stats(worker);
|
||||
vp9_frameworker_unlock_stats(worker);
|
||||
#else
|
||||
(void)buf;
|
||||
(void)row;
|
||||
#endif // CONFIG_MULTITHREAD
|
||||
}
|
||||
|
||||
void vp9_frameworker_copy_context(VPxWorker *const dst_worker,
|
||||
VPxWorker *const src_worker) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
FrameWorkerData *const src_worker_data = (FrameWorkerData *)src_worker->data1;
|
||||
FrameWorkerData *const dst_worker_data = (FrameWorkerData *)dst_worker->data1;
|
||||
VP9_COMMON *const src_cm = &src_worker_data->pbi->common;
|
||||
VP9_COMMON *const dst_cm = &dst_worker_data->pbi->common;
|
||||
int i;
|
||||
|
||||
// Wait until source frame's context is ready.
|
||||
vp9_frameworker_lock_stats(src_worker);
|
||||
while (!src_worker_data->frame_context_ready) {
|
||||
pthread_cond_wait(&src_worker_data->stats_cond,
|
||||
&src_worker_data->stats_mutex);
|
||||
}
|
||||
|
||||
dst_cm->last_frame_seg_map = src_cm->seg.enabled
|
||||
? src_cm->current_frame_seg_map
|
||||
: src_cm->last_frame_seg_map;
|
||||
dst_worker_data->pbi->need_resync = src_worker_data->pbi->need_resync;
|
||||
vp9_frameworker_unlock_stats(src_worker);
|
||||
|
||||
dst_cm->bit_depth = src_cm->bit_depth;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
dst_cm->use_highbitdepth = src_cm->use_highbitdepth;
|
||||
#endif
|
||||
dst_cm->prev_frame =
|
||||
src_cm->show_existing_frame ? src_cm->prev_frame : src_cm->cur_frame;
|
||||
dst_cm->last_width =
|
||||
!src_cm->show_existing_frame ? src_cm->width : src_cm->last_width;
|
||||
dst_cm->last_height =
|
||||
!src_cm->show_existing_frame ? src_cm->height : src_cm->last_height;
|
||||
dst_cm->subsampling_x = src_cm->subsampling_x;
|
||||
dst_cm->subsampling_y = src_cm->subsampling_y;
|
||||
dst_cm->frame_type = src_cm->frame_type;
|
||||
dst_cm->last_show_frame = !src_cm->show_existing_frame
|
||||
? src_cm->show_frame
|
||||
: src_cm->last_show_frame;
|
||||
for (i = 0; i < REF_FRAMES; ++i)
|
||||
dst_cm->ref_frame_map[i] = src_cm->next_ref_frame_map[i];
|
||||
|
||||
memcpy(dst_cm->lf_info.lfthr, src_cm->lf_info.lfthr,
|
||||
(MAX_LOOP_FILTER + 1) * sizeof(loop_filter_thresh));
|
||||
dst_cm->lf.last_sharpness_level = src_cm->lf.sharpness_level;
|
||||
dst_cm->lf.filter_level = src_cm->lf.filter_level;
|
||||
memcpy(dst_cm->lf.ref_deltas, src_cm->lf.ref_deltas, MAX_REF_LF_DELTAS);
|
||||
memcpy(dst_cm->lf.mode_deltas, src_cm->lf.mode_deltas, MAX_MODE_LF_DELTAS);
|
||||
dst_cm->seg = src_cm->seg;
|
||||
memcpy(dst_cm->frame_contexts, src_cm->frame_contexts,
|
||||
FRAME_CONTEXTS * sizeof(dst_cm->frame_contexts[0]));
|
||||
#else
|
||||
(void)dst_worker;
|
||||
(void)src_worker;
|
||||
#endif // CONFIG_MULTITHREAD
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef VP9_DECODER_VP9_DTHREAD_H_
|
||||
#define VP9_DECODER_VP9_DTHREAD_H_
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
#include "vpx/internal/vpx_codec_internal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct VP9Common;
|
||||
struct VP9Decoder;
|
||||
|
||||
// WorkerData for the FrameWorker thread. It contains all the information of
|
||||
// the worker and decode structures for decoding a frame.
|
||||
typedef struct FrameWorkerData {
|
||||
struct VP9Decoder *pbi;
|
||||
const uint8_t *data;
|
||||
const uint8_t *data_end;
|
||||
size_t data_size;
|
||||
void *user_priv;
|
||||
int result;
|
||||
int worker_id;
|
||||
int received_frame;
|
||||
|
||||
// scratch_buffer is used in frame parallel mode only.
|
||||
// It is used to make a copy of the compressed data.
|
||||
uint8_t *scratch_buffer;
|
||||
size_t scratch_buffer_size;
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
pthread_mutex_t stats_mutex;
|
||||
pthread_cond_t stats_cond;
|
||||
#endif
|
||||
|
||||
int frame_context_ready; // Current frame's context is ready to read.
|
||||
int frame_decoded; // Finished decoding current frame.
|
||||
} FrameWorkerData;
|
||||
|
||||
void vp9_frameworker_lock_stats(VPxWorker *const worker);
|
||||
void vp9_frameworker_unlock_stats(VPxWorker *const worker);
|
||||
void vp9_frameworker_signal_stats(VPxWorker *const worker);
|
||||
|
||||
// Wait until ref_buf has been decoded to row in real pixel unit.
|
||||
// Note: worker may already finish decoding ref_buf and release it in order to
|
||||
// start decoding next frame. So need to check whether worker is still decoding
|
||||
// ref_buf.
|
||||
void vp9_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
|
||||
int row);
|
||||
|
||||
// FrameWorker broadcasts its decoding progress so other workers that are
|
||||
// waiting on it can resume decoding.
|
||||
void vp9_frameworker_broadcast(RefCntBuffer *const buf, int row);
|
||||
|
||||
// Copy necessary decoding context from src worker to dst worker.
|
||||
void vp9_frameworker_copy_context(VPxWorker *const dst_worker,
|
||||
VPxWorker *const src_worker);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // VP9_DECODER_VP9_DTHREAD_H_
|
||||
Reference in new issue
Block a user