Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/FFmpeg/FFmpeg
Browse files Browse the repository at this point in the history
Conflicts:
	ffplay.c

Ignored 4590811 committed on Jan 21, 2016
This changes are already applied to FFmpeg-jwmod.
  • Loading branch information
cho-dev committed Jan 21, 2016
2 parents 38835dc + 8bbb972 commit 3bc482f
Show file tree
Hide file tree
Showing 44 changed files with 390 additions and 334 deletions.
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -5455,7 +5455,7 @@ enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
check_lib "${gsm_hdr}" gsm_create -lgsm && break;
done || die "ERROR: libgsm not found"; }
enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
enabled libkvazaar && require_pkg_config "kvazaar >= 0.7.1" kvazaar.h kvz_api_get
enabled libkvazaar && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
enabled libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
Expand Down Expand Up @@ -6084,6 +6084,7 @@ enabled sab_filter && prepend avfilter_deps "swscale"
enabled scale_filter && prepend avfilter_deps "swscale"
enabled scale2ref_filter && prepend avfilter_deps "swscale"
enabled sofalizer_filter && prepend avfilter_deps "avcodec"
enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale"
enabled showfreqs_filter && prepend avfilter_deps "avcodec"
enabled showspectrum_filter && prepend avfilter_deps "avcodec"
enabled smartblur_filter && prepend avfilter_deps "swscale"
Expand Down
5 changes: 4 additions & 1 deletion doc/ffplay.texi
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,12 @@ Seek to the previous/next chapter.
or if there are no chapters
Seek backward/forward 10 minutes.

@item mouse click
@item right mouse click
Seek to percentage in file corresponding to fraction of width.

@item left mouse double-click
Toggle full screen.

@end table

@c man end
Expand Down
24 changes: 24 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -9954,6 +9954,21 @@ dimension is divisible by n and adjust the value if necessary.
See below for the list of accepted constants for use in the dimension
expression.

@item eval
Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:

@table @samp
@item init
Only evaluate expressions once during the filter initialization or when a command is processed.

@item frame
Evaluate expressions for each incoming frame.

@end table

Default value is @samp{init}.


@item interl
Set the interlacing mode. It accepts the following values:

Expand All @@ -9977,6 +9992,15 @@ Set libswscale scaling flags. See
complete list of values. If not explicitly specified the filter applies
the default flags.


@item param0, param1
Set libswscale input parameters for scaling algorithms that need them. See
@ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
complete documentation. If not explicitly specified the filter applies
empty parameters.



@item size, s
Set the video size. For the syntax of this option, check the
@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
Expand Down
1 change: 1 addition & 0 deletions doc/scaler.texi
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Select source range.
@item dst_range
Select destination range.

@anchor{sws_params}
@item param0, param1
Set scaling algorithm parameters. The specified values are specific of
some scaling algorithms and ignored by others. The specified values
Expand Down
191 changes: 0 additions & 191 deletions libavcodec/aaccoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,175 +392,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
}


static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
SingleChannelElement *sce,
const float lambda)
{
int start = 0, i, w, w2, g;
float uplim[128], maxq[128];
int minq, maxsf;
float distfact = ((sce->ics.num_windows > 1) ? 85.80 : 147.84) / lambda;
int last = 0, lastband = 0, curband = 0;
float avg_energy = 0.0;
if (sce->ics.num_windows == 1) {
start = 0;
for (i = 0; i < 1024; i++) {
if (i - start >= sce->ics.swb_sizes[curband]) {
start += sce->ics.swb_sizes[curband];
curband++;
}
if (sce->coeffs[i]) {
avg_energy += sce->coeffs[i] * sce->coeffs[i];
last = i;
lastband = curband;
}
}
} else {
for (w = 0; w < 8; w++) {
const float *coeffs = &sce->coeffs[w*128];
curband = start = 0;
for (i = 0; i < 128; i++) {
if (i - start >= sce->ics.swb_sizes[curband]) {
start += sce->ics.swb_sizes[curband];
curband++;
}
if (coeffs[i]) {
avg_energy += coeffs[i] * coeffs[i];
last = FFMAX(last, i);
lastband = FFMAX(lastband, curband);
}
}
}
}
last++;
avg_energy /= last;
if (avg_energy == 0.0f) {
for (i = 0; i < FF_ARRAY_ELEMS(sce->sf_idx); i++)
sce->sf_idx[i] = SCALE_ONE_POS;
return;
}
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
float *coefs = &sce->coeffs[start];
const int size = sce->ics.swb_sizes[g];
int start2 = start, end2 = start + size, peakpos = start;
float maxval = -1, thr = 0.0f, t;
maxq[w*16+g] = 0.0f;
if (g > lastband) {
maxq[w*16+g] = 0.0f;
start += size;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++)
memset(coefs + w2*128, 0, sizeof(coefs[0])*size);
continue;
}
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
for (i = 0; i < size; i++) {
float t = coefs[w2*128+i]*coefs[w2*128+i];
maxq[w*16+g] = FFMAX(maxq[w*16+g], fabsf(coefs[w2*128 + i]));
thr += t;
if (sce->ics.num_windows == 1 && maxval < t) {
maxval = t;
peakpos = start+i;
}
}
}
if (sce->ics.num_windows == 1) {
start2 = FFMAX(peakpos - 2, start2);
end2 = FFMIN(peakpos + 3, end2);
} else {
start2 -= start;
end2 -= start;
}
start += size;
thr = pow(thr / (avg_energy * (end2 - start2)), 0.3 + 0.1*(lastband - g) / lastband);
t = 1.0 - (1.0 * start2 / last);
uplim[w*16+g] = distfact / (1.4 * thr + t*t*t + 0.075);
}
}
memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
const float *coefs = &sce->coeffs[start];
const float *scaled = &s->scoefs[start];
const int size = sce->ics.swb_sizes[g];
int scf, prev_scf, step;
int min_scf = -1, max_scf = 256;
float curdiff;
if (maxq[w*16+g] < 21.544) {
sce->zeroes[w*16+g] = 1;
start += size;
continue;
}
sce->zeroes[w*16+g] = 0;
scf = prev_scf = av_clip(SCALE_ONE_POS - SCALE_DIV_512 - log2f(1/maxq[w*16+g])*16/3, 60, 218);
for (;;) {
float dist = 0.0f;
int quant_max;

for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
int b;
dist += quantize_band_cost(s, coefs + w2*128,
scaled + w2*128,
sce->ics.swb_sizes[g],
scf,
ESC_BT,
lambda,
INFINITY,
&b, NULL,
0);
dist -= b;
}
dist *= 1.0f / 512.0f / lambda;
quant_max = quant(maxq[w*16+g], ff_aac_pow2sf_tab[POW_SF2_ZERO - scf + SCALE_ONE_POS - SCALE_DIV_512], ROUND_STANDARD);
if (quant_max >= 8191) { // too much, return to the previous quantizer
sce->sf_idx[w*16+g] = prev_scf;
break;
}
prev_scf = scf;
curdiff = fabsf(dist - uplim[w*16+g]);
if (curdiff <= 1.0f)
step = 0;
else
step = log2f(curdiff);
if (dist > uplim[w*16+g])
step = -step;
scf += step;
scf = av_clip_uint8(scf);
step = scf - prev_scf;
if (FFABS(step) <= 1 || (step > 0 && scf >= max_scf) || (step < 0 && scf <= min_scf)) {
sce->sf_idx[w*16+g] = av_clip(scf, min_scf, max_scf);
break;
}
if (step > 0)
min_scf = prev_scf;
else
max_scf = prev_scf;
}
start += size;
}
}
minq = sce->sf_idx[0] ? sce->sf_idx[0] : INT_MAX;
for (i = 1; i < 128; i++) {
if (!sce->sf_idx[i])
sce->sf_idx[i] = sce->sf_idx[i-1];
else
minq = FFMIN(minq, sce->sf_idx[i]);
}
if (minq == INT_MAX)
minq = 0;
minq = FFMIN(minq, SCALE_MAX_POS);
maxsf = FFMIN(minq + SCALE_MAX_DIFF, SCALE_MAX_POS);
for (i = 126; i >= 0; i--) {
if (!sce->sf_idx[i])
sce->sf_idx[i] = sce->sf_idx[i+1];
sce->sf_idx[i] = av_clip(sce->sf_idx[i], minq, maxsf);
}
}

static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
SingleChannelElement *sce,
const float lambda)
Expand Down Expand Up @@ -951,28 +782,6 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
}

AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
[AAC_CODER_FAAC] = {
search_for_quantizers_faac,
encode_window_bands_info,
quantize_and_encode_band,
ff_aac_encode_tns_info,
ff_aac_encode_ltp_info,
ff_aac_encode_main_pred,
ff_aac_adjust_common_pred,
ff_aac_adjust_common_ltp,
ff_aac_apply_main_pred,
ff_aac_apply_tns,
ff_aac_update_ltp,
ff_aac_ltp_insert_new_frame,
set_special_band_scalefactors,
search_for_pns,
mark_pns,
ff_aac_search_for_tns,
ff_aac_search_for_ltp,
search_for_ms,
ff_aac_search_for_is,
ff_aac_search_for_pred,
},
[AAC_CODER_ANMR] = {
search_for_quantizers_anmr,
encode_window_bands_info,
Expand Down
25 changes: 10 additions & 15 deletions libavcodec/aacenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
chans = tag == TYPE_CPE ? 2 : 1;
cpe = &s->cpe[i];
for (ch = 0; ch < chans; ch++) {
int k;
float clip_avoidance_factor;
sce = &cpe->ch[ch];
ics = &sce->ics;
Expand Down Expand Up @@ -607,17 +608,11 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf);
}

if (!(isfinite(cpe->ch[ch].coeffs[ 0]) &&
isfinite(cpe->ch[ch].coeffs[ 128]) &&
isfinite(cpe->ch[ch].coeffs[2*128]) &&
isfinite(cpe->ch[ch].coeffs[3*128]) &&
isfinite(cpe->ch[ch].coeffs[4*128]) &&
isfinite(cpe->ch[ch].coeffs[5*128]) &&
isfinite(cpe->ch[ch].coeffs[6*128]) &&
isfinite(cpe->ch[ch].coeffs[7*128]))
) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL);
for (k = 0; k < 1024; k++) {
if (!isfinite(cpe->ch[ch].coeffs[k])) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL);
}
}
avoid_clipping(s, sce);
}
Expand Down Expand Up @@ -983,12 +978,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if (s->options.coder != AAC_CODER_TWOLOOP) {
ERROR_IF(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
"Coders other than twoloop require -strict -2 and some may be removed in the future\n");
WARN_IF(s->options.coder == AAC_CODER_FAAC,
"The FAAC-like coder will be removed in the near future, please use twoloop!\n");
s->options.intensity_stereo = 0;
s->options.pns = 0;
}

ERROR_IF(s->options.ltp && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
"The LPT profile requires experimental compliance, add -strict -2 to enable!\n");

if ((ret = dsp_init(avctx, s)) < 0)
goto fail;

Expand Down Expand Up @@ -1026,8 +1022,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)

#define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
static const AVOption aacenc_options[] = {
{"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, -1, AAC_CODER_NB-1, AACENC_FLAGS, "coder"},
{"faac", "FAAC-inspired method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAAC}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"},
{"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"fast", "Constant quantizer", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
Expand Down
3 changes: 1 addition & 2 deletions libavcodec/aacenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include "lpc.h"

typedef enum AACCoder {
AAC_CODER_FAAC = 0,
AAC_CODER_ANMR,
AAC_CODER_ANMR = 0,
AAC_CODER_TWOLOOP,
AAC_CODER_FAST,

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/ass_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)
if (!style || !*style)
style = "Default";
for (i=0; i<ass->styles_count; i++)
if (!strcmp(ass->styles[i].name, style))
if (ass->styles[i].name && !strcmp(ass->styles[i].name, style))
return ass->styles + i;
return NULL;
}
9 changes: 7 additions & 2 deletions libavcodec/libkvazaar.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
cfg->width = avctx->width;
cfg->height = avctx->height;

cfg->framerate =
avctx->time_base.den / (double)(avctx->time_base.num * avctx->ticks_per_frame);
if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
av_log(avctx, AV_LOG_ERROR,
"Could not set framerate for kvazaar: integer overflow\n");
return AVERROR(EINVAL);
}
cfg->framerate_num = avctx->time_base.den;
cfg->framerate_denom = avctx->time_base.num * avctx->ticks_per_frame;
cfg->target_bitrate = avctx->bit_rate;
cfg->vui.sar_width = avctx->sample_aspect_ratio.num;
cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
Expand Down
3 changes: 0 additions & 3 deletions libavcodec/mpeg12enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;

if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
avctx->thread_count = 1;

if (ff_mpv_encode_init(avctx) < 0)
return -1;

Expand Down
Loading

0 comments on commit 3bc482f

Please sign in to comment.