mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 22:38:38 +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
@@ -930,7 +930,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
|
||||
/* When error concealment is enabled we should only check the sync
|
||||
* code if we have enough bits available
|
||||
*/
|
||||
if (!pbi->ec_active || data + 3 < data_end) {
|
||||
if (data + 3 < data_end) {
|
||||
if (clear[0] != 0x9d || clear[1] != 0x01 || clear[2] != 0x2a) {
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Invalid frame sync code");
|
||||
@@ -941,13 +941,19 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
|
||||
* if we have enough data. Otherwise we will end up with the wrong
|
||||
* size.
|
||||
*/
|
||||
if (!pbi->ec_active || data + 6 < data_end) {
|
||||
if (data + 6 < data_end) {
|
||||
pc->Width = (clear[3] | (clear[4] << 8)) & 0x3fff;
|
||||
pc->horiz_scale = clear[4] >> 6;
|
||||
pc->Height = (clear[5] | (clear[6] << 8)) & 0x3fff;
|
||||
pc->vert_scale = clear[6] >> 6;
|
||||
data += 7;
|
||||
} else if (!pbi->ec_active) {
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Truncated key frame header");
|
||||
} else {
|
||||
/* Error concealment is active, clear the frame. */
|
||||
data = data_end;
|
||||
}
|
||||
data += 7;
|
||||
} else {
|
||||
memcpy(&xd->pre, yv12_fb_new, sizeof(YV12_BUFFER_CONFIG));
|
||||
memcpy(&xd->dst, yv12_fb_new, sizeof(YV12_BUFFER_CONFIG));
|
||||
@@ -1199,7 +1205,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
|
||||
pbi->frame_corrupt_residual = 0;
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
if (pbi->b_multithreaded_rd && pc->multi_token_partition != ONE_PARTITION) {
|
||||
if (vpx_atomic_load_acquire(&pbi->b_multithreaded_rd) &&
|
||||
pc->multi_token_partition != ONE_PARTITION) {
|
||||
unsigned int thread;
|
||||
vp8mt_decode_mb_rows(pbi, xd);
|
||||
vp8_yv12_extend_frame_borders(yv12_fb_new);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "decodemv.h"
|
||||
#include "treereader.h"
|
||||
#include "vp8/common/entropymv.h"
|
||||
#include "vp8/common/entropymode.h"
|
||||
@@ -64,8 +65,7 @@ static int read_mvcomponent(vp8_reader *r, const MV_CONTEXT *mvc) {
|
||||
const vp8_prob *const p = (const vp8_prob *)mvc;
|
||||
int x = 0;
|
||||
|
||||
if (vp8_read(r, p[mvpis_short])) /* Large */
|
||||
{
|
||||
if (vp8_read(r, p[mvpis_short])) { /* Large */
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
@@ -284,8 +284,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi,
|
||||
MB_MODE_INFO *mbmi) {
|
||||
vp8_reader *const bc = &pbi->mbc[8];
|
||||
mbmi->ref_frame = (MV_REFERENCE_FRAME)vp8_read(bc, pbi->prob_intra);
|
||||
if (mbmi->ref_frame) /* inter MB */
|
||||
{
|
||||
if (mbmi->ref_frame) { /* inter MB */
|
||||
enum { CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
|
||||
int cnt[4];
|
||||
int *cntx = cnt;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
#include "vpx_scale/vpx_scale.h"
|
||||
#include "vp8/common/systemdependent.h"
|
||||
#include "vpx_ports/system_state.h"
|
||||
#include "vpx_ports/vpx_once.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
#include "detokenize.h"
|
||||
@@ -40,7 +41,6 @@
|
||||
#endif
|
||||
|
||||
extern void vp8_init_loop_filter(VP8_COMMON *cm);
|
||||
extern void vp8cx_init_de_quantizer(VP8D_COMP *pbi);
|
||||
static int get_free_fb(VP8_COMMON *cm);
|
||||
static void ref_cnt_fb(int *buf, int *idx, int new_idx);
|
||||
|
||||
@@ -352,7 +352,7 @@ int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size,
|
||||
goto decode_exit;
|
||||
}
|
||||
|
||||
vp8_clear_system_state();
|
||||
vpx_clear_system_state();
|
||||
|
||||
if (cm->show_frame) {
|
||||
cm->current_video_frame++;
|
||||
@@ -383,7 +383,7 @@ int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size,
|
||||
|
||||
decode_exit:
|
||||
pbi->common.error.setjmp = 0;
|
||||
vp8_clear_system_state();
|
||||
vpx_clear_system_state();
|
||||
return retcode;
|
||||
}
|
||||
int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd,
|
||||
@@ -416,7 +416,7 @@ int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd,
|
||||
}
|
||||
|
||||
#endif /*!CONFIG_POSTPROC*/
|
||||
vp8_clear_system_state();
|
||||
vpx_clear_system_state();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -438,47 +438,39 @@ int vp8dx_references_buffer(VP8_COMMON *oci, int ref_frame) {
|
||||
}
|
||||
|
||||
int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf) {
|
||||
if (!fb->use_frame_threads) {
|
||||
/* decoder instance for single thread mode */
|
||||
fb->pbi[0] = create_decompressor(oxcf);
|
||||
if (!fb->pbi[0]) return VPX_CODEC_ERROR;
|
||||
/* decoder instance for single thread mode */
|
||||
fb->pbi[0] = create_decompressor(oxcf);
|
||||
if (!fb->pbi[0]) return VPX_CODEC_ERROR;
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
if (setjmp(fb->pbi[0]->common.error.jmp)) {
|
||||
vp8_remove_decoder_instances(fb);
|
||||
memset(fb->pbi, 0, sizeof(fb->pbi) / sizeof(fb->pbi[0]));
|
||||
vp8_clear_system_state();
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
|
||||
fb->pbi[0]->common.error.setjmp = 1;
|
||||
fb->pbi[0]->max_threads = oxcf->max_threads;
|
||||
vp8_decoder_create_threads(fb->pbi[0]);
|
||||
fb->pbi[0]->common.error.setjmp = 0;
|
||||
#endif
|
||||
} else {
|
||||
/* TODO : create frame threads and decoder instances for each
|
||||
* thread here */
|
||||
if (setjmp(fb->pbi[0]->common.error.jmp)) {
|
||||
vp8_remove_decoder_instances(fb);
|
||||
memset(fb->pbi, 0, sizeof(fb->pbi));
|
||||
vpx_clear_system_state();
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
|
||||
fb->pbi[0]->common.error.setjmp = 1;
|
||||
fb->pbi[0]->max_threads = oxcf->max_threads;
|
||||
vp8_decoder_create_threads(fb->pbi[0]);
|
||||
fb->pbi[0]->common.error.setjmp = 0;
|
||||
#endif
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
int vp8_remove_decoder_instances(struct frame_buffers *fb) {
|
||||
if (!fb->use_frame_threads) {
|
||||
VP8D_COMP *pbi = fb->pbi[0];
|
||||
VP8D_COMP *pbi = fb->pbi[0];
|
||||
|
||||
if (!pbi) return VPX_CODEC_ERROR;
|
||||
if (!pbi) return VPX_CODEC_ERROR;
|
||||
#if CONFIG_MULTITHREAD
|
||||
vp8_decoder_remove_threads(pbi);
|
||||
vp8_decoder_remove_threads(pbi);
|
||||
#endif
|
||||
|
||||
/* decoder instance for single thread mode */
|
||||
remove_decompressor(pbi);
|
||||
} else {
|
||||
/* TODO : remove frame threads and decoder instances for each
|
||||
* thread here */
|
||||
}
|
||||
|
||||
/* decoder instance for single thread mode */
|
||||
remove_decompressor(pbi);
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
int vp8dx_get_quantizer(const VP8D_COMP *cpi) {
|
||||
return cpi->common.base_qindex;
|
||||
}
|
||||
@@ -47,9 +47,6 @@ struct frame_buffers {
|
||||
* this struct will be populated with frame buffer management
|
||||
* info in future commits. */
|
||||
|
||||
/* enable/disable frame-based threading */
|
||||
int use_frame_threads;
|
||||
|
||||
/* decoder instances */
|
||||
struct VP8D_COMP *pbi[MAX_FB_MT_DEC];
|
||||
};
|
||||
@@ -70,7 +67,8 @@ typedef struct VP8D_COMP {
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
/* variable for threading */
|
||||
volatile int b_multithreaded_rd;
|
||||
|
||||
vpx_atomic_int b_multithreaded_rd;
|
||||
int max_threads;
|
||||
int current_mb_col_main;
|
||||
unsigned int decoding_thread_count;
|
||||
@@ -78,7 +76,8 @@ typedef struct VP8D_COMP {
|
||||
|
||||
int mt_baseline_filter_level[MAX_MB_SEGMENTS];
|
||||
int sync_range;
|
||||
int *mt_current_mb_col; /* Each row remembers its already decoded column. */
|
||||
/* Each row remembers its already decoded column. */
|
||||
vpx_atomic_int *mt_current_mb_col;
|
||||
|
||||
unsigned char **mt_yabove_row; /* mb_rows x width */
|
||||
unsigned char **mt_uabove_row;
|
||||
@@ -119,6 +118,8 @@ typedef struct VP8D_COMP {
|
||||
void *decrypt_state;
|
||||
} VP8D_COMP;
|
||||
|
||||
void vp8cx_init_de_quantizer(VP8D_COMP *pbi);
|
||||
void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd);
|
||||
int vp8_decode_frame(VP8D_COMP *cpi);
|
||||
|
||||
int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "vp8/common/loopfilter.h"
|
||||
#include "vp8/common/extend.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
#include "decoderthreading.h"
|
||||
#include "detokenize.h"
|
||||
#include "vp8/common/reconintra4x4.h"
|
||||
#include "vp8/common/reconinter.h"
|
||||
@@ -36,8 +37,6 @@
|
||||
memset((p), 0, (n) * sizeof(*(p))); \
|
||||
} while (0)
|
||||
|
||||
void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd);
|
||||
|
||||
static void setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
MB_ROW_DEC *mbrd, int count) {
|
||||
VP8_COMMON *const pc = &pbi->common;
|
||||
@@ -50,9 +49,6 @@ static void setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
|
||||
mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
|
||||
|
||||
mbd->mode_info_context = pc->mi + pc->mode_info_stride * (i + 1);
|
||||
mbd->mode_info_stride = pc->mode_info_stride;
|
||||
|
||||
mbd->frame_type = pc->frame_type;
|
||||
mbd->pre = xd->pre;
|
||||
mbd->dst = xd->dst;
|
||||
@@ -83,7 +79,8 @@ static void setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
if (pc->full_pixel) mbd->fullpixel_mask = 0xfffffff8;
|
||||
}
|
||||
|
||||
for (i = 0; i < pc->mb_rows; ++i) pbi->mt_current_mb_col[i] = -1;
|
||||
for (i = 0; i < pc->mb_rows; ++i)
|
||||
vpx_atomic_store_release(&pbi->mt_current_mb_col[i], -1);
|
||||
}
|
||||
|
||||
static void mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
@@ -251,12 +248,13 @@ static void mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
|
||||
static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
int start_mb_row) {
|
||||
volatile const int *last_row_current_mb_col;
|
||||
volatile int *current_mb_col;
|
||||
const vpx_atomic_int *last_row_current_mb_col;
|
||||
vpx_atomic_int *current_mb_col;
|
||||
int mb_row;
|
||||
VP8_COMMON *pc = &pbi->common;
|
||||
const int nsync = pbi->sync_range;
|
||||
const int first_row_no_sync_above = pc->mb_cols + nsync;
|
||||
const vpx_atomic_int first_row_no_sync_above =
|
||||
VPX_ATOMIC_INIT(pc->mb_cols + nsync);
|
||||
int num_part = 1 << pbi->common.multi_token_partition;
|
||||
int last_mb_row = start_mb_row;
|
||||
|
||||
@@ -289,6 +287,9 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
|
||||
xd->up_available = (start_mb_row != 0);
|
||||
|
||||
xd->mode_info_context = pc->mi + pc->mode_info_stride * start_mb_row;
|
||||
xd->mode_info_stride = pc->mode_info_stride;
|
||||
|
||||
for (mb_row = start_mb_row; mb_row < pc->mb_rows;
|
||||
mb_row += (pbi->decoding_thread_count + 1)) {
|
||||
int recon_yoffset, recon_uvoffset;
|
||||
@@ -318,7 +319,7 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
|
||||
xd->left_available = 0;
|
||||
|
||||
xd->mb_to_top_edge = -((mb_row * 16)) << 3;
|
||||
xd->mb_to_top_edge = -((mb_row * 16) << 3);
|
||||
xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
|
||||
|
||||
if (pbi->common.filter_level) {
|
||||
@@ -355,14 +356,13 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
xd->dst.uv_stride);
|
||||
}
|
||||
|
||||
for (mb_col = 0; mb_col < pc->mb_cols; mb_col++) {
|
||||
*current_mb_col = mb_col - 1;
|
||||
for (mb_col = 0; mb_col < pc->mb_cols; ++mb_col) {
|
||||
if (((mb_col - 1) % nsync) == 0) {
|
||||
vpx_atomic_store_release(current_mb_col, mb_col - 1);
|
||||
}
|
||||
|
||||
if ((mb_col & (nsync - 1)) == 0) {
|
||||
while (mb_col > (*last_row_current_mb_col - nsync)) {
|
||||
x86_pause_hint();
|
||||
thread_sleep(1);
|
||||
}
|
||||
if (mb_row && !(mb_col & (nsync - 1))) {
|
||||
vp8_atomic_spin_wait(mb_col, last_row_current_mb_col, nsync);
|
||||
}
|
||||
|
||||
/* Distance of MB to the various image edges.
|
||||
@@ -548,7 +548,7 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
|
||||
}
|
||||
|
||||
/* last MB of row is ready just after extension is done */
|
||||
*current_mb_col = mb_col + nsync;
|
||||
vpx_atomic_store_release(current_mb_col, mb_col + nsync);
|
||||
|
||||
++xd->mode_info_context; /* skip prediction column */
|
||||
xd->up_available = 1;
|
||||
@@ -568,10 +568,10 @@ static THREAD_FUNCTION thread_decoding_proc(void *p_data) {
|
||||
ENTROPY_CONTEXT_PLANES mb_row_left_context;
|
||||
|
||||
while (1) {
|
||||
if (pbi->b_multithreaded_rd == 0) break;
|
||||
if (vpx_atomic_load_acquire(&pbi->b_multithreaded_rd) == 0) break;
|
||||
|
||||
if (sem_wait(&pbi->h_event_start_decoding[ithread]) == 0) {
|
||||
if (pbi->b_multithreaded_rd == 0) {
|
||||
if (vpx_atomic_load_acquire(&pbi->b_multithreaded_rd) == 0) {
|
||||
break;
|
||||
} else {
|
||||
MACROBLOCKD *xd = &mbrd->mbd;
|
||||
@@ -589,7 +589,7 @@ void vp8_decoder_create_threads(VP8D_COMP *pbi) {
|
||||
int core_count = 0;
|
||||
unsigned int ithread;
|
||||
|
||||
pbi->b_multithreaded_rd = 0;
|
||||
vpx_atomic_init(&pbi->b_multithreaded_rd, 0);
|
||||
pbi->allocated_decoding_thread_count = 0;
|
||||
|
||||
/* limit decoding threads to the max number of token partitions */
|
||||
@@ -601,7 +601,7 @@ void vp8_decoder_create_threads(VP8D_COMP *pbi) {
|
||||
}
|
||||
|
||||
if (core_count > 1) {
|
||||
pbi->b_multithreaded_rd = 1;
|
||||
vpx_atomic_init(&pbi->b_multithreaded_rd, 1);
|
||||
pbi->decoding_thread_count = core_count - 1;
|
||||
|
||||
CALLOC_ARRAY(pbi->h_decoding_thread, pbi->decoding_thread_count);
|
||||
@@ -712,7 +712,7 @@ void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows) {
|
||||
int i;
|
||||
int uv_width;
|
||||
|
||||
if (pbi->b_multithreaded_rd) {
|
||||
if (vpx_atomic_load_acquire(&pbi->b_multithreaded_rd)) {
|
||||
vp8mt_de_alloc_temp_buffers(pbi, prev_mb_rows);
|
||||
|
||||
/* our internal buffers are always multiples of 16 */
|
||||
@@ -730,27 +730,33 @@ void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows) {
|
||||
|
||||
uv_width = width >> 1;
|
||||
|
||||
/* Allocate an int for each mb row. */
|
||||
CALLOC_ARRAY(pbi->mt_current_mb_col, pc->mb_rows);
|
||||
/* Allocate a vpx_atomic_int for each mb row. */
|
||||
CHECK_MEM_ERROR(pbi->mt_current_mb_col,
|
||||
vpx_malloc(sizeof(*pbi->mt_current_mb_col) * pc->mb_rows));
|
||||
for (i = 0; i < pc->mb_rows; ++i)
|
||||
vpx_atomic_init(&pbi->mt_current_mb_col[i], 0);
|
||||
|
||||
/* Allocate memory for above_row buffers. */
|
||||
CALLOC_ARRAY(pbi->mt_yabove_row, pc->mb_rows);
|
||||
for (i = 0; i < pc->mb_rows; ++i)
|
||||
CHECK_MEM_ERROR(pbi->mt_yabove_row[i],
|
||||
vpx_memalign(16, sizeof(unsigned char) *
|
||||
(width + (VP8BORDERINPIXELS << 1))));
|
||||
CHECK_MEM_ERROR(
|
||||
pbi->mt_yabove_row[i],
|
||||
vpx_memalign(
|
||||
16, sizeof(unsigned char) * (width + (VP8BORDERINPIXELS << 1))));
|
||||
|
||||
CALLOC_ARRAY(pbi->mt_uabove_row, pc->mb_rows);
|
||||
for (i = 0; i < pc->mb_rows; ++i)
|
||||
CHECK_MEM_ERROR(pbi->mt_uabove_row[i],
|
||||
vpx_memalign(16, sizeof(unsigned char) *
|
||||
(uv_width + VP8BORDERINPIXELS)));
|
||||
CHECK_MEM_ERROR(
|
||||
pbi->mt_uabove_row[i],
|
||||
vpx_memalign(16,
|
||||
sizeof(unsigned char) * (uv_width + VP8BORDERINPIXELS)));
|
||||
|
||||
CALLOC_ARRAY(pbi->mt_vabove_row, pc->mb_rows);
|
||||
for (i = 0; i < pc->mb_rows; ++i)
|
||||
CHECK_MEM_ERROR(pbi->mt_vabove_row[i],
|
||||
vpx_memalign(16, sizeof(unsigned char) *
|
||||
(uv_width + VP8BORDERINPIXELS)));
|
||||
CHECK_MEM_ERROR(
|
||||
pbi->mt_vabove_row[i],
|
||||
vpx_memalign(16,
|
||||
sizeof(unsigned char) * (uv_width + VP8BORDERINPIXELS)));
|
||||
|
||||
/* Allocate memory for left_col buffers. */
|
||||
CALLOC_ARRAY(pbi->mt_yleft_col, pc->mb_rows);
|
||||
@@ -772,9 +778,9 @@ void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows) {
|
||||
|
||||
void vp8_decoder_remove_threads(VP8D_COMP *pbi) {
|
||||
/* shutdown MB Decoding thread; */
|
||||
if (pbi->b_multithreaded_rd) {
|
||||
if (vpx_atomic_load_acquire(&pbi->b_multithreaded_rd)) {
|
||||
int i;
|
||||
pbi->b_multithreaded_rd = 0;
|
||||
vpx_atomic_store_release(&pbi->b_multithreaded_rd, 0);
|
||||
|
||||
/* allow all threads to exit */
|
||||
for (i = 0; i < pbi->allocated_decoding_thread_count; ++i) {
|
||||
|
||||
Reference in new issue
Block a user