[FFmpeg-devel] [PATCH] avformat/udp: deprecate local_port option

2016-10-08 Thread Steven Liu



0001-avformat-udp-deprecate-local_port-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/metadata: fix metadata deletion if comparison returns false

2016-10-08 Thread Paul B Mahol
On 10/6/16, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/f_metadata.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>

lgtm
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf/mxfenc: Do not print a useless error message

2016-10-08 Thread Carl Eugen Hoyos
Hi!

Attached patch removes a warning that is always shown if the 
default mxf muxer is used.

Please comment, Carl Eugen
From 07718cad8cefbafd18355f91b9548118308c42bd Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sat, 8 Oct 2016 11:23:41 +0200
Subject: [PATCH] lavf/mxfenc: Do not print a useless error message.

The option d10_channelcount only exists for mxf_d10.
---
 libavformat/mxfenc.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 7733ef8..afea117 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1169,8 +1169,6 @@ static void 
mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
 av_log(s, AV_LOG_WARNING, "d10_channelcount shall be set to 4 or 8 
: the output will not comply to MXF D-10 specs\n");
 avio_wb32(pb, mxf->channel_count);
 } else {
-if (show_warnings && mxf->channel_count != -1 && s->oformat != 
&ff_mxf_opatom_muxer)
-av_log(s, AV_LOG_ERROR, "-d10_channelcount requires MXF D-10 and 
will be ignored\n");
 avio_wb32(pb, st->codecpar->channels);
 }
 
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] libavformat/segment: reindent

2016-10-08 Thread Simon Thelen
Signed-off-by: Simon Thelen 
---
 libavformat/segment.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 82872fa..98e7bcc 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -69,8 +69,8 @@ typedef enum {
 LIST_TYPE_NB,
 } ListType;
 
-#define SEGMENT_LIST_FLAG_CACHE 1
-#define SEGMENT_LIST_FLAG_LIVE  2
+#define SEGMENT_LIST_FLAG_CACHE  1
+#define SEGMENT_LIST_FLAG_LIVE   2
 #define SEGMENT_LIST_FLAG_DELETE 4
 
 typedef struct SegmentContext {
@@ -460,8 +460,8 @@ static int segment_end(AVFormatContext *s, int 
write_trailer, int is_last)
 if ((ret = delete_old_segments(seg)) < 0)
 return ret;
 } else {
-av_freep(&entry->filename);
-av_freep(&entry);
+av_freep(&entry->filename);
+av_freep(&entry);
 }
 }
 
@@ -1060,9 +1060,9 @@ static const AVOption options[] = {
 { "segment_header_filename", "write a single file containing the header", 
OFFSET(header_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
 
 { "segment_list_flags","set flags affecting segment list generation", 
OFFSET(list_flags), AV_OPT_TYPE_FLAGS, {.i64 = SEGMENT_LIST_FLAG_CACHE }, 0, 
UINT_MAX, E, "list_flags"},
-{ "cache", "allow list caching",   
 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_CACHE }, INT_MIN, INT_MAX, 
  E, "list_flags"},
-{ "live",  "enable live-friendly list generation (useful for 
HLS)", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, 
INT_MAX,E, "list_flags"},
-{ "delete","delete segment files that are no longer part of 
the playlist", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_DELETE }, 
INT_MIN, INT_MAX,E, "list_flags"},
+{ "cache", "allow list caching",   
0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_CACHE }, INT_MIN, 
INT_MAX,  E, "list_flags"},
+{ "live",  "enable live-friendly list generation (useful for 
HLS)",0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, 
INT_MAX,   E, "list_flags"},
+{ "delete","delete segment files that are no longer part of 
the playlist", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_DELETE }, 
INT_MIN, INT_MAX, E, "list_flags"},
 
 { "segment_list_size", "set the maximum number of playlist entries", 
OFFSET(list_size), AV_OPT_TYPE_INT,  {.i64 = 0}, 0, INT_MAX, E },
 
-- 
2.10.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avformat/segment: add delete segment_list flag

2016-10-08 Thread Simon Thelen
Works in the same manner as the hls segment_delete flag.

Signed-off-by: Simon Thelen 
---
 doc/muxers.texi   |  5 +++
 libavformat/segment.c | 89 +++
 2 files changed, 94 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 9ec2e31..4002473 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1228,6 +1228,11 @@ Allow caching (only affects M3U8 list files).
 
 @item live
 Allow live-friendly file generation.
+
+@item delete
+Segment files removed from the playlist are deleted after a period of time
+equal to the duration of the segment plus the duration of the playlist.
+
 @end table
 
 @item segment_list_size @var{size}
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 33a5cf0..82872fa 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -26,8 +26,12 @@
 
 /* #define DEBUG */
 
+#include "config.h"
 #include 
 #include 
+#if HAVE_UNISTD_H
+#include 
+#endif
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -67,6 +71,7 @@ typedef enum {
 
 #define SEGMENT_LIST_FLAG_CACHE 1
 #define SEGMENT_LIST_FLAG_LIVE  2
+#define SEGMENT_LIST_FLAG_DELETE 4
 
 typedef struct SegmentContext {
 const AVClass *class;  /**< Class for private options. */
@@ -126,6 +131,7 @@ typedef struct SegmentContext {
 SegmentListEntry cur_entry;
 SegmentListEntry *segment_list_entries;
 SegmentListEntry *segment_list_entries_end;
+SegmentListEntry *segment_list_old;
 } SegmentContext;
 
 static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
@@ -144,6 +150,72 @@ static void print_csv_escaped_str(AVIOContext *ctx, const 
char *str)
 avio_w8(ctx, '"');
 }
 
+static int delete_old_segments(SegmentContext *seg)
+{
+SegmentListEntry *segment, *previous_segment = NULL;
+float playlist_duration = 0.0f;
+int ret = 0, path_size;
+char *dirname = NULL, *p;
+char *path = NULL;
+
+segment = seg->segment_list_entries;
+while (segment) {
+playlist_duration += segment->end_time - segment->start_time;
+segment = segment->next;
+}
+
+segment = seg->segment_list_old;
+while (segment) {
+playlist_duration -= segment->end_time - segment->start_time;
+previous_segment = segment;
+segment = previous_segment->next;
+if (playlist_duration <= -(previous_segment->end_time - 
previous_segment->start_time)) {
+previous_segment->next = NULL;
+break;
+}
+}
+
+if (segment) {
+dirname = av_strdup(seg->avf->filename);
+if (!dirname) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+p = (char *)av_basename(dirname);
+*p = '\0';
+}
+
+while (segment) {
+av_log(seg, AV_LOG_DEBUG, "deleting old segment %s\n",
+  segment->filename);
+path_size = strlen(dirname) + strlen(segment->filename) + 1;
+path = av_malloc(path_size);
+if (!path) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
+av_strlcpy(path, dirname, path_size);
+av_strlcat(path, segment->filename, path_size);
+if (unlink(path) < 0) {
+av_log(segment, AV_LOG_ERROR, "failed to delete old segment %s: 
%s\n",
+  path, strerror(errno));
+}
+av_freep(&path);
+previous_segment = segment;
+segment = previous_segment->next;
+av_freep(&previous_segment->filename);
+av_free(previous_segment);
+}
+
+fail:
+av_free(path);
+av_free(dirname);
+
+return ret;
+}
+
+
 static int segment_mux_init(AVFormatContext *s)
 {
 SegmentContext *seg = s->priv_data;
@@ -381,8 +453,16 @@ static int segment_end(AVFormatContext *s, int 
write_trailer, int is_last)
 if (seg->list_size && seg->segment_count >= seg->list_size) {
 entry = seg->segment_list_entries;
 seg->segment_list_entries = seg->segment_list_entries->next;
+if (entry && seg->list_flags & SEGMENT_LIST_FLAG_DELETE &&
+!seg->segment_idx_wrap) {
+entry->next = seg->segment_list_old;
+seg->segment_list_old = entry;
+if ((ret = delete_old_segments(seg)) < 0)
+return ret;
+} else {
 av_freep(&entry->filename);
 av_freep(&entry);
+}
 }
 
 if ((ret = segment_list_open(s)) < 0)
@@ -957,6 +1037,14 @@ fail:
 cur = next;
 }
 
+cur = seg->segment_list_old;
+while (cur) {
+next = cur->next;
+av_freep(&cur->filename);
+av_free(cur);
+cur = next;
+}
+
 avformat_free_context(oc);
 seg->avf = NULL;
 return ret;
@@ -974,6 +1062,7 @@ static const AVOption options[] = {
 { "segment_list_flags","set flags affecting segment

[FFmpeg-devel] [PATCH 0/2] aacenc: performance improvements

2016-10-08 Thread Rostislav Pehlivanov
Should improve encoding performance a bit with twoloop and alot with the
fast coder.

Rostislav Pehlivanov (2):
  aacenc: use the decoder's lcg PRNG
  aacenc: add SIMD optimizations for abs_pow34 and quantization

 libavcodec/aaccoder.c|  30 +--
 libavcodec/aaccoder_trellis.h|   2 +-
 libavcodec/aaccoder_twoloop.h|   2 +-
 libavcodec/aacenc.c  |   6 ++-
 libavcodec/aacenc.h  |   8 ++-
 libavcodec/aacenc_is.c   |   6 +--
 libavcodec/aacenc_ltp.c  |   4 +-
 libavcodec/aacenc_pred.c |   6 +--
 libavcodec/aacenc_quantization.h |   4 +-
 libavcodec/aacenc_utils.h|  15 +-
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/aacencdsp.asm | 111 +++
 libavcodec/x86/aacencdsp_init.c  |  57 
 13 files changed, 221 insertions(+), 32 deletions(-)
 create mode 100644 libavcodec/x86/aacencdsp.asm
 create mode 100644 libavcodec/x86/aacencdsp_init.c

-- 
2.9.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-08 Thread Rostislav Pehlivanov
Performance improvements:

quant_bands:
with: 681 decicycles in quant_bands, 8388453 runs,155 skips
without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
Around 42% for the function

Twoloop coder:

abs_pow34:
with/without: 7.82s/8.17s
Around 4% for the entire encoder

Both:
with/without: 7.15s/8.17s
Around 12% for the entire encoder

Fast coder:

abs_pow34:
with/without: 3.40s/3.77s
Around 10% for the entire encoder

Both:
with/without: 3.02s/3.77s
Around 20% faster for the entire encoder

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/aaccoder.c|  22 
 libavcodec/aaccoder_trellis.h|   2 +-
 libavcodec/aaccoder_twoloop.h|   2 +-
 libavcodec/aacenc.c  |   4 ++
 libavcodec/aacenc.h  |   6 +++
 libavcodec/aacenc_is.c   |   6 +--
 libavcodec/aacenc_ltp.c  |   4 +-
 libavcodec/aacenc_pred.c |   6 +--
 libavcodec/aacenc_quantization.h |   4 +-
 libavcodec/aacenc_utils.h|   2 +-
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/aacencdsp.asm | 111 +++
 libavcodec/x86/aacencdsp_init.c  |  57 
 13 files changed, 204 insertions(+), 24 deletions(-)
 create mode 100644 libavcodec/x86/aacencdsp.asm
 create mode 100644 libavcodec/x86/aacencdsp_init.c

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 35787e8..6760a70 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -88,7 +88,7 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 float next_minrd = INFINITY;
 int next_mincb = 0;
 
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(s->scoefs, sce->coeffs, 1024);
 start = win*128;
 for (cb = 0; cb < CB_TOT_ALL; cb++) {
 path[0][cb].cost = 0.0f;
@@ -299,7 +299,7 @@ static void search_for_quantizers_anmr(AVCodecContext 
*avctx, AACEncContext *s,
 }
 }
 idx = 1;
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(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++) {
@@ -446,7 +446,7 @@ static void search_for_quantizers_fast(AVCodecContext 
*avctx, AACEncContext *s,
 
 if (!allz)
 return;
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(s->scoefs, sce->coeffs, 1024);
 ff_quantize_band_cost_cache_init(s);
 
 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
@@ -652,8 +652,8 @@ static void search_for_pns(AACEncContext *s, AVCodecContext 
*avctx, SingleChanne
 s->fdsp->vector_fmul_scalar(PNS, PNS, scale, 
sce->ics.swb_sizes[g]);
 pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, 
sce->ics.swb_sizes[g]);
 pns_energy += pns_senergy;
-abs_pow34_v(NOR34, &sce->coeffs[start_c], 
sce->ics.swb_sizes[g]);
-abs_pow34_v(PNS34, PNS, sce->ics.swb_sizes[g]);
+s->abs_pow34(NOR34, &sce->coeffs[start_c], 
sce->ics.swb_sizes[g]);
+s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
 dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
 NOR34,
 sce->ics.swb_sizes[g],
@@ -789,8 +789,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement 
*cpe)
 S[i] =  M[i]
   - sce1->coeffs[start+(w+w2)*128+i];
 }
-abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
-abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
+s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
+s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
 for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
 Mmax = FFMAX(Mmax, M34[i]);
 Smax = FFMAX(Smax, S34[i]);
@@ -833,10 +833,10 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe)
   - sce1->coeffs[start+(w+w2)*128+i];
 }
 
-abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(M34, M, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(S34, S, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(M34, M, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(S34, S, 
sce0->ics.sw

[FFmpeg-devel] [PATCH 1/2] aacenc: use the decoder's lcg PRNG

2016-10-08 Thread Rostislav Pehlivanov
Using lfg was an overkill in this case where the random numbers
were only used for encoder descisions. Should increase result
uniformity between different FPUs and gives a slight speedup.

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/aaccoder.c |  8 +++-
 libavcodec/aacenc.c   |  2 +-
 libavcodec/aacenc.h   |  2 --
 libavcodec/aacenc_utils.h | 13 +
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 284b401..35787e8 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -643,11 +643,9 @@ static void search_for_pns(AACEncContext *s, 
AVCodecContext *avctx, SingleChanne
 float band_energy, scale, pns_senergy;
 const int start_c = (w+w2)*128+sce->ics.swb_offset[g];
 band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
-for (i = 0; i < sce->ics.swb_sizes[g]; i+=2) {
-double rnd[2];
-av_bmg_get(&s->lfg, rnd);
-PNS[i+0] = (float)rnd[0];
-PNS[i+1] = (float)rnd[1];
+for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
+s->random_state  = lcg_random(s->random_state);
+PNS[i] = s->random_state;
 }
 band_energy = s->fdsp->scalarproduct_float(PNS, PNS, 
sce->ics.swb_sizes[g]);
 scale = noise_amp/sqrtf(band_energy);
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 9e421a9..ee3cbf8 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -1031,7 +1031,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 goto fail;
 s->psypp = ff_psy_preprocess_init(avctx);
 ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, 
FF_LPC_TYPE_LEVINSON);
-av_lfg_init(&s->lfg, 0x72adca55);
+s->random_state = 0x1f2e3d4c;
 
 if (HAVE_MIPSDSP)
 ff_aac_coder_init_mips(s);
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 63e7893..1ace00d 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -23,7 +23,6 @@
 #define AVCODEC_AACENC_H
 
 #include "libavutil/float_dsp.h"
-#include "libavutil/lfg.h"
 #include "avcodec.h"
 #include "put_bits.h"
 
@@ -100,7 +99,6 @@ typedef struct AACEncContext {
 FFTContext mdct1024; ///< long (1024 samples) 
frame transform context
 FFTContext mdct128;  ///< short (128 samples) 
frame transform context
 AVFloatDSPContext *fdsp;
-AVLFG lfg;   ///< PRNG needed for PNS
 float *planar_samples[8];///< saved preprocessed input
 
 int profile; ///< copied from avctx
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index bb1dcb4..ff9188a 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -252,6 +252,19 @@ static inline int ff_sfdelta_can_replace(const 
SingleChannelElement *sce,
 && sce->sf_idx[nextband[band]] <= (new_sf + SCALE_MAX_DIFF);
 }
 
+/**
+ * linear congruential pseudorandom number generator
+ *
+ * @param   previous_valpointer to the current state of the generator
+ *
+ * @return  Returns a 32-bit pseudorandom integer
+ */
+static av_always_inline int lcg_random(unsigned previous_val)
+{
+union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
+return v.s;
+}
+
 #define ERROR_IF(cond, ...) \
 if (cond) { \
 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
-- 
2.9.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/utils: Update codec_id before using it in the parser init

2016-10-08 Thread Michael Niedermayer
Fixes assertion failure

Fixes: input.avi

Found-by: 连一汉 
Signed-off-by: Michael Niedermayer 
---
 libavformat/utils.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1aa3b50..8a51aea 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3383,6 +3383,17 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 if (!avctx->time_base.num)
 avctx->time_base = st->time_base;
 }
+
+/* check if the caller has overridden the codec id */
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+if (st->codec->codec_id != st->internal->orig_codec_id) {
+st->codecpar->codec_id   = st->codec->codec_id;
+st->codecpar->codec_type = st->codec->codec_type;
+st->internal->orig_codec_id = st->codec->codec_id;
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 // only for the split stuff
 if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE) && 
st->request_probe <= 0) {
 st->parser = av_parser_init(st->codecpar->codec_id);
@@ -3399,16 +3410,6 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 }
 }
 
-/* check if the caller has overridden the codec id */
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
-if (st->codec->codec_id != st->internal->orig_codec_id) {
-st->codecpar->codec_id   = st->codec->codec_id;
-st->codecpar->codec_type = st->codec->codec_type;
-st->internal->orig_codec_id = st->codec->codec_id;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 if (st->codecpar->codec_id != st->internal->orig_codec_id)
 st->internal->orig_codec_id = st->codecpar->codec_id;
 
-- 
2.10.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-08 Thread Henrik Gramner
On Sat, Oct 8, 2016 at 5:20 PM, Rostislav Pehlivanov
 wrote:
> +cglobal aac_quantize_bands, 8, 8, 7, out, in, scaled, size, Q34, is_signed, 
> maxval, rounding
[...]
> +movdm4, is_signedd

movd is SSE2. Can be worked around by moving it through the stack though.

[...]

> +/* Can't pass floats to external assembly directly */
>  \
> +ff_aac_quantize_bands_ ## SET(out, in, scaled, size, (const float 
> [RSIZE_BYTES]){Q34},\
> +  is_signed, (const float 
> [RSIZE_BYTES]){(float)maxval},  \
> +  (const float [RSIZE_BYTES]){rounding});
>  \

If you reorder the function arguments so that the floating-point ones
are at the end (should preferably be done as a separate patch though)
it'd be fairly easy to handle it directly in assembly instead with
something like this (untested):

;void ff_aac_quantize_bands_sse(int *out, const float *in, const float *scaled,
;   int size, int is_signed, int maxval,
;   float Q34, float rounding)
;***
INIT_XMM sse
cglobal aac_quantize_bands, 5, 5, 7, out, in, scaled, size, is_signed,
maxval, Q34, rounding
%if WIN64 || ARCH_X86_32
movssm0, Q34m
movssm1, roundingm
%endif
cvtsi2ss m2, dword maxvalm
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mov: Evaluate the movie display matrix

2016-10-08 Thread Michael Niedermayer
On Fri, Oct 07, 2016 at 10:38:22PM -0400, Vittorio Giovara wrote:
> On Fri, Oct 7, 2016 at 8:38 PM, Michael Niedermayer
>  wrote:
> > On Fri, Oct 07, 2016 at 03:31:46PM -0400, Vittorio Giovara wrote:
> >> This matrix needs to be applied after all others have (currently only
> >> display matrix from trak), but cannot be handled in movie box, since
> >> streams are not allocated yet.
> >>
> >> So store it in main context and if not identity, apply it when appropriate,
> >> handling the case when trak display matrix is identity and when it is not.
> >>
> >> Signed-off-by: Vittorio Giovara 
> >> ---
> >
> >> +} else { // otherwise multiply the two and store the result
> >> +int64_t val = 0;
> >> +for (i = 0; i < 3; i++) {
> >> +for (j = 0; j < 3; j++) {
> >> +int sh = j == 2 ? 30 : 16;
> >> +for (e = 0; e < 3; e++) {
> >> +val += CONV_FP2INT(display_matrix[i][e], sh) *
> >> +   CONV_FP2INT(c->movie_display_matrix[e][j], 
> >> sh);
> >
> > This does not work (you are dividing the 32bit numbers down to 2 bit)
> 
> I don't understand this comment, are you referring to the fact that
> the first two columns of the display matrix are 16.16, while the third
> column is 2:30?

you have 32bit integers and sh can be 30, in that case you throw away
30 of 32 bits before doing anything with the number


> 
> > also its not tested by the fate testcase
> > i can just replace it by 0 and fate-mov-movie-display-matrix still
> > passes
> 
> Yes, the sample I shared only has the movie display matrix, not
> trak+movie. I can create another sample if you insist, but a fate test
> would test little more than the matrix multiplication loops.

yes


> 
> > the macros also lack some () protection giving probably unintended
> > results
> 
> Can you tell me how many more () would they need?

#define CONV_FP2INT(x, sh) ((int64_t) (x)) / (1 << sh)

is missing at least 2 pairs

#define CONV_FP2INT(x, sh) (((int64_t) (x)) / (1 << (sh)))

also the rounding is not optimal it should likely be rounding to
nearest
the division can be replaced by a shift while correcting the rounding


> 
> From the subsequent email
> 
> > to explain a bit more how to do it with int64 instead of double floats
> > int32 can be multiplied together to form int64 with a new fixed point
> > without rounding or shifts
> > then added up and then at the end shifted down with rounding to get
> > back to the fixed point needed for the final destination
> 
> The problem is that the display matrix fields have different mantissa
> length, the first two columns are 16.16, the last one is 2:30. I think
> that method would work if all elements were the same length no?

iam not sure the original double code is correct, but it used the same
shift for each output, just changing between outputs.

if that was correct it should work fine, if it was not correct then
some extra shift is needed after the multiplication and before the
addition to get things to match


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-08 Thread Rostislav Pehlivanov
Performance improvements:

quant_bands:
with: 681 decicycles in quant_bands, 8388453 runs,155 skips
without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
Around 42% for the function

Twoloop coder:

abs_pow34:
with/without: 7.82s/8.17s
Around 4% for the entire encoder

Both:
with/without: 7.15s/8.17s
Around 12% for the entire encoder

Fast coder:

abs_pow34:
with/without: 3.40s/3.77s
Around 10% for the entire encoder

Both:
with/without: 3.02s/3.77s
Around 20% faster for the entire encoder

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/aaccoder.c|  22 
 libavcodec/aaccoder_trellis.h|   2 +-
 libavcodec/aaccoder_twoloop.h|   2 +-
 libavcodec/aacenc.c  |   4 ++
 libavcodec/aacenc.h  |   6 +++
 libavcodec/aacenc_is.c   |   6 +--
 libavcodec/aacenc_ltp.c  |   4 +-
 libavcodec/aacenc_pred.c |   6 +--
 libavcodec/aacenc_quantization.h |   4 +-
 libavcodec/aacenc_utils.h|   4 +-
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/aacencdsp.asm | 108 +++
 libavcodec/x86/aacencdsp_init.c  |  42 +++
 13 files changed, 187 insertions(+), 25 deletions(-)
 create mode 100644 libavcodec/x86/aacencdsp.asm
 create mode 100644 libavcodec/x86/aacencdsp_init.c

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 35787e8..6760a70 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -88,7 +88,7 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 float next_minrd = INFINITY;
 int next_mincb = 0;
 
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(s->scoefs, sce->coeffs, 1024);
 start = win*128;
 for (cb = 0; cb < CB_TOT_ALL; cb++) {
 path[0][cb].cost = 0.0f;
@@ -299,7 +299,7 @@ static void search_for_quantizers_anmr(AVCodecContext 
*avctx, AACEncContext *s,
 }
 }
 idx = 1;
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(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++) {
@@ -446,7 +446,7 @@ static void search_for_quantizers_fast(AVCodecContext 
*avctx, AACEncContext *s,
 
 if (!allz)
 return;
-abs_pow34_v(s->scoefs, sce->coeffs, 1024);
+s->abs_pow34(s->scoefs, sce->coeffs, 1024);
 ff_quantize_band_cost_cache_init(s);
 
 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
@@ -652,8 +652,8 @@ static void search_for_pns(AACEncContext *s, AVCodecContext 
*avctx, SingleChanne
 s->fdsp->vector_fmul_scalar(PNS, PNS, scale, 
sce->ics.swb_sizes[g]);
 pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, 
sce->ics.swb_sizes[g]);
 pns_energy += pns_senergy;
-abs_pow34_v(NOR34, &sce->coeffs[start_c], 
sce->ics.swb_sizes[g]);
-abs_pow34_v(PNS34, PNS, sce->ics.swb_sizes[g]);
+s->abs_pow34(NOR34, &sce->coeffs[start_c], 
sce->ics.swb_sizes[g]);
+s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
 dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
 NOR34,
 sce->ics.swb_sizes[g],
@@ -789,8 +789,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement 
*cpe)
 S[i] =  M[i]
   - sce1->coeffs[start+(w+w2)*128+i];
 }
-abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
-abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
+s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
+s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
 for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
 Mmax = FFMAX(Mmax, M34[i]);
 Smax = FFMAX(Smax, S34[i]);
@@ -833,10 +833,10 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe)
   - sce1->coeffs[start+(w+w2)*128+i];
 }
 
-abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(M34, M, 
sce0->ics.swb_sizes[g]);
-abs_pow34_v(S34, S, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(M34, M, 
sce0->ics.swb_sizes[g]);
+s->abs_pow34(S34, S, 
sce0->ics.swb_siz

Re: [FFmpeg-devel] [PATCH] avformat/udp: deprecate local_port option

2016-10-08 Thread Michael Niedermayer
On Sat, Oct 08, 2016 at 03:35:02PM +0800, Steven Liu wrote:
> 

>  udp.c |   19 ++-
>  version.h |3 +++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> bf9c64b4a0fd9a1d998c11376c5c5c2a90389caf  
> 0001-avformat-udp-deprecate-local_port-option.patch
> From 16a41c1e76fef082bf2a7238f940968238f573d5 Mon Sep 17 00:00:00 2001
> From: Steven Liu 
> Date: Sat, 8 Oct 2016 15:31:25 +0800
> Subject: [PATCH] avformat/udp: deprecate local_port option
> 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/udp.c | 19 ++-
>  libavformat/version.h |  3 +++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 3835f98..39b3350 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -86,6 +86,9 @@ typedef struct UDPContext {
>  int pkt_size;
>  int is_multicast;
>  int is_broadcast;
> +#if FF_API_UDP_LOCAL_PORT
> +int local_port_deprecated;
> +#endif
>  int local_port;
>  int reuse_socket;
>  int overrun_nonfatal;
> @@ -123,7 +126,9 @@ static const AVOption options[] = {
>  { "bitrate","Bits to send per second", 
> OFFSET(bitrate),AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0, INT64_MAX, 
> .flags = E },
>  { "burst_bits", "Max length of bursts in bits (when using bitrate)", 
> OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0, INT64_MAX, 
> .flags = E },
>  { "localport",  "Local port",  
> OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1, INT_MAX, 
> D|E },
> -{ "local_port", "Local port",  
> OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1, INT_MAX, 
> .flags = D|E },
> +#ifdef FF_API_UDP_LOCAL_PORT

#ifdef vs #if mistake also there are more such


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation

2016-10-08 Thread James Almer
On 9/28/2016 3:18 PM, James Almer wrote:
> On 9/19/2016 7:00 AM, Ivan Uskov wrote:
>> This should be a good step to make qsv branches of ffmpeg and libav
>> closer.
>> LGTM.
> 
> This has now been merged.
> 
> Could i ask you or Nablet to look at commits
> a0524d9b1e1bb0012207584f067096df7792df6c and
> ad9c9440d592e4d53d6bec9961b4b22e25387d70 from libav and see if you can
> implement then in our tree? They are next in the merge queue and there
> have been some changes in our tree that make merging both of them not
> trivial, and i have no way to test.
> 
> Thanks!

Ping. These two commits are required to continue with the merges, so
please see if you can implement them as soon as possible.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] aacenc: use the decoder's lcg PRNG

2016-10-08 Thread Michael Niedermayer
On Sat, Oct 08, 2016 at 04:20:30PM +0100, Rostislav Pehlivanov wrote:
> Using lfg was an overkill in this case where the random numbers
> were only used for encoder descisions. Should increase result
> uniformity between different FPUs and gives a slight speedup.
> 
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavcodec/aaccoder.c |  8 +++-
>  libavcodec/aacenc.c   |  2 +-
>  libavcodec/aacenc.h   |  2 --
>  libavcodec/aacenc_utils.h | 13 +
>  4 files changed, 17 insertions(+), 8 deletions(-)

probably ok,
none of the fate tests change

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/udp: deprecate local_port option

2016-10-08 Thread Steven Liu
2016-10-09 2:11 GMT+08:00 Michael Niedermayer :

> On Sat, Oct 08, 2016 at 03:35:02PM +0800, Steven Liu wrote:
> >
>
> >  udp.c |   19 ++-
> >  version.h |3 +++
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> > bf9c64b4a0fd9a1d998c11376c5c5c2a90389caf  0001-avformat-udp-deprecate-
> local_port-option.patch
> > From 16a41c1e76fef082bf2a7238f940968238f573d5 Mon Sep 17 00:00:00 2001
> > From: Steven Liu 
> > Date: Sat, 8 Oct 2016 15:31:25 +0800
> > Subject: [PATCH] avformat/udp: deprecate local_port option
> >
> > Signed-off-by: Steven Liu 
> > ---
> >  libavformat/udp.c | 19 ++-
> >  libavformat/version.h |  3 +++
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/udp.c b/libavformat/udp.c
> > index 3835f98..39b3350 100644
> > --- a/libavformat/udp.c
> > +++ b/libavformat/udp.c
> > @@ -86,6 +86,9 @@ typedef struct UDPContext {
> >  int pkt_size;
> >  int is_multicast;
> >  int is_broadcast;
> > +#if FF_API_UDP_LOCAL_PORT
> > +int local_port_deprecated;
> > +#endif
> >  int local_port;
> >  int reuse_socket;
> >  int overrun_nonfatal;
> > @@ -123,7 +126,9 @@ static const AVOption options[] = {
> >  { "bitrate","Bits to send per second",
>OFFSET(bitrate),AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0,
> INT64_MAX, .flags = E },
> >  { "burst_bits", "Max length of bursts in bits (when using
> bitrate)", OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0,
> INT64_MAX, .flags = E },
> >  { "localport",  "Local port",
> OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1,
> INT_MAX, D|E },
> > -{ "local_port", "Local port",
> OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1,
> INT_MAX, .flags = D|E },
> > +#ifdef FF_API_UDP_LOCAL_PORT
>
> #ifdef vs #if mistake also there are more such
>
>
> [...]
>
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 2
> "100% positive feedback" - "All either got their money back or didnt
> complain"
> "Best seller ever, very honest" - "Seller refunded buyer after failed scam"
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> patch update


0001-avformat-udp-deprecate-local_port-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avformat/movenc: Check frame rate in mov_write_uuidprof_tag()

2016-10-08 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/movenc.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2c155eb..d7c7158 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4261,7 +4261,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, 
AVFormatContext *s)
 return update_size(pb, pos);
 }
 
-static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
+static int mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
 {
 AVStream   *video_st= s->streams[0];
 AVCodecParameters *video_par = s->streams[0]->codecpar;
@@ -4271,6 +4271,11 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, 
AVFormatContext *s)
 int audio_kbitrate = audio_par->bit_rate / 1000;
 int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - 
audio_kbitrate);
 
+if (frame_rate < 0 || frame_rate > INT32_MAX) {
+av_log(s, AV_LOG_ERROR, "Frame rate %f outside supported range\n", 
frame_rate / (double)0x1);
+return AVERROR(EINVAL);
+}
+
 avio_wb32(pb, 0x94); /* size */
 ffio_wfourcc(pb, "uuid");
 ffio_wfourcc(pb, "PROF");
@@ -4321,6 +4326,8 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, 
AVFormatContext *s)
 avio_wb16(pb, video_par->width);
 avio_wb16(pb, video_par->height);
 avio_wb32(pb, 0x010001); /* ? */
+
+return 0;
 }
 
 static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)
@@ -4345,7 +4352,7 @@ static int mov_write_identification(AVIOContext *pb, 
AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio 
stream\n");
 return AVERROR(EINVAL);
 }
-mov_write_uuidprof_tag(pb, s);
+return mov_write_uuidprof_tag(pb, s);
 }
 return 0;
 }
-- 
2.10.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avformat/movenc: Switch mov_write_uuidprof_tag() to avg_frame_rate

2016-10-08 Thread Michael Niedermayer
Using the stream timebase simply overflows
Fix integer overflow in psp framerate computation

Signed-off-by: Michael Niedermayer 
---
 libavformat/movenc.c| 3 +--
 tests/ref/fate/copy-psp | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8b4aa5f..2c155eb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4267,8 +4267,7 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, 
AVFormatContext *s)
 AVCodecParameters *video_par = s->streams[0]->codecpar;
 AVCodecParameters *audio_par = s->streams[1]->codecpar;
 int audio_rate = audio_par->sample_rate;
-// TODO: should be avg_frame_rate
-int frame_rate = ((video_st->time_base.den) * (0x1)) / 
(video_st->time_base.num);
+int64_t frame_rate = (video_st->avg_frame_rate.num * 0x1LL) / 
video_st->avg_frame_rate.den;
 int audio_kbitrate = audio_par->bit_rate / 1000;
 int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - 
audio_kbitrate);
 
diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp
index bc7e60d..7089f48 100644
--- a/tests/ref/fate/copy-psp
+++ b/tests/ref/fate/copy-psp
@@ -1,4 +1,4 @@
-c4b2503a069fecd2f82704decf285160 *tests/data/fate/copy-psp.psp
+6889223644fc560069c8591984175a62 *tests/data/fate/copy-psp.psp
 2041379 tests/data/fate/copy-psp.psp
 #extradata 0:   51, 0xaf6d1012
 #extradata 1:2, 0x00b200a1
-- 
2.10.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi/pan: better handling of negative gains

2016-10-08 Thread Moritz Barsnick
While trying to use pan to subtract two channels (actually to see whether a
two-channel file I have is effectively mono), I noticed that
"pan=mono|c0=-0.5*c0+0.5*c1" would work, while "pan=mono|c0=0.5*c0-0.5*c1"
would cause the parser to choke, expecting a '+'.

Using this (second) patch, you could now not only "check" for channel
differences, but also eliminate centered stereo signals, like an "out of
phase stereo" ("karaoke") filter.

Meanwhile I also noticed that "pan=mono|c0<-0.49*c0+0.51*c1" would be
incorrectly amplified by a factor of 50 (= 1/(-0.49+0.51)), which can lead
to clipping with any non-related inputs, as the negative gain factor
actually only inverts the input's phase, not its level. This is fixed in
the first patch.

Moritz Barsnick (2):
  lavfi/pan: renormalize negative gain coefficients properly
  lavfi/pan: allow negative gain parameters also for other inputs than
the first named

 doc/filters.texi |  2 +-
 libavfilter/af_pan.c | 10 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi/pan: renormalize negative gain coefficients properly

2016-10-08 Thread Moritz Barsnick
The parser for the outdef will accept a negative value for the first
named channel's gain. As negative values effectively only invert the
phase of the signal, and not negate the level, the gains' absolute
values must be used to correctly accumulate the levels.

Signed-off-by: Moritz Barsnick 
---
 libavfilter/af_pan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 1eb102c..3037864 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -322,7 +322,7 @@ static int config_props(AVFilterLink *link)
 continue;
 t = 0;
 for (j = 0; j < link->channels; j++)
-t += pan->gain[i][j];
+t += fabs(pan->gain[i][j]);
 if (t > -1E-5 && t < 1E-5) {
 // t is almost 0 but not exactly, this is probably a mistake
 if (t)
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi/pan: allow negative gain parameters also for other inputs than the first named

2016-10-08 Thread Moritz Barsnick
Expands the parser to also accept the separator '-' in addition to
'+', and take the negative sign into consideration.

Signed-off-by: Moritz Barsnick 
---
 doc/filters.texi | 2 +-
 libavfilter/af_pan.c | 8 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 4b2f7bf..64934f7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3001,7 +3001,7 @@ output channel layout or number of channels
 
 @item outdef
 output channel specification, of the form:
-"@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
+"@var{out_name}=[@var{gain}*]@var{in_name}[(+|-)[@var{gain}*]@var{in_name}...]"
 
 @item out_name
 output channel to define, either a channel name (FL, FR, etc.) or a channel
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 3037864..f395c71 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -102,7 +102,7 @@ static av_cold int init(AVFilterContext *ctx)
 {
 PanContext *const pan = ctx->priv;
 char *arg, *arg0, *tokenizer, *args = av_strdup(pan->args);
-int out_ch_id, in_ch_id, len, named, ret;
+int out_ch_id, in_ch_id, len, named, ret, sign = 1;
 int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input 
channels
 double gain;
 
@@ -178,11 +178,13 @@ static av_cold int init(AVFilterContext *ctx)
 ret = AVERROR(EINVAL);
 goto fail;
 }
-pan->gain[out_ch_id][in_ch_id] = gain;
+pan->gain[out_ch_id][in_ch_id] = sign * gain;
 skip_spaces(&arg);
 if (!*arg)
 break;
-if (*arg != '+') {
+if (*arg == '-') {
+sign = -1;
+} else if (*arg != '+') {
 av_log(ctx, AV_LOG_ERROR, "Syntax error near \"%.8s\"\n", arg);
 ret = AVERROR(EINVAL);
 goto fail;
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] aacenc: add SIMD optimizations for abs_pow34 and quantization

2016-10-08 Thread Michael Niedermayer
On Sat, Oct 08, 2016 at 06:42:28PM +0100, Rostislav Pehlivanov wrote:
> Performance improvements:
> 
> quant_bands:
> with: 681 decicycles in quant_bands, 8388453 runs,155 skips
> without: 1190 decicycles in quant_bands, 8388386 runs,222 skips
> Around 42% for the function
> 
> Twoloop coder:
> 
> abs_pow34:
> with/without: 7.82s/8.17s
> Around 4% for the entire encoder
> 
> Both:
> with/without: 7.15s/8.17s
> Around 12% for the entire encoder
> 
> Fast coder:
> 
> abs_pow34:
> with/without: 3.40s/3.77s
> Around 10% for the entire encoder
> 
> Both:
> with/without: 3.02s/3.77s
> Around 20% faster for the entire encoder
> 
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavcodec/aaccoder.c|  22 
>  libavcodec/aaccoder_trellis.h|   2 +-
>  libavcodec/aaccoder_twoloop.h|   2 +-
>  libavcodec/aacenc.c  |   4 ++
>  libavcodec/aacenc.h  |   6 +++
>  libavcodec/aacenc_is.c   |   6 +--
>  libavcodec/aacenc_ltp.c  |   4 +-
>  libavcodec/aacenc_pred.c |   6 +--
>  libavcodec/aacenc_quantization.h |   4 +-
>  libavcodec/aacenc_utils.h|   4 +-
>  libavcodec/x86/Makefile  |   2 +
>  libavcodec/x86/aacencdsp.asm | 108 
> +++
>  libavcodec/x86/aacencdsp_init.c  |  42 +++
>  13 files changed, 187 insertions(+), 25 deletions(-)
>  create mode 100644 libavcodec/x86/aacencdsp.asm
>  create mode 100644 libavcodec/x86/aacencdsp_init.c

libavcodec/x86/aacencdsp.asm:67: error: expression syntax error
libavcodec/x86/aacencdsp.asm:79: warning: (RUN_AVX_INSTR:22) use of ``movd'' 
sse2 instruction in sse function: ff_aac_quantize_bands_sse
libavcodec/x86/aacencdsp.asm:99: warning: (RUN_AVX_INSTR:22) use of ``pand'' 
sse2 instruction in sse function: ff_aac_quantize_bands_sse
libavcodec/x86/aacencdsp.asm:103: warning: (RUN_AVX_INSTR:20) use of 
``cvttps2dq'' sse2 instruction in sse function: ff_aac_quantize_bands_sse

yasm 1.2.0

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel