[FFmpeg-cvslog] avcodec/motion_est: use 2x8x8 for interlaced qpel

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
13:23:24 2014 +0100| [b50e003e1cb6a215df44ffa3354603bf600b4aa3] | committer: 
Michael Niedermayer

avcodec/motion_est: use 2x8x8 for interlaced qpel

Fixes out of array read
Fixes Ticket4121

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b50e003e1cb6a215df44ffa3354603bf600b4aa3
---

 libavcodec/motion_est.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 6826740..901fafd 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -193,7 +193,13 @@ static av_always_inline int cmp_inline(MpegEncContext *s, 
const int x, const int
 int uvdxy;  /* no, it might not be used uninitialized */
 if(dxy){
 if(qpel){
-c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, 
stride); //FIXME prototype (add h)
+if (h << size == 16) {
+c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, 
stride); //FIXME prototype (add h)
+} else if (size == 0 && h == 8) {
+c->qpel_put[1][dxy](c->temp, ref[0] + x + y*stride
, stride);
+c->qpel_put[1][dxy](c->temp + 8, ref[0] + x + y*stride + 
8, stride);
+} else
+av_assert2(0);
 if(chroma){
 int cx= hx/2;
 int cy= hy/2;

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


[FFmpeg-cvslog] avformat/utils: Search harder for missing stream information in flv by default

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
15:26:58 2014 +0100| [24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b] | committer: 
Michael Niedermayer

avformat/utils: Search harder for missing stream information in flv by default

Fixes Ticket4133

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b
---

 libavformat/utils.c |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 693b033..798c612 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2989,6 +2989,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 int orig_nb_streams = ic->nb_streams;
 int flush_codecs;
 int64_t max_analyze_duration = ic->max_analyze_duration2;
+int64_t max_stream_analyze_duration;
 int64_t probesize = ic->probesize2;
 
 if (!max_analyze_duration)
@@ -2999,11 +3000,12 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 
 av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN);
 
+max_stream_analyze_duration = max_analyze_duration;
 if (!max_analyze_duration) {
-if (!strcmp(ic->iformat->name, "flv") && !(ic->ctx_flags & 
AVFMTCTX_NOHEADER)) {
-max_analyze_duration = 10*AV_TIME_BASE;
-} else
-max_analyze_duration = 5*AV_TIME_BASE;
+max_stream_analyze_duration =
+max_analyze_duration= 5*AV_TIME_BASE;
+if (!strcmp(ic->iformat->name, "flv"))
+max_stream_analyze_duration = 30*AV_TIME_BASE;
 }
 
 if (ic->pb)
@@ -3076,6 +3078,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 count = 0;
 read_size = 0;
 for (;;) {
+int analyzed_all_streams;
 if (ff_check_interrupt(&ic->interrupt_callback)) {
 ret = AVERROR_EXIT;
 av_log(ic, AV_LOG_DEBUG, "interrupted\n");
@@ -3115,7 +3118,9 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
  st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
 break;
 }
+analyzed_all_streams = 0;
 if (i == ic->nb_streams) {
+analyzed_all_streams = 1;
 /* NOTE: If the format has no header, then we need to read some
  * packets to get most of the streams, so we cannot stop here. */
 if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
@@ -3223,7 +3228,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 && st->info->fps_last_dts  != AV_NOPTS_VALUE)
 t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - 
st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q));
 
-if (t >= max_analyze_duration) {
+if (t >= (analyzed_all_streams ? max_analyze_duration : 
max_stream_analyze_duration)) {
 av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %"PRId64" 
reached at %"PRId64" microseconds\n",
max_analyze_duration,
t);

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


[FFmpeg-cvslog] avcodec/wmaprodec: Use avpriv_float_dsp_alloc()

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
18:07:59 2014 +0100| [3384d76503b40b395189227b8cc8f8942c545ccd] | committer: 
Michael Niedermayer

avcodec/wmaprodec: Use avpriv_float_dsp_alloc()

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3384d76503b40b395189227b8cc8f8942c545ccd
---

 libavcodec/wmaprodec.c |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 56d6d32..cc7ad0d 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -171,7 +171,7 @@ typedef struct {
 typedef struct WMAProDecodeCtx {
 /* generic decoder variables */
 AVCodecContext*  avctx; ///< codec context for 
av_log
-AVFloatDSPContext fdsp;
+AVFloatDSPContext *fdsp;
 uint8_t  frame_data[MAX_FRAMESIZE +
   FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
 PutBitContextpb;///< context for filling 
the frame_data buffer
@@ -260,6 +260,8 @@ static av_cold int decode_end(AVCodecContext *avctx)
 WMAProDecodeCtx *s = avctx->priv_data;
 int i;
 
+av_freep(&s->fdsp);
+
 for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
 ff_mdct_end(&s->mdct_ctx[i]);
 
@@ -286,7 +288,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 
 s->avctx = avctx;
-avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
+if (!s->fdsp)
+return AVERROR(ENOMEM);
 
 init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
 
@@ -1037,10 +1041,10 @@ static void inverse_channel_transform(WMAProDecodeCtx 
*s)
 }
 } else if (s->avctx->channels == 2) {
 int len = FFMIN(sfb[1], s->subframe_len) - sfb[0];
-s->fdsp.vector_fmul_scalar(ch_data[0] + sfb[0],
+s->fdsp->vector_fmul_scalar(ch_data[0] + sfb[0],
ch_data[0] + sfb[0],
181.0 / 128, len);
-s->fdsp.vector_fmul_scalar(ch_data[1] + sfb[0],
+s->fdsp->vector_fmul_scalar(ch_data[1] + sfb[0],
ch_data[1] + sfb[0],
181.0 / 128, len);
 }
@@ -1071,7 +1075,7 @@ static void wmapro_window(WMAProDecodeCtx *s)
 
 winlen >>= 1;
 
-s->fdsp.vector_fmul_window(start, start, start + winlen,
+s->fdsp->vector_fmul_window(start, start, start + winlen,
window, winlen);
 
 s->channel[c].prev_block_len = s->subframe_len;
@@ -1291,7 +1295,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
 s->channel[c].scale_factor_step;
 const float quant = pow(10.0, exp / 20.0);
 int start = s->cur_sfb_offsets[b];
-s->fdsp.vector_fmul_scalar(s->tmp + start,
+s->fdsp->vector_fmul_scalar(s->tmp + start,
s->channel[c].coeffs + start,
quant, end - start);
 }

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


[FFmpeg-cvslog] avcodec/vorbisdec: Use avpriv_float_dsp_alloc()

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
18:10:11 2014 +0100| [51f2422c2b7a6d694e967864a1fe6fd94ebec803] | committer: 
Michael Niedermayer

avcodec/vorbisdec: Use avpriv_float_dsp_alloc()

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51f2422c2b7a6d694e967864a1fe6fd94ebec803
---

 libavcodec/vorbisdec.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 2ad5b4f..fb16099 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -127,7 +127,7 @@ typedef struct vorbis_context_s {
 AVCodecContext *avctx;
 GetBitContext gb;
 VorbisDSPContext dsp;
-AVFloatDSPContext fdsp;
+AVFloatDSPContext *fdsp;
 FmtConvertContext fmt_conv;
 
 FFTContext mdct[2];
@@ -193,6 +193,7 @@ static void vorbis_free(vorbis_context *vc)
 
 av_freep(&vc->channel_residues);
 av_freep(&vc->saved);
+av_freep(&vc->fdsp);
 
 if (vc->residues)
 for (i = 0; i < vc->residue_count; i++)
@@ -992,6 +993,9 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
 
 ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0);
 ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0);
+vc->fdsp = avpriv_float_dsp_alloc(vc->avctx->flags & CODEC_FLAG_BITEXACT);
+if (!vc->fdsp)
+return AVERROR(ENOMEM);
 
 av_dlog(NULL, " vorbis version %d \n audio_channels %d \n audio_samplerate 
%d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d 
\n ",
 vc->version, vc->audio_channels, vc->audio_samplerate, 
vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, 
vc->blocksize[0], vc->blocksize[1]);
@@ -1020,7 +1024,6 @@ static av_cold int vorbis_decode_init(AVCodecContext 
*avctx)
 
 vc->avctx = avctx;
 ff_vorbisdsp_init(&vc->dsp);
-avpriv_float_dsp_init(&vc->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
 ff_fmt_convert_init(&vc->fmt_conv, avctx);
 
 avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
@@ -1688,7 +1691,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, 
float **floor_ptr)
 
 for (j = vc->audio_channels-1;j >= 0; j--) {
 ch_res_ptr   = vc->channel_residues + res_chan[j] * blocksize / 2;
-vc->fdsp.vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, blocksize 
/ 2);
+vc->fdsp->vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, 
blocksize / 2);
 mdct->imdct_half(mdct, ch_res_ptr, floor_ptr[j]);
 }
 
@@ -1705,13 +1708,13 @@ static int vorbis_parse_audio_packet(vorbis_context 
*vc, float **floor_ptr)
 const float *win  = vc->win[blockflag & previous_window];
 
 if (blockflag == previous_window) {
-vc->fdsp.vector_fmul_window(ret, saved, buf, win, blocksize / 4);
+vc->fdsp->vector_fmul_window(ret, saved, buf, win, blocksize / 4);
 } else if (blockflag > previous_window) {
-vc->fdsp.vector_fmul_window(ret, saved, buf, win, bs0 / 4);
+vc->fdsp->vector_fmul_window(ret, saved, buf, win, bs0 / 4);
 memcpy(ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) * sizeof(float));
 } else {
 memcpy(ret, saved, ((bs1 - bs0) / 4) * sizeof(float));
-vc->fdsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - 
bs0) / 4, buf, win, bs0 / 4);
+vc->fdsp->vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - 
bs0) / 4, buf, win, bs0 / 4);
 }
 memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float));
 }

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


[FFmpeg-cvslog] avcodec/opus_celt: Use avpriv_float_dsp_alloc()

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
18:12:38 2014 +0100| [00d4759134defa7394d7ca3175c43222bc6a] | committer: 
Michael Niedermayer

avcodec/opus_celt: Use avpriv_float_dsp_alloc()

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00d4759134defa7394d7ca3175c43222bc6a
---

 libavcodec/opus_celt.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c
index e8a8de7..4f3212b 100644
--- a/libavcodec/opus_celt.c
+++ b/libavcodec/opus_celt.c
@@ -62,7 +62,7 @@ struct CeltContext {
 // constant values that do not change during context lifetime
 AVCodecContext*avctx;
 CeltIMDCTContext  *imdct[4];
-AVFloatDSPContext  dsp;
+AVFloatDSPContext  *dsp;
 int output_channels;
 
 // values that have inter-frame effect and must be reset on flush
@@ -2072,7 +2072,7 @@ int ff_celt_decode_frame(CeltContext *s, OpusRangeCoder 
*rc,
 
 /* stereo -> mono downmix */
 if (s->output_channels < s->coded_channels) {
-s->dsp.vector_fmac_scalar(s->coeffs[0], s->coeffs[1], 1.0, 
FFALIGN(frame_size, 16));
+s->dsp->vector_fmac_scalar(s->coeffs[0], s->coeffs[1], 1.0, 
FFALIGN(frame_size, 16));
 imdct_scale = 0.5;
 } else if (s->output_channels > s->coded_channels)
 memcpy(s->coeffs[1], s->coeffs[0], frame_size * sizeof(float));
@@ -2098,7 +2098,7 @@ int ff_celt_decode_frame(CeltContext *s, OpusRangeCoder 
*rc,
 
 imdct->imdct_half(imdct, dst + CELT_OVERLAP / 2, s->coeffs[i] + j,
   s->blocks, imdct_scale);
-s->dsp.vector_fmul_window(dst, dst, dst + CELT_OVERLAP / 2,
+s->dsp->vector_fmul_window(dst, dst, dst + CELT_OVERLAP / 2,
   celt_window, CELT_OVERLAP / 2);
 }
 
@@ -2181,6 +2181,7 @@ void ff_celt_free(CeltContext **ps)
 for (i = 0; i < FF_ARRAY_ELEMS(s->imdct); i++)
 ff_celt_imdct_uninit(&s->imdct[i]);
 
+av_freep(&s->dsp);
 av_freep(ps);
 }
 
@@ -2208,7 +2209,11 @@ int ff_celt_init(AVCodecContext *avctx, CeltContext 
**ps, int output_channels)
 goto fail;
 }
 
-avpriv_float_dsp_init(&s->dsp, avctx->flags & CODEC_FLAG_BITEXACT);
+s->dsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
+if (!s->dsp) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 
 ff_celt_flush(s);
 

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


[FFmpeg-cvslog] Make the RELEASE file match with the most recent tag

2014-12-01 Thread Reinhard Tartler
ffmpeg | branch: master | Reinhard Tartler  | Sun Nov 30 
22:31:31 2014 -0500| [e4a77dc204f80a6876cbd91de9b71c30feebe119] | committer: 
Reinhard Tartler

Make the RELEASE file match with the most recent tag

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4a77dc204f80a6876cbd91de9b71c30feebe119
---

 RELEASE |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RELEASE b/RELEASE
index 27383c3..e41f5e7 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-11_beta2
+12_dev0

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


[FFmpeg-cvslog] Merge commit 'e4a77dc204f80a6876cbd91de9b71c30feebe119'

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon Dec  1 
21:33:07 2014 +0100| [9978916c531d077e359b6cde378115dfc45e172e] | committer: 
Michael Niedermayer

Merge commit 'e4a77dc204f80a6876cbd91de9b71c30feebe119'

* commit 'e4a77dc204f80a6876cbd91de9b71c30feebe119':
  Make the RELEASE file match with the most recent tag

Conflicts:
RELEASE

Not merged as the tag is not a FFmpeg version

Merged-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9978916c531d077e359b6cde378115dfc45e172e
---



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


[FFmpeg-cvslog] doc: mention the noise_bsf parameter in the docs

2014-12-01 Thread Christophe Gisquet
ffmpeg | branch: master | Christophe Gisquet  | 
Sun Nov 30 11:59:22 2014 +0100| [55a06b46193560196b4951d6c4905fa4ab0c3740] | 
committer: Michael Niedermayer

doc: mention the noise_bsf parameter in the docs

This looks more like a seed than an amount, as the variable name
could lead to think.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55a06b46193560196b4951d6c4905fa4ab0c3740
---

 doc/bitstream_filters.texi |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 8124238..6431ce8 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -21,7 +21,8 @@ name after a '='.
 ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT
 @end example
 
-Below is a description of the currently available bitstream filters.
+Below is a description of the currently available bitstream filters,
+with their parameters, if any.
 
 @section aac_adtstoasc
 
@@ -143,9 +144,16 @@ ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
 Damages the contents of packets without damaging the container. Can be
 used for fuzzing or testing error resilience/concealment.
 
+Parameters:
+A numeral string, whose value is related to how often output bytes will
+be modified. Therefore, values below or equal to 0 are forbidden, and
+the lower the more frequent bytes will be modified, with 1 meaning
+every byte is modified.
+
 @example
-ffmpeg -i INPUT -c copy -bsf noise output.mkv
+ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
 @end example
+applies the modification to every byte.
 
 @section remove_extra
 

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


[FFmpeg-cvslog] avformat/crypto: Use av_memdup()

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Dec  2 
01:47:49 2014 +0100| [24e7e0237b6eb95a649dc62bd70817a12c6c6ea6] | committer: 
Michael Niedermayer

avformat/crypto: Use av_memdup()

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24e7e0237b6eb95a649dc62bd70817a12c6c6ea6
---

 libavformat/crypto.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/crypto.c b/libavformat/crypto.c
index f3a85c7..c1754b0 100644
--- a/libavformat/crypto.c
+++ b/libavformat/crypto.c
@@ -91,10 +91,9 @@ static int set_aes_arg(CryptoContext *c, uint8_t **buf, int 
*buf_len,
desc, default_buf_len, BLOCKSIZE);
 return AVERROR(EINVAL);
 }
-*buf = av_malloc(default_buf_len);
+*buf = av_memdup(default_buf, default_buf_len);
 if (!*buf)
 return AVERROR(ENOMEM);
-memcpy(*buf, default_buf, default_buf_len);
 *buf_len = default_buf_len;
 } else if (*buf_len != BLOCKSIZE) {
 av_log(c, AV_LOG_ERROR,

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


[FFmpeg-cvslog] avformat/crypto: added encryption

2014-12-01 Thread Christian Suloway
ffmpeg | branch: master | Christian Suloway  | Mon Dec  1 
12:55:28 2014 -0600| [00d4013d9f841c189a2f10dd05526ca40129b880] | committer: 
Michael Niedermayer

avformat/crypto: added encryption

Signed-off-by: Christian Suloway 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00d4013d9f841c189a2f10dd05526ca40129b880
---

 libavformat/crypto.c |  166 --
 1 file changed, 146 insertions(+), 20 deletions(-)

diff --git a/libavformat/crypto.c b/libavformat/crypto.c
index a9b6e47..f3a85c7 100644
--- a/libavformat/crypto.c
+++ b/libavformat/crypto.c
@@ -41,14 +41,32 @@ typedef struct {
 int keylen;
 uint8_t *iv;
 int ivlen;
-struct AVAES *aes;
+uint8_t *decrypt_key;
+int decrypt_keylen;
+uint8_t *decrypt_iv;
+int decrypt_ivlen;
+uint8_t *encrypt_key;
+int encrypt_keylen;
+uint8_t *encrypt_iv;
+int encrypt_ivlen;
+struct AVAES *aes_decrypt;
+struct AVAES *aes_encrypt;
+
+uint8_t pad[BLOCKSIZE];
+int pad_len;
+
 } CryptoContext;
 
 #define OFFSET(x) offsetof(CryptoContext, x)
 #define D AV_OPT_FLAG_DECODING_PARAM
+#define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{"key", "AES decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D 
},
-{"iv",  "AES decryption initialization vector", OFFSET(iv), 
AV_OPT_TYPE_BINARY, .flags = D },
+{"key", "AES encryption/decryption key",   OFFSET(key),
 AV_OPT_TYPE_BINARY, .flags = D|E },
+{"iv",  "AES encryption/decryption initialization vector", OFFSET(iv), 
 AV_OPT_TYPE_BINARY, .flags = D|E },
+{"decryption_key", "AES decryption key",   
OFFSET(decrypt_key), AV_OPT_TYPE_BINARY, .flags = D },
+{"decryption_iv",  "AES decryption initialization vector", 
OFFSET(decrypt_iv),  AV_OPT_TYPE_BINARY, .flags = D },
+{"encryption_key", "AES encryption key",   
OFFSET(encrypt_key), AV_OPT_TYPE_BINARY, .flags = E },
+{"encryption_iv",  "AES encryption initialization vector", 
OFFSET(encrypt_iv),  AV_OPT_TYPE_BINARY, .flags = E },
 { NULL }
 };
 
@@ -59,6 +77,34 @@ static const AVClass crypto_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
+static int set_aes_arg(CryptoContext *c, uint8_t **buf, int *buf_len,
+   uint8_t *default_buf, int default_buf_len,
+   const char *desc)
+{
+if (!*buf_len) {
+if (!default_buf_len) {
+av_log(c, AV_LOG_ERROR, "%s not set\n", desc);
+return AVERROR(EINVAL);
+} else if (default_buf_len != BLOCKSIZE) {
+av_log(c, AV_LOG_ERROR,
+   "invalid %s size (%d bytes, block size is %d)\n",
+   desc, default_buf_len, BLOCKSIZE);
+return AVERROR(EINVAL);
+}
+*buf = av_malloc(default_buf_len);
+if (!*buf)
+return AVERROR(ENOMEM);
+memcpy(*buf, default_buf, default_buf_len);
+*buf_len = default_buf_len;
+} else if (*buf_len != BLOCKSIZE) {
+av_log(c, AV_LOG_ERROR,
+   "invalid %s size (%d bytes, block size is %d)\n",
+   desc, *buf_len, BLOCKSIZE);
+return AVERROR(EINVAL);
+}
+return 0;
+}
+
 static int crypto_open2(URLContext *h, const char *uri, int flags, 
AVDictionary **options)
 {
 const char *nested_url;
@@ -72,28 +118,54 @@ static int crypto_open2(URLContext *h, const char *uri, 
int flags, AVDictionary
 goto err;
 }
 
-if (c->keylen < BLOCKSIZE || c->ivlen < BLOCKSIZE) {
-av_log(h, AV_LOG_ERROR, "Key or IV not set\n");
-ret = AVERROR(EINVAL);
-goto err;
+if (flags & AVIO_FLAG_READ) {
+if ((ret = set_aes_arg(c, &c->decrypt_key, &c->decrypt_keylen,
+   c->key, c->keylen, "decryption key")) < 0)
+goto err;
+if ((ret = set_aes_arg(c, &c->decrypt_iv, &c->decrypt_ivlen,
+   c->key, c->keylen, "decryption IV")) < 0)
+goto err;
 }
+
 if (flags & AVIO_FLAG_WRITE) {
-av_log(h, AV_LOG_ERROR, "Only decryption is supported currently\n");
-ret = AVERROR(ENOSYS);
-goto err;
+if ((ret = set_aes_arg(c, &c->encrypt_key, &c->encrypt_keylen,
+   c->key, c->keylen, "encryption key")) < 0)
+if (ret < 0)
+goto err;
+if ((ret = set_aes_arg(c, &c->encrypt_iv, &c->encrypt_ivlen,
+   c->key, c->keylen, "encryption IV")) < 0)
+goto err;
 }
-if ((ret = ffurl_open(&c->hd, nested_url, AVIO_FLAG_READ,
+
+if ((ret = ffurl_open(&c->hd, nested_url, flags,
   &h->interrupt_callback, options)) < 0) {
-av_log(h, AV_LOG_ERROR, "Unable to open input\n");
+av_log(h, AV_LOG_ERROR, "Unable to open resource: %s\n", nested_url);
 goto err;

[FFmpeg-cvslog] tests: Add vsynth2 which uses the new reference.pnm

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun Nov 30 
19:28:42 2014 +0100| [42801505cd82caf9cc71d6a3ab933d9f4a983600] | committer: 
Michael Niedermayer

tests: Add vsynth2 which uses the new reference.pnm

The file is already present in git and by using it we can perform more tests
without the need of fate samples

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42801505cd82caf9cc71d6a3ab933d9f4a983600
---

 tests/Makefile |3 +++
 tests/fate/vcodec.mak  |8 ++--
 tests/ref/vsynth/vsynth2-amv   |4 
 tests/ref/vsynth/vsynth2-asv1  |4 
 tests/ref/vsynth/vsynth2-asv2  |4 
 tests/ref/vsynth/vsynth2-avui  |4 
 tests/ref/vsynth/vsynth2-cljr  |4 
 tests/ref/vsynth/vsynth2-dnxhd-1080i   |4 
 tests/ref/vsynth/vsynth2-dnxhd-720p|4 
 tests/ref/vsynth/vsynth2-dnxhd-720p-10bit  |4 
 tests/ref/vsynth/vsynth2-dnxhd-720p-rd |4 
 tests/ref/vsynth/vsynth2-dv|4 
 tests/ref/vsynth/vsynth2-dv-411|4 
 tests/ref/vsynth/vsynth2-dv-50 |4 
 tests/ref/vsynth/vsynth2-ffv1  |4 
 tests/ref/vsynth/vsynth2-ffv1.0|4 
 tests/ref/vsynth/vsynth2-ffvhuff   |4 
 tests/ref/vsynth/vsynth2-ffvhuff420p12 |4 
 tests/ref/vsynth/vsynth2-ffvhuff422p10left |4 
 tests/ref/vsynth/vsynth2-ffvhuff444|4 
 tests/ref/vsynth/vsynth2-ffvhuff444p16 |4 
 tests/ref/vsynth/vsynth2-flashsv   |4 
 tests/ref/vsynth/vsynth2-flashsv2  |4 
 tests/ref/vsynth/vsynth2-flv   |4 
 tests/ref/vsynth/vsynth2-h261  |4 
 tests/ref/vsynth/vsynth2-h261-trellis  |4 
 tests/ref/vsynth/vsynth2-h263  |4 
 tests/ref/vsynth/vsynth2-h263-obmc |4 
 tests/ref/vsynth/vsynth2-h263p |4 
 tests/ref/vsynth/vsynth2-huffyuv   |4 
 tests/ref/vsynth/vsynth2-huffyuvbgr24  |4 
 tests/ref/vsynth/vsynth2-huffyuvbgra   |4 
 tests/ref/vsynth/vsynth2-jpeg2000  |4 
 tests/ref/vsynth/vsynth2-jpeg2000-97   |4 
 tests/ref/vsynth/vsynth2-jpegls|4 
 tests/ref/vsynth/vsynth2-ljpeg |4 
 tests/ref/vsynth/vsynth2-mjpeg |4 
 tests/ref/vsynth/vsynth2-mjpeg-422 |4 
 tests/ref/vsynth/vsynth2-mjpeg-444 |4 
 tests/ref/vsynth/vsynth2-mpeg1 |4 
 tests/ref/vsynth/vsynth2-mpeg1b|4 
 tests/ref/vsynth/vsynth2-mpeg2 |4 
 tests/ref/vsynth/vsynth2-mpeg2-422 |4 
 tests/ref/vsynth/vsynth2-mpeg2-idct-int|4 
 tests/ref/vsynth/vsynth2-mpeg2-ilace   |4 
 tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd   |4 
 tests/ref/vsynth/vsynth2-mpeg2-thread  |4 
 tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc |4 
 tests/ref/vsynth/vsynth2-mpeg4 |4 
 tests/ref/vsynth/vsynth2-mpeg4-adap|4 
 tests/ref/vsynth/vsynth2-mpeg4-adv |4 
 tests/ref/vsynth/vsynth2-mpeg4-error   |4 
 tests/ref/vsynth/vsynth2-mpeg4-nr  |4 
 tests/ref/vsynth/vsynth2-mpeg4-nsse|4 
 tests/ref/vsynth/vsynth2-mpeg4-qpel|4 
 tests/ref/vsynth/vsynth2-mpeg4-qprd|4 
 tests/ref/vsynth/vsynth2-mpeg4-rc  |4 
 tests/ref/vsynth/vsynth2-mpeg4-thread  |4 
 tests/ref/vsynth/vsynth2-mpng  |4 
 tests/ref/vsynth/vsynth2-msmpeg4   |4 
 tests/ref/vsynth/vsynth2-msmpeg4v2 |4 
 tests/ref/vsynth/vsynth2-msvideo1  |4 
 tests/ref/vsynth/vsynth2-prores|4 
 tests/ref/vsynth/vsynth2-prores_ks |4 
 tests/ref/vsynth/vsynth2-qtrle |4 
 tests/ref/vsynth/vsynth2-qtrlegray |4 
 tests/ref/vsynth/vsynth2-r210  |4 
 tests/ref/vsynth/vsynth2-rgb   |4 
 tests/ref/vsynth/vsynth2-roqvideo  |4 
 tests/ref/vsynth/vsynth2-rv10  |4 
 tests/ref/vsynth/vsynth2-rv20  |4 
 tests/ref/vsynth/vsynth2-snow  |4 
 tests/ref/vsynth/vsynth2-snow-hpel |4 
 tests/ref/vsynth/vsynth2-snow-ll   |4 
 tests/ref/vsynth/vsynth2-svq1  |4 
 tests/ref/vsynth/vsynth2-v210  |4 
 tests/ref/vsynth/vsynth2-v308  |4 
 tests/ref/vsynth/vsynth2-v408  |4 
 tests/ref/vsynth/vsynth2-wmv1  |4 
 tests/ref/vsynth/vsynth2-wmv2  |4 
 tests/ref/vsynth/vsynth2-xface |

[FFmpeg-cvslog] tests: Rename vsynth2 to vsynth_lena

2014-12-01 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun Nov 30 
19:47:45 2014 +0100| [ed49b142bb8b67abf1aabf501972f09f11cc8ba7] | committer: 
Michael Niedermayer

tests: Rename vsynth2 to vsynth_lena

This avoids confusion with a growing number of vsynth tests

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed49b142bb8b67abf1aabf501972f09f11cc8ba7
---

 tests/Makefile |2 +-
 tests/fate/ffmpeg.mak  |8 +-
 tests/fate/seek.mak|  176 ++--
 tests/fate/vcodec.mak  |   12 +-
 tests/ref/seek/{vsynth2-asv1 => vsynth_lena-asv1}  |0
 tests/ref/seek/{vsynth2-asv2 => vsynth_lena-asv2}  |0
 ...vsynth2-dnxhd-1080i => vsynth_lena-dnxhd-1080i} |0
 .../{vsynth2-dnxhd-720p => vsynth_lena-dnxhd-720p} |0
 ...th2-dnxhd-720p-rd => vsynth_lena-dnxhd-720p-rd} |0
 tests/ref/seek/{vsynth2-dv => vsynth_lena-dv}  |0
 .../seek/{vsynth2-dv-411 => vsynth_lena-dv-411}|0
 .../ref/seek/{vsynth2-dv-50 => vsynth_lena-dv-50}  |0
 tests/ref/seek/{vsynth2-ffv1 => vsynth_lena-ffv1}  |0
 .../seek/{vsynth2-flashsv => vsynth_lena-flashsv}  |0
 tests/ref/seek/{vsynth2-flv => vsynth_lena-flv}|0
 tests/ref/seek/{vsynth2-h261 => vsynth_lena-h261}  |0
 tests/ref/seek/{vsynth2-h263 => vsynth_lena-h263}  |0
 .../ref/seek/{vsynth2-h263p => vsynth_lena-h263p}  |0
 .../seek/{vsynth2-huffyuv => vsynth_lena-huffyuv}  |0
 .../seek/{vsynth2-jpegls => vsynth_lena-jpegls}|0
 .../ref/seek/{vsynth2-ljpeg => vsynth_lena-ljpeg}  |0
 .../ref/seek/{vsynth2-mjpeg => vsynth_lena-mjpeg}  |0
 .../ref/seek/{vsynth2-mpeg1 => vsynth_lena-mpeg1}  |0
 .../seek/{vsynth2-mpeg1b => vsynth_lena-mpeg1b}|0
 .../{vsynth2-mpeg2-422 => vsynth_lena-mpeg2-422}   |0
 ...2-mpeg2-idct-int => vsynth_lena-mpeg2-idct-int} |0
 ...vsynth2-mpeg2-ilace => vsynth_lena-mpeg2-ilace} |0
 ...mpeg2-ivlc-qprd => vsynth_lena-mpeg2-ivlc-qprd} |0
 ...ynth2-mpeg2-thread => vsynth_lena-mpeg2-thread} |0
 ...2-thread-ivlc => vsynth_lena-mpeg2-thread-ivlc} |0
 .../ref/seek/{vsynth2-mpeg4 => vsynth_lena-mpeg4}  |0
 .../{vsynth2-mpeg4-adap => vsynth_lena-mpeg4-adap} |0
 .../{vsynth2-mpeg4-adv => vsynth_lena-mpeg4-adv}   |0
 ...vsynth2-mpeg4-error => vsynth_lena-mpeg4-error} |0
 .../{vsynth2-mpeg4-nr => vsynth_lena-mpeg4-nr} |0
 .../{vsynth2-mpeg4-nsse => vsynth_lena-mpeg4-nsse} |0
 .../{vsynth2-mpeg4-qpel => vsynth_lena-mpeg4-qpel} |0
 .../{vsynth2-mpeg4-qprd => vsynth_lena-mpeg4-qprd} |0
 .../{vsynth2-mpeg4-rc => vsynth_lena-mpeg4-rc} |0
 ...ynth2-mpeg4-thread => vsynth_lena-mpeg4-thread} |0
 .../seek/{vsynth2-msmpeg4 => vsynth_lena-msmpeg4}  |0
 .../{vsynth2-msmpeg4v2 => vsynth_lena-msmpeg4v2}   |0
 tests/ref/seek/{vsynth2-rgb => vsynth_lena-rgb}|0
 .../{vsynth2-roqvideo => vsynth_lena-roqvideo} |0
 tests/ref/seek/{vsynth2-rv10 => vsynth_lena-rv10}  |0
 tests/ref/seek/{vsynth2-rv20 => vsynth_lena-rv20}  |0
 tests/ref/seek/{vsynth2-snow => vsynth_lena-snow}  |0
 .../seek/{vsynth2-snow-ll => vsynth_lena-snow-ll}  |0
 tests/ref/seek/{vsynth2-svq1 => vsynth_lena-svq1}  |0
 tests/ref/seek/{vsynth2-wmv1 => vsynth_lena-wmv1}  |0
 tests/ref/seek/{vsynth2-wmv2 => vsynth_lena-wmv2}  |0
 tests/ref/seek/{vsynth2-yuv => vsynth_lena-yuv}|0
 tests/ref/vsynth/vsynth2-amv   |4 -
 tests/ref/vsynth/vsynth2-asv1  |4 -
 tests/ref/vsynth/vsynth2-asv2  |4 -
 tests/ref/vsynth/vsynth2-avui  |4 -
 tests/ref/vsynth/vsynth2-cljr  |4 -
 tests/ref/vsynth/vsynth2-dnxhd-1080i   |4 -
 tests/ref/vsynth/vsynth2-dnxhd-720p|4 -
 tests/ref/vsynth/vsynth2-dnxhd-720p-10bit  |4 -
 tests/ref/vsynth/vsynth2-dnxhd-720p-rd |4 -
 tests/ref/vsynth/vsynth2-dnxhd_1080i   |4 -
 tests/ref/vsynth/vsynth2-dv|4 -
 tests/ref/vsynth/vsynth2-dv-411|4 -
 tests/ref/vsynth/vsynth2-dv-50 |4 -
 tests/ref/vsynth/vsynth2-dv_411|4 -
 tests/ref/vsynth/vsynth2-ffv1  |4 -
 tests/ref/vsynth/vsynth2-ffv1.0|4 -
 tests/ref/vsynth/vsynth2-ffvhuff   |4 -
 tests/ref/vsynth/vsynth2-ffvhuff420p12 |4 -
 tests/ref/vsynth/vsynth2-ffvhuff422p10left |4 -
 tests/ref/vsynth/vsynth2-ffvhuff444|4 -
 tests/ref/vsynth/vsynth2-ffvhuff444p16 |4 -
 tests/ref/vsynth/vsynth2-flashsv   |4 -
 tests/ref/vsynth/vsynth2-flashsv2  |4 -
 tests/ref/vsynth/vsynth2-flv   |4 -
 tests/ref/vsynth/vsynth2-h261