mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 09:57:32 +09:00
ffvpx: update ffmpeg to 3.4.9
This commit is contained in:
parent
c45d02ceb2
commit
9ab5fe7274
20 changed files with 137 additions and 75 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
This directory contains files used in goanna builds from FFmpeg
|
This directory contains files used in goanna builds from FFmpeg
|
||||||
(http://ffmpeg.org). The current files are from FFmpeg as of
|
(http://ffmpeg.org). The current files are from FFmpeg as of
|
||||||
Release 3.4.8
|
Release 3.4.9
|
||||||
All source files match their path from the library's source archive.
|
All source files match their path from the library's source archive.
|
||||||
|
|
||||||
Currently, we only use the vp8 and vp9 portion of the library, and only on x86
|
Currently, we only use the vp8 and vp9 portion of the library, and only on x86
|
||||||
|
|
|
||||||
|
|
@ -2777,7 +2777,7 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
|
||||||
|
|
||||||
static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
|
static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
|
||||||
{
|
{
|
||||||
INTFLOAT *in = sce->coeffs;
|
UINTFLOAT *in = sce->coeffs;
|
||||||
INTFLOAT *out = sce->ret;
|
INTFLOAT *out = sce->ret;
|
||||||
INTFLOAT *saved = sce->saved;
|
INTFLOAT *saved = sce->saved;
|
||||||
INTFLOAT *buf = ac->buf_mdct;
|
INTFLOAT *buf = ac->buf_mdct;
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
|
||||||
} else {
|
} else {
|
||||||
int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
|
int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
|
||||||
for (; i < samples; i++) {
|
for (; i < samples; i++) {
|
||||||
int v = get_sr_golomb_flac(&s->gb, tmp, real_limit, 0);
|
int v = get_sr_golomb_flac(&s->gb, tmp, real_limit, 1);
|
||||||
if (v == 0x80000000){
|
if (v == 0x80000000){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
|
av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize frame thread encoder.
|
||||||
|
* @note hardware encoders are not supported
|
||||||
|
*/
|
||||||
int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options);
|
int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options);
|
||||||
void ff_frame_thread_encoder_free(AVCodecContext *avctx);
|
void ff_frame_thread_encoder_free(AVCodecContext *avctx);
|
||||||
int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr);
|
int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr);
|
||||||
|
|
|
||||||
|
|
@ -296,9 +296,8 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
|
||||||
if (dst == src)
|
if (dst == src)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// We can't fail if SPS isn't set at it breaks current skip_frame code
|
if (inited && !h1->ps.sps)
|
||||||
//if (!h1->ps.sps)
|
return AVERROR_INVALIDDATA;
|
||||||
// return AVERROR_INVALIDDATA;
|
|
||||||
|
|
||||||
if (inited &&
|
if (inited &&
|
||||||
(h->width != h1->width ||
|
(h->width != h1->width ||
|
||||||
|
|
@ -915,6 +914,11 @@ static int h264_slice_header_init(H264Context *h)
|
||||||
const SPS *sps = h->ps.sps;
|
const SPS *sps = h->ps.sps;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
if (!sps) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ff_set_sar(h->avctx, sps->sar);
|
ff_set_sar(h->avctx, sps->sar);
|
||||||
av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt,
|
av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt,
|
||||||
&h->chroma_x_shift, &h->chroma_y_shift);
|
&h->chroma_x_shift, &h->chroma_y_shift);
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,13 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){
|
||||||
const int stride= 16*2;
|
const int stride= 16*2;
|
||||||
const int xStride= 16;
|
const int xStride= 16;
|
||||||
int i;
|
int i;
|
||||||
int temp[8];
|
unsigned temp[8];
|
||||||
static const uint8_t x_offset[2]={0, 16};
|
static const uint8_t x_offset[2]={0, 16};
|
||||||
dctcoef *block = (dctcoef*)_block;
|
dctcoef *block = (dctcoef*)_block;
|
||||||
|
|
||||||
for(i=0; i<4; i++){
|
for(i=0; i<4; i++){
|
||||||
temp[2*i+0] = block[stride*i + xStride*0] + block[stride*i + xStride*1];
|
temp[2*i+0] = block[stride*i + xStride*0] + (unsigned)block[stride*i + xStride*1];
|
||||||
temp[2*i+1] = block[stride*i + xStride*0] - block[stride*i + xStride*1];
|
temp[2*i+1] = block[stride*i + xStride*0] - (unsigned)block[stride*i + xStride*1];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<2; i++){
|
for(i=0; i<2; i++){
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@ static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int
|
||||||
} else {
|
} else {
|
||||||
int prefix_minus3 = prefix - 3;
|
int prefix_minus3 = prefix - 3;
|
||||||
|
|
||||||
if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param >= 31) {
|
if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param > 16 + 6) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,11 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
|
||||||
next_coef = 8;
|
next_coef = 8;
|
||||||
coef_num = FFMIN(64, 1 << (4 + (size_id << 1)));
|
coef_num = FFMIN(64, 1 << (4 + (size_id << 1)));
|
||||||
if (size_id > 1) {
|
if (size_id > 1) {
|
||||||
scaling_list_dc_coef[size_id - 2][matrix_id] = get_se_golomb(gb) + 8;
|
int scaling_list_coeff_minus8 = get_se_golomb(gb);
|
||||||
|
if (scaling_list_coeff_minus8 < -7 ||
|
||||||
|
scaling_list_coeff_minus8 > 247)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
scaling_list_dc_coef[size_id - 2][matrix_id] = scaling_list_coeff_minus8 + 8;
|
||||||
next_coef = scaling_list_dc_coef[size_id - 2][matrix_id];
|
next_coef = scaling_list_dc_coef[size_id - 2][matrix_id];
|
||||||
sl->sl_dc[size_id - 2][matrix_id] = next_coef;
|
sl->sl_dc[size_id - 2][matrix_id] = next_coef;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,8 @@ static int decode_nal_sei_message(GetBitContext *gb, HEVCSEIContext *s,
|
||||||
byte = get_bits(gb, 8);
|
byte = get_bits(gb, 8);
|
||||||
payload_size += byte;
|
payload_size += byte;
|
||||||
}
|
}
|
||||||
|
if (get_bits_left(gb) < 8LL*payload_size)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
if (nal_unit_type == HEVC_NAL_SEI_PREFIX) {
|
if (nal_unit_type == HEVC_NAL_SEI_PREFIX) {
|
||||||
return decode_nal_sei_prefix(gb, s, ps, payload_type, payload_size, logctx);
|
return decode_nal_sei_prefix(gb, s, ps, payload_type, payload_size, logctx);
|
||||||
} else { /* nal_unit_type == NAL_SEI_SUFFIX */
|
} else { /* nal_unit_type == NAL_SEI_SUFFIX */
|
||||||
|
|
|
||||||
|
|
@ -749,6 +749,11 @@ static int hls_slice_header(HEVCContext *s)
|
||||||
if (s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
|
if (s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
|
||||||
sh->slice_cb_qp_offset = get_se_golomb(gb);
|
sh->slice_cb_qp_offset = get_se_golomb(gb);
|
||||||
sh->slice_cr_qp_offset = get_se_golomb(gb);
|
sh->slice_cr_qp_offset = get_se_golomb(gb);
|
||||||
|
if (sh->slice_cb_qp_offset < -12 || sh->slice_cb_qp_offset > 12 ||
|
||||||
|
sh->slice_cr_qp_offset < -12 || sh->slice_cr_qp_offset > 12) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Invalid slice cx qp offset.\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sh->slice_cb_qp_offset = 0;
|
sh->slice_cb_qp_offset = 0;
|
||||||
sh->slice_cr_qp_offset = 0;
|
sh->slice_cr_qp_offset = 0;
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ do { \
|
||||||
int y = y0 >> vshift;
|
int y = y0 >> vshift;
|
||||||
int x_tb = (x0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
int x_tb = (x0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
||||||
int y_tb = (y0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
int y_tb = (y0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
||||||
|
int spin = c_idx && !size_in_tbs_v && ((2 * y0) & (1 << s->ps.sps->log2_min_tb_size));
|
||||||
|
|
||||||
int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
|
int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
|
||||||
|
|
||||||
|
|
@ -103,11 +104,11 @@ do { \
|
||||||
pixel *top = top_array + 1;
|
pixel *top = top_array + 1;
|
||||||
pixel *filtered_left = filtered_left_array + 1;
|
pixel *filtered_left = filtered_left_array + 1;
|
||||||
pixel *filtered_top = filtered_top_array + 1;
|
pixel *filtered_top = filtered_top_array + 1;
|
||||||
int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS( x_tb - 1, (y_tb + size_in_tbs_v) & s->ps.sps->tb_mask);
|
int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS( x_tb - 1, (y_tb + size_in_tbs_v + spin) & s->ps.sps->tb_mask);
|
||||||
int cand_left = lc->na.cand_left;
|
int cand_left = lc->na.cand_left;
|
||||||
int cand_up_left = lc->na.cand_up_left;
|
int cand_up_left = lc->na.cand_up_left;
|
||||||
int cand_up = lc->na.cand_up;
|
int cand_up = lc->na.cand_up;
|
||||||
int cand_up_right = lc->na.cand_up_right && cur_tb_addr > MIN_TB_ADDR_ZS((x_tb + size_in_tbs_h) & s->ps.sps->tb_mask, y_tb - 1);
|
int cand_up_right = lc->na.cand_up_right && !spin && cur_tb_addr > MIN_TB_ADDR_ZS((x_tb + size_in_tbs_h) & s->ps.sps->tb_mask, y_tb - 1);
|
||||||
|
|
||||||
int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma_v, s->ps.sps->height) -
|
int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma_v, s->ps.sps->height) -
|
||||||
(y0 + size_in_luma_v)) >> vshift;
|
(y0 + size_in_luma_v)) >> vshift;
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len,
|
||||||
compute_ref_coefs(autoc, order, ref, error);
|
compute_ref_coefs(autoc, order, ref, error);
|
||||||
for (i = 0; i < order; i++)
|
for (i = 0; i < order; i++)
|
||||||
avg_err = (avg_err + error[i])/2.0f;
|
avg_err = (avg_err + error[i])/2.0f;
|
||||||
return signal/avg_err;
|
return avg_err ? signal/avg_err : NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
|
||||||
gen0[i] = gen1[i] = autoc[i + 1];
|
gen0[i] = gen1[i] = autoc[i + 1];
|
||||||
|
|
||||||
err = autoc[0];
|
err = autoc[0];
|
||||||
ref[0] = -gen1[0] / err;
|
ref[0] = -gen1[0] / ((USE_FIXED || err) ? err : 1);
|
||||||
err += gen1[0] * ref[0];
|
err += gen1[0] * ref[0];
|
||||||
if (error)
|
if (error)
|
||||||
error[0] = err;
|
error[0] = err;
|
||||||
|
|
@ -152,7 +152,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
|
||||||
gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
|
gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
|
||||||
gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
|
gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
|
||||||
}
|
}
|
||||||
ref[i] = -gen1[0] / err;
|
ref[i] = -gen1[0] / ((USE_FIXED || err) ? err : 1);
|
||||||
err += gen1[0] * ref[i];
|
err += gen1[0] * ref[i];
|
||||||
if (error)
|
if (error)
|
||||||
error[i] = err;
|
error[i] = err;
|
||||||
|
|
@ -186,7 +186,8 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o
|
||||||
for(j=0; j<i; j++)
|
for(j=0; j<i; j++)
|
||||||
r -= lpc_last[j] * autoc[i-j-1];
|
r -= lpc_last[j] * autoc[i-j-1];
|
||||||
|
|
||||||
r /= err;
|
if (err)
|
||||||
|
r /= err;
|
||||||
err *= FIXR(1.0) - (r * r);
|
err *= FIXR(1.0) - (r * r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,8 @@ static inline void idct4col_add(uint8_t *dest, ptrdiff_t line_size, const int16_
|
||||||
#define R_SHIFT 11
|
#define R_SHIFT 11
|
||||||
static inline void idct4row(int16_t *row)
|
static inline void idct4row(int16_t *row)
|
||||||
{
|
{
|
||||||
int c0, c1, c2, c3, a0, a1, a2, a3;
|
unsigned c0, c1, c2, c3;
|
||||||
|
int a0, a1, a2, a3;
|
||||||
|
|
||||||
a0 = row[0];
|
a0 = row[0];
|
||||||
a1 = row[1];
|
a1 = row[1];
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,16 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||||
w_align = 8;
|
w_align = 8;
|
||||||
h_align = 8;
|
h_align = 8;
|
||||||
}
|
}
|
||||||
|
if (s->codec_id == AV_CODEC_ID_MJPEG ||
|
||||||
|
s->codec_id == AV_CODEC_ID_MJPEGB ||
|
||||||
|
s->codec_id == AV_CODEC_ID_LJPEG ||
|
||||||
|
s->codec_id == AV_CODEC_ID_SMVJPEG ||
|
||||||
|
s->codec_id == AV_CODEC_ID_AMV ||
|
||||||
|
s->codec_id == AV_CODEC_ID_SP5X ||
|
||||||
|
s->codec_id == AV_CODEC_ID_JPEGLS) {
|
||||||
|
w_align = 8;
|
||||||
|
h_align = 2*8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AV_PIX_FMT_BGR24:
|
case AV_PIX_FMT_BGR24:
|
||||||
if ((s->codec_id == AV_CODEC_ID_MSZH) ||
|
if ((s->codec_id == AV_CODEC_ID_MSZH) ||
|
||||||
|
|
@ -612,7 +622,14 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
|
bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
|
||||||
bit_rate = bits_per_sample ? ctx->sample_rate * (int64_t)ctx->channels * bits_per_sample : ctx->bit_rate;
|
if (bits_per_sample) {
|
||||||
|
bit_rate = ctx->sample_rate * (int64_t)ctx->channels;
|
||||||
|
if (bit_rate > INT64_MAX / bits_per_sample) {
|
||||||
|
bit_rate = 0;
|
||||||
|
} else
|
||||||
|
bit_rate *= bits_per_sample;
|
||||||
|
} else
|
||||||
|
bit_rate = ctx->bit_rate;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bit_rate = 0;
|
bit_rate = 0;
|
||||||
|
|
@ -1749,8 +1766,11 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
|
|
||||||
if (ch > 0) {
|
if (ch > 0) {
|
||||||
/* calc from sample rate and channels */
|
/* calc from sample rate and channels */
|
||||||
if (id == AV_CODEC_ID_BINKAUDIO_DCT)
|
if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
|
||||||
|
if (sr / 22050 > 22)
|
||||||
|
return 0;
|
||||||
return (480 << (sr / 22050)) / ch;
|
return (480 << (sr / 22050)) / ch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == AV_CODEC_ID_MP3)
|
if (id == AV_CODEC_ID_MP3)
|
||||||
|
|
@ -1798,7 +1818,10 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
return frame_bytes / (9 * ch) * 16;
|
return frame_bytes / (9 * ch) * 16;
|
||||||
case AV_CODEC_ID_ADPCM_PSX:
|
case AV_CODEC_ID_ADPCM_PSX:
|
||||||
case AV_CODEC_ID_ADPCM_DTK:
|
case AV_CODEC_ID_ADPCM_DTK:
|
||||||
return frame_bytes / (16 * ch) * 28;
|
frame_bytes /= 16 * ch;
|
||||||
|
if (frame_bytes > INT_MAX / 28)
|
||||||
|
return 0;
|
||||||
|
return frame_bytes * 28;
|
||||||
case AV_CODEC_ID_ADPCM_4XM:
|
case AV_CODEC_ID_ADPCM_4XM:
|
||||||
case AV_CODEC_ID_ADPCM_IMA_DAT4:
|
case AV_CODEC_ID_ADPCM_IMA_DAT4:
|
||||||
case AV_CODEC_ID_ADPCM_IMA_ISS:
|
case AV_CODEC_ID_ADPCM_IMA_ISS:
|
||||||
|
|
@ -1810,7 +1833,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
case AV_CODEC_ID_ADPCM_THP:
|
case AV_CODEC_ID_ADPCM_THP:
|
||||||
case AV_CODEC_ID_ADPCM_THP_LE:
|
case AV_CODEC_ID_ADPCM_THP_LE:
|
||||||
if (extradata)
|
if (extradata)
|
||||||
return frame_bytes * 14 / (8 * ch);
|
return frame_bytes * 14LL / (8 * ch);
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_XA:
|
case AV_CODEC_ID_ADPCM_XA:
|
||||||
return (frame_bytes / 128) * 224 / ch;
|
return (frame_bytes / 128) * 224 / ch;
|
||||||
|
|
@ -1844,21 +1867,33 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
if (ba > 0) {
|
if (ba > 0) {
|
||||||
/* calc from frame_bytes, channels, and block_align */
|
/* calc from frame_bytes, channels, and block_align */
|
||||||
int blocks = frame_bytes / ba;
|
int blocks = frame_bytes / ba;
|
||||||
|
int64_t tmp = 0;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case AV_CODEC_ID_ADPCM_IMA_WAV:
|
case AV_CODEC_ID_ADPCM_IMA_WAV:
|
||||||
if (bps < 2 || bps > 5)
|
if (bps < 2 || bps > 5)
|
||||||
return 0;
|
return 0;
|
||||||
return blocks * (1 + (ba - 4 * ch) / (bps * ch) * 8);
|
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_IMA_DK3:
|
case AV_CODEC_ID_ADPCM_IMA_DK3:
|
||||||
return blocks * (((ba - 16) * 2 / 3 * 4) / ch);
|
tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_IMA_DK4:
|
case AV_CODEC_ID_ADPCM_IMA_DK4:
|
||||||
return blocks * (1 + (ba - 4 * ch) * 2 / ch);
|
tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_IMA_RAD:
|
case AV_CODEC_ID_ADPCM_IMA_RAD:
|
||||||
return blocks * ((ba - 4 * ch) * 2 / ch);
|
tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_MS:
|
case AV_CODEC_ID_ADPCM_MS:
|
||||||
return blocks * (2 + (ba - 7 * ch) * 2 / ch);
|
tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_MTAF:
|
case AV_CODEC_ID_ADPCM_MTAF:
|
||||||
return blocks * (ba - 16) * 2 / ch;
|
tmp = blocks * (ba - 16LL) * 2 / ch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (tmp) {
|
||||||
|
if (tmp != (int)tmp)
|
||||||
|
return 0;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1896,20 +1931,22 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
|
|
||||||
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
|
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
|
||||||
{
|
{
|
||||||
return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate,
|
int duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate,
|
||||||
avctx->channels, avctx->block_align,
|
avctx->channels, avctx->block_align,
|
||||||
avctx->codec_tag, avctx->bits_per_coded_sample,
|
avctx->codec_tag, avctx->bits_per_coded_sample,
|
||||||
avctx->bit_rate, avctx->extradata, avctx->frame_size,
|
avctx->bit_rate, avctx->extradata, avctx->frame_size,
|
||||||
frame_bytes);
|
frame_bytes);
|
||||||
|
return FFMAX(0, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
|
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
|
||||||
{
|
{
|
||||||
return get_audio_frame_duration(par->codec_id, par->sample_rate,
|
int duration = get_audio_frame_duration(par->codec_id, par->sample_rate,
|
||||||
par->channels, par->block_align,
|
par->channels, par->block_align,
|
||||||
par->codec_tag, par->bits_per_coded_sample,
|
par->codec_tag, par->bits_per_coded_sample,
|
||||||
par->bit_rate, par->extradata, par->frame_size,
|
par->bit_rate, par->extradata, par->frame_size,
|
||||||
frame_bytes);
|
frame_bytes);
|
||||||
|
return FFMAX(0, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !HAVE_THREADS
|
#if !HAVE_THREADS
|
||||||
|
|
|
||||||
|
|
@ -1138,7 +1138,7 @@ static void type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
|
||||||
for (j = 0; j < sz; j++) \
|
for (j = 0; j < sz; j++) \
|
||||||
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
|
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
|
||||||
(bits ? \
|
(bits ? \
|
||||||
(t + (1 << (bits - 1))) >> bits : \
|
(int)(t + (1U << (bits - 1))) >> bits : \
|
||||||
t)); \
|
t)); \
|
||||||
dst++; \
|
dst++; \
|
||||||
} \
|
} \
|
||||||
|
|
@ -1153,7 +1153,7 @@ static void type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
|
||||||
for (j = 0; j < sz; j++) \
|
for (j = 0; j < sz; j++) \
|
||||||
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
|
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
|
||||||
(bits ? \
|
(bits ? \
|
||||||
(out[j] + (1 << (bits - 1))) >> bits : \
|
(int)(out[j] + (1U << (bits - 1))) >> bits : \
|
||||||
out[j])); \
|
out[j])); \
|
||||||
dst++; \
|
dst++; \
|
||||||
} \
|
} \
|
||||||
|
|
@ -1260,25 +1260,25 @@ static av_always_inline void iadst8_1d(const dctcoef *in, ptrdiff_t stride,
|
||||||
t6 = (t2a - t6a + (1 << 13)) >> 14;
|
t6 = (t2a - t6a + (1 << 13)) >> 14;
|
||||||
t7 = (t3a - t7a + (1 << 13)) >> 14;
|
t7 = (t3a - t7a + (1 << 13)) >> 14;
|
||||||
|
|
||||||
t4a = 15137 * t4 + 6270 * t5;
|
t4a = 15137U * t4 + 6270U * t5;
|
||||||
t5a = 6270 * t4 - 15137 * t5;
|
t5a = 6270U * t4 - 15137U * t5;
|
||||||
t6a = 15137 * t7 - 6270 * t6;
|
t6a = 15137U * t7 - 6270U * t6;
|
||||||
t7a = 6270 * t7 + 15137 * t6;
|
t7a = 6270U * t7 + 15137U * t6;
|
||||||
|
|
||||||
out[0] = t0 + t2;
|
out[0] = t0 + t2;
|
||||||
out[7] = -(t1 + t3);
|
out[7] = -(t1 + t3);
|
||||||
t2 = t0 - t2;
|
t2 = t0 - t2;
|
||||||
t3 = t1 - t3;
|
t3 = t1 - t3;
|
||||||
|
|
||||||
out[1] = -((t4a + t6a + (1 << 13)) >> 14);
|
out[1] = -((dctint)((1U << 13) + t4a + t6a) >> 14);
|
||||||
out[6] = (t5a + t7a + (1 << 13)) >> 14;
|
out[6] = (dctint)((1U << 13) + t5a + t7a) >> 14;
|
||||||
t6 = (t4a - t6a + (1 << 13)) >> 14;
|
t6 = (dctint)((1U << 13) + t4a - t6a) >> 14;
|
||||||
t7 = (t5a - t7a + (1 << 13)) >> 14;
|
t7 = (dctint)((1U << 13) + t5a - t7a) >> 14;
|
||||||
|
|
||||||
out[3] = -(((t2 + t3) * 11585 + (1 << 13)) >> 14);
|
out[3] = -((dctint)((t2 + t3) * 11585U + (1 << 13)) >> 14);
|
||||||
out[4] = ((t2 - t3) * 11585 + (1 << 13)) >> 14;
|
out[4] = (dctint)((t2 - t3) * 11585U + (1 << 13)) >> 14;
|
||||||
out[2] = ((t6 + t7) * 11585 + (1 << 13)) >> 14;
|
out[2] = (dctint)((t6 + t7) * 11585U + (1 << 13)) >> 14;
|
||||||
out[5] = -(((t6 - t7) * 11585 + (1 << 13)) >> 14);
|
out[5] = -((dctint)((t6 - t7) * 11585U + (1 << 13)) >> 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
itxfm_wrap(8, 5)
|
itxfm_wrap(8, 5)
|
||||||
|
|
@ -1290,22 +1290,22 @@ static av_always_inline void idct16_1d(const dctcoef *in, ptrdiff_t stride,
|
||||||
dctint t0a, t1a, t2a, t3a, t4a, t5a, t6a, t7a;
|
dctint t0a, t1a, t2a, t3a, t4a, t5a, t6a, t7a;
|
||||||
dctint t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
|
dctint t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
|
||||||
|
|
||||||
t0a = ((IN(0) + IN(8)) * 11585 + (1 << 13)) >> 14;
|
t0a = (dctint)((IN(0) + IN(8)) * 11585U + (1 << 13)) >> 14;
|
||||||
t1a = ((IN(0) - IN(8)) * 11585 + (1 << 13)) >> 14;
|
t1a = (dctint)((IN(0) - IN(8)) * 11585U + (1 << 13)) >> 14;
|
||||||
t2a = (IN(4) * 6270 - IN(12) * 15137 + (1 << 13)) >> 14;
|
t2a = (dctint)(IN(4) * 6270U - IN(12) * 15137U + (1 << 13)) >> 14;
|
||||||
t3a = (IN(4) * 15137 + IN(12) * 6270 + (1 << 13)) >> 14;
|
t3a = (dctint)(IN(4) * 15137U + IN(12) * 6270U + (1 << 13)) >> 14;
|
||||||
t4a = (IN(2) * 3196 - IN(14) * 16069 + (1 << 13)) >> 14;
|
t4a = (dctint)(IN(2) * 3196U - IN(14) * 16069U + (1 << 13)) >> 14;
|
||||||
t7a = (IN(2) * 16069 + IN(14) * 3196 + (1 << 13)) >> 14;
|
t7a = (dctint)(IN(2) * 16069U + IN(14) * 3196U + (1 << 13)) >> 14;
|
||||||
t5a = (IN(10) * 13623 - IN(6) * 9102 + (1 << 13)) >> 14;
|
t5a = (dctint)(IN(10) * 13623U - IN(6) * 9102U + (1 << 13)) >> 14;
|
||||||
t6a = (IN(10) * 9102 + IN(6) * 13623 + (1 << 13)) >> 14;
|
t6a = (dctint)(IN(10) * 9102U + IN(6) * 13623U + (1 << 13)) >> 14;
|
||||||
t8a = (IN(1) * 1606 - IN(15) * 16305 + (1 << 13)) >> 14;
|
t8a = (dctint)(IN(1) * 1606U - IN(15) * 16305U + (1 << 13)) >> 14;
|
||||||
t15a = (IN(1) * 16305 + IN(15) * 1606 + (1 << 13)) >> 14;
|
t15a = (dctint)(IN(1) * 16305U + IN(15) * 1606U + (1 << 13)) >> 14;
|
||||||
t9a = (IN(9) * 12665 - IN(7) * 10394 + (1 << 13)) >> 14;
|
t9a = (dctint)(IN(9) * 12665U - IN(7) * 10394U + (1 << 13)) >> 14;
|
||||||
t14a = (IN(9) * 10394 + IN(7) * 12665 + (1 << 13)) >> 14;
|
t14a = (dctint)(IN(9) * 10394U + IN(7) * 12665U + (1 << 13)) >> 14;
|
||||||
t10a = (IN(5) * 7723 - IN(11) * 14449 + (1 << 13)) >> 14;
|
t10a = (dctint)(IN(5) * 7723U - IN(11) * 14449U + (1 << 13)) >> 14;
|
||||||
t13a = (IN(5) * 14449 + IN(11) * 7723 + (1 << 13)) >> 14;
|
t13a = (dctint)(IN(5) * 14449U + IN(11) * 7723U + (1 << 13)) >> 14;
|
||||||
t11a = (IN(13) * 15679 - IN(3) * 4756 + (1 << 13)) >> 14;
|
t11a = (dctint)(IN(13) * 15679U - IN(3) * 4756U + (1 << 13)) >> 14;
|
||||||
t12a = (IN(13) * 4756 + IN(3) * 15679 + (1 << 13)) >> 14;
|
t12a = (dctint)(IN(13) * 4756U + IN(3) * 15679U + (1 << 13)) >> 14;
|
||||||
|
|
||||||
t0 = t0a + t3a;
|
t0 = t0a + t3a;
|
||||||
t1 = t1a + t2a;
|
t1 = t1a + t2a;
|
||||||
|
|
@ -1324,12 +1324,12 @@ static av_always_inline void idct16_1d(const dctcoef *in, ptrdiff_t stride,
|
||||||
t14 = t15a - t14a;
|
t14 = t15a - t14a;
|
||||||
t15 = t15a + t14a;
|
t15 = t15a + t14a;
|
||||||
|
|
||||||
t5a = ((t6 - t5) * 11585 + (1 << 13)) >> 14;
|
t5a = (dctint)((t6 - t5) * 11585U + (1 << 13)) >> 14;
|
||||||
t6a = ((t6 + t5) * 11585 + (1 << 13)) >> 14;
|
t6a = (dctint)((t6 + t5) * 11585U + (1 << 13)) >> 14;
|
||||||
t9a = ( t14 * 6270 - t9 * 15137 + (1 << 13)) >> 14;
|
t9a = (dctint)( t14 * 6270U - t9 * 15137U + (1 << 13)) >> 14;
|
||||||
t14a = ( t14 * 15137 + t9 * 6270 + (1 << 13)) >> 14;
|
t14a = (dctint)( t14 * 15137U + t9 * 6270U + (1 << 13)) >> 14;
|
||||||
t10a = (-(t13 * 15137 + t10 * 6270) + (1 << 13)) >> 14;
|
t10a = (dctint)(-(t13 * 15137U + t10 * 6270U) + (1 << 13)) >> 14;
|
||||||
t13a = ( t13 * 6270 - t10 * 15137 + (1 << 13)) >> 14;
|
t13a = (dctint)( t13 * 6270U - t10 * 15137U + (1 << 13)) >> 14;
|
||||||
|
|
||||||
t0a = t0 + t7;
|
t0a = t0 + t7;
|
||||||
t1a = t1 + t6a;
|
t1a = t1 + t6a;
|
||||||
|
|
@ -1348,10 +1348,10 @@ static av_always_inline void idct16_1d(const dctcoef *in, ptrdiff_t stride,
|
||||||
t14 = t14a + t13a;
|
t14 = t14a + t13a;
|
||||||
t15a = t15 + t12;
|
t15a = t15 + t12;
|
||||||
|
|
||||||
t10a = ((t13 - t10) * 11585 + (1 << 13)) >> 14;
|
t10a = (dctint)((t13 - t10) * 11585U + (1 << 13)) >> 14;
|
||||||
t13a = ((t13 + t10) * 11585 + (1 << 13)) >> 14;
|
t13a = (dctint)((t13 + t10) * 11585U + (1 << 13)) >> 14;
|
||||||
t11 = ((t12a - t11a) * 11585 + (1 << 13)) >> 14;
|
t11 = (dctint)((t12a - t11a) * 11585U + (1 << 13)) >> 14;
|
||||||
t12 = ((t12a + t11a) * 11585 + (1 << 13)) >> 14;
|
t12 = (dctint)((t12a + t11a) * 11585U + (1 << 13)) >> 14;
|
||||||
|
|
||||||
out[ 0] = t0a + t15a;
|
out[ 0] = t0a + t15a;
|
||||||
out[ 1] = t1a + t14;
|
out[ 1] = t1a + t14;
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ static double eval_expr(Parser *p, AVExpr *e)
|
||||||
double d = eval_expr(p, e->param[0]);
|
double d = eval_expr(p, e->param[0]);
|
||||||
double d2 = eval_expr(p, e->param[1]);
|
double d2 = eval_expr(p, e->param[1]);
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case e_mod: return e->value * (d - floor((!CONFIG_FTRAPV || d2) ? d / d2 : d * INFINITY) * d2);
|
case e_mod: return e->value * (d - floor(d2 ? d / d2 : d * INFINITY) * d2);
|
||||||
case e_gcd: return e->value * av_gcd(d,d2);
|
case e_gcd: return e->value * av_gcd(d,d2);
|
||||||
case e_max: return e->value * (d > d2 ? d : d2);
|
case e_max: return e->value * (d > d2 ? d : d2);
|
||||||
case e_min: return e->value * (d < d2 ? d : d2);
|
case e_min: return e->value * (d < d2 ? d : d2);
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,10 @@ static int scalarproduct_fixed_c(const int *v1, const int *v2, int len)
|
||||||
return (int)(p >> 31);
|
return (int)(p >> 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void butterflies_fixed_c(int *v1, int *v2, int len)
|
static void butterflies_fixed_c(int *v1s, int *v2, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
unsigned int *v1 = v1s;
|
||||||
|
|
||||||
for (i = 0; i < len; i++){
|
for (i = 0; i < len; i++){
|
||||||
int t = v1[i] - v2[i];
|
int t = v1[i] - v2[i];
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,8 @@
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr))
|
||||||
|
|
||||||
#include "libm.h"
|
#include "libm.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps)
|
||||||
d = framenum / frames_per_10mins;
|
d = framenum / frames_per_10mins;
|
||||||
m = framenum % frames_per_10mins;
|
m = framenum % frames_per_10mins;
|
||||||
|
|
||||||
return framenum + 9 * drop_frames * d + drop_frames * ((m - drop_frames) / (frames_per_10mins / 10));
|
return framenum + 9U * drop_frames * d + drop_frames * ((m - drop_frames) / (frames_per_10mins / 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
|
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
|
||||||
|
|
@ -96,8 +96,8 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
|
||||||
}
|
}
|
||||||
ff = framenum % fps;
|
ff = framenum % fps;
|
||||||
ss = framenum / fps % 60;
|
ss = framenum / fps % 60;
|
||||||
mm = framenum / (fps*60) % 60;
|
mm = framenum / (fps*60LL) % 60;
|
||||||
hh = framenum / (fps*3600);
|
hh = framenum / (fps*3600LL);
|
||||||
if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
|
if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
|
||||||
hh = hh % 24;
|
hh = hh % 24;
|
||||||
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",
|
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue