mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 23:08:35 +00:00
[libvpx] Update to v1.12.0
This commit is contained in:
1 parent
287a71dc66
commit
b5046d2a76
572 files changed
+52900
-29493
No files matched your search
@@ -97,7 +97,7 @@ vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id, ...) {
|
||||
|
||||
res = VPX_CODEC_INCAPABLE;
|
||||
|
||||
for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++) {
|
||||
for (entry = ctx->iface->ctrl_maps; entry->fn; entry++) {
|
||||
if (!entry->ctrl_id || entry->ctrl_id == ctrl_id) {
|
||||
va_list ap;
|
||||
|
||||
|
||||
@@ -138,9 +138,10 @@ vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
|
||||
|
||||
if (!ctx || !cb)
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
else if (!ctx->iface || !ctx->priv ||
|
||||
!(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
|
||||
else if (!ctx->iface || !ctx->priv)
|
||||
res = VPX_CODEC_ERROR;
|
||||
else if (!(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
|
||||
res = VPX_CODEC_INCAPABLE;
|
||||
else {
|
||||
ctx->priv->dec.put_frame_cb.u.put_frame = cb;
|
||||
ctx->priv->dec.put_frame_cb.user_priv = user_priv;
|
||||
@@ -157,9 +158,10 @@ vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
|
||||
|
||||
if (!ctx || !cb)
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
else if (!ctx->iface || !ctx->priv ||
|
||||
!(ctx->iface->caps & VPX_CODEC_CAP_PUT_SLICE))
|
||||
else if (!ctx->iface || !ctx->priv)
|
||||
res = VPX_CODEC_ERROR;
|
||||
else if (!(ctx->iface->caps & VPX_CODEC_CAP_PUT_SLICE))
|
||||
res = VPX_CODEC_INCAPABLE;
|
||||
else {
|
||||
ctx->priv->dec.put_slice_cb.u.put_slice = cb;
|
||||
ctx->priv->dec.put_slice_cb.user_priv = user_priv;
|
||||
@@ -176,9 +178,10 @@ vpx_codec_err_t vpx_codec_set_frame_buffer_functions(
|
||||
|
||||
if (!ctx || !cb_get || !cb_release) {
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
} else if (!ctx->iface || !ctx->priv ||
|
||||
!(ctx->iface->caps & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
|
||||
} else if (!ctx->iface || !ctx->priv) {
|
||||
res = VPX_CODEC_ERROR;
|
||||
} else if (!(ctx->iface->caps & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
|
||||
res = VPX_CODEC_INCAPABLE;
|
||||
} else {
|
||||
res = ctx->iface->dec.set_fb_fn(get_alg_priv(ctx), cb_get, cb_release,
|
||||
cb_priv);
|
||||
|
||||
@@ -152,35 +152,28 @@ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
|
||||
vpx_codec_enc_cfg_t *cfg,
|
||||
unsigned int usage) {
|
||||
vpx_codec_err_t res;
|
||||
vpx_codec_enc_cfg_map_t *map;
|
||||
int i;
|
||||
|
||||
if (!iface || !cfg || usage != 0)
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
|
||||
res = VPX_CODEC_INCAPABLE;
|
||||
else {
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
|
||||
for (i = 0; i < iface->enc.cfg_map_count; ++i) {
|
||||
map = iface->enc.cfg_maps + i;
|
||||
*cfg = map->cfg;
|
||||
res = VPX_CODEC_OK;
|
||||
break;
|
||||
}
|
||||
assert(iface->enc.cfg_map_count == 1);
|
||||
*cfg = iface->enc.cfg_maps->cfg;
|
||||
res = VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#if VPX_ARCH_X86 || VPX_ARCH_X86_64
|
||||
/* On X86, disable the x87 unit's internal 80 bit precision for better
|
||||
* consistency with the SSE unit's 64 bit precision.
|
||||
*/
|
||||
#include "vpx_ports/x86.h"
|
||||
#define FLOATING_POINT_INIT() \
|
||||
do { \
|
||||
unsigned short x87_orig_mode = x87_set_double_precision();
|
||||
unsigned short x87_orig_mode = x87_set_double_precision()
|
||||
#define FLOATING_POINT_RESTORE() \
|
||||
x87_set_control_word(x87_orig_mode); \
|
||||
} \
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -22,7 +23,9 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
|
||||
unsigned char *img_data) {
|
||||
unsigned int h, w, s, xcs, ycs, bps;
|
||||
unsigned int stride_in_bytes;
|
||||
int align;
|
||||
unsigned int align;
|
||||
|
||||
if (img != NULL) memset(img, 0, sizeof(vpx_image_t));
|
||||
|
||||
/* Treat align==0 like align==1 */
|
||||
if (!buf_align) buf_align = 1;
|
||||
@@ -38,23 +41,9 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
|
||||
|
||||
/* Get sample size for this format */
|
||||
switch (fmt) {
|
||||
case VPX_IMG_FMT_RGB32:
|
||||
case VPX_IMG_FMT_RGB32_LE:
|
||||
case VPX_IMG_FMT_ARGB:
|
||||
case VPX_IMG_FMT_ARGB_LE: bps = 32; break;
|
||||
case VPX_IMG_FMT_RGB24:
|
||||
case VPX_IMG_FMT_BGR24: bps = 24; break;
|
||||
case VPX_IMG_FMT_RGB565:
|
||||
case VPX_IMG_FMT_RGB565_LE:
|
||||
case VPX_IMG_FMT_RGB555:
|
||||
case VPX_IMG_FMT_RGB555_LE:
|
||||
case VPX_IMG_FMT_UYVY:
|
||||
case VPX_IMG_FMT_YUY2:
|
||||
case VPX_IMG_FMT_YVYU: bps = 16; break;
|
||||
case VPX_IMG_FMT_I420:
|
||||
case VPX_IMG_FMT_YV12:
|
||||
case VPX_IMG_FMT_VPXI420:
|
||||
case VPX_IMG_FMT_VPXYV12: bps = 12; break;
|
||||
case VPX_IMG_FMT_NV12: bps = 12; break;
|
||||
case VPX_IMG_FMT_I422:
|
||||
case VPX_IMG_FMT_I440: bps = 16; break;
|
||||
case VPX_IMG_FMT_I444: bps = 24; break;
|
||||
@@ -66,11 +55,11 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
|
||||
}
|
||||
|
||||
/* Get chroma shift values for this format */
|
||||
// For VPX_IMG_FMT_NV12, xcs needs to be 0 such that UV data is all read at
|
||||
// one time.
|
||||
switch (fmt) {
|
||||
case VPX_IMG_FMT_I420:
|
||||
case VPX_IMG_FMT_YV12:
|
||||
case VPX_IMG_FMT_VPXI420:
|
||||
case VPX_IMG_FMT_VPXYV12:
|
||||
case VPX_IMG_FMT_I422:
|
||||
case VPX_IMG_FMT_I42016:
|
||||
case VPX_IMG_FMT_I42216: xcs = 1; break;
|
||||
@@ -79,10 +68,9 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
|
||||
|
||||
switch (fmt) {
|
||||
case VPX_IMG_FMT_I420:
|
||||
case VPX_IMG_FMT_NV12:
|
||||
case VPX_IMG_FMT_I440:
|
||||
case VPX_IMG_FMT_YV12:
|
||||
case VPX_IMG_FMT_VPXI420:
|
||||
case VPX_IMG_FMT_VPXYV12:
|
||||
case VPX_IMG_FMT_I42016:
|
||||
case VPX_IMG_FMT_I44016: ycs = 1; break;
|
||||
default: ycs = 0; break;
|
||||
@@ -103,8 +91,6 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
|
||||
if (!img) goto fail;
|
||||
|
||||
img->self_allocd = 1;
|
||||
} else {
|
||||
memset(img, 0, sizeof(vpx_image_t));
|
||||
}
|
||||
|
||||
img->img_data = img_data;
|
||||
@@ -167,9 +153,8 @@ vpx_image_t *vpx_img_wrap(vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w,
|
||||
|
||||
int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
|
||||
unsigned int w, unsigned int h) {
|
||||
unsigned char *data;
|
||||
|
||||
if (x + w <= img->w && y + h <= img->h) {
|
||||
if (x <= UINT_MAX - w && x + w <= img->w && y <= UINT_MAX - h &&
|
||||
y + h <= img->h) {
|
||||
img->d_w = w;
|
||||
img->d_h = h;
|
||||
|
||||
@@ -180,7 +165,7 @@ int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
|
||||
} else {
|
||||
const int bytes_per_sample =
|
||||
(img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
|
||||
data = img->img_data;
|
||||
unsigned char *data = img->img_data;
|
||||
|
||||
if (img->fmt & VPX_IMG_FMT_HAS_ALPHA) {
|
||||
img->planes[VPX_PLANE_ALPHA] =
|
||||
@@ -192,7 +177,12 @@ int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
|
||||
data + x * bytes_per_sample + y * img->stride[VPX_PLANE_Y];
|
||||
data += img->h * img->stride[VPX_PLANE_Y];
|
||||
|
||||
if (!(img->fmt & VPX_IMG_FMT_UV_FLIP)) {
|
||||
if (img->fmt == VPX_IMG_FMT_NV12) {
|
||||
img->planes[VPX_PLANE_U] =
|
||||
data + (x >> img->x_chroma_shift) +
|
||||
(y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
|
||||
img->planes[VPX_PLANE_V] = img->planes[VPX_PLANE_U] + 1;
|
||||
} else if (!(img->fmt & VPX_IMG_FMT_UV_FLIP)) {
|
||||
img->planes[VPX_PLANE_U] =
|
||||
data + (x >> img->x_chroma_shift) * bytes_per_sample +
|
||||
(y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
|
||||
|
||||
Reference in new issue
Block a user