mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-18 07:18:34 +00:00
[libvpx] Update to v1.17.0-97-gd3335af9e
This commit is contained in:
1 parent
7481baed18
commit
a55111af58
615 files changed
+68654
-28912
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/mem_ops.h"
|
||||
#include "vpx_scale/vpx_scale.h"
|
||||
#include "vpx_util/vpx_pthread.h"
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
#if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
|
||||
#include "vpx_util/vpx_debug_util.h"
|
||||
@@ -67,6 +68,7 @@ static int decode_unsigned_max(struct vpx_read_bit_buffer *rb, int max) {
|
||||
static TX_MODE read_tx_mode(vpx_reader *r) {
|
||||
TX_MODE tx_mode = vpx_read_literal(r, 2);
|
||||
if (tx_mode == ALLOW_32X32) tx_mode += vpx_read_bit(r);
|
||||
assert(tx_mode < TX_MODES);
|
||||
return tx_mode;
|
||||
}
|
||||
|
||||
@@ -323,9 +325,9 @@ static void predict_and_reconstruct_intra_block(TileWorkerData *twd,
|
||||
if (!mi->skip) {
|
||||
const TX_TYPE tx_type =
|
||||
(plane || xd->lossless) ? DCT_DCT : intra_mode_to_tx_type_lookup[mode];
|
||||
const scan_order *sc = (plane || xd->lossless)
|
||||
? &vp9_default_scan_orders[tx_size]
|
||||
: &vp9_scan_orders[tx_size][tx_type];
|
||||
const ScanOrder *sc = (plane || xd->lossless)
|
||||
? &vp9_default_scan_orders[tx_size]
|
||||
: &vp9_scan_orders[tx_size][tx_type];
|
||||
const int eob = vp9_decode_block_tokens(twd, plane, sc, col, row, tx_size,
|
||||
mi->segment_id);
|
||||
if (eob > 0) {
|
||||
@@ -348,9 +350,9 @@ static void parse_intra_block_row_mt(TileWorkerData *twd, MODE_INFO *const mi,
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const TX_TYPE tx_type =
|
||||
(plane || xd->lossless) ? DCT_DCT : intra_mode_to_tx_type_lookup[mode];
|
||||
const scan_order *sc = (plane || xd->lossless)
|
||||
? &vp9_default_scan_orders[tx_size]
|
||||
: &vp9_scan_orders[tx_size][tx_type];
|
||||
const ScanOrder *sc = (plane || xd->lossless)
|
||||
? &vp9_default_scan_orders[tx_size]
|
||||
: &vp9_scan_orders[tx_size][tx_type];
|
||||
*pd->eob = vp9_decode_block_tokens(twd, plane, sc, col, row, tx_size,
|
||||
mi->segment_id);
|
||||
/* Keep the alignment to 16 */
|
||||
@@ -393,7 +395,7 @@ static int reconstruct_inter_block(TileWorkerData *twd, MODE_INFO *const mi,
|
||||
int mi_row, int mi_col) {
|
||||
MACROBLOCKD *const xd = &twd->xd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const scan_order *sc = &vp9_default_scan_orders[tx_size];
|
||||
const ScanOrder *sc = &vp9_default_scan_orders[tx_size];
|
||||
const int eob = vp9_decode_block_tokens(twd, plane, sc, col, row, tx_size,
|
||||
mi->segment_id);
|
||||
uint8_t *dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
|
||||
@@ -423,7 +425,7 @@ static int parse_inter_block_row_mt(TileWorkerData *twd, MODE_INFO *const mi,
|
||||
TX_SIZE tx_size) {
|
||||
MACROBLOCKD *const xd = &twd->xd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const scan_order *sc = &vp9_default_scan_orders[tx_size];
|
||||
const ScanOrder *sc = &vp9_default_scan_orders[tx_size];
|
||||
const int eob = vp9_decode_block_tokens(twd, plane, sc, col, row, tx_size,
|
||||
mi->segment_id);
|
||||
|
||||
@@ -1469,7 +1471,7 @@ static void resize_mv_buffer(VP9_COMMON *cm) {
|
||||
vpx_free(cm->cur_frame->mvs);
|
||||
cm->cur_frame->mi_rows = cm->mi_rows;
|
||||
cm->cur_frame->mi_cols = cm->mi_cols;
|
||||
CHECK_MEM_ERROR(cm, cm->cur_frame->mvs,
|
||||
CHECK_MEM_ERROR(&cm->error, cm->cur_frame->mvs,
|
||||
(MV_REF *)vpx_calloc(cm->mi_rows * cm->mi_cols,
|
||||
sizeof(*cm->cur_frame->mvs)));
|
||||
}
|
||||
@@ -1558,16 +1560,13 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
if (vpx_rb_read_bit(rb)) {
|
||||
if (cm->frame_refs[i].idx != INVALID_IDX) {
|
||||
YV12_BUFFER_CONFIG *const buf = cm->frame_refs[i].buf;
|
||||
width = buf->y_crop_width;
|
||||
height = buf->y_crop_height;
|
||||
found = 1;
|
||||
break;
|
||||
} else {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Failed to decode frame size");
|
||||
}
|
||||
assert(cm->frame_refs[i].idx >= 0 &&
|
||||
cm->frame_refs[i].idx < FRAME_BUFFERS);
|
||||
YV12_BUFFER_CONFIG *const buf = cm->frame_refs[i].buf;
|
||||
width = buf->y_crop_width;
|
||||
height = buf->y_crop_height;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1581,18 +1580,18 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
||||
// has valid dimensions.
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
RefBuffer *const ref_frame = &cm->frame_refs[i];
|
||||
assert(ref_frame->idx >= 0 && ref_frame->idx < FRAME_BUFFERS);
|
||||
has_valid_ref_frame |=
|
||||
(ref_frame->idx != INVALID_IDX &&
|
||||
valid_ref_frame_size(ref_frame->buf->y_crop_width,
|
||||
ref_frame->buf->y_crop_height, width, height));
|
||||
valid_ref_frame_size(ref_frame->buf->y_crop_width,
|
||||
ref_frame->buf->y_crop_height, width, height);
|
||||
}
|
||||
if (!has_valid_ref_frame)
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Referenced frame has invalid size");
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
RefBuffer *const ref_frame = &cm->frame_refs[i];
|
||||
if (ref_frame->idx == INVALID_IDX ||
|
||||
!valid_ref_frame_img_fmt(ref_frame->buf->bit_depth,
|
||||
assert(ref_frame->idx >= 0 && ref_frame->idx < FRAME_BUFFERS);
|
||||
if (!valid_ref_frame_img_fmt(ref_frame->buf->bit_depth,
|
||||
ref_frame->buf->subsampling_x,
|
||||
ref_frame->buf->subsampling_y, cm->bit_depth,
|
||||
cm->subsampling_x, cm->subsampling_y))
|
||||
@@ -1776,7 +1775,8 @@ static void vp9_jobq_alloc(VP9Decoder *pbi) {
|
||||
|
||||
if (jobq_size > row_mt_worker_data->jobq_size) {
|
||||
vpx_free(row_mt_worker_data->jobq_buf);
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->jobq_buf, vpx_calloc(1, jobq_size));
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->jobq_buf,
|
||||
vpx_calloc(1, jobq_size));
|
||||
vp9_jobq_init(&row_mt_worker_data->jobq, row_mt_worker_data->jobq_buf,
|
||||
jobq_size);
|
||||
row_mt_worker_data->jobq_size = jobq_size;
|
||||
@@ -1801,7 +1801,8 @@ static void recon_tile_row(TileWorkerData *tile_data, VP9Decoder *pbi,
|
||||
for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MI_BLOCK_SIZE) {
|
||||
const int c = mi_col >> MI_BLOCK_SIZE_LOG2;
|
||||
int plane;
|
||||
const int sb_num = (cur_sb_row * (aligned_cols >> MI_BLOCK_SIZE_LOG2) + c);
|
||||
const size_t sb_num =
|
||||
(cur_sb_row * (aligned_cols >> MI_BLOCK_SIZE_LOG2) + c);
|
||||
|
||||
// Top Dependency
|
||||
if (cur_sb_row) {
|
||||
@@ -1876,7 +1877,7 @@ static void parse_tile_row(TileWorkerData *tile_data, VP9Decoder *pbi,
|
||||
const int r = mi_row >> MI_BLOCK_SIZE_LOG2;
|
||||
const int c = mi_col >> MI_BLOCK_SIZE_LOG2;
|
||||
int plane;
|
||||
const int sb_num = (r * (aligned_cols >> MI_BLOCK_SIZE_LOG2) + c);
|
||||
const size_t sb_num = (r * (aligned_cols >> MI_BLOCK_SIZE_LOG2) + c);
|
||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||
tile_data->xd.plane[plane].eob =
|
||||
row_mt_worker_data->eob[plane] + (sb_num << EOBS_PER_SB_LOG2);
|
||||
@@ -1923,7 +1924,7 @@ static int row_decode_worker_hook(void *arg1, void *arg2) {
|
||||
const int is_last_row = sb_rows - 1 == cur_sb_row;
|
||||
int mi_col_start, mi_col_end;
|
||||
if (!tile_data_recon)
|
||||
CHECK_MEM_ERROR(cm, tile_data_recon,
|
||||
CHECK_MEM_ERROR(&cm->error, tile_data_recon,
|
||||
vpx_memalign(32, sizeof(TileWorkerData)));
|
||||
|
||||
tile_data_recon->xd = pbi->mb;
|
||||
@@ -2025,7 +2026,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, const uint8_t *data,
|
||||
|
||||
if (cm->lf.filter_level && !cm->skip_loop_filter &&
|
||||
pbi->lf_worker.data1 == NULL) {
|
||||
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
|
||||
CHECK_MEM_ERROR(&cm->error, pbi->lf_worker.data1,
|
||||
vpx_memalign(32, sizeof(LFWorkerData)));
|
||||
pbi->lf_worker.hook = vp9_loop_filter_worker;
|
||||
if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) {
|
||||
@@ -2192,8 +2193,6 @@ static int tile_worker_hook(void *arg1, void *arg2) {
|
||||
|
||||
volatile int mi_row = 0;
|
||||
volatile int n = tile_data->buf_start;
|
||||
tile_data->error_info.setjmp = 1;
|
||||
|
||||
if (setjmp(tile_data->error_info.jmp)) {
|
||||
tile_data->error_info.setjmp = 0;
|
||||
tile_data->xd.corrupted = 1;
|
||||
@@ -2206,6 +2205,7 @@ static int tile_worker_hook(void *arg1, void *arg2) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
tile_data->error_info.setjmp = 1;
|
||||
|
||||
tile_data->xd.corrupted = 0;
|
||||
|
||||
@@ -2285,14 +2285,20 @@ static INLINE void init_mt(VP9Decoder *pbi) {
|
||||
|
||||
if (pbi->num_tile_workers == 0) {
|
||||
const int num_threads = pbi->max_threads;
|
||||
CHECK_MEM_ERROR(cm, pbi->tile_workers,
|
||||
CHECK_MEM_ERROR(&cm->error, pbi->tile_workers,
|
||||
vpx_malloc(num_threads * sizeof(*pbi->tile_workers)));
|
||||
for (n = 0; n < num_threads; ++n) {
|
||||
VPxWorker *const worker = &pbi->tile_workers[n];
|
||||
++pbi->num_tile_workers;
|
||||
|
||||
winterface->init(worker);
|
||||
worker->thread_name = "vpx tile worker";
|
||||
if (n < num_threads - 1 && !winterface->reset(worker)) {
|
||||
do {
|
||||
winterface->end(&pbi->tile_workers[pbi->num_tile_workers - 1]);
|
||||
} while (--pbi->num_tile_workers != 0);
|
||||
vpx_free(pbi->tile_workers);
|
||||
pbi->tile_workers = NULL;
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
"Tile decoder thread creation failed");
|
||||
}
|
||||
@@ -2733,6 +2739,11 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
const int ref = vpx_rb_read_literal(rb, REF_FRAMES_LOG2);
|
||||
const int idx = cm->ref_frame_map[ref];
|
||||
if (idx == INVALID_IDX) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Invalid reference frame index");
|
||||
}
|
||||
assert(idx >= 0 && idx < FRAME_BUFFERS);
|
||||
RefBuffer *const ref_frame = &cm->frame_refs[i];
|
||||
ref_frame->idx = idx;
|
||||
ref_frame->buf = &frame_bufs[idx].buf;
|
||||
@@ -2824,7 +2835,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
const int num_jobs = sb_rows << cm->log2_tile_cols;
|
||||
|
||||
if (pbi->row_mt_worker_data == NULL) {
|
||||
CHECK_MEM_ERROR(cm, pbi->row_mt_worker_data,
|
||||
CHECK_MEM_ERROR(&cm->error, pbi->row_mt_worker_data,
|
||||
vpx_calloc(1, sizeof(*pbi->row_mt_worker_data)));
|
||||
#if CONFIG_MULTITHREAD
|
||||
pthread_mutex_init(&pbi->row_mt_worker_data->recon_done_mutex, NULL);
|
||||
@@ -3004,9 +3015,10 @@ void vp9_decode_frame(VP9Decoder *pbi, const uint8_t *data,
|
||||
const size_t twd_size = num_tile_workers * sizeof(*pbi->tile_worker_data);
|
||||
// Ensure tile data offsets will be properly aligned. This may fail on
|
||||
// platforms without DECLARE_ALIGNED().
|
||||
assert((sizeof(*pbi->tile_worker_data) % 16) == 0);
|
||||
static_assert((sizeof(*pbi->tile_worker_data) % 16) == 0, "");
|
||||
vpx_free(pbi->tile_worker_data);
|
||||
CHECK_MEM_ERROR(cm, pbi->tile_worker_data, vpx_memalign(32, twd_size));
|
||||
CHECK_MEM_ERROR(&cm->error, pbi->tile_worker_data,
|
||||
vpx_memalign(32, twd_size));
|
||||
pbi->total_tiles = tile_rows * tile_cols;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||
mi->skip = read_skip(cm, xd, mi->segment_id, r);
|
||||
mi->tx_size = read_tx_size(cm, xd, 1, r);
|
||||
mi->ref_frame[0] = INTRA_FRAME;
|
||||
mi->ref_frame[1] = NONE;
|
||||
mi->ref_frame[1] = NO_REF_FRAME;
|
||||
|
||||
switch (bsize) {
|
||||
case BLOCK_4X4:
|
||||
@@ -299,7 +299,7 @@ static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
|
||||
}
|
||||
}
|
||||
|
||||
// Read the referncence frame
|
||||
// Read the reference frame
|
||||
static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
vpx_reader *r, int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame[2]) {
|
||||
@@ -309,7 +309,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
||||
ref_frame[0] = (MV_REFERENCE_FRAME)get_segdata(&cm->seg, segment_id,
|
||||
SEG_LVL_REF_FRAME);
|
||||
ref_frame[1] = NONE;
|
||||
ref_frame[1] = NO_REF_FRAME;
|
||||
} else {
|
||||
const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r);
|
||||
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
|
||||
@@ -333,7 +333,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
ref_frame[0] = LAST_FRAME;
|
||||
}
|
||||
|
||||
ref_frame[1] = NONE;
|
||||
ref_frame[1] = NO_REF_FRAME;
|
||||
} else {
|
||||
assert(0 && "Invalid prediction mode.");
|
||||
}
|
||||
@@ -383,7 +383,7 @@ static void read_intra_block_mode_info(VP9_COMMON *const cm,
|
||||
mi->interp_filter = SWITCHABLE_FILTERS;
|
||||
|
||||
mi->ref_frame[0] = INTRA_FRAME;
|
||||
mi->ref_frame[1] = NONE;
|
||||
mi->ref_frame[1] = NO_REF_FRAME;
|
||||
}
|
||||
|
||||
static INLINE int is_mv_valid(const MV *mv) {
|
||||
@@ -426,7 +426,9 @@ static INLINE int assign_mv(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
zero_mv_pair(mv);
|
||||
break;
|
||||
}
|
||||
default: { return 0; }
|
||||
default: {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -706,7 +708,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
||||
mi->mode = ZEROMV;
|
||||
if (bsize < BLOCK_8X8) {
|
||||
vpx_internal_error(xd->error_info, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Invalid usage of segement feature on small blocks");
|
||||
"Invalid usage of segment feature on small blocks");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -755,7 +757,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
||||
if (!assign_mv(cm, xd, b_mode, mi->bmi[j].as_mv, best_ref_mvs,
|
||||
best_sub8x8, is_compound, allow_hp, r)) {
|
||||
xd->corrupted |= 1;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_4x4_h == 2) mi->bmi[j + 2] = mi->bmi[j];
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
|
||||
#include "vpx/internal/vpx_codec_internal.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/system_state.h"
|
||||
#include "vpx_ports/vpx_once.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
#include "vpx_scale/vpx_scale.h"
|
||||
#include "vpx_util/vpx_pthread.h"
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
|
||||
#include "vp9/common/vp9_alloccommon.h"
|
||||
@@ -58,15 +61,18 @@ static void vp9_dec_setup_mi(VP9_COMMON *cm) {
|
||||
void vp9_dec_alloc_row_mt_mem(RowMTWorkerData *row_mt_worker_data,
|
||||
VP9_COMMON *cm, int num_sbs, int max_threads,
|
||||
int num_jobs) {
|
||||
int plane;
|
||||
const size_t dqcoeff_size = (num_sbs << DQCOEFFS_PER_SB_LOG2) *
|
||||
if ((size_t)num_sbs > SIZE_MAX / (sizeof(*row_mt_worker_data->dqcoeff[0])
|
||||
<< DQCOEFFS_PER_SB_LOG2)) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "num_sbs too big");
|
||||
}
|
||||
const size_t dqcoeff_size = ((size_t)num_sbs << DQCOEFFS_PER_SB_LOG2) *
|
||||
sizeof(*row_mt_worker_data->dqcoeff[0]);
|
||||
row_mt_worker_data->num_jobs = num_jobs;
|
||||
#if CONFIG_MULTITHREAD
|
||||
{
|
||||
int i;
|
||||
CHECK_MEM_ERROR(
|
||||
cm, row_mt_worker_data->recon_sync_mutex,
|
||||
&cm->error, row_mt_worker_data->recon_sync_mutex,
|
||||
vpx_malloc(sizeof(*row_mt_worker_data->recon_sync_mutex) * num_jobs));
|
||||
if (row_mt_worker_data->recon_sync_mutex) {
|
||||
for (i = 0; i < num_jobs; ++i) {
|
||||
@@ -75,7 +81,7 @@ void vp9_dec_alloc_row_mt_mem(RowMTWorkerData *row_mt_worker_data,
|
||||
}
|
||||
|
||||
CHECK_MEM_ERROR(
|
||||
cm, row_mt_worker_data->recon_sync_cond,
|
||||
&cm->error, row_mt_worker_data->recon_sync_cond,
|
||||
vpx_malloc(sizeof(*row_mt_worker_data->recon_sync_cond) * num_jobs));
|
||||
if (row_mt_worker_data->recon_sync_cond) {
|
||||
for (i = 0; i < num_jobs; ++i) {
|
||||
@@ -85,25 +91,25 @@ void vp9_dec_alloc_row_mt_mem(RowMTWorkerData *row_mt_worker_data,
|
||||
}
|
||||
#endif
|
||||
row_mt_worker_data->num_sbs = num_sbs;
|
||||
for (plane = 0; plane < 3; ++plane) {
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->dqcoeff[plane],
|
||||
vpx_memalign(16, dqcoeff_size));
|
||||
for (int plane = 0; plane < 3; ++plane) {
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->dqcoeff[plane],
|
||||
vpx_memalign(32, dqcoeff_size));
|
||||
memset(row_mt_worker_data->dqcoeff[plane], 0, dqcoeff_size);
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->eob[plane],
|
||||
vpx_calloc(num_sbs << EOBS_PER_SB_LOG2,
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->eob[plane],
|
||||
vpx_calloc((size_t)num_sbs << EOBS_PER_SB_LOG2,
|
||||
sizeof(*row_mt_worker_data->eob[plane])));
|
||||
}
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->partition,
|
||||
vpx_calloc(num_sbs * PARTITIONS_PER_SB,
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->partition,
|
||||
vpx_calloc((size_t)num_sbs * PARTITIONS_PER_SB,
|
||||
sizeof(*row_mt_worker_data->partition)));
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->recon_map,
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->recon_map,
|
||||
vpx_calloc(num_sbs, sizeof(*row_mt_worker_data->recon_map)));
|
||||
|
||||
// allocate memory for thread_data
|
||||
if (row_mt_worker_data->thread_data == NULL) {
|
||||
const size_t thread_size =
|
||||
max_threads * sizeof(*row_mt_worker_data->thread_data);
|
||||
CHECK_MEM_ERROR(cm, row_mt_worker_data->thread_data,
|
||||
CHECK_MEM_ERROR(&cm->error, row_mt_worker_data->thread_data,
|
||||
vpx_memalign(32, thread_size));
|
||||
}
|
||||
}
|
||||
@@ -181,9 +187,10 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
|
||||
|
||||
cm->error.setjmp = 1;
|
||||
|
||||
CHECK_MEM_ERROR(cm, cm->fc, (FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
|
||||
CHECK_MEM_ERROR(&cm->error, cm->fc,
|
||||
(FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
|
||||
CHECK_MEM_ERROR(
|
||||
cm, cm->frame_contexts,
|
||||
&cm->error, cm->frame_contexts,
|
||||
(FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS, sizeof(*cm->frame_contexts)));
|
||||
|
||||
pbi->need_resync = 1;
|
||||
@@ -209,6 +216,7 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
|
||||
cm->error.setjmp = 0;
|
||||
|
||||
vpx_get_worker_interface()->init(&pbi->lf_worker);
|
||||
pbi->lf_worker.thread_name = "vpx lf worker";
|
||||
|
||||
return pbi;
|
||||
}
|
||||
@@ -509,16 +517,27 @@ int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
|
||||
pbi->ready_for_new_data = 1;
|
||||
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
if (setjmp(cm->error.jmp)) {
|
||||
cm->error.setjmp = 0;
|
||||
vpx_clear_system_state();
|
||||
return -1;
|
||||
}
|
||||
|
||||
cm->error.setjmp = 1;
|
||||
|
||||
if (!cm->show_existing_frame) {
|
||||
ret = vp9_post_proc_frame(cm, sd, flags, cm->width);
|
||||
} else {
|
||||
*sd = *cm->frame_to_show;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
cm->error.setjmp = 0;
|
||||
#else
|
||||
*sd = *cm->frame_to_show;
|
||||
ret = 0;
|
||||
#endif /*!CONFIG_POSTPROC*/
|
||||
|
||||
vpx_clear_system_state();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx_dsp/bitreader.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vpx_util/vpx_pthread.h"
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
|
||||
#include "vp9/common/vp9_thread_common.h"
|
||||
@@ -54,7 +55,7 @@ typedef struct TileWorkerData {
|
||||
VP9LfSync *lf_sync;
|
||||
DECLARE_ALIGNED(16, MACROBLOCKD, xd);
|
||||
/* dqcoeff are shared by all the planes. So planes must be decoded serially */
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff[32 * 32]);
|
||||
DECLARE_ALIGNED(32, tran_low_t, dqcoeff[32 * 32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, extend_and_predict_buf[80 * 2 * 80 * 2]);
|
||||
struct vpx_internal_error_info error_info;
|
||||
} TileWorkerData;
|
||||
|
||||
@@ -124,8 +124,8 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
||||
const vpx_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
||||
fc->coef_probs[tx_size][type][ref];
|
||||
const vpx_prob *prob;
|
||||
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
|
||||
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
|
||||
unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
|
||||
unsigned int (*eob_branch_count)[COEFF_CONTEXTS];
|
||||
uint8_t token_cache[32 * 32];
|
||||
const uint8_t *band_translate = get_band_translate(tx_size);
|
||||
const int dq_shift = (tx_size == TX_32X32);
|
||||
@@ -133,17 +133,18 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
||||
int16_t dqv = dq[0];
|
||||
const uint8_t *const cat6_prob =
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
(xd->bd == VPX_BITS_12)
|
||||
? vp9_cat6_prob_high12
|
||||
: (xd->bd == VPX_BITS_10) ? vp9_cat6_prob_high12 + 2 :
|
||||
(xd->bd == VPX_BITS_12) ? vp9_cat6_prob_high12
|
||||
: (xd->bd == VPX_BITS_10) ? vp9_cat6_prob_high12 + 2
|
||||
:
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
vp9_cat6_prob;
|
||||
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;
|
||||
@@ -271,9 +272,8 @@ static void get_ctx_shift(MACROBLOCKD *xd, int *ctx_shift_a, int *ctx_shift_l,
|
||||
}
|
||||
}
|
||||
|
||||
int vp9_decode_block_tokens(TileWorkerData *twd, int plane,
|
||||
const scan_order *sc, int x, int y, TX_SIZE tx_size,
|
||||
int seg_id) {
|
||||
int vp9_decode_block_tokens(TileWorkerData *twd, int plane, const ScanOrder *sc,
|
||||
int x, int y, TX_SIZE tx_size, int seg_id) {
|
||||
vpx_reader *r = &twd->bit_reader;
|
||||
MACROBLOCKD *xd = &twd->xd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int vp9_decode_block_tokens(TileWorkerData *twd, int plane,
|
||||
const scan_order *sc, int x, int y, TX_SIZE tx_size,
|
||||
int seg_id);
|
||||
int vp9_decode_block_tokens(TileWorkerData *twd, int plane, const ScanOrder *sc,
|
||||
int x, int y, TX_SIZE tx_size, int seg_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_util/vpx_pthread.h"
|
||||
|
||||
#include "vp9/decoder/vp9_job_queue.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef VPX_VP9_DECODER_VP9_JOB_QUEUE_H_
|
||||
#define VPX_VP9_DECODER_VP9_JOB_QUEUE_H_
|
||||
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
#include "vpx_util/vpx_pthread.h"
|
||||
|
||||
typedef struct {
|
||||
// Pointer to buffer base which contains the jobs
|
||||
|
||||
Reference in new issue
Block a user