mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 15:47:30 +09:00
Issue #2332 - libvpx upgrade followup part 1
Port commit a8f45aba816b7b5e1bd2bbdb663bdf5f044e2f5d to new libvpx version
This commit is contained in:
parent
b860c5fe95
commit
ed581885f8
1 changed files with 32 additions and 21 deletions
|
|
@ -12,8 +12,11 @@
|
||||||
* \brief Provides the high level interface to wrap encoder algorithms.
|
* \brief Provides the high level interface to wrap encoder algorithms.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#include <assert.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "vp8/common/blockd.h"
|
||||||
#include "vpx_config.h"
|
#include "vpx_config.h"
|
||||||
#include "vpx/internal/vpx_codec_internal.h"
|
#include "vpx/internal/vpx_codec_internal.h"
|
||||||
|
|
||||||
|
|
@ -81,6 +84,8 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(
|
||||||
int i;
|
int i;
|
||||||
void *mem_loc = NULL;
|
void *mem_loc = NULL;
|
||||||
|
|
||||||
|
if (iface->enc.mr_get_mem_loc == NULL) return VPX_CODEC_INCAPABLE;
|
||||||
|
|
||||||
if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
|
if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
|
||||||
for (i = 0; i < num_enc; i++) {
|
for (i = 0; i < num_enc; i++) {
|
||||||
vpx_codec_priv_enc_mr_cfg_t mr_cfg;
|
vpx_codec_priv_enc_mr_cfg_t mr_cfg;
|
||||||
|
|
@ -90,27 +95,29 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(
|
||||||
dsf->den > dsf->num) {
|
dsf->den > dsf->num) {
|
||||||
res = VPX_CODEC_INVALID_PARAM;
|
res = VPX_CODEC_INVALID_PARAM;
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
mr_cfg.mr_low_res_mode_info = mem_loc;
|
||||||
|
mr_cfg.mr_total_resolutions = num_enc;
|
||||||
|
mr_cfg.mr_encoder_id = num_enc - 1 - i;
|
||||||
|
mr_cfg.mr_down_sampling_factor.num = dsf->num;
|
||||||
|
mr_cfg.mr_down_sampling_factor.den = dsf->den;
|
||||||
|
|
||||||
|
/* Force Key-frame synchronization. Namely, encoder at higher
|
||||||
|
* resolution always use the same frame_type chosen by the
|
||||||
|
* lowest-resolution encoder.
|
||||||
|
*/
|
||||||
|
if (mr_cfg.mr_encoder_id)
|
||||||
|
cfg->kf_mode = VPX_KF_DISABLED;
|
||||||
|
|
||||||
|
ctx->iface = iface;
|
||||||
|
ctx->name = iface->name;
|
||||||
|
ctx->priv = NULL;
|
||||||
|
ctx->init_flags = flags;
|
||||||
|
ctx->config.enc = cfg;
|
||||||
|
res = ctx->iface->init(ctx, &mr_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
mr_cfg.mr_low_res_mode_info = mem_loc;
|
|
||||||
mr_cfg.mr_total_resolutions = num_enc;
|
|
||||||
mr_cfg.mr_encoder_id = num_enc - 1 - i;
|
|
||||||
mr_cfg.mr_down_sampling_factor.num = dsf->num;
|
|
||||||
mr_cfg.mr_down_sampling_factor.den = dsf->den;
|
|
||||||
|
|
||||||
/* Force Key-frame synchronization. Namely, encoder at higher
|
|
||||||
* resolution always use the same frame_type chosen by the
|
|
||||||
* lowest-resolution encoder.
|
|
||||||
*/
|
|
||||||
if (mr_cfg.mr_encoder_id) cfg->kf_mode = VPX_KF_DISABLED;
|
|
||||||
|
|
||||||
ctx->iface = iface;
|
|
||||||
ctx->name = iface->name;
|
|
||||||
ctx->priv = NULL;
|
|
||||||
ctx->init_flags = flags;
|
|
||||||
ctx->config.enc = cfg;
|
|
||||||
res = ctx->iface->init(ctx, &mr_cfg);
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL;
|
const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL;
|
||||||
/* Destroy current ctx */
|
/* Destroy current ctx */
|
||||||
|
|
@ -124,10 +131,14 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(
|
||||||
vpx_codec_destroy(ctx);
|
vpx_codec_destroy(ctx);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
#if CONFIG_MULTI_RES_ENCODING
|
||||||
|
assert(mem_loc);
|
||||||
|
free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info);
|
||||||
|
free(mem_loc);
|
||||||
|
#endif
|
||||||
|
return SAVE_STATUS(ctx, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res) break;
|
|
||||||
|
|
||||||
ctx++;
|
ctx++;
|
||||||
cfg++;
|
cfg++;
|
||||||
dsf++;
|
dsf++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue