[libav-commits] Announce new releases: 10.4, 10.7

2015-05-31 Thread Reinhard Tartler
Module: libav.org
Branch: master
Commit: 805241cb26acc0eafcd5d8ed261d9f8959e94ee5

Author:Reinhard Tartler siret...@tauware.de
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun May 31 13:29:39 2015 -0400

Announce new releases: 10.4, 10.7

---

 src/download |   44 ++--
 src/index|   20 ++--
 src/news |   23 +++
 3 files changed, 55 insertions(+), 32 deletions(-)

diff --git a/src/download b/src/download
index fb1ca0e..904a556 100644
--- a/src/download
+++ b/src/download
@@ -29,45 +29,45 @@ this is the only place in which bnew development/b 
happens.
 a name=release_11/ah2Libav 11 One Louder/h2
 
 p
-11.3 was released on 2015-03-11. It is the latest point release from the 11
+11.4 was released on 2015-05-31. It is the latest point release from the 11
 release series. 11 was published 2014-09-08, the 11 branch was cut
 2014-08-20. Please give us feedback and use
 our a href=https://bugzilla.libav.org;Bugzilla/a for filing bugs.
 /p
 
 p
-a href=releases/libav-11.3.tar.xzDownload XZ tarball/anbsp;nbsp;
-a href=releases/libav-11.3.tar.xz.md5MD5/a
-a href=releases/libav-11.3.tar.xz.sha1SHA1/a
-a href=releases/libav-11.3.tar.xz.ascPGP signature/abr /
-a href=releases/libav-11.3.tar.gzDownload gzip tarball/anbsp;nbsp;
-a href=releases/libav-11.3.tar.gz.md5MD5/a
-a href=releases/libav-11.3.tar.gz.sha1SHA1/a
-a href=releases/libav-11.3.tar.gz.ascPGP signature/abr /
-a href=releases/libav-11.3.changelogChangelog/abr /
-a href=releases/libav-11.3.releaseRelease Notes/a
+a href=releases/libav-11.4.tar.xzDownload XZ tarball/anbsp;nbsp;
+a href=releases/libav-11.4.tar.xz.md5MD5/a
+a href=releases/libav-11.4.tar.xz.sha1SHA1/a
+a href=releases/libav-11.4.tar.xz.ascPGP signature/abr /
+a href=releases/libav-11.4.tar.gzDownload gzip tarball/anbsp;nbsp;
+a href=releases/libav-11.4.tar.gz.md5MD5/a
+a href=releases/libav-11.4.tar.gz.sha1SHA1/a
+a href=releases/libav-11.4.tar.gz.ascPGP signature/abr /
+a href=releases/libav-11.4.changelogChangelog/abr /
+a href=releases/libav-11.4.releaseRelease Notes/a
 /p
 
 a name=release_10/ah2Libav 10 Eks/h2
 
 p
-10.6 was released on 2015-03-11. It is the latest point release from the 10
+10.7 was released on 2015-05-31. It is the latest point release from the 10
 release series. 10 was published 2014-03-23, the 10 branch was cut
 2014-03-23. Please give us feedback and use
 our a href=//bugzilla.libav.orgBugzilla/a for filing bugs.
 /p
 
 p
-a href=releases/libav-10.6.tar.xzDownload XZ tarball/anbsp;nbsp;
-a href=releases/libav-10.6.tar.xz.md5MD5/a
-a href=releases/libav-10.6.tar.xz.sha1SHA1/a
-a href=releases/libav-10.6.tar.xz.ascPGP signature/abr /
-a href=releases/libav-10.6.tar.gzDownload gzip tarball/anbsp;nbsp;
-a href=releases/libav-10.6.tar.gz.md5MD5/a
-a href=releases/libav-10.6.tar.gz.sha1SHA1/a
-a href=releases/libav-10.6.tar.gz.ascPGP signature/abr /
-a href=releases/libav-10.6.changelogChangelog/abr /
-a href=releases/libav-10.6.releaseRelease Notes/a
+a href=releases/libav-10.7.tar.xzDownload XZ tarball/anbsp;nbsp;
+a href=releases/libav-10.7.tar.xz.md5MD5/a
+a href=releases/libav-10.7.tar.xz.sha1SHA1/a
+a href=releases/libav-10.7.tar.xz.ascPGP signature/abr /
+a href=releases/libav-10.7.tar.gzDownload gzip tarball/anbsp;nbsp;
+a href=releases/libav-10.7.tar.gz.md5MD5/a
+a href=releases/libav-10.7.tar.gz.sha1SHA1/a
+a href=releases/libav-10.7.tar.gz.ascPGP signature/abr /
+a href=releases/libav-10.7.changelogChangelog/abr /
+a href=releases/libav-10.7.releaseRelease Notes/a
 /p
 
 a name=release_9/ah2Libav 9 plain 9/h2
diff --git a/src/index b/src/index
index 1bb9c6f..1059631 100644
--- a/src/index
+++ b/src/index
@@ -35,30 +35,30 @@ with the latest developments by subscribing to both the
 div class=panel-headingLatest Releases/div
 div class=list-group
   div href=# class=list-group-item
-span class=badge alert-successMarch 11, 2015/span
-h4 class=list-group-item-headingLibav 11.3/h4
+span class=badge alert-successMay 31, 2015/span
+h4 class=list-group-item-headingLibav 11.4/h4
 p class=list-group-item-text clearfix
 span class=pull-right
 a class=label label-info
-   href=releases/libav-11.3.releaseRelease Notes/a
+   href=releases/libav-11.4.releaseRelease Notes/a
 a class=label label-success
-   href=releases/libav-11.3.tar.xzxz/a
+   href=releases/libav-11.4.tar.xzxz/a
 a class=label label-primary
-   href=releases/libav-11.3.tar.gzgzip/a
+   href=releases/libav-11.4.tar.gzgzip/a
 /span
 /p
   /div
   div href=# class=list-group-item
-span class=badge alert-successMarch 11, 2015/span
-h4 class=list-group-item-headingLibav 10.6/h4
+span class=badge 

[libav-commits] Tag v11.4 : 11.4 Release

2015-05-31 Thread Reinhard Tartler
Module: libav
Branch: refs/tags/v11.4
Tag:3b7d396359134d26cb8175b707cd0a6a9cdd2734

Tagger: Reinhard Tartler siret...@tauware.de
Date:   Sun May 31 12:03:47 2015 -0400

11.4 Release
___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] Tag v10.7 : 10.7 Release

2015-05-31 Thread Reinhard Tartler
Module: libav
Branch: refs/tags/v10.7
Tag:d233127b0e75737d5561a4796f9f8df5e15eb2c3

Tagger: Reinhard Tartler siret...@tauware.de
Date:   Sun May 31 12:57:48 2015 -0400

10.7 Release
___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x86: Put COPY3_IF_LT under HAVE_6REGS

2015-05-31 Thread Luca Barbato
Module: libav
Branch: release/10
Commit: 987a8f8514e07aba8136d491949d0b8d6bb183f9

Author:Luca Barbato lu_z...@gentoo.org
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon Mar 16 11:26:48 2015 +0100

x86: Put COPY3_IF_LT under HAVE_6REGS

It uses 6 registers, unbreaks building on hardened x86 system.

Bug-Id: gentoo/541930
CC: libav-sta...@libav.org
(cherry picked from commit 2af720fe5f0418612a8fc26b0147a0e10414fcbe)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/x86/mathops.h |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index a62094e..2c04d9d 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -23,7 +23,9 @@
 #define AVCODEC_X86_MATHOPS_H
 
 #include config.h
+
 #include libavutil/common.h
+#include libavutil/x86/asm.h
 
 #if HAVE_INLINE_ASM
 
@@ -88,6 +90,7 @@ static inline av_const int mid_pred(int a, int b, int c)
 return i;
 }
 
+#if HAVE_6REGS
 #define COPY3_IF_LT(x, y, a, b, c, d)\
 __asm__ volatile(\
 cmpl  %0, %3   \n\t\
@@ -97,6 +100,8 @@ __asm__ volatile(\
 : +r (x), +r (a), +r (c)\
 : r (y), r (b), r (d)\
 );
+#endif /* HAVE_6REGS */
+
 #endif /* HAVE_I686 */
 
 #define MASK_ABS(mask, level)   \

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mov: Fix little endian audio detection

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: release/10
Commit: 8b9d0f5d3aceb67d472d190db53a21177fea9275

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri Mar 13 19:45:14 2015 +

mov: Fix little endian audio detection

Set this field to TRUE if the audio component is to operate on
little-endian data, and FALSE otherwise.

However TRUE and FALSE are not defined. Since this flag is just a boolean,
interpret all values except for 0 as little endian.

Sample-Id: 64bit_FLOAT_Little_Endian.mov
(cherry picked from commit 8ae4d4e117626313e0b7df746e82de84d00d160a)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/mov.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5ef343e..4f0062d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -816,7 +816,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 st = c-fc-streams[c-fc-nb_streams-1];
 
-little_endian = avio_rb16(pb);
+little_endian = !!avio_rb16(pb);
 av_dlog(c-fc, enda %d\n, little_endian);
 if (little_endian == 1) {
 switch (st-codec-codec_id) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] nut: Make sure to clean up on read_header failure

2015-05-31 Thread Luca Barbato
Module: libav
Branch: release/10
Commit: c34d1099db6f9bc49f30eb3141f87c42b01a3714

Author:Luca Barbato lu_z...@gentoo.org
Committer: Reinhard Tartler siret...@tauware.de
Date:  Wed Apr 29 21:29:49 2015 +0200

nut: Make sure to clean up on read_header failure

Based on Andreas Cadhalpun andreas.cadhal...@googlemail.com work.

CC: libav-sta...@libav.org
(cherry picked from commit 1f64b018cbec018fa66a4a20f79958d9707913de)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/nutdec.c |   39 ++-
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 0da7c4b..56bffe0 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -659,6 +659,20 @@ fail:
 return ret;
 }
 
+static int nut_read_close(AVFormatContext *s)
+{
+NUTContext *nut = s-priv_data;
+int i;
+
+av_freep(nut-time_base);
+av_freep(nut-stream);
+ff_nut_free_sp(nut);
+for (i = 1; i  nut-header_count; i++)
+av_freep(nut-header[i]);
+
+return 0;
+}
+
 static int nut_read_header(AVFormatContext *s)
 {
 NUTContext *nut = s-priv_data;
@@ -674,7 +688,7 @@ static int nut_read_header(AVFormatContext *s)
 pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
 if (pos  0 + 1) {
 av_log(s, AV_LOG_ERROR, No main startcode found.\n);
-return AVERROR_INVALIDDATA;
+goto fail;
 }
 } while (decode_main_header(nut)  0);
 
@@ -684,7 +698,7 @@ static int nut_read_header(AVFormatContext *s)
 pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
 if (pos  0 + 1) {
 av_log(s, AV_LOG_ERROR, Not all stream headers found.\n);
-return AVERROR_INVALIDDATA;
+goto fail;
 }
 if (decode_stream_header(nut) = 0)
 initialized_stream_count++;
@@ -698,7 +712,7 @@ static int nut_read_header(AVFormatContext *s)
 
 if (startcode == 0) {
 av_log(s, AV_LOG_ERROR, EOF before video frames\n);
-return AVERROR_INVALIDDATA;
+goto fail;
 } else if (startcode == SYNCPOINT_STARTCODE) {
 nut-next_startcode = startcode;
 break;
@@ -721,6 +735,11 @@ static int nut_read_header(AVFormatContext *s)
 ff_metadata_conv_ctx(s, NULL, ff_nut_metadata_conv);
 
 return 0;
+
+fail:
+nut_read_close(s);
+
+return AVERROR_INVALIDDATA;
 }
 
 static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id,
@@ -987,20 +1006,6 @@ static int read_seek(AVFormatContext *s, int stream_index,
 return 0;
 }
 
-static int nut_read_close(AVFormatContext *s)
-{
-NUTContext *nut = s-priv_data;
-int i;
-
-av_freep(nut-time_base);
-av_freep(nut-stream);
-ff_nut_free_sp(nut);
-for (i = 1; i  nut-header_count; i++)
-av_freep(nut-header[i]);
-
-return 0;
-}
-
 AVInputFormat ff_nut_demuxer = {
 .name   = nut,
 .long_name  = NULL_IF_CONFIG_SMALL(NUT),

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avpacket: Check for and return errors in ff_interleave_add_packet()

2015-05-31 Thread Nidhi Makhijani
Module: libav
Branch: release/10
Commit: e3c4eb87e4d9650d76f6d8d790a9b749b325e973

Author:Nidhi Makhijani nidhim...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon Jul 14 12:10:44 2014 +0530

avpacket: Check for and return errors in ff_interleave_add_packet()

Signed-off-by: Diego Biurrun di...@biurrun.de
(cherry picked from commit 324ff59444ff5470bb325ff1e2be7c4b054fc944)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/audiointerleave.c |8 +---
 libavformat/internal.h|4 ++--
 libavformat/mux.c |   20 +++-
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
index e4cde9d..e49c77f 100644
--- a/libavformat/audiointerleave.c
+++ b/libavformat/audiointerleave.c
@@ -99,7 +99,7 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket 
*out, AVPacket *pkt
 int (*get_packet)(AVFormatContext *, AVPacket *, 
AVPacket *, int),
 int (*compare_ts)(AVFormatContext *, AVPacket *, 
AVPacket *))
 {
-int i;
+int i, ret;
 
 if (pkt) {
 AVStream *st = s-streams[pkt-stream_index];
@@ -116,7 +116,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, 
AVPacket *out, AVPacket *pkt
 // rewrite pts and dts to be decoded time line position
 pkt-pts = pkt-dts = aic-dts;
 aic-dts += pkt-duration;
-ff_interleave_add_packet(s, pkt, compare_ts);
+if ((ret = ff_interleave_add_packet(s, pkt, compare_ts))  0)
+return ret;
 }
 pkt = NULL;
 }
@@ -126,7 +127,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, 
AVPacket *out, AVPacket *pkt
 if (st-codec-codec_type == AVMEDIA_TYPE_AUDIO) {
 AVPacket new_pkt;
 while (interleave_new_audio_packet(s, new_pkt, i, flush))
-ff_interleave_add_packet(s, new_pkt, compare_ts);
+if ((ret = ff_interleave_add_packet(s, new_pkt, compare_ts)) 
 0)
+return ret;
 }
 }
 
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 0e7eb36..2824436 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -87,8 +87,8 @@ void ff_program_add_stream_index(AVFormatContext *ac, int 
progid, unsigned int i
  * Add packet to AVFormatContext-packet_buffer list, determining its
  * interleaved position using compare() function argument.
  */
-void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
-  int (*compare)(AVFormatContext *, AVPacket *, 
AVPacket *));
+int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
+ int (*compare)(AVFormatContext *, AVPacket *, 
AVPacket *));
 
 void ff_read_frame_flush(AVFormatContext *s);
 
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 59f9c42..8466605 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -477,12 +477,15 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 return ret;
 }
 
-void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
-  int (*compare)(AVFormatContext *, AVPacket *, 
AVPacket *))
+int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
+ int (*compare)(AVFormatContext *, AVPacket *, 
AVPacket *))
 {
+int ret;
 AVPacketList **next_point, *this_pktl;
 
 this_pktl  = av_mallocz(sizeof(AVPacketList));
+if (!this_pktl)
+return AVERROR(ENOMEM);
 this_pktl-pkt = *pkt;
 #if FF_API_DESTRUCT_PACKET
 FF_DISABLE_DEPRECATION_WARNINGS
@@ -490,7 +493,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 pkt-buf   = NULL;
-av_dup_packet(this_pktl-pkt);  // duplicate the packet if it uses 
non-alloced memory
+// Duplicate the packet if it uses non-allocated memory
+if ((ret = av_dup_packet(this_pktl-pkt))  0) {
+av_free(this_pktl);
+return ret;
+}
 
 if (s-streams[pkt-stream_index]-last_in_packet_buffer) {
 next_point = 
(s-streams[pkt-stream_index]-last_in_packet_buffer-next);
@@ -515,6 +522,8 @@ next_non_null:
 
 s-streams[pkt-stream_index]-last_in_packet_buffer =
 *next_point  = this_pktl;
+
+return 0;
 }
 
 static int interleave_compare_dts(AVFormatContext *s, AVPacket *next,
@@ -535,10 +544,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, 
AVPacket *out,
 {
 AVPacketList *pktl;
 int stream_count = 0;
-int i;
+int i, ret;
 
 if (pkt) {
-ff_interleave_add_packet(s, pkt, interleave_compare_dts);
+if ((ret = ff_interleave_add_packet(s, pkt, interleave_compare_dts))  
0)
+return ret;
 }
 
 if (s-max_interleave_delta  0  s-packet_buffer  !flush) {

___
libav-commits mailing list

[libav-commits] h264: Make sure reinit failures mark the context as not initialized

2015-05-31 Thread Luca Barbato
Module: libav
Branch: release/10
Commit: 964fef3f3ced60e67831549df223bc177e1537c9

Author:Luca Barbato lu_z...@gentoo.org
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon May 25 22:30:10 2015 +0200

h264: Make sure reinit failures mark the context as not initialized

Bug-Id: CVE-2015-3417
CC: libav-sta...@libav.org
(cherry picked from commit 3b69f245dbe6e2016659a45c4bfe284f6c5ac57e)
Signed-off-by: Reinhard Tartler siret...@tauware.de

Conflicts:
libavcodec/h264_slice.c

---

 libavcodec/h264.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 857a949..c327113 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3489,6 +3489,7 @@ static int decode_slice_header(H264Context *h, 
H264Context *h0)
 (h-width  != h-avctx-coded_width   ||
  h-height != h-avctx-coded_height  ||
  needs_reinit)) {
+h-context_initialized = 0;
 if (h != h0) {
 av_log(h-avctx, AV_LOG_ERROR, changing width/height on 
slice %d\n, h0-current_slice + 1);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] Update Changelog for 10.7

2015-05-31 Thread Reinhard Tartler
Module: libav
Branch: release/10
Commit: e863f4cd2a5ea05c74b8beb92e55d7ed10908d64

Author:Reinhard Tartler siret...@tauware.de
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun May 31 11:39:39 2015 -0400

Update Changelog for 10.7

---

 Changelog |   28 
 RELEASE   |2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index adaf30e..290d791 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,34 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version 10.7:
+- h264: Make sure reinit failures mark the context as not initialized 
(CVE-2015-3417)
+- msrle: Use FFABS to determine the frame size in msrle_decode_pal4 
(CVE-2015-3395)
+- x86: cavs: Remove an unneeded scratch buffer
+- configure: Disable i686 for i586 and lower CPUs (debian/783082)
+- mjpegenc: Fix JFIF header byte ordering (bug/808)
+- nut: Make sure to clean up on read_header failure
+- png: Set the color range as full range
+- avi: Validate sample_size
+- nut: Check chapter creation in decode_info_header
+- alac: Reject rice_limit 0 if compression is used
+- ape: Support _ files with nblock smaller than 64
+- mux: Do not leave stale side data pointers in ff_interleave_add_packet()
+- avpacket: Check for and return errors in ff_interleave_add_packet()
+- mpegts: Update the PSI/SI table only if the version change
+- rtsp: Make sure we don't write too many transport entries into a fixed-size 
array
+- rtpenc_jpeg: Handle case of picture dimensions not dividing by 8
+- mov: Fix little endian audio detection
+- x86: Put COPY3_IF_LT under HAVE_6REGS (gentoo/541930)
+- roqvideoenc: set enc-avctx in roq_encode_init
+- libvpx: Fix mixed use of av_malloc() and av_reallocp()
+- (libav.org/release/10) alsdec: only adapt order for positive max_order
+- alsdec: check sample pointer range in revert_channel_correlation
+- aacpsy: correct calculation of minath in psy_3gpp_init
+- alsdec: limit avctx-bits_per_raw_sample to 32
+- aasc: return correct buffer size from aasc_decode_frame
+- matroskadec: fix crash when parsing invalid mkv
+
 version 10.6:
 - utvideodec: Handle slice_height being zero (CVE-2014-9604)
 - tiff: Check that there is no aliasing in pixel format selection 
(CVE-2014-8544)
diff --git a/RELEASE b/RELEASE
index 12c0281..4e74f9f 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-10.6
+10.7

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x86: cavs: Remove an unneeded scratch buffer

2015-05-31 Thread Michael Niedermayer
Module: libav
Branch: release/10
Commit: 60852532ba0971c4d253b755a3596e0a004a8bd9

Author:Michael Niedermayer michae...@gmx.at
Committer: Reinhard Tartler siret...@tauware.de
Date:  Thu May 28 12:38:35 2015 +0200

x86: cavs: Remove an unneeded scratch buffer

Simplifies the code and makes it build on certain compilers
running out of registers on x86.

CC: libav-sta...@libav.org
Reported-By: mudler
(cherry picked from commit e4610300de6869bd6b3b00e76cfeabb6d7653dcd)
Signed-off-by: Luca Barbato lu_z...@gentoo.org
(cherry picked from commit 4dc0fbb13c33b4e5bdb766652f4daf900ccc952f)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/x86/cavsdsp.c |   28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index bc9cbf7..fef299c 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -140,9 +140,7 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t 
*block, int stride)
 DECLARE_ALIGNED(8, int16_t, b2)[64];
 
 for(i=0; i2; i++){
-DECLARE_ALIGNED(8, uint64_t, tmp);
-
-cavs_idct8_1d(block+4*i, ff_pw_4.a);
+cavs_idct8_1d(block + 4 * i, ff_pw_4.a);
 
 __asm__ volatile(
 psraw $3, %%mm7  \n\t
@@ -153,20 +151,20 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t 
*block, int stride)
 psraw $3, %%mm2  \n\t
 psraw $3, %%mm1  \n\t
 psraw $3, %%mm0  \n\t
-movq   %%mm7,%0   \n\t
+movq   %%mm7,  (%0)  \n\t
 TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
-movq   %%mm0,  8(%1)  \n\t
-movq   %%mm6, 24(%1)  \n\t
-movq   %%mm7, 40(%1)  \n\t
-movq   %%mm4, 56(%1)  \n\t
-movq%0,%%mm7  \n\t
+movq   %%mm0,  8(%0)  \n\t
+movq   %%mm6, 24(%0)  \n\t
+movq   %%mm7, 40(%0)  \n\t
+movq   %%mm4, 56(%0)  \n\t
+movq(%0),  %%mm7  \n\t
 TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
-movq   %%mm7,   (%1)  \n\t
-movq   %%mm1, 16(%1)  \n\t
-movq   %%mm0, 32(%1)  \n\t
-movq   %%mm3, 48(%1)  \n\t
-: =m(tmp)
-: r(b2+32*i)
+movq   %%mm7,   (%0)  \n\t
+movq   %%mm1, 16(%0)  \n\t
+movq   %%mm0, 32(%0)  \n\t
+movq   %%mm3, 48(%0)  \n\t
+:
+: r(b2 + 32 * i)
 : memory
 );
 }

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] png: Set the color range as full range

2015-05-31 Thread wm4
Module: libav
Branch: release/10
Commit: f29cf578923d2d4d2cf891dfc0c7ac45c641a5b7

Author:wm4 nfx...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri May  8 17:01:50 2015 +0200

png: Set the color range as full range

The format uses full range for the gray formats.

CC: libav-sta...@libav.org
(cherry picked from commit 0f50c53cfb959162f2bccc1a2c2e066d35723595)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/pngdec.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index e646296..eac4bd7 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -629,6 +629,8 @@ static av_cold int png_dec_init(AVCodecContext *avctx)
 {
 PNGDecContext *s = avctx-priv_data;
 
+avctx-color_range = AVCOL_RANGE_JPEG;
+
 s-prev = av_frame_alloc();
 if (!s-prev)
 return AVERROR(ENOMEM);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] rtsp: Make sure we don' t write too many transport entries into a fixed-size array

2015-05-31 Thread Martin Storsjö
Module: libav
Branch: release/10
Commit: 4c4cc9b27b69a86e405fd7612aa0a62f3b62b027

Author:Martin Storsjö mar...@martin.st
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri Apr 24 12:38:09 2015 +0300

rtsp: Make sure we don't write too many transport entries into a fixed-size 
array

CC: libav-sta...@libav.org
Signed-off-by: Martin Storsjö mar...@martin.st
(cherry picked from commit f77c9d71615e17414aacbb1720693b800a5a32d3)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/rtsp.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b95be46..6f7d775 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -904,6 +904,8 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, 
const char *p)
 p++;
 
 reply-nb_transports++;
+if (reply-nb_transports = RTSP_MAX_TRANSPORTS)
+break;
 }
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

[libav-commits] configure: Disable i686 for i586 and lower CPUs

2015-05-31 Thread Mikulas Patocka
Module: libav
Branch: release/10
Commit: 9eba675e549c48860601a4018df7756b57623e93

Author:Mikulas Patocka miku...@artax.karlin.mff.cuni.cz
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon Sep 15 05:11:21 2014 -0700

configure: Disable i686 for i586 and lower CPUs

(cherry picked from commit b37bfbfbe53917820d1f97312fa0b2e8c7a15217)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 configure |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 35f9d5c..b4ba1e0 100755
--- a/configure
+++ b/configure
@@ -3121,6 +3121,7 @@ elif enabled x86; then
 case $cpu in
 i[345]86|pentium)
 cpuflags=-march=$cpu
+disable i686
 disable mmx
 ;;
 # targets that do NOT support nopl and conditional mov (cmov)

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] nut: Check chapter creation in decode_info_header

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: release/10
Commit: 3bebca9634f05ea5da7624e3a3f35ec95341e250

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Tue Apr 28 20:57:59 2015 +0200

nut: Check chapter creation in decode_info_header

This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Luca Barbato lu_z...@gentoo.org

CC: libav-sta...@libav.org
(cherry picked from commit 21b21aed797b5e636adcf2df811f96a95f208930)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/nutdec.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 6328549..0da7c4b 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -474,6 +474,10 @@ static int decode_info_header(NUTContext *nut)
  nut-time_base[chapter_start %
 nut-time_base_count],
  start, start + chapter_len, NULL);
+if (!chapter) {
+av_log(s, AV_LOG_ERROR, Could not create chapter.\n);
+return AVERROR(ENOMEM);
+}
 metadata = chapter-metadata;
 } else if (stream_id_plus1) {
 st   = s-streams[stream_id_plus1 - 1];

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] msrle: Use FFABS to determine the frame size in msrle_decode_pal4

2015-05-31 Thread Luca Barbato
Module: libav
Branch: release/10
Commit: 48c7fe5b5834a197f10a6eb56cbe7cda8ee32407

Author:Luca Barbato lu_z...@gentoo.org
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon May 25 21:53:26 2015 +0200

msrle: Use FFABS to determine the frame size in msrle_decode_pal4

As done in msrle_decode_8_16_24_32.

Bug-Id: CVE-2015-3395
CC: libav-sta...@libav.org

---

 libavcodec/msrledec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index af2a247..370d9bd 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -39,7 +39,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture 
*pic,
 unsigned int pixel_ptr = 0;
 int row_dec = pic-linesize[0];
 int row_ptr = (avctx-height - 1) * row_dec;
-int frame_size = row_dec * avctx-height;
+int frame_size = FFABS(row_dec) * avctx-height;
 int i;
 
 while (row_ptr = 0) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avi: Validate sample_size

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: release/10
Commit: 0654518597e6ee2947e4a81c26f03f9aec7ef656

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Wed May  6 02:26:57 2015 +0200

avi: Validate sample_size

And either error out or set it to 0 if it is negative.

CC: libav-sta...@libav.org
Signed-off-by: Luca Barbato lu_z...@gentoo.org
(cherry picked from commit a55a70644872027fdf76a75edf12a09c9008880f)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/avidec.c |   17 +
 1 file changed, 17 insertions(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e851f0b..0423da2 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -569,6 +569,23 @@ static int avi_read_header(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, unknown stream type %X\n, tag1);
 goto fail;
 }
+
+if (ast-sample_size  0) {
+if (s-error_recognition  AV_EF_EXPLODE) {
+av_log(s, AV_LOG_ERROR,
+   Invalid sample_size %d at stream %d\n,
+   ast-sample_size,
+   stream_index);
+goto fail;
+}
+av_log(s, AV_LOG_WARNING,
+   Invalid sample_size %d at stream %d 
+   setting it to 0\n,
+   ast-sample_size,
+   stream_index);
+ast-sample_size = 0;
+}
+
 if (ast-sample_size == 0)
 st-duration = st-nb_frames;
 ast-frame_offset = ast-cum_len;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mjpegenc: Fix JFIF header byte ordering

2015-05-31 Thread Shiina Hideaki
Module: libav
Branch: release/10
Commit: 5e886756ee687be5840867d3810991efe17a66c3

Author:Shiina Hideaki shi...@yndrd.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Thu May  7 01:46:55 2015 +0100

mjpegenc: Fix JFIF header byte ordering

The header had a wrong version description.

Bug-Id: 808
Signed-off-by: Shiina Hideaki shi...@yndrd.com
Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
(cherry picked from commit 5549f693d2181b3211427f65e48eaa2f4fc5a402)
Signed-off-by: Reinhard Tartler siret...@tauware.de

Conflicts:
libavcodec/mjpegenc_common.c

---

 libavcodec/mjpegenc.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 30433c3..cf0f510 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -142,7 +142,10 @@ static void jpeg_put_comments(AVCodecContext *avctx, 
PutBitContext *p)
 put_marker(p, APP0);
 put_bits(p, 16, 16);
 avpriv_put_string(p, JFIF, 1); /* this puts the trailing zero-byte 
too */
-put_bits(p, 16, 0x0201); /* v 1.02 */
+/* The most significant byte is used for major revisions, the least
+ * significant byte for minor revisions. Version 1.02 is the current
+ * released revision. */
+put_bits(p, 16, 0x0102);
 put_bits(p,  8, 0);  /* units type: 0 - aspect ratio */
 put_bits(p, 16, avctx-sample_aspect_ratio.num);
 put_bits(p, 16, avctx-sample_aspect_ratio.den);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] alac: Reject rice_limit 0 if compression is used

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: release/10
Commit: 1dcb68c02a55648facb82c0b2b6a1eb3dc18f988

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri Apr 24 00:01:43 2015 +0200

alac: Reject rice_limit 0 if compression is used

If in compression mode rice_limit = 0 leads to call
`show_bits(gb, k)` in `decode_scalar` with k = 0.

Request a sample in case it is valid and it should be accepted.

Signed-off-by: Luca Barbato lu_z...@gentoo.org

CC: libav-sta...@libav.org
(cherry picked from commit cb5324200ccdc693dd5b28dcd7d4b722fad83ea2)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/alac.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index f972531..7c2b925 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -305,6 +305,12 @@ static int decode_element(AVCodecContext *avctx, AVFrame 
*frame, int ch_index,
 int lpc_quant[2];
 int rice_history_mult[2];
 
+if (!alac-rice_limit) {
+avpriv_request_sample(alac-avctx,
+  Compression with rice limit 0);
+return AVERROR(ENOSYS);
+}
+
 decorr_shift   = get_bits(alac-gb, 8);
 decorr_left_weight = get_bits(alac-gb, 8);
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mux: Do not leave stale side data pointers in ff_interleave_add_packet()

2015-05-31 Thread Michael Niedermayer
Module: libav
Branch: release/10
Commit: 296d70f58517d6702bfda32178c1e395bca9665e

Author:Michael Niedermayer michae...@gmx.at
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri May  1 23:55:42 2015 +0100

mux: Do not leave stale side data pointers in ff_interleave_add_packet()

Signed-off-by: Michael Niedermayer michae...@gmx.at
Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
(cherry picked from commit 386e80610de282c92ad5897683ccaf2675766ac5)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/mux.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 8466605..e4b6144 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -493,6 +493,8 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 pkt-buf   = NULL;
+pkt-side_data = NULL;
+pkt-side_data_elems = 0;
 // Duplicate the packet if it uses non-allocated memory
 if ((ret = av_dup_packet(this_pktl-pkt))  0) {
 av_free(this_pktl);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] roqvideoenc: set enc-avctx in roq_encode_init

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: release/10
Commit: c7a983762ab40bca4f85be64995d5398a4307aa5

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon Mar  9 19:24:09 2015 +0100

roqvideoenc: set enc-avctx in roq_encode_init

So far it is only set in roq_encode_frame, but it is used in
roq_encode_end to free the coded_frame. This currently segfaults if
roq_encode_frame is not called between roq_encode_init and
roq_encode_end.

CC:libav-sta...@libav.org
Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Signed-off-by: Anton Khirnov an...@khirnov.net
(cherry picked from commit 9f6c36d961d27283808310e3ca1d8390b55fce9b)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/roqvideoenc.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index af0089f..871371b 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -959,6 +959,8 @@ static av_cold int roq_encode_init(AVCodecContext *avctx)
 
 av_lfg_init(enc-randctx, 1);
 
+enc-avctx = avctx;
+
 enc-framesSinceKeyframe = 0;
 if ((avctx-width  0xf) || (avctx-height  0xf)) {
 av_log(avctx, AV_LOG_ERROR, Dimensions must be divisible by 16\n);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ape: Support _0000 files with nblock smaller than 64

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: release/10
Commit: 9726f3007196a9c3589c4f09a81c0d75e1d97f2c

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Wed Apr 29 20:39:22 2015 +0200

ape: Support _ files with nblock smaller than 64

The decode_array_ assumed that 64 is the minimal block size
while it is not.

CC: libav-sta...@libav.org
Signed-off-by: Luca Barbato lu_z...@gentoo.org
(cherry picked from commit ac1660509ecfbeca7b63eb5ab8360011180e705b)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/apedec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8669db8..d107d2b 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -590,12 +590,12 @@ static void decode_array_(APEContext *ctx, 
GetBitContext *gb,
 int ksummax, ksummin;
 
 rice-ksum = 0;
-for (i = 0; i  5; i++) {
+for (i = 0; i  FFMIN(blockstodecode, 5); i++) {
 out[i] = get_rice_ook(ctx-gb, 10);
 rice-ksum += out[i];
 }
 rice-k = av_log2(rice-ksum / 10) + 1;
-for (; i  64; i++) {
+for (; i  FFMIN(blockstodecode, 64); i++) {
 out[i] = get_rice_ook(ctx-gb, rice-k);
 rice-ksum += out[i];
 rice-k = av_log2(rice-ksum / ((i + 1) * 2)) + 1;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] libvpx: Fix mixed use of av_malloc() and av_reallocp()

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: release/10
Commit: 891ed1184e49bc7944311302d9ece01e87c188a8

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun Mar  8 21:08:16 2015 +

libvpx: Fix mixed use of av_malloc() and av_reallocp()

This buffer is resized when vpx_codec_get_cx_data() returns a
VPX_CODEC_STATS_PKT packet.

CC: libav-sta...@libav.org
Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
(cherry picked from commit 7244cefd6e6ba7258cb022dfd7a284099d88a3e8)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/libvpxenc.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index dc1ddc3..ba14b1d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -291,7 +291,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 if (enccfg.g_pass == VPX_RC_FIRST_PASS)
 enccfg.g_lag_in_frames = 0;
 else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
-int decode_size;
+int decode_size, ret;
 
 if (!avctx-stats_in) {
 av_log(avctx, AV_LOG_ERROR, No stats file for second pass\n);
@@ -299,12 +299,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 }
 
 ctx-twopass_stats.sz  = strlen(avctx-stats_in) * 3 / 4;
-ctx-twopass_stats.buf = av_malloc(ctx-twopass_stats.sz);
-if (!ctx-twopass_stats.buf) {
+ret = av_reallocp(ctx-twopass_stats.buf, ctx-twopass_stats.sz);
+if (ret  0) {
 av_log(avctx, AV_LOG_ERROR,
Stat buffer alloc (%zu bytes) failed\n,
ctx-twopass_stats.sz);
-return AVERROR(ENOMEM);
+return ret;
 }
 decode_size = av_base64_decode(ctx-twopass_stats.buf, avctx-stats_in,
ctx-twopass_stats.sz);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] rtpenc_jpeg: Handle case of picture dimensions not dividing by 8

2015-05-31 Thread Andrey Utkin
Module: libav
Branch: release/10
Commit: 1f1686615c20982a68b2d8db3ff109834a260d27

Author:Andrey Utkin andrey.krieger.ut...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sat Apr 11 00:54:10 2015 +0300

rtpenc_jpeg: Handle case of picture dimensions not dividing by 8

This fixes the calculation of the number of needed blocks to make
sure that ALL pixels are represented by the result.

Signed-off-by: Martin Storsjö mar...@martin.st
(cherry picked from commit 4415d0f3bbaeb287327ef101ae98d727a69d9af1)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavformat/rtpenc_jpeg.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 04df658..0ceb091 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -40,8 +40,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 s-timestamp = s-cur_timestamp;
 
 /* convert video pixel dimensions from pixels to blocks */
-w = s1-streams[0]-codec-width   3;
-h = s1-streams[0]-codec-height  3;
+w = (s1-streams[0]-codec-width  + 7)  3;
+h = (s1-streams[0]-codec-height + 7)  3;
 
 /* check if pixel format is not the normal 420 case */
 if (s1-streams[0]-codec-pix_fmt == AV_PIX_FMT_YUVJ422P) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

[libav-commits] network: prevent SIGPIPE on OSX

2015-05-31 Thread wm4
Module: libav
Branch: master
Commit: 881b80b3294483696a21b21a69fa5eee30f33037

Author:wm4 nfx...@googlemail.com
Committer: Martin Storsjö mar...@martin.st
Date:  Thu May 28 18:23:27 2015 +0200

network: prevent SIGPIPE on OSX

OSX does not know MSG_NOSIGNAL. BSD (which OSX is based on) has got
the socket option SO_NOSIGPIPE (even if modern BSDs also support
MSG_NOSIGNAL).

Signed-off-by: Martin Storsjö mar...@martin.st

---

 libavformat/network.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/network.c b/libavformat/network.c
index a12e70d..2c34b4a 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -153,6 +153,10 @@ int ff_socket(int af, int type, int proto)
 fcntl(fd, F_SETFD, FD_CLOEXEC);
 #endif
 }
+#ifdef SO_NOSIGPIPE
+if (fd != -1)
+setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (int){1}, sizeof(int));
+#endif
 return fd;
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

[libav-commits] mpegvideo: Move tables to a separate file

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 378a00087fdadcc9b34165c05cd10a1a15f3fe61

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Vittorio Giovara vittorio.giov...@gmail.com
Date:  Fri May 29 19:44:03 2015 +0100

mpegvideo: Move tables to a separate file

---

 libavcodec/Makefile|3 +-
 libavcodec/flvdec.c|1 +
 libavcodec/flvenc.c|1 +
 libavcodec/h261enc.c   |1 +
 libavcodec/intelh263dec.c  |1 +
 libavcodec/ituh263dec.c|1 +
 libavcodec/ituh263enc.c|1 +
 libavcodec/mpeg12.c|1 +
 libavcodec/mpeg12dec.c |1 +
 libavcodec/mpeg4videodec.c |1 +
 libavcodec/mpegvideo.c |   84 +---
 libavcodec/mpegvideo.h |8 
 libavcodec/mpegvideo_enc.c |1 +
 libavcodec/mpegvideodata.c |  102 
 libavcodec/mpegvideodata.h |   33 ++
 libavcodec/msmpeg4.c   |1 +
 libavcodec/rv10.c  |1 +
 libavcodec/rv20enc.c   |1 +
 18 files changed, 151 insertions(+), 92 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0107460..96cc258 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -76,7 +76,8 @@ OBJS-$(CONFIG_MPEGAUDIODSP)+= mpegaudiodsp.o  
  \
   mpegaudiodsp_fixed.o  \
   mpegaudiodsp_float.o
 OBJS-$(CONFIG_MPEGVIDEO)   += mpegvideo.o mpegvideodsp.o rl.o \
-  mpegvideo_motion.o mpegutils.o
+  mpegvideo_motion.o mpegutils.o \
+  mpegvideodata.o
 OBJS-$(CONFIG_MPEGVIDEOENC)+= mpegvideo_enc.o mpeg12data.o  \
   motion_est.o ratecontrol.o\
   mpegvideoencdsp.o
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index 0a6f268..7161794 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -23,6 +23,7 @@
 #include flv.h
 #include h263.h
 #include mpegvideo.h
+#include mpegvideodata.h
 
 void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last)
 {
diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index e14a105..f52f66a 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -21,6 +21,7 @@
 #include flv.h
 #include h263.h
 #include mpegvideo.h
+#include mpegvideodata.h
 
 void ff_flv_encode_picture_header(MpegEncContext *s, int picture_number)
 {
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index f24e590..ae61fc2 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -31,6 +31,7 @@
 #include mpegvideo.h
 #include h263.h
 #include h261.h
+#include mpegvideodata.h
 
 int ff_h261_get_picture_format(int width, int height)
 {
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index e34da5c..3f37489 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -20,6 +20,7 @@
 
 #include mpegvideo.h
 #include h263.h
+#include mpegvideodata.h
 
 /* don't understand why they choose a different header ! */
 int ff_intel_h263_decode_picture_header(MpegEncContext *s)
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 1f9ac27..8f69f0f 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -41,6 +41,7 @@
 #include unary.h
 #include flv.h
 #include mpeg4video.h
+#include mpegvideodata.h
 
 // The defines below define the number of bits that are read at once for
 // reading vlc values. Changing these may improve speed and data cache needs
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 3afc238..952e15c 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -32,6 +32,7 @@
 #include libavutil/attributes.h
 #include avcodec.h
 #include mpegvideo.h
+#include mpegvideodata.h
 #include h263.h
 #include mathops.h
 #include mpegutils.h
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 900761d..69c6d0a 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -32,6 +32,7 @@
 #include error_resilience.h
 #include mpeg12.h
 #include mpeg12data.h
+#include mpegvideodata.h
 #include bytestream.h
 #include thread.h
 
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c66d6aa..d4c517d 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -41,6 +41,7 @@
 #include mpeg12data.h
 #include mpegutils.h
 #include mpegvideo.h
+#include mpegvideodata.h
 #include thread.h
 #include version.h
 #include xvmc_internal.h
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 7e36170..eb71a86 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -25,6 +25,7 @@
 #include internal.h
 #include mpegutils.h
 #include mpegvideo.h
+#include mpegvideodata.h
 #include mpeg4video.h
 #include h263.h
 #include thread.h
diff --git a/libavcodec/mpegvideo.c 

[libav-commits] mpegvideo: wmv2: Move function declarations

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 2f15846ad7ad57beb0bca99c624affa0facf284b

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Vittorio Giovara vittorio.giov...@gmail.com
Date:  Fri May 29 19:44:01 2015 +0100

mpegvideo: wmv2: Move function declarations

---

 libavcodec/h263dec.c  |1 +
 libavcodec/mpegvideo.c|1 +
 libavcodec/mpegvideo.h|   11 ---
 libavcodec/mpegvideo_enc.c|1 +
 libavcodec/mpegvideo_motion.c |1 +
 libavcodec/msmpeg4.h  |1 -
 libavcodec/msmpeg4dec.c   |1 +
 libavcodec/wmv2.h |   14 ++
 8 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 0e08a8d..3d0d1de 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -39,6 +39,7 @@
 #include msmpeg4.h
 #include qpeldsp.h
 #include thread.h
+#include wmv2.h
 
 static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
 {
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4294eb6..49f2e66 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -44,6 +44,7 @@
 #include qpeldsp.h
 #include xvmc_internal.h
 #include thread.h
+#include wmv2.h
 #include limits.h
 
 static const uint8_t ff_default_chroma_qscale_table[32] = {
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 4eff4d9..9c226cc 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -851,17 +851,6 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s);
 int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
 int ff_msmpeg4_decode_init(AVCodecContext *avctx);
 int ff_msmpeg4_encode_init(MpegEncContext *s);
-int ff_wmv2_decode_picture_header(MpegEncContext * s);
-int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
-void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64], uint8_t *dest_y, 
uint8_t *dest_cb, uint8_t *dest_cr);
-void ff_mspel_motion(MpegEncContext *s,
-   uint8_t *dest_y, uint8_t *dest_cb, uint8_t 
*dest_cr,
-   uint8_t **ref_picture, op_pixels_func 
(*pix_op)[4],
-   int motion_x, int motion_y, int h);
-int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
-void ff_wmv2_encode_mb(MpegEncContext * s,
-   int16_t block[6][64],
-   int motion_x, int motion_y);
 
 int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src);
 void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *picture);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 15cca64..a477818 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -56,6 +56,7 @@
 #include mpeg4video.h
 #include internal.h
 #include bytestream.h
+#include wmv2.h
 #include limits.h
 
 #define QUANT_BIAS_SHIFT 8
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 95414d1..a25b251 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -31,6 +31,7 @@
 #include mjpegenc.h
 #include msmpeg4.h
 #include qpeldsp.h
+#include wmv2.h
 #include limits.h
 
 static void gmc1_motion(MpegEncContext *s,
diff --git a/libavcodec/msmpeg4.h b/libavcodec/msmpeg4.h
index 0a8ecd9..23138dc 100644
--- a/libavcodec/msmpeg4.h
+++ b/libavcodec/msmpeg4.h
@@ -54,7 +54,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * 
block,
 int n, int coded, const uint8_t *scan_table);
 int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
int16_t **dc_val_ptr, int *dir_ptr);
-int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]);
 
 #define CONFIG_MSMPEG4_DECODER (CONFIG_MSMPEG4V1_DECODER || \
 CONFIG_MSMPEG4V2_DECODER || \
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 2fc2de1..bc3cd76 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -32,6 +32,7 @@
 #include mpeg4video.h
 #include msmpeg4data.h
 #include vc1data.h
+#include wmv2.h
 
 #define DC_VLC_BITS 9
 #define V2_INTRA_CBPC_VLC_BITS 3
diff --git a/libavcodec/wmv2.h b/libavcodec/wmv2.h
index 03a8514..b77dd98 100644
--- a/libavcodec/wmv2.h
+++ b/libavcodec/wmv2.h
@@ -56,4 +56,18 @@ typedef struct Wmv2Context {
 
 void ff_wmv2_common_init(Wmv2Context *w);
 
+int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]);
+int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
+void ff_wmv2_encode_mb(MpegEncContext * s, int16_t block[6][64],
+   int motion_x, int motion_y);
+int ff_wmv2_decode_picture_header(MpegEncContext * s);
+int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
+void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64],
+uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
+
+void ff_mspel_motion(MpegEncContext *s,
+ uint8_t *dest_y, 

[libav-commits] mpegvideo: Move MotionEstContext and function declarations to a separate header

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 149fa0b7ac180fe1df48a2e379c560813555bf57

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Vittorio Giovara vittorio.giov...@gmail.com
Date:  Fri May 29 19:44:05 2015 +0100

mpegvideo: Move MotionEstContext and function declarations to a separate header

---

 libavcodec/motion_est.c |1 +
 libavcodec/motion_est.h |  128 +++
 libavcodec/mpegvideo.h  |   88 +---
 3 files changed, 130 insertions(+), 87 deletions(-)

diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index c51be8d..d0c0439 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -34,6 +34,7 @@
 #include avcodec.h
 #include internal.h
 #include mathops.h
+#include motion_est.h
 #include mpegutils.h
 #include mpegvideo.h
 
diff --git a/libavcodec/motion_est.h b/libavcodec/motion_est.h
new file mode 100644
index 000..cbfbbe8
--- /dev/null
+++ b/libavcodec/motion_est.h
@@ -0,0 +1,128 @@
+/*
+ * Motion estimation
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_MOTIONEST_H
+#define AVCODEC_MOTIONEST_H
+
+#include stdint.h
+
+#include avcodec.h
+#include hpeldsp.h
+#include qpeldsp.h
+
+struct MpegEncContext;
+
+#define MAX_MV 2048
+
+/**
+ * Motion estimation context.
+ */
+typedef struct MotionEstContext {
+AVCodecContext *avctx;
+int skip;   /// set if ME is skipped for the current 
MB
+int co_located_mv[4][2];/// mv from last P-frame for direct mode 
ME
+int direct_basis_mv[4][2];
+uint8_t *scratchpad;/** data area for the ME algo, so that
+ * the ME does not need to malloc/free. */
+uint8_t *best_mb;
+uint8_t *temp_mb[2];
+uint8_t *temp;
+int best_bits;
+uint32_t *map;  /// map to avoid duplicate evaluations
+uint32_t *score_map;/// map to store the scores
+unsigned map_generation;
+int pre_penalty_factor;
+int penalty_factor; /** an estimate of the bits required to
+ * code a given mv value, e.g. (1,0) takes
+ * more bits than (0,0). We have to
+ * estimate whether any reduction in
+ * residual is worth the extra bits. */
+int sub_penalty_factor;
+int mb_penalty_factor;
+int flags;
+int sub_flags;
+int mb_flags;
+int pre_pass;   /// = 1 for the pre pass
+int dia_size;
+int xmin;
+int xmax;
+int ymin;
+int ymax;
+int pred_x;
+int pred_y;
+uint8_t *src[4][4];
+uint8_t *ref[4][4];
+int stride;
+int uvstride;
+/* temp variables for picture complexity calculation */
+int mc_mb_var_sum_temp;
+int mb_var_sum_temp;
+int scene_change_score;
+
+op_pixels_func(*hpel_put)[4];
+op_pixels_func(*hpel_avg)[4];
+qpel_mc_func(*qpel_put)[16];
+qpel_mc_func(*qpel_avg)[16];
+uint8_t (*mv_penalty)[MAX_MV * 2 + 1]; /// bit amount needed to encode a 
MV
+uint8_t *current_mv_penalty;
+int (*sub_motion_search)(struct MpegEncContext *s,
+ int *mx_ptr, int *my_ptr, int dmin,
+ int src_index, int ref_index,
+ int size, int h);
+} MotionEstContext;
+
+static inline int ff_h263_round_chroma(int x)
+{
+//FIXME static or not?
+static const uint8_t h263_chroma_roundtab[16] = {
+//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
+0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
+};
+return h263_chroma_roundtab[x  0xf] + (x  3);
+}
+
+int ff_init_me(struct MpegEncContext *s);
+
+void ff_estimate_p_frame_motion(struct MpegEncContext *s, int mb_x, int mb_y);
+void ff_estimate_b_frame_motion(struct MpegEncContext *s, int mb_x, int mb_y);
+
+int ff_pre_estimate_p_frame_motion(struct MpegEncContext *s,
+   int mb_x, int mb_y);
+
+int ff_epzs_motion_search(struct MpegEncContext *s, int *mx_ptr, int *my_ptr,
+  int P[10][2], int src_index, int ref_index,
+  int16_t 

[libav-commits] mpegvideo: mpeg12: Move function declarations

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: b2b766914a49c4e3537df3a585e97b98d432edd2

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Vittorio Giovara vittorio.giov...@gmail.com
Date:  Fri May 29 19:44:04 2015 +0100

mpegvideo: mpeg12: Move function declarations

---

 libavcodec/mpeg12.h|6 ++
 libavcodec/mpegvideo.h |7 ---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index 9132dc3..4c1578f 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -71,4 +71,10 @@ int ff_mpeg1_decode_block_intra(MpegEncContext *s, int16_t 
*block, int n);
 void ff_mpeg1_clean_buffers(MpegEncContext *s);
 int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size, AVCodecParserContext *s);
 
+void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
+int motion_x, int motion_y);
+void ff_mpeg1_encode_init(MpegEncContext *s);
+void ff_mpeg1_encode_slice_header(MpegEncContext *s);
+
 #endif /* AVCODEC_MPEG12_H */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 7fd4f11..bb27d06 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -817,13 +817,6 @@ int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, 
int *my_ptr,
 int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
int ref_index, int size, int h, int add_rate);
 
-void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
-void ff_mpeg1_encode_mb(MpegEncContext *s,
-int16_t block[8][64],
-int motion_x, int motion_y);
-void ff_mpeg1_encode_init(MpegEncContext *s);
-void ff_mpeg1_encode_slice_header(MpegEncContext *s);
-
 extern const uint8_t ff_aic_dc_scale_table[32];
 extern const uint8_t ff_h263_chroma_qscale_table[32];
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] vp9: Parse subsampling and report missing feature

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 3f38d4b816b2aeca15c0b9ea7ed40377eb0c

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Vittorio Giovara vittorio.giov...@gmail.com
Date:  Wed May 27 15:06:57 2015 +0100

vp9: Parse subsampling and report missing feature

---

 libavcodec/vp9.c |   24 +++-
 libavcodec/vp9.h |2 ++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 50b84ae..b9397f5 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -219,7 +219,29 @@ static int decode_frame_header(AVCodecContext *avctx,
 return AVERROR_INVALIDDATA;
 }
 s-fullrange = get_bits1(s-gb);
-// for profile 1, here follows the subsampling bits
+
+// subsampling bits
+if (s-profile == 1 || s-profile == 3) {
+s-sub_x = get_bits1(s-gb);
+s-sub_y = get_bits1(s-gb);
+if (s-sub_x  s-sub_y) {
+av_log(avctx, AV_LOG_ERROR,
+   4:2:0 color not supported in profile 1 or 3\n);
+return AVERROR_INVALIDDATA;
+}
+if (get_bits1(s-gb)) { // reserved bit
+av_log(avctx, AV_LOG_ERROR, Reserved bit should be zero\n);
+return AVERROR_INVALIDDATA;
+}
+} else {
+s-sub_x = s-sub_y = 1;
+}
+if (!s-sub_x || !s-sub_y) {
+avpriv_report_missing_feature(avctx, Subsampling %d:%d,
+  s-sub_x, s-sub_y);
+return AVERROR_PATCHWELCOME;
+}
+
 s-refreshrefmask = 0xff;
 w = get_bits(s-gb, 16) + 1;
 h = get_bits(s-gb, 16) + 1;
diff --git a/libavcodec/vp9.h b/libavcodec/vp9.h
index 724288d..c6f395e 100644
--- a/libavcodec/vp9.h
+++ b/libavcodec/vp9.h
@@ -277,6 +277,8 @@ typedef struct VP9Context {
 uint8_t use_last_frame_mvs;
 uint8_t errorres;
 uint8_t colorspace;
+uint8_t sub_x;
+uint8_t sub_y;
 uint8_t fullrange;
 uint8_t intraonly;
 uint8_t resetctx;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] dxva2_hevc: fix 32x32 scaling lists

2015-05-31 Thread Hendrik Leppkes
Module: libav
Branch: master
Commit: 35818b8aaf4d669ed0bbb05c3fd06e619f2db01a

Author:Hendrik Leppkes h.lepp...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Thu May 28 18:25:36 2015 +0200

dxva2_hevc: fix 32x32 scaling lists

Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavcodec/dxva2_hevc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index 9d130d9..a2abb97 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -209,12 +209,12 @@ static void fill_scaling_lists(AVDXVAContext *ctx, const 
HEVCContext *h, DXVA_Qm
 qm-ucScalingLists2[i][j] = sl-sl[2][i][pos];
 
 if (i  2)
-qm-ucScalingLists3[i][j] = sl-sl[3][i][pos];
+qm-ucScalingLists3[i][j] = sl-sl[3][i * 3][pos];
 }
 
 qm-ucScalingListDCCoefSizeID2[i] = sl-sl_dc[0][i];
 if (i  2)
-qm-ucScalingListDCCoefSizeID3[i] = sl-sl_dc[1][i];
+qm-ucScalingListDCCoefSizeID3[i] = sl-sl_dc[1][i * 3];
 }
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x86: check for AV_CPU_FLAG_AVXSLOW where useful

2015-05-31 Thread James Almer
Module: libav
Branch: master
Commit: d68c05380cebf563915412182643a8be04ef890b

Author:James Almer jamr...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:29:08 2015 -0300

x86: check for AV_CPU_FLAG_AVXSLOW where useful

Signed-off-by: James Almer jamr...@gmail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavcodec/x86/dcadsp_init.c   |4 ++--
 libavcodec/x86/dct_init.c  |2 +-
 libavcodec/x86/fft_init.c  |2 +-
 libavfilter/x86/af_volume_init.c   |2 +-
 libavresample/x86/audio_convert_init.c |4 +++-
 libavresample/x86/audio_mix_init.c |4 +++-
 libavresample/x86/dither_init.c|4 ++--
 libavutil/x86/float_dsp_init.c |2 +-
 libavutil/x86/lls_init.c   |2 +-
 9 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c
index 9acb818..7c2bec1 100644
--- a/libavcodec/x86/dcadsp_init.c
+++ b/libavcodec/x86/dcadsp_init.c
@@ -98,10 +98,10 @@ av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
 if (EXTERNAL_SSE2(cpu_flags)) {
 s-synth_filter_float = synth_filter_sse2;
 }
-if (EXTERNAL_AVX(cpu_flags)) {
+if (EXTERNAL_AVX_FAST(cpu_flags)) {
 s-synth_filter_float = synth_filter_avx;
 }
-if (EXTERNAL_FMA3(cpu_flags)) {
+if (EXTERNAL_FMA3(cpu_flags)  !(cpu_flags  AV_CPU_FLAG_AVXSLOW)) {
 s-synth_filter_float = synth_filter_fma3;
 }
 #endif /* HAVE_YASM */
diff --git a/libavcodec/x86/dct_init.c b/libavcodec/x86/dct_init.c
index 7bda5e8..ca9fbc7 100644
--- a/libavcodec/x86/dct_init.c
+++ b/libavcodec/x86/dct_init.c
@@ -34,6 +34,6 @@ av_cold void ff_dct_init_x86(DCTContext *s)
 s-dct32 = ff_dct32_float_sse;
 if (EXTERNAL_SSE2(cpu_flags))
 s-dct32 = ff_dct32_float_sse2;
-if (EXTERNAL_AVX(cpu_flags))
+if (EXTERNAL_AVX_FAST(cpu_flags))
 s-dct32 = ff_dct32_float_avx;
 }
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c
index 7ca72c5..5c0273d 100644
--- a/libavcodec/x86/fft_init.c
+++ b/libavcodec/x86/fft_init.c
@@ -48,7 +48,7 @@ av_cold void ff_fft_init_x86(FFTContext *s)
 s-fft_calc= ff_fft_calc_sse;
 s-fft_permutation = FF_FFT_PERM_SWAP_LSBS;
 }
-if (EXTERNAL_AVX(cpu_flags)  s-nbits = 5) {
+if (EXTERNAL_AVX_FAST(cpu_flags)  s-nbits = 5) {
 /* AVX for SB */
 s-imdct_half  = ff_imdct_half_avx;
 s-fft_calc= ff_fft_calc_avx;
diff --git a/libavfilter/x86/af_volume_init.c b/libavfilter/x86/af_volume_init.c
index c59e0ed..26605fb 100644
--- a/libavfilter/x86/af_volume_init.c
+++ b/libavfilter/x86/af_volume_init.c
@@ -52,7 +52,7 @@ av_cold void ff_volume_init_x86(VolumeContext *vol)
 vol-scale_samples = ff_scale_samples_s32_ssse3_atom;
 vol-samples_align = 4;
 }
-if (EXTERNAL_AVX(cpu_flags)) {
+if (EXTERNAL_AVX_FAST(cpu_flags)) {
 vol-scale_samples = ff_scale_samples_s32_avx;
 vol-samples_align = 8;
 }
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index d85ca84..ae6c319 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -226,11 +226,13 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
   6, 16, 4, SSE4, 
ff_conv_fltp_to_flt_6ch_sse4);
 }
-if (EXTERNAL_AVX(cpu_flags)) {
+if (EXTERNAL_AVX_FAST(cpu_flags)) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
   0, 32, 16, AVX, ff_conv_s32_to_flt_avx);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
   0, 32, 32, AVX, ff_conv_flt_to_s32_avx);
+}
+if (EXTERNAL_AVX(cpu_flags)) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
   2, 16, 16, AVX, 
ff_conv_s16p_to_s16_2ch_avx);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
diff --git a/libavresample/x86/audio_mix_init.c 
b/libavresample/x86/audio_mix_init.c
index 7fc530e..e14a540 100644
--- a/libavresample/x86/audio_mix_init.c
+++ b/libavresample/x86/audio_mix_init.c
@@ -195,11 +195,13 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am)
 ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
   1, 2, 16, 8, SSE4, 
ff_mix_1_to_2_s16p_flt_sse4);
 }
-if (EXTERNAL_AVX(cpu_flags)) {
+if (EXTERNAL_AVX_FAST(cpu_flags)) {
 ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
   2, 1, 32, 16, AVX, ff_mix_2_to_1_fltp_flt_avx);
 ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
   

[libav-commits] ppc: Clarify and extend the cpuid check

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: 3058872c293e239e3b51e86fe18cfbe720aadff1

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 00:49:51 2015 +0200

ppc: Clarify and extend the cpuid check

Add POWER entries.

---

 libavutil/ppc/cpu.c |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 2ceb88a..27a2853 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -94,15 +94,30 @@ out:
 close(fd);
 return ret;
 #elif CONFIG_RUNTIME_CPUDETECT
+#define PVR_G4_7400  0x000C
+#define PVR_G5_970   0x0039
+#define PVR_G5_970FX 0x003C
+#define PVR_G5_970MP 0x0044
+#define PVR_G5_970GX 0x0045
+#define PVR_POWER6   0x003E
+#define PVR_POWER7   0x003F
+#define PVR_POWER8   0x004B
+#define PVR_CELL_PPU 0x0070
+
 int proc_ver;
 // Support of mfspr PVR emulation added in Linux 2.6.17.
 __asm__ volatile(mfspr %0, 287 : =r (proc_ver));
 proc_ver = 16;
 if (proc_ver   0x8000 ||
-proc_ver == 0x000c ||
-proc_ver == 0x0039 || proc_ver == 0x003c ||
-proc_ver == 0x0044 || proc_ver == 0x0045 ||
-proc_ver == 0x0070)
+proc_ver == PVR_G4_7400  ||
+proc_ver == PVR_G5_970   ||
+proc_ver == PVR_G5_970FX ||
+proc_ver == PVR_G5_970MP ||
+proc_ver == PVR_G5_970GX ||
+proc_ver == PVR_POWER6   ||
+proc_ver == PVR_POWER7   ||
+proc_ver == PVR_POWER8   ||
+proc_ver == PVR_CELL_PPU)
 return AV_CPU_FLAG_ALTIVEC;
 return 0;
 #else

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ppc: avutil: Use the abriged vector types

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: 72cebae0d981dde144340cf51f3c323f01e215e5

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 04:37:50 2015 +0200

ppc: avutil: Use the abriged vector types

---

 libavutil/ppc/float_dsp_altivec.c |   18 +-
 libavutil/ppc/util_altivec.h  |   16 
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavutil/ppc/float_dsp_altivec.c 
b/libavutil/ppc/float_dsp_altivec.c
index fee4e7c..f6918e1 100644
--- a/libavutil/ppc/float_dsp_altivec.c
+++ b/libavutil/ppc/float_dsp_altivec.c
@@ -25,7 +25,7 @@ void ff_vector_fmul_altivec(float *dst, const float *src0, 
const float *src1,
 int len)
 {
 int i;
-vector float d0, d1, s, zero = (vector float)vec_splat_u32(0);
+vec_f d0, d1, s, zero = (vec_f)vec_splat_u32(0);
 for (i = 0; i  len - 7; i += 8) {
 d0 = vec_ld( 0, src0 + i);
 s  = vec_ld( 0, src1 + i);
@@ -40,15 +40,15 @@ void ff_vector_fmul_altivec(float *dst, const float *src0, 
const float *src1,
 void ff_vector_fmul_window_altivec(float *dst, const float *src0,
const float *src1, const float *win, int 
len)
 {
-vector float zero, t0, t1, s0, s1, wi, wj;
-const vector unsigned char reverse = vcprm(3, 2, 1, 0);
+vec_f zero, t0, t1, s0, s1, wi, wj;
+const vec_u8 reverse = vcprm(3, 2, 1, 0);
 int i, j;
 
 dst  += len;
 win  += len;
 src0 += len;
 
-zero = (vector float)vec_splat_u32(0);
+zero = (vec_f)vec_splat_u32(0);
 
 for (i = -len * 4, j = len * 4 - 16; i  0; i += 16, j -= 16) {
 s0 = vec_ld(i, src0);
@@ -75,9 +75,9 @@ void ff_vector_fmul_add_altivec(float *dst, const float *src0,
 int len)
 {
 int i;
-vector float d, s0, s1, s2, t0, t1, edges;
-vector unsigned char align = vec_lvsr(0,dst),
- mask = vec_lvsl(0, dst);
+vec_f d, s0, s1, s2, t0, t1, edges;
+vec_u8  align = vec_lvsr(0, dst);
+vec_u8  mask  = vec_lvsl(0, dst);
 
 for (i = 0; i  len - 3; i += 4) {
 t0 = vec_ld(0, dst + i);
@@ -98,8 +98,8 @@ void ff_vector_fmul_reverse_altivec(float *dst, const float 
*src0,
 const float *src1, int len)
 {
 int i;
-vector float d, s0, s1, h0, l0,
-s2, s3, zero = (vector float) vec_splat_u32(0);
+vec_f d, s0, s1, h0, l0, s2, s3;
+vec_f zero = (vec_f)vec_splat_u32(0);
 
 src1 += len-4;
 for(i = 0; i  len - 7; i += 8) {
diff --git a/libavutil/ppc/util_altivec.h b/libavutil/ppc/util_altivec.h
index 5624ac5..8b31327 100644
--- a/libavutil/ppc/util_altivec.h
+++ b/libavutil/ppc/util_altivec.h
@@ -47,14 +47,14 @@
 #define WORD_s2 0x18,0x19,0x1a,0x1b
 #define WORD_s3 0x1c,0x1d,0x1e,0x1f
 
-#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, 
WORD_ ## c, WORD_ ## d}
+#define vcprm(a,b,c,d) (const vec_u8){WORD_ ## a, WORD_ ## b, WORD_ ## c, 
WORD_ ## d}
 
 
 // Transpose 8x8 matrix of 16-bit elements (in-place)
 #define TRANSPOSE8(a,b,c,d,e,f,g,h) \
 do { \
-vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \
-vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \
+vec_s16 A1, B1, C1, D1, E1, F1, G1, H1; \
+vec_s16 A2, B2, C2, D2, E2, F2, G2, H2; \
  \
 A1 = vec_mergeh (a, e); \
 B1 = vec_mergel (a, e); \
@@ -87,11 +87,11 @@ do { \
 
 /** @brief loads unaligned vector @a *src with offset @a offset
 and returns it */
-static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
+static inline vec_u8 unaligned_load(int offset, uint8_t *src)
 {
-register vector unsigned char first = vec_ld(offset, src);
-register vector unsigned char second = vec_ld(offset+15, src);
-register vector unsigned char mask = vec_lvsl(offset, src);
+register vec_u8 first = vec_ld(offset, src);
+register vec_u8 second = vec_ld(offset + 15, src);
+register vec_u8 mask = vec_lvsl(offset, src);
 return vec_perm(first, second, mask);
 }
 
@@ -102,7 +102,7 @@ static inline vector unsigned char unaligned_load(int 
offset, uint8_t *src)
 static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 
perm_vec)
 {
 vec_u8 a = vec_ld(offset, src);
-vec_u8 b = vec_ld(offset+15, src);
+vec_u8 b = vec_ld(offset + 15, src);
 return vec_perm(a, b, perm_vec);
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x86: add AV_CPU_FLAG_AVXSLOW flag

2015-05-31 Thread James Almer
Module: libav
Branch: master
Commit: f7cafb5d02aa3f26c185f6f9851413ad77a73872

Author:James Almer jamr...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:29:06 2015 -0300

x86: add AV_CPU_FLAG_AVXSLOW flag

Signed-off-by: James Almer jamr...@gmail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 doc/APIchanges  |3 +++
 libavutil/cpu.c |3 +++
 libavutil/cpu.h |1 +
 libavutil/version.h |4 ++--
 libavutil/x86/cpu.c |   17 ++---
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5d39ec6..2c443b0 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - xxx - lavu 54.14.0 - cpu.h
+  Add AV_CPU_FLAG_AVXSLOW.
+
 2015-xx-xx - xxx - lavc 56.23.0
   Add av_vda_default_init2.
 
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 4e8ef61..e24b9dd 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -86,6 +86,7 @@ int av_parse_cpu_flags(const char *s)
 #define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3)
 #define CPUFLAG_SSE42(AV_CPU_FLAG_SSE42| CPUFLAG_SSE4)
 #define CPUFLAG_AVX  (AV_CPU_FLAG_AVX  | CPUFLAG_SSE42)
+#define CPUFLAG_AVXSLOW  (AV_CPU_FLAG_AVXSLOW  | CPUFLAG_AVX)
 #define CPUFLAG_XOP  (AV_CPU_FLAG_XOP  | CPUFLAG_AVX)
 #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX)
 #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
@@ -108,6 +109,7 @@ int av_parse_cpu_flags(const char *s)
 { sse4.1  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4
 },.unit = flags },
 { sse4.2  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42   
 },.unit = flags },
 { avx , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX 
 },.unit = flags },
+{ avxslow , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVXSLOW 
 },.unit = flags },
 { xop , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP 
 },.unit = flags },
 { fma3, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3
 },.unit = flags },
 { fma4, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4
 },.unit = flags },
@@ -219,6 +221,7 @@ static const struct {
 { AV_CPU_FLAG_SSE4,  sse4.1 },
 { AV_CPU_FLAG_SSE42, sse4.2 },
 { AV_CPU_FLAG_AVX,   avx},
+{ AV_CPU_FLAG_AVXSLOW,   avxslow},
 { AV_CPU_FLAG_XOP,   xop},
 { AV_CPU_FLAG_FMA3,  fma3   },
 { AV_CPU_FLAG_FMA4,  fma4   },
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index d7fdf26..67a1abc 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -45,6 +45,7 @@
 #define AV_CPU_FLAG_SSE4 0x0100 /// Penryn SSE4.1 functions
 #define AV_CPU_FLAG_SSE420x0200 /// Nehalem SSE4.2 functions
 #define AV_CPU_FLAG_AVX  0x4000 /// AVX functions: requires OS 
support even if YMM registers aren't used
+#define AV_CPU_FLAG_AVXSLOW   0x800 /// AVX supported, but slow when 
using YMM registers (e.g. Bulldozer)
 #define AV_CPU_FLAG_XOP  0x0400 /// Bulldozer XOP functions
 #define AV_CPU_FLAG_FMA4 0x0800 /// Bulldozer FMA4 functions
 #define AV_CPU_FLAG_CMOV 0x1000 /// i686 cmov
diff --git a/libavutil/version.h b/libavutil/version.h
index 13bb6f0..c3342cd 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,8 +54,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 54
-#define LIBAVUTIL_VERSION_MINOR 13
-#define LIBAVUTIL_VERSION_MICRO  1
+#define LIBAVUTIL_VERSION_MINOR 14
+#define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 8be6d94..098ccf7 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -167,6 +167,7 @@ int ff_get_cpu_flags_x86(void)
 if (ext_caps  (1  22))
 rval |= AV_CPU_FLAG_MMXEXT;
 
+if (!strncmp(vendor.c, AuthenticAMD, 12)) {
 /* Allow for selectively disabling SSE2 functions on AMD processors
with SSE2 support but not SSE4a. This includes Athlon64, some
Opteron, and some Sempron processors. MMX, SSE, or 3DNow! are faster
@@ -174,9 +175,19 @@ int ff_get_cpu_flags_x86(void)
AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case
so that SSE2 is used unless explicitly disabled by checking
AV_CPU_FLAG_SSE2SLOW. */
-if (!strncmp(vendor.c, AuthenticAMD, 12) 
-rval  AV_CPU_FLAG_SSE2  !(ecx  0x0040)) {
-rval |= AV_CPU_FLAG_SSE2SLOW;
+if (rval  AV_CPU_FLAG_SSE2  !(ecx  0x0040))
+rval |= AV_CPU_FLAG_SSE2SLOW;
+
+/* Similar to the above but for AVX functions on AMD processors.
+   This is 

[libav-commits] ppc: avutil: Drop a potentially dangerous workaround

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: 254eb5b6faebb7bcfc3cefc1edced6652fe9d5be

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 22:48:30 2015 +0200

ppc: avutil: Drop a potentially dangerous workaround

The compiler is free to optimize such expressions in any sort of way.

---

 libavutil/ppc/intreadwrite.h |   14 --
 1 file changed, 14 deletions(-)

diff --git a/libavutil/ppc/intreadwrite.h b/libavutil/ppc/intreadwrite.h
index 4471c6a..8f8078d 100644
--- a/libavutil/ppc/intreadwrite.h
+++ b/libavutil/ppc/intreadwrite.h
@@ -24,20 +24,6 @@
 #include stdint.h
 #include config.h
 
-/*
- * -O0 would compile the packed struct version, which is used by
- * default, in an overly verbose fashion, so we override it here.
- */
-#if HAVE_BIGENDIAN
-#define AV_RB64(p) (*(const uint64_t *)(p))
-#define AV_WB64(p, v) (*(uint64_t *)(p) = (v))
-
-#else
-#define AV_RL64(p) (*(const uint64_t *)(p))
-#define AV_WL64(p, v) (*(uint64_t *)(p) = (v))
-
-#endif
-
 #if HAVE_XFORM_ASM
 
 #if HAVE_BIGENDIAN

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ppc: pixblockdsp: Use the abriged vector types

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: 7014b65995b1fe6188fb53447bf61b08e3963355

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 12 00:45:37 2015 +0200

ppc: pixblockdsp: Use the abriged vector types

---

 libavcodec/ppc/pixblockdsp.c |   43 --
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/libavcodec/ppc/pixblockdsp.c b/libavcodec/ppc/pixblockdsp.c
index 698d655..a500a70 100644
--- a/libavcodec/ppc/pixblockdsp.c
+++ b/libavcodec/ppc/pixblockdsp.c
@@ -39,24 +39,22 @@ static void get_pixels_altivec(int16_t *restrict block, 
const uint8_t *pixels,
int line_size)
 {
 int i;
-vector unsigned char perm = vec_lvsl(0, pixels);
-const vector unsigned char zero =
-(const vector unsigned char) vec_splat_u8(0);
+vec_u8 perm = vec_lvsl(0, pixels);
+const vec_u8 zero = (const vec_u8)vec_splat_u8(0);
 
 for (i = 0; i  8; i++) {
 /* Read potentially unaligned pixels.
  * We're reading 16 pixels, and actually only want 8,
  * but we simply ignore the extras. */
-vector unsigned char pixl = vec_ld(0, pixels);
-vector unsigned char pixr = vec_ld(7, pixels);
-vector unsigned char bytes = vec_perm(pixl, pixr, perm);
+vec_u8 pixl = vec_ld(0, pixels);
+vec_u8 pixr = vec_ld(7, pixels);
+vec_u8 bytes = vec_perm(pixl, pixr, perm);
 
 // Convert the bytes into shorts.
-vector signed short shorts = (vector signed short) vec_mergeh(zero,
-  bytes);
+vec_s16 shorts = (vec_s16)vec_mergeh(zero, bytes);
 
 // Save the data to the block, we assume the block is 16-byte aligned.
-vec_st(shorts, i * 16, (vector signed short *) block);
+vec_st(shorts, i * 16, (vec_s16 *)block);
 
 pixels += line_size;
 }
@@ -66,22 +64,21 @@ static void diff_pixels_altivec(int16_t *restrict block, 
const uint8_t *s1,
 const uint8_t *s2, int stride)
 {
 int i;
-vector unsigned char perm1 = vec_lvsl(0, s1);
-vector unsigned char perm2 = vec_lvsl(0, s2);
-const vector unsigned char zero =
-(const vector unsigned char) vec_splat_u8(0);
-vector signed short shorts1, shorts2;
+vec_u8 perm1 = vec_lvsl(0, s1);
+vec_u8 perm2 = vec_lvsl(0, s2);
+const vec_u8 zero = (const vec_u8)vec_splat_u8(0);
+vec_s16 shorts1, shorts2;
 
 for (i = 0; i  4; i++) {
 /* Read potentially unaligned pixels.
  * We're reading 16 pixels, and actually only want 8,
  * but we simply ignore the extras. */
-vector unsigned char pixl  = vec_ld(0,  s1);
-vector unsigned char pixr  = vec_ld(15, s1);
-vector unsigned char bytes = vec_perm(pixl, pixr, perm1);
+vec_u8 pixl  = vec_ld(0,  s1);
+vec_u8 pixr  = vec_ld(15, s1);
+vec_u8 bytes = vec_perm(pixl, pixr, perm1);
 
 // Convert the bytes into shorts.
-shorts1 = (vector signed short) vec_mergeh(zero, bytes);
+shorts1 = (vec_s16)vec_mergeh(zero, bytes);
 
 // Do the same for the second block of pixels.
 pixl  = vec_ld(0,  s2);
@@ -89,13 +86,13 @@ static void diff_pixels_altivec(int16_t *restrict block, 
const uint8_t *s1,
 bytes = vec_perm(pixl, pixr, perm2);
 
 // Convert the bytes into shorts.
-shorts2 = (vector signed short) vec_mergeh(zero, bytes);
+shorts2 = (vec_s16)vec_mergeh(zero, bytes);
 
 // Do the subtraction.
 shorts1 = vec_sub(shorts1, shorts2);
 
 // Save the data to the block, we assume the block is 16-byte aligned.
-vec_st(shorts1, 0, (vector signed short *) block);
+vec_st(shorts1, 0, (vec_s16 *)block);
 
 s1+= stride;
 s2+= stride;
@@ -112,7 +109,7 @@ static void diff_pixels_altivec(int16_t *restrict block, 
const uint8_t *s1,
 bytes = vec_perm(pixl, pixr, perm1);
 
 // Convert the bytes into shorts.
-shorts1 = (vector signed short) vec_mergeh(zero, bytes);
+shorts1 = (vec_s16)vec_mergeh(zero, bytes);
 
 // Do the same for the second block of pixels.
 pixl  = vec_ld(0,  s2);
@@ -120,13 +117,13 @@ static void diff_pixels_altivec(int16_t *restrict block, 
const uint8_t *s1,
 bytes = vec_perm(pixl, pixr, perm2);
 
 // Convert the bytes into shorts.
-shorts2 = (vector signed short) vec_mergeh(zero, bytes);
+shorts2 = (vec_s16)vec_mergeh(zero, bytes);
 
 // Do the subtraction.
 shorts1 = vec_sub(shorts1, shorts2);
 
 // Save the data to the block, we assume the block is 16-byte aligned.
-vec_st(shorts1, 0, (vector signed short *) block);
+vec_st(shorts1, 0, (vec_s16 *)block);
 
 s1+= stride;
 s2+= stride;


[libav-commits] ppc: vsx: Implement diff_pixels and get_pixels

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: d0bf20a4f25ac5de021c860a0c8ad05638ee2078

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 12 02:38:56 2015 +0200

ppc: vsx: Implement diff_pixels and get_pixels

Use a macro to abstract the endianness.

---

 libavcodec/ppc/pixblockdsp.c |   44 ++
 libavutil/ppc/util_altivec.h |   12 
 2 files changed, 56 insertions(+)

diff --git a/libavcodec/ppc/pixblockdsp.c b/libavcodec/ppc/pixblockdsp.c
index 2c28e29..9cac70e 100644
--- a/libavcodec/ppc/pixblockdsp.c
+++ b/libavcodec/ppc/pixblockdsp.c
@@ -133,6 +133,40 @@ static void diff_pixels_altivec(int16_t *restrict block, 
const uint8_t *s1,
 
 #endif /* HAVE_ALTIVEC */
 
+#if HAVE_VSX
+static void get_pixels_vsx(int16_t *restrict block, const uint8_t *pixels,
+   int line_size)
+{
+int i;
+for (i = 0; i  8; i++) {
+vec_s16 shorts = vsx_ld_u8_s16(0, pixels);
+
+vec_vsx_st(shorts, i * 16, block);
+
+pixels += line_size;
+}
+}
+
+static void diff_pixels_vsx(int16_t *restrict block, const uint8_t *s1,
+const uint8_t *s2, int stride)
+{
+int i;
+vec_s16 shorts1, shorts2;
+for (i = 0; i  8; i++) {
+shorts1 = vsx_ld_u8_s16(0, s1);
+shorts2 = vsx_ld_u8_s16(0, s2);
+
+shorts1 = vec_sub(shorts1, shorts2);
+
+vec_vsx_st(shorts1, 0, block);
+
+s1+= stride;
+s2+= stride;
+block += 8;
+}
+}
+#endif /* HAVE_VSX */
+
 av_cold void ff_pixblockdsp_init_ppc(PixblockDSPContext *c,
  AVCodecContext *avctx,
  unsigned high_bit_depth)
@@ -147,4 +181,14 @@ av_cold void ff_pixblockdsp_init_ppc(PixblockDSPContext *c,
 c-get_pixels = get_pixels_altivec;
 }
 #endif /* HAVE_ALTIVEC */
+
+#if HAVE_VSX
+if (!PPC_VSX(av_get_cpu_flags()))
+return;
+
+c-diff_pixels = diff_pixels_vsx;
+
+if (!high_bit_depth)
+c-get_pixels = get_pixels_vsx;
+#endif /* HAVE_VSX */
 }
diff --git a/libavutil/ppc/util_altivec.h b/libavutil/ppc/util_altivec.h
index 8b31327..02cff18 100644
--- a/libavutil/ppc/util_altivec.h
+++ b/libavutil/ppc/util_altivec.h
@@ -111,4 +111,16 @@ static inline vec_u8 load_with_perm_vec(int offset, 
uint8_t *src, vec_u8 perm_ve
 
 #endif /* HAVE_ALTIVEC */
 
+#if HAVE_VSX
+#if HAVE_BIGENDIAN
+#define vsx_ld_u8_s16(off, p)   \
+((vec_s16)vec_mergeh((vec_u8)vec_splat_u8(0),   \
+ (vec_u8)vec_vsx_ld((off), (p
+#else
+#define vsx_ld_u8_s16(off, p)   \
+((vec_s16)vec_mergeh((vec_u8)vec_vsx_ld((off), (p)),\
+ (vec_u8)vec_splat_u8(0)))
+#endif /* HAVE_BIGENDIAN */
+#endif /* HAVE_VSX */
+
 #endif /* AVUTIL_PPC_UTIL_ALTIVEC_H */

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ppc: Restrict some Altivec implementations to Big Endian

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: da60b99a8857d5ca236f32c1799a066e0135a866

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 23:22:17 2015 +0200

ppc: Restrict some Altivec implementations to Big Endian

In Little Endian the vec_ld/vec_st operations work as
expected only for byte-vectors.

---

 libavcodec/ppc/apedsp_altivec.c   |4 ++--
 libavcodec/ppc/audiodsp.c |4 ++--
 libavcodec/ppc/dct-test.c |2 +-
 libavcodec/ppc/fdctdsp.c  |4 ++--
 libavcodec/ppc/fft_init.c |4 ++--
 libavcodec/ppc/fmtconvert_altivec.c   |4 ++--
 libavcodec/ppc/h264chroma_init.c  |4 ++--
 libavcodec/ppc/h264dsp.c  |4 ++--
 libavcodec/ppc/h264qpel.c |4 ++--
 libavcodec/ppc/hpeldsp_altivec.c  |4 ++--
 libavcodec/ppc/huffyuvdsp_altivec.c   |4 ++--
 libavcodec/ppc/idctdsp.c  |4 ++--
 libavcodec/ppc/me_cmp.c   |4 ++--
 libavcodec/ppc/mpegaudiodsp_altivec.c |4 ++--
 libavcodec/ppc/mpegvideo_altivec.c|4 ++--
 libavcodec/ppc/mpegvideodsp.c |4 ++--
 libavcodec/ppc/mpegvideoencdsp.c  |4 ++--
 libavcodec/ppc/pixblockdsp.c  |4 ++--
 libavcodec/ppc/svq1enc_altivec.c  |4 ++--
 libavcodec/ppc/vc1dsp_altivec.c   |4 ++--
 libavcodec/ppc/vorbisdsp_altivec.c|4 ++--
 libavcodec/ppc/vp3dsp_altivec.c   |4 ++--
 libavcodec/ppc/vp8dsp_altivec.c   |4 ++--
 libavutil/ppc/float_dsp_init.c|3 ++-
 libswscale/ppc/swscale_altivec.c  |2 +-
 25 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/libavcodec/ppc/apedsp_altivec.c b/libavcodec/ppc/apedsp_altivec.c
index d8bf4bd..3b9d045 100644
--- a/libavcodec/ppc/apedsp_altivec.c
+++ b/libavcodec/ppc/apedsp_altivec.c
@@ -29,7 +29,7 @@
 #include libavutil/ppc/types_altivec.h
 #include libavcodec/apedsp.h
 
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1,
 const int16_t *v2,
 const int16_t *v3,
@@ -73,7 +73,7 @@ static int32_t scalarproduct_and_madd_int16_altivec(int16_t 
*v1,
 
 av_cold void ff_apedsp_init_ppc(APEDSPContext *c)
 {
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 if (!PPC_ALTIVEC(av_get_cpu_flags()))
 return;
 
diff --git a/libavcodec/ppc/audiodsp.c b/libavcodec/ppc/audiodsp.c
index 36506ce..2a0a6d8 100644
--- a/libavcodec/ppc/audiodsp.c
+++ b/libavcodec/ppc/audiodsp.c
@@ -35,7 +35,7 @@
 #include libavutil/ppc/util_altivec.h
 #include libavcodec/audiodsp.h
 
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 
 static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t 
*v2,
int order)
@@ -63,7 +63,7 @@ static int32_t scalarproduct_int16_altivec(const int16_t *v1, 
const int16_t *v2,
 
 av_cold void ff_audiodsp_init_ppc(AudioDSPContext *c)
 {
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 if (!PPC_ALTIVEC(av_get_cpu_flags()))
 return;
 
diff --git a/libavcodec/ppc/dct-test.c b/libavcodec/ppc/dct-test.c
index 37fd8bb..2acbe2a 100644
--- a/libavcodec/ppc/dct-test.c
+++ b/libavcodec/ppc/dct-test.c
@@ -21,7 +21,7 @@
 #include fdct.h
 
 static const struct algo fdct_tab_arch[] = {
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 { altivecfdct, ff_fdct_altivec, FF_IDCT_PERM_NONE, AV_CPU_FLAG_ALTIVEC },
 #endif
 { 0 }
diff --git a/libavcodec/ppc/fdctdsp.c b/libavcodec/ppc/fdctdsp.c
index 51417a5..89ceb47 100644
--- a/libavcodec/ppc/fdctdsp.c
+++ b/libavcodec/ppc/fdctdsp.c
@@ -29,7 +29,7 @@
 #include libavcodec/fdctdsp.h
 #include fdct.h
 
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 
 #define vs16(v)   ((vector signed short) (v))
 #define vs32(v) ((vector signed int) (v))
@@ -465,7 +465,7 @@ void ff_fdct_altivec(int16_t *block)
 av_cold void ff_fdctdsp_init_ppc(FDCTDSPContext *c, AVCodecContext *avctx,
  unsigned high_bit_depth)
 {
-#if HAVE_ALTIVEC
+#if HAVE_ALTIVEC  HAVE_BIGENDIAN
 if (!PPC_ALTIVEC(av_get_cpu_flags()))
 return;
 
diff --git a/libavcodec/ppc/fft_init.c b/libavcodec/ppc/fft_init.c
index 8fcc033..9e79f70 100644
--- a/libavcodec/ppc/fft_init.c
+++ b/libavcodec/ppc/fft_init.c
@@ -39,7 +39,7 @@
 void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z);
 void ff_fft_calc_interleave_altivec(FFTContext *s, FFTComplex *z);
 
-#if HAVE_GNU_AS  HAVE_ALTIVEC
+#if HAVE_GNU_AS  HAVE_ALTIVEC  HAVE_BIGENDIAN
 static void imdct_half_altivec(FFTContext *s, FFTSample *output, const 
FFTSample *input)
 {
 int j, k;
@@ -143,7 +143,7 @@ static void imdct_calc_altivec(FFTContext *s, FFTSample 
*output, const FFTSample
 
 av_cold void ff_fft_init_ppc(FFTContext *s)
 {
-#if HAVE_GNU_AS  HAVE_ALTIVEC
+#if HAVE_GNU_AS  HAVE_ALTIVEC  HAVE_BIGENDIAN
 if 

[libav-commits] ppc: vsx: Implement float_dsp

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: eecd29b3fd7fee221580798346d6582b75c7ade4

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Mon May 11 02:44:10 2015 +0200

ppc: vsx: Implement float_dsp

---

 arch.mak   |1 +
 libavutil/ppc/Makefile |2 +
 libavutil/ppc/float_dsp_init.c |   26 +
 libavutil/ppc/float_dsp_vsx.c  |  117 
 libavutil/ppc/float_dsp_vsx.h  |   38 +
 5 files changed, 175 insertions(+), 9 deletions(-)

diff --git a/arch.mak b/arch.mak
index 4bfc883..720062a 100644
--- a/arch.mak
+++ b/arch.mak
@@ -5,6 +5,7 @@ OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
 OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes)
 
 OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
+OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
 
 OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
 OBJS-$(HAVE_YASM)+= $(YASM-OBJS)$(YASM-OBJS-yes)
diff --git a/libavutil/ppc/Makefile b/libavutil/ppc/Makefile
index 4fd8d6d..a0febf8 100644
--- a/libavutil/ppc/Makefile
+++ b/libavutil/ppc/Makefile
@@ -2,3 +2,5 @@ OBJS += ppc/cpu.o   
\
 ppc/float_dsp_init.o\
 
 ALTIVEC-OBJS += ppc/float_dsp_altivec.o \
+
+VSX-OBJS += ppc/float_dsp_vsx.o \
diff --git a/libavutil/ppc/float_dsp_init.c b/libavutil/ppc/float_dsp_init.c
index e81dc7a..4407962 100644
--- a/libavutil/ppc/float_dsp_init.c
+++ b/libavutil/ppc/float_dsp_init.c
@@ -24,18 +24,26 @@
 #include libavutil/float_dsp.h
 #include libavutil/ppc/cpu.h
 #include float_dsp_altivec.h
+#include float_dsp_vsx.h
 
 av_cold void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int bit_exact)
 {
-if (!PPC_ALTIVEC(av_get_cpu_flags()))
-return;
-#if HAVE_BIGENDIAN
-fdsp-vector_fmul = ff_vector_fmul_altivec;
-fdsp-vector_fmul_add = ff_vector_fmul_add_altivec;
-fdsp-vector_fmul_reverse = ff_vector_fmul_reverse_altivec;
+if (HAVE_BIGENDIAN  PPC_ALTIVEC(av_get_cpu_flags())) {
+fdsp-vector_fmul = ff_vector_fmul_altivec;
+fdsp-vector_fmul_add = ff_vector_fmul_add_altivec;
+fdsp-vector_fmul_reverse = ff_vector_fmul_reverse_altivec;
 
-if (!bit_exact) {
-fdsp-vector_fmul_window = ff_vector_fmul_window_altivec;
+if (!bit_exact) {
+fdsp-vector_fmul_window = ff_vector_fmul_window_altivec;
+}
+}
+if (PPC_VSX(av_get_cpu_flags())) {
+fdsp-vector_fmul = ff_vector_fmul_vsx;
+fdsp-vector_fmul_add = ff_vector_fmul_add_vsx;
+fdsp-vector_fmul_reverse = ff_vector_fmul_reverse_vsx;
+
+if (!bit_exact) {
+fdsp-vector_fmul_window = ff_vector_fmul_window_vsx;
+}
 }
-#endif
 }
diff --git a/libavutil/ppc/float_dsp_vsx.c b/libavutil/ppc/float_dsp_vsx.c
new file mode 100644
index 000..4135db1
--- /dev/null
+++ b/libavutil/ppc/float_dsp_vsx.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2015 Luca Barbato lu_z...@gentoo.org
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include util_altivec.h
+#include float_dsp_vsx.h
+
+void ff_vector_fmul_vsx(float *dst,
+const float *src0, const float *src1,
+int len)
+{
+int i;
+vec_f d0, d1, zero = (vec_f)vec_splat_u32(0);
+for (i = 0; i  len - 7; i += 8) {
+d0 = vec_vsx_ld( 0, src0 + i);
+d1 = vec_vsx_ld(16, src0 + i);
+d0 = vec_madd(d0, vec_vsx_ld( 0, src1 + i), zero);
+d1 = vec_madd(d1, vec_vsx_ld(16, src1 + i), zero);
+vec_vsx_st(d0,  0, dst + i);
+vec_vsx_st(d1, 16, dst + i);
+}
+}
+
+void ff_vector_fmul_window_vsx(float *dst, const float *src0,
+   const float *src1, const float *win,
+   int len)
+{
+vec_f zero, t0, t1, s0, s1, wi, wj;
+const vec_u8 reverse = vcprm(3, 2, 1, 0);
+int i, j;
+
+dst  += len;
+win  += len;
+src0 += len;
+
+zero = (vec_f)vec_splat_u32(0);
+
+for (i = -len * 4, j = len * 4 - 16; i  0; i += 16, j -= 16) {
+s0 = vec_vsx_ld(i, src0);
+   

[libav-commits] ppc: cpu: Add support for VSX and POWER8 extensions

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: 7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 04:15:59 2015 +0200

ppc: cpu: Add support for VSX and POWER8 extensions

---

 libavutil/cpu.h |2 ++
 libavutil/ppc/cpu.c |   20 +---
 libavutil/ppc/cpu.h |2 ++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 7ce..d7fdf26 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -54,6 +54,8 @@
 #define AV_CPU_FLAG_BMI20x4 /// Bit Manipulation Instruction Set 2
 
 #define AV_CPU_FLAG_ALTIVEC  0x0001 /// standard
+#define AV_CPU_FLAG_VSX  0x0002 /// ISA 2.06
+#define AV_CPU_FLAG_POWER8   0x0004 /// ISA 2.07
 
 #define AV_CPU_FLAG_ARMV5TE  (1  0)
 #define AV_CPU_FLAG_ARMV6(1  1)
diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 27a2853..2981856 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -85,6 +85,14 @@ int ff_get_cpu_flags_ppc(void)
 if (buf[i] == AT_HWCAP) {
 if (buf[i + 1]  PPC_FEATURE_HAS_ALTIVEC)
 ret = AV_CPU_FLAG_ALTIVEC;
+#ifdef PPC_FEATURE_HAS_VSX
+if (buf[i + 1]  PPC_FEATURE_HAS_VSX)
+ret |= AV_CPU_FLAG_VSX;
+#endif
+#ifdef PPC_FEATURE_ARCH_2_07
+if (buf[i + 1]  PPC_FEATURE_HAS_POWER8)
+ret |= AV_CPU_FLAG_POWER8;
+#endif
 goto out;
 }
 }
@@ -103,7 +111,7 @@ out:
 #define PVR_POWER7   0x003F
 #define PVR_POWER8   0x004B
 #define PVR_CELL_PPU 0x0070
-
+int ret = 0;
 int proc_ver;
 // Support of mfspr PVR emulation added in Linux 2.6.17.
 __asm__ volatile(mfspr %0, 287 : =r (proc_ver));
@@ -118,8 +126,14 @@ out:
 proc_ver == PVR_POWER7   ||
 proc_ver == PVR_POWER8   ||
 proc_ver == PVR_CELL_PPU)
-return AV_CPU_FLAG_ALTIVEC;
-return 0;
+ret = AV_CPU_FLAG_ALTIVEC;
+if (proc_ver == PVR_POWER7 ||
+proc_ver == PVR_POWER8)
+ret |= AV_CPU_FLAG_VSX;
+if (proc_ver == PVR_POWER8)
+ret |= AV_CPU_FLAG_POWER8;
+
+return ret;
 #else
 // Since we were compiled for AltiVec, just assume we have it
 // until someone comes up with a proper way (not involving signal hacks).
diff --git a/libavutil/ppc/cpu.h b/libavutil/ppc/cpu.h
index f8fae58..a8b823f 100644
--- a/libavutil/ppc/cpu.h
+++ b/libavutil/ppc/cpu.h
@@ -24,5 +24,7 @@
 #include libavutil/cpu_internal.h
 
 #define PPC_ALTIVEC(flags) CPUEXT(flags, ALTIVEC)
+#define PPC_VSX(flags) CPUEXT(flags, VSX)
+#define PPC_POWER8(flags) CPUEXT(flags, POWER8)
 
 #endif /* AVUTIL_PPC_CPU_H */

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ppc: configure: Support ISA 2.06 and later

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: f22ebd2555d15b59e109a5b630dd71374b076d0b

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 10 02:47:31 2015 +0200

ppc: configure: Support ISA 2.06 and later

POWER 7 and POWER 8 support VSX and ldbrx.

POWER 8 supports additional extended VSX instructions introduced
with ISA 2.07.

---

 configure |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 863e33b..d59f5e4 100755
--- a/configure
+++ b/configure
@@ -276,6 +276,8 @@ Advanced options (experts only):
 Optimization options (experts only):
   --disable-asmdisable all assembly optimizations
   --disable-altivecdisable AltiVec optimizations
+  --disable-vsxdisable VSX optimizations
+  --disable-power8 disable POWER8 optimizations
   --disable-amd3dnow   disable 3DNow! optimizations
   --disable-amd3dnowextdisable 3DNow! extended optimizations
   --disable-mmxdisable MMX optimizations
@@ -1339,7 +1341,9 @@ ARCH_EXT_LIST_PPC=
 altivec
 dcbzl
 ldbrx
+power8
 ppc4xx
+vsx
 
 
 ARCH_EXT_LIST_X86=
@@ -1709,6 +1713,8 @@ map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
 
 altivec_deps=ppc
 ppc4xx_deps=ppc
+vsx_deps=altivec
+power8_deps=vsx
 
 cpunop_deps=i686
 x86_64_select=i686
@@ -3323,19 +3329,28 @@ elif enabled ppc; then
 ;;
 g4|745*|ppc745*|powerpc745*)
 cpuflags=-mcpu=7450
+disable vsx
 ;;
 74*|ppc74*|powerpc74*)
 cpuflags=-mcpu=7400
+disable vsx
 ;;
 g5|970|ppc970|powerpc970)
 cpuflags=-mcpu=970
+disable vsx
 ;;
-power[3-7]*)
+power[3-6]*)
 cpuflags=-mcpu=$cpu
+disable vsx
+;;
+power[7-8]*)
+cpuflags=-mcpu=$cpu
+enable ldbrx
 ;;
 cell)
 cpuflags=-mcpu=cell
 enable ldbrx
+disable vsx
 ;;
 e500mc)
 cpuflags=-mcpu=e500mc
@@ -4012,6 +4027,15 @@ EOF
 enabled altivec || warn Altivec disabled, possibly missing --cpu flag
 fi
 
+if enabled vsx; then
+check_cflags -mvsx 
+check_builtin vec_vsx_ld altivec.h __builtin_vec_vsx_ld || disable 
vsx
+fi
+
+if enabled power8; then
+check_cpp_condition altivec.h defined(_ARCH_PWR8) || disable power8
+fi
+
 elif enabled x86; then
 
 check_builtin rdtscintrin.h   __rdtsc()
@@ -4706,6 +4730,8 @@ if enabled arm; then
 fi
 if enabled ppc; then
 echo AltiVec enabled   ${altivec-no}
+echo VSX enabled   ${vsx-no}
+echo POWER8 enabled${power8-no}
 echo PPC 4xx optimizations ${ppc4xx-no}
 echo dcbzl available   ${dcbzl-no}
 fi

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x86: Add helper macros to check for slow cpuflags

2015-05-31 Thread James Almer
Module: libav
Branch: master
Commit: cae39851201b7781f1262e1c23627b45e6e80bb4

Author:James Almer jamr...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:29:07 2015 -0300

x86: Add helper macros to check for slow cpuflags

Signed-off-by: James Almer jamr...@gmail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavutil/cpu_internal.h |   10 ++
 libavutil/x86/cpu.h  |   18 ++
 2 files changed, 28 insertions(+)

diff --git a/libavutil/cpu_internal.h b/libavutil/cpu_internal.h
index 3bfe8a8..49c7b07 100644
--- a/libavutil/cpu_internal.h
+++ b/libavutil/cpu_internal.h
@@ -24,7 +24,17 @@
 #define CPUEXT_SUFFIX(flags, suffix, cpuext)\
 (HAVE_ ## cpuext ## suffix  ((flags)  AV_CPU_FLAG_ ## cpuext))
 
+#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext)   \
+(HAVE_ ## cpuext ## suffix  ((flags)  AV_CPU_FLAG_ ## cpuext)  \
+ !((flags)  AV_CPU_FLAG_ ## cpuext ## SLOW))
+
+#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext)   \
+(HAVE_ ## cpuext ## suffix  ((flags)  AV_CPU_FLAG_ ## cpuext)  \
+ ((flags)  AV_CPU_FLAG_ ## cpuext ## SLOW))
+
 #define CPUEXT(flags, cpuext) CPUEXT_SUFFIX(flags, , cpuext)
+#define CPUEXT_FAST(flags, cpuext) CPUEXT_SUFFIX_FAST(flags, , cpuext)
+#define CPUEXT_SLOW(flags, cpuext) CPUEXT_SUFFIX_SLOW(flags, , cpuext)
 
 int ff_get_cpu_flags_aarch64(void);
 int ff_get_cpu_flags_arm(void);
diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
index 50da30e..0695436 100644
--- a/libavutil/x86/cpu.h
+++ b/libavutil/x86/cpu.h
@@ -32,11 +32,17 @@
 #define X86_MMXEXT(flags)   CPUEXT(flags, MMXEXT)
 #define X86_SSE(flags)  CPUEXT(flags, SSE)
 #define X86_SSE2(flags) CPUEXT(flags, SSE2)
+#define X86_SSE2_FAST(flags)CPUEXT_FAST(flags, SSE2)
+#define X86_SSE2_SLOW(flags)CPUEXT_SLOW(flags, SSE2)
 #define X86_SSE3(flags) CPUEXT(flags, SSE3)
+#define X86_SSE3_FAST(flags)CPUEXT_FAST(flags, SSE3)
+#define X86_SSE3_SLOW(flags)CPUEXT_SLOW(flags, SSE3)
 #define X86_SSSE3(flags)CPUEXT(flags, SSSE3)
 #define X86_SSE4(flags) CPUEXT(flags, SSE4)
 #define X86_SSE42(flags)CPUEXT(flags, SSE42)
 #define X86_AVX(flags)  CPUEXT(flags, AVX)
+#define X86_AVX_FAST(flags) CPUEXT_FAST(flags, AVX)
+#define X86_AVX_SLOW(flags) CPUEXT_SLOW(flags, AVX)
 #define X86_XOP(flags)  CPUEXT(flags, XOP)
 #define X86_FMA3(flags) CPUEXT(flags, FMA3)
 #define X86_FMA4(flags) CPUEXT(flags, FMA4)
@@ -48,11 +54,17 @@
 #define EXTERNAL_MMXEXT(flags)  CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT)
 #define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE)
 #define EXTERNAL_SSE2(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2)
+#define EXTERNAL_SSE2_FAST(flags)   CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSE2)
+#define EXTERNAL_SSE2_SLOW(flags)   CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSE2)
 #define EXTERNAL_SSE3(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3)
+#define EXTERNAL_SSE3_FAST(flags)   CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSE3)
+#define EXTERNAL_SSE3_SLOW(flags)   CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSE3)
 #define EXTERNAL_SSSE3(flags)   CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
 #define EXTERNAL_SSE4(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
 #define EXTERNAL_SSE42(flags)   CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
 #define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
+#define EXTERNAL_AVX_FAST(flags)CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, AVX)
+#define EXTERNAL_AVX_SLOW(flags)CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, AVX)
 #define EXTERNAL_XOP(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, XOP)
 #define EXTERNAL_FMA3(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, FMA3)
 #define EXTERNAL_FMA4(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
@@ -64,11 +76,17 @@
 #define INLINE_MMXEXT(flags)CPUEXT_SUFFIX(flags, _INLINE, MMXEXT)
 #define INLINE_SSE(flags)   CPUEXT_SUFFIX(flags, _INLINE, SSE)
 #define INLINE_SSE2(flags)  CPUEXT_SUFFIX(flags, _INLINE, SSE2)
+#define INLINE_SSE2_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE2)
+#define INLINE_SSE2_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE2)
 #define INLINE_SSE3(flags)  CPUEXT_SUFFIX(flags, _INLINE, SSE3)
+#define INLINE_SSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE3)
+#define INLINE_SSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE3)
 #define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
 #define INLINE_SSE4(flags)  CPUEXT_SUFFIX(flags, _INLINE, SSE4)
 #define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
 #define INLINE_AVX(flags)   CPUEXT_SUFFIX(flags, _INLINE, AVX)
+#define INLINE_AVX_FAST(flags)  CPUEXT_SUFFIX_FAST(flags, _INLINE, AVX)
+#define INLINE_AVX_SLOW(flags)  

[libav-commits] ppc: linux: Check altivec using the auxv

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: baa94563fede8959a638b0fa132dd2124acd93e8

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Fri Apr  3 15:31:32 2015 +0200

ppc: linux: Check altivec using the auxv

Should prevent trying to use altivec when it is disabled by the kernel.

---

 libavutil/ppc/cpu.c |   31 +++
 1 file changed, 31 insertions(+)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 50107e1..2ceb88a 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -18,6 +18,11 @@
 
 #ifdef __APPLE__
 #include sys/sysctl.h
+#elif defined(__linux__)
+#include asm/cputable.h
+#include linux/auxvec.h
+#include fcntl.h
+#include unistd.h
 #elif defined(__OpenBSD__)
 #include sys/param.h
 #include sys/sysctl.h
@@ -62,6 +67,32 @@ int ff_get_cpu_flags_ppc(void)
 if (err == 0)
 return has_vu ? AV_CPU_FLAG_ALTIVEC : 0;
 return 0;
+#elif defined(__linux__)
+// The linux kernel could have the altivec support disabled
+// even if the cpu has it.
+int i, ret = 0;
+int fd = open(/proc/self/auxv, O_RDONLY);
+unsigned long buf[64] = { 0 };
+ssize_t count;
+
+if (fd  0)
+return 0;
+
+while ((count = read(fd, buf, sizeof(buf)))  0) {
+for (i = 0; i  count / sizeof(*buf); i += 2) {
+if (buf[i] == AT_NULL)
+goto out;
+if (buf[i] == AT_HWCAP) {
+if (buf[i + 1]  PPC_FEATURE_HAS_ALTIVEC)
+ret = AV_CPU_FLAG_ALTIVEC;
+goto out;
+}
+}
+}
+
+out:
+close(fd);
+return ret;
 #elif CONFIG_RUNTIME_CPUDETECT
 int proc_ver;
 // Support of mfspr PVR emulation added in Linux 2.6.17.

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] dxva2_hevc: re-write reference frame handling

2015-05-31 Thread Hendrik Leppkes
Module: libav
Branch: master
Commit: 902a55f7161ffea10e13c1e7df14022e2ed90514

Author:Hendrik Leppkes h.lepp...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Thu May 28 18:25:37 2015 +0200

dxva2_hevc: re-write reference frame handling

The old logic required an explicit clearing of the lists first and was
prone to overflow the DXVA2 struct in some circumstances.

Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavcodec/dxva2_hevc.c |   40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index a2abb97..5112bd2 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -57,7 +57,7 @@ static void fill_picture_parameters(const AVCodecContext 
*avctx, AVDXVAContext *
 DXVA_PicParams_HEVC *pp)
 {
 const HEVCFrame *current_picture = h-ref;
-int i, j, k;
+int i, j;
 
 memset(pp, 0, sizeof(*pp));
 
@@ -155,30 +155,34 @@ static void fill_picture_parameters(const AVCodecContext 
*avctx, AVDXVAContext *
 pp-log2_parallel_merge_level_minus2 = h-pps-log2_parallel_merge_level - 
2;
 pp-CurrPicOrderCntVal   = h-poc;
 
-// empty the lists
-memset(pp-RefPicList, 0xff, sizeof(pp-RefPicList));
-memset(pp-RefPicSetStCurrBefore, 0xff, 
sizeof(pp-RefPicSetStCurrBefore));
-memset(pp-RefPicSetStCurrAfter, 0xff, sizeof(pp-RefPicSetStCurrAfter));
-memset(pp-RefPicSetLtCurr, 0xff, sizeof(pp-RefPicSetLtCurr));
-
 // fill RefPicList from the DPB
-for (i = 0, j = 0; i  FF_ARRAY_ELEMS(h-DPB); i++) {
-const HEVCFrame *frame = h-DPB[i];
-if (frame != current_picture  (frame-flags  
(HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) {
-fill_picture_entry(pp-RefPicList[j], 
ff_dxva2_get_surface_index(avctx, ctx, frame-frame), !!(frame-flags  
HEVC_FRAME_FLAG_LONG_REF));
-pp-PicOrderCntValList[j] = frame-poc;
+for (i = 0, j = 0; i  FF_ARRAY_ELEMS(pp-RefPicList); i++) {
+const HEVCFrame *frame = NULL;
+while (!frame  j  FF_ARRAY_ELEMS(h-DPB)) {
+if (h-DPB[j] != current_picture  (h-DPB[j].flags  
(HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
+frame = h-DPB[j];
 j++;
 }
+
+if (frame) {
+fill_picture_entry(pp-RefPicList[i], 
ff_dxva2_get_surface_index(avctx, ctx, frame-frame), !!(frame-flags  
HEVC_FRAME_FLAG_LONG_REF));
+pp-PicOrderCntValList[i] = frame-poc;
+} else {
+pp-RefPicList[i].bPicEntry = 0xff;
+pp-PicOrderCntValList[i]   = 0;
+}
 }
 
 #define DO_REF_LIST(ref_idx, ref_list) { \
 const RefPicList *rpl = h-rps[ref_idx]; \
-av_assert0(rpl-nb_refs = FF_ARRAY_ELEMS(pp-ref_list)); \
-for (j = 0, k = 0; j  rpl-nb_refs; j++) { \
-if (rpl-ref[j]) { \
-pp-ref_list[k] = get_refpic_index(pp, 
ff_dxva2_get_surface_index(avctx, ctx, rpl-ref[j]-frame)); \
-k++; \
-} \
+for (i = 0, j = 0; i  FF_ARRAY_ELEMS(pp-ref_list); i++) { \
+const HEVCFrame *frame = NULL; \
+while (!frame  j  rpl-nb_refs) \
+frame = rpl-ref[j++]; \
+if (frame) \
+pp-ref_list[i] = get_refpic_index(pp, 
ff_dxva2_get_surface_index(avctx, ctx, frame-frame)); \
+else \
+pp-ref_list[i] = 0xff; \
 } \
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mov: Correctly allocate ctts_data

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: a8a90906fb0ad0f8d3c68a97f182528ee3b5198c

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 12:28:33 2015 +0200

mov: Correctly allocate ctts_data

It can be reallocated.

CC: libav-sta...@libav.org

---

 libavformat/mov.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 33e1054..fbbfef0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2035,7 +2035,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 if (entries = UINT_MAX / sizeof(*sc-ctts_data))
 return AVERROR_INVALIDDATA;
-sc-ctts_data = av_malloc(entries * sizeof(*sc-ctts_data));
+sc-ctts_data = av_realloc(NULL, entries * sizeof(*sc-ctts_data));
 if (!sc-ctts_data)
 return AVERROR(ENOMEM);
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mov: Fix two memleaks

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: master
Commit: f261a55d72753bcec33369954809732abae8f8f7

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:24:36 2015 +0100

mov: Fix two memleaks

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

CC: libav-sta...@libav.org

---

 libavformat/mov.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 70fa1e0..33e1054 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1942,10 +1942,11 @@ static int mov_read_stsz(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 sc-sample_count = i;
 
+av_free(buf);
+
 if (pb-eof_reached)
 return AVERROR_EOF;
 
-av_free(buf);
 return 0;
 }
 
@@ -2028,6 +2029,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 av_log(c-fc, AV_LOG_TRACE, track[%i].ctts.entries = %i\n, 
c-fc-nb_streams-1, entries);
 
+av_freep(sc-ctts_data);
+
 if (!entries)
 return 0;
 if (entries = UINT_MAX / sizeof(*sc-ctts_data))

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mov: reject zero bytes_per_frame with non-zero samples_per_frame

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: master
Commit: cffb9ea81bd16d2ed8bce187b6bf0279c07b3b9b

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:24:37 2015 +0100

mov: reject zero bytes_per_frame with non-zero samples_per_frame

In this case the mov demuxer can return a large number of empty packets.

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavformat/mov.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index fbbfef0..2cf6e8e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2263,6 +2263,13 @@ static void mov_build_index(MOVContext *mov, AVStream 
*st)
 AVIndexEntry *e;
 unsigned size, samples;
 
+if (sc-samples_per_frame  1  !sc-bytes_per_frame) {
+avpriv_request_sample(mov-fc,
+   Zero bytes per frame, but %d samples per frame,
+   sc-samples_per_frame);
+return;
+}
+
 if (sc-samples_per_frame = 160) { // gsm
 samples = sc-samples_per_frame;
 size = sc-bytes_per_frame;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] mov: abort on EOF in ff_mov_read_chan

2015-05-31 Thread Andreas Cadhalpun
Module: libav
Branch: master
Commit: 8e9c39e81fe5ba34010a7ba05cbe4ae31f177d89

Author:Andreas Cadhalpun andreas.cadhal...@googlemail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:24:35 2015 +0100

mov: abort on EOF in ff_mov_read_chan

Otherwise the loop can take a lot of time if num_descr is very large.

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavformat/mov_chan.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
index 2c54920..94b93cf 100644
--- a/libavformat/mov_chan.c
+++ b/libavformat/mov_chan.c
@@ -565,6 +565,11 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, 
AVStream *st,
 label_mask = 0;
 for (i = 0; i  num_descr; i++) {
 uint32_t label;
+if (pb-eof_reached) {
+av_log(s, AV_LOG_ERROR,
+   reached EOF while reading channel layout\n);
+return AVERROR_INVALIDDATA;
+}
 label = avio_rb32(pb);  // mChannelLabel
 avio_rb32(pb);  // mChannelFlags
 avio_rl32(pb);  // mCoordinates[0]

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avio: Add avio_read wrapper to simplify error checking

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: bff0349d9da527084e1433167466d8afc9e25c7f

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Tue May 26 14:24:38 2015 +0100

avio: Add avio_read wrapper to simplify error checking

Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 libavformat/avio_internal.h |7 +++
 libavformat/aviobuf.c   |8 
 2 files changed, 15 insertions(+)

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index c8630ab..aff5564 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -85,6 +85,13 @@ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned 
char *buf, int buf_size
 
 uint64_t ffio_read_varlen(AVIOContext *bc);
 
+/**
+ * Read size bytes from AVIOContext into buf.
+ * Check that exactly size bytes have been read.
+ * @return number of bytes read or AVERROR
+ */
+int ffio_read_size(AVIOContext *s, unsigned char *buf, int size);
+
 /** @warning must be called before any I/O */
 int ffio_set_buf_size(AVIOContext *s, int buf_size);
 
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 59f807c..d3e3452 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -496,6 +496,14 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
 return size1 - size;
 }
 
+int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
+{
+int ret = avio_read(s, buf, size);
+if (ret != size)
+return AVERROR_INVALIDDATA;
+return ret;
+}
+
 int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const 
unsigned char **data)
 {
 if (s-buf_end - s-buf_ptr = size  !s-write_flag) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] truemotion2: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: e1ea365f7e1477c78865b866a180712174536c20

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:27 2015 +0200

truemotion2: Check memory allocation

---

 libavcodec/truemotion2.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 122643d..094096e 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -171,6 +171,10 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes 
*code)
 huff.nums= av_mallocz(huff.max_num * sizeof(int));
 huff.bits= av_mallocz(huff.max_num * sizeof(uint32_t));
 huff.lens= av_mallocz(huff.max_num * sizeof(int));
+if (!huff.nums || !huff.bits || !huff.lens) {
+res = AVERROR(ENOMEM);
+goto out;
+}
 
 res = tm2_read_tree(ctx, 0, 0, huff);
 
@@ -193,10 +197,16 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes 
*code)
 code-bits = huff.max_bits;
 code-length = huff.max_num;
 code-recode = av_malloc(code-length * sizeof(int));
+if (!code-recode) {
+res = AVERROR(ENOMEM);
+goto out;
+}
 for (i = 0; i  code-length; i++)
 code-recode[i] = huff.nums[i];
 }
 }
+
+out:
 /* free allocated memory */
 av_free(huff.nums);
 av_free(huff.bits);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] asv: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: e524f37356156893cae50fc46451bd4a6198703d

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:50:21 2015 +0200

asv: Check memory allocation

---

 libavcodec/asvenc.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index f8c52af..0879615 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -299,6 +299,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
  avctx-global_quality / 2) / avctx-global_quality;
 
 avctx-extradata   = av_mallocz(8);
+if (!avctx-extradata)
+return AVERROR(ENOMEM);
 avctx-extradata_size  = 8;
 ((uint32_t *) avctx-extradata)[0] = av_le2ne32(a-inv_qscale);
 ((uint32_t *) avctx-extradata)[1] = av_le2ne32(AV_RL32(ASUS));

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] pthread: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 0994e142132200c706f704271b5a7ae81d128f5c

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:06 2015 +0200

pthread: Check memory allocation

---

 libavcodec/pthread_frame.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index effc9a5..d7f742b 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -584,8 +584,15 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 }
 
 avctx-internal-thread_ctx = fctx = 
av_mallocz(sizeof(FrameThreadContext));
+if (!fctx)
+return AVERROR(ENOMEM);
 
 fctx-threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
+if (!fctx-threads) {
+av_freep(avctx-internal-thread_ctx);
+return AVERROR(ENOMEM);
+}
+
 pthread_mutex_init(fctx-buffer_mutex, NULL);
 fctx-delaying = 1;
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] psymodel: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 03927cb73399e6f07185fc7f8851d7612b4187b6

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:55 2015 +0200

psymodel: Check memory allocation

---

 libavcodec/psymodel.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
index a2af611..5179ede 100644
--- a/libavcodec/psymodel.c
+++ b/libavcodec/psymodel.c
@@ -39,6 +39,12 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext 
*avctx, int num_lens,
 ctx-group = av_mallocz(sizeof(ctx-group[0]) * num_groups);
 ctx-bands = av_malloc (sizeof(ctx-bands[0]) * num_lens);
 ctx-num_bands = av_malloc (sizeof(ctx-num_bands[0]) * num_lens);
+
+if (!ctx-ch || !ctx-group || !ctx-bands || !ctx-num_bands) {
+ff_psy_end(ctx);
+return AVERROR(ENOMEM);
+}
+
 memcpy(ctx-bands, bands, sizeof(ctx-bands[0]) *  num_lens);
 memcpy(ctx-num_bands, num_bands, sizeof(ctx-num_bands[0]) *  num_lens);
 
@@ -98,6 +104,8 @@ av_cold struct FFPsyPreprocessContext* 
ff_psy_preprocess_init(AVCodecContext *av
 int i;
 float cutoff_coeff = 0;
 ctx= av_mallocz(sizeof(FFPsyPreprocessContext));
+if (!ctx)
+return NULL;
 ctx-avctx = avctx;
 
 if (avctx-cutoff  0)
@@ -109,6 +117,10 @@ av_cold struct FFPsyPreprocessContext* 
ff_psy_preprocess_init(AVCodecContext *av
  cutoff_coeff, 0.0, 0.0);
 if (ctx-fcoeffs) {
 ctx-fstate = av_mallocz(sizeof(ctx-fstate[0]) * avctx-channels);
+if (!ctx-fstate) {
+av_free(ctx);
+return NULL;
+}
 for (i = 0; i  avctx-channels; i++)
 ctx-fstate[i] = ff_iir_filter_init_state(FILT_ORDER);
 }

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] nvenc: H264 and HEVC encoders

2015-05-31 Thread Luca Barbato
Module: libav
Branch: master
Commit: b08caa87c35a768ec0abb16b1e99c3a85f1df28e

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sat May 30 16:40:13 2015 +0200

nvenc: H264 and HEVC encoders

Partially based on the work of Timo Rothenpieler t...@rothenpieler.org

Signed-off-by: Luca Barbato lu_z...@gentoo.org

---

 Changelog   |1 +
 configure   |   16 +
 libavcodec/Makefile |3 +
 libavcodec/allcodecs.c  |2 +
 libavcodec/nvenc.c  | 1136 +++
 libavcodec/nvenc.h  |  135 ++
 libavcodec/nvenc_h264.c |  110 +
 libavcodec/nvenc_hevc.c |  108 +
 libavcodec/version.h|2 +-
 9 files changed, 1512 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 41fe7c8..2c268ed 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version next:
 - Canopus HQ/HQA decoder
 - Automatically rotate videos based on metadata in avconv
 - improved Quickdraw compatibility
+- NVIDIA NVENC-accelerated H.264 and HEVC encoding support
 
 
 version 11:
diff --git a/configure b/configure
index d59f5e4..c1e516c 100755
--- a/configure
+++ b/configure
@@ -220,6 +220,7 @@ External library support:
   --enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
   --enable-mmalenable decoding via MMAL [no]
+  --enable-nvenc   enable encoding via NVENC [no]
   --enable-openssl enable openssl [no]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --enable-zlibenable zlib [autodetect]
@@ -1191,6 +1192,7 @@ EXTERNAL_LIBRARY_LIST=
 libxcb_xfixes
 libxvid
 mmal
+nvenc
 openssl
 x11grab
 zlib
@@ -1483,6 +1485,7 @@ SYSTEM_FUNCS=
 inet_aton
 isatty
 jack_port_get_latency_range
+LoadLibrary
 localtime_r
 mach_absolute_time
 MapViewOfFile
@@ -1780,6 +1783,8 @@ mpegaudio_select=mpegaudiodsp
 mpegaudiodsp_select=dct
 mpegvideo_select=blockdsp hpeldsp idctdsp me_cmp videodsp
 mpegvideoenc_select=me_cmp mpegvideo pixblockdsp qpeldsp
+nvenc_deps_any=dlopen LoadLibrary
+nvenc_extralibs='$ldl'
 qsvdec_select=qsv
 qsvenc_select=qsv
 
@@ -1849,11 +1854,13 @@ h263i_decoder_select=h263_decoder
 h263p_encoder_select=h263_encoder
 h264_decoder_select=cabac golomb h264chroma h264dsp h264pred h264qpel 
startcode videodsp
 h264_decoder_suggest=error_resilience
+h264_nvenc_encoder_deps=nvenc
 h264_qsv_decoder_deps=libmfx
 h264_qsv_decoder_select=h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel
 h264_qsv_encoder_deps=libmfx
 h264_qsv_encoder_select=qsvenc
 hevc_decoder_select=bswapdsp cabac golomb videodsp
+hevc_nvenc_encoder_deps=nvenc
 huffyuv_decoder_select=bswapdsp huffyuvdsp
 huffyuv_encoder_select=bswapdsp huffman huffyuvencdsp
 iac_decoder_select=imc_decoder
@@ -3822,6 +3829,7 @@ die_license_disabled gpl x11grab
 
 die_license_disabled nonfree libfaac
 die_license_disabled nonfree libfdk_aac
+die_license_disabled nonfree nvenc
 die_license_disabled nonfree openssl
 
 die_license_disabled version3 libopencore_amrnb
@@ -4188,6 +4196,7 @@ check_func_headers windows.h CoTaskMemFree -lole32
 check_func_headers windows.h GetProcessAffinityMask
 check_func_headers windows.h GetProcessTimes
 check_func_headers windows.h GetSystemTimeAsFileTime
+check_func_headers windows.h LoadLibrary
 check_func_headers windows.h MapViewOfFile
 check_func_headers windows.h SetConsoleTextAttribute
 check_func_headers windows.h Sleep
@@ -4340,6 +4349,13 @@ if enabled libdc1394; then
 die ERROR: No version of libdc1394 found 
 fi
 
+if enabled nvenc; then
+check_header cuda.h || die ERROR: cuda.h not found.;
+check_header nvEncodeAPI.h || die ERROR: nvEncodeAPI.h not found.;
+check_cpp_condition nvEncodeAPI.h NVENCAPI_MAJOR_VERSION = 5 ||
+die ERROR: NVENC API version 4 or older is not supported;
+fi
+
 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
 check_cpp_condition SDL.h (SDL_MAJOR_VERSION16 | SDL_MINOR_VERSION8 | 
SDL_PATCHLEVEL) = 0x010201 $sdl_cflags 
 check_cpp_condition SDL.h (SDL_MAJOR_VERSION16 | SDL_MINOR_VERSION8 | 
SDL_PATCHLEVEL)  0x010300 $sdl_cflags 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 96cc258..629d25d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -82,6 +82,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC)+= mpegvideo_enc.o 
mpeg12data.o  \
   motion_est.o ratecontrol.o\
   mpegvideoencdsp.o
 OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
+OBJS-${CONFIG_NVENC}   += nvenc.o
 OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
 OBJS-$(CONFIG_QSV) += qsv.o
 OBJS-$(CONFIG_QSVDEC)  += qsvdec.o
@@ -228,11 +229,13 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o 
h264_cabac.o h264_cavlc.o \
  

[libav-commits] jpegls: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 7ca603f96f93d988e01d161d611f69a4ecaa3f02

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:11 2015 +0200

jpegls: Check memory allocation

---

 libavcodec/jpeglsdec.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index d9b08fb..3b93799 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -278,10 +278,16 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int 
near,
 int off = 0, stride = 1, width, shift, ret = 0;
 
 zero = av_mallocz(s-picture_ptr-linesize[0]);
+if (!zero)
+return AVERROR(ENOMEM);
 last = zero;
 cur  = s-picture_ptr-data[0];
 
 state = av_mallocz(sizeof(JLSState));
+if (!state) {
+av_free(zero);
+return AVERROR(ENOMEM);
+}
 /* initialize JPEG-LS state from JPEG parameters */
 state-near   = near;
 state-bpp= (s-bits  2) ? 2 : s-bits;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] ratecontrol: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 42df71d9bbb1a5b4bce0bb34417692565c72d390

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:12 2015 +0200

ratecontrol: Check memory allocation

---

 libavcodec/ratecontrol.c |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 620c854..d0e13b92 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -163,6 +163,8 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
 return -1;
 rcc-entry   = av_mallocz(i * sizeof(RateControlEntry));
 rcc-num_entries = i;
+if (!rcc-entry)
+return AVERROR(ENOMEM);
 
 /* init all to skipped p frames
  * (with b frames we might have a not encoded frame at the end FIXME) 
*/
@@ -210,8 +212,10 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
 p = next;
 }
 
-if (init_pass2(s)  0)
+if (init_pass2(s)  0) {
+ff_rate_control_uninit(s);
 return -1;
+}
 
 // FIXME maybe move to end
 if ((s-avctx-flags  CODEC_FLAG_PASS2)  s-avctx-rc_strategy == 
FF_RC_STRATEGY_XVID) {
@@ -932,6 +936,11 @@ static int init_pass2(MpegEncContext *s)
 
 qscale = av_malloc(sizeof(double) * rcc-num_entries);
 blurred_qscale = av_malloc(sizeof(double) * rcc-num_entries);
+if (!qscale || !blurred_qscale) {
+av_free(qscale);
+av_free(blurred_qscale);
+return AVERROR(ENOMEM);
+}
 toobig = 0;
 
 for (step = 256 * 256; step  0.001; step *= 0.5) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] libtheora: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 41658bc88553dab8499e4dfca311559dcbae2674

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:29 2015 +0200

libtheora: Check memory allocation

---

 libavcodec/libtheoraenc.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index 462bc94..097336b 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -101,6 +101,8 @@ static int get_stats(AVCodecContext *avctx, int eos)
 if (!eos) {
 h-stats = av_fast_realloc(h-stats, h-stats_size,
h-stats_offset + bytes);
+if (!h-stats)
+return AVERROR(ENOMEM);
 memcpy(h-stats + h-stats_offset, buf, bytes);
 h-stats_offset += bytes;
 } else {
@@ -108,6 +110,8 @@ static int get_stats(AVCodecContext *avctx, int eos)
 // libtheora generates a summary header at the end
 memcpy(h-stats, buf, bytes);
 avctx-stats_out = av_malloc(b64_size);
+if (!avctx-stats_out)
+return AVERROR(ENOMEM);
 av_base64_encode(avctx-stats_out, b64_size, h-stats, 
h-stats_offset);
 }
 return 0;
@@ -131,6 +135,8 @@ static int submit_stats(AVCodecContext *avctx)
 }
 h-stats_size = strlen(avctx-stats_in) * 3/4;
 h-stats  = av_malloc(h-stats_size);
+if (!h-stats)
+return AVERROR(ENOMEM);
 h-stats_size = av_base64_decode(h-stats, avctx-stats_in, 
h-stats_size);
 }
 while (h-stats_size - h-stats_offset  0) {

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] xsub: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 522d971c7f5921bebcea2fc50e67056afdabb951

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:44 2015 +0200

xsub: Check memory allocation

---

 libavcodec/xsubdec.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index d01b410..a7dd7ee 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -95,7 +95,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *data_size,
 
 // allocate sub and set values
 sub-rects =  av_mallocz(sizeof(*sub-rects));
+if (!sub-rects)
+return AVERROR(ENOMEM);
 sub-rects[0] = av_mallocz(sizeof(*sub-rects[0]));
+if (!sub-rects[0]) {
+av_freep(sub-rects);
+return AVERROR(ENOMEM);
+}
 sub-num_rects = 1;
 sub-rects[0]-x = x; sub-rects[0]-y = y;
 sub-rects[0]-w = w; sub-rects[0]-h = h;
@@ -104,6 +110,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *data_size,
 sub-rects[0]-pict.data[0] = av_malloc(w * h);
 sub-rects[0]-nb_colors = 4;
 sub-rects[0]-pict.data[1] = av_mallocz(AVPALETTE_SIZE);
+if (!sub-rects[0]-pict.data[0] || !sub-rects[0]-pict.data[1]) {
+av_freep(sub-rects[0]-pict.data[1]);
+av_freep(sub-rects[0]-pict.data[0]);
+av_freep(sub-rects[0]);
+av_freep(sub-rects);
+return AVERROR(ENOMEM);
+}
 
 // read palette
 for (i = 0; i  sub-rects[0]-nb_colors; i++)

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] wma: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 83797da6e36c1aadd85f41ca237dce823fc7bfa1

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:35 2015 +0200

wma: Check memory allocation

---

 libavcodec/wmaenc.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index e801663..c176daa 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -62,11 +62,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
 flags2 = 1;
 if (avctx-codec-id == AV_CODEC_ID_WMAV1) {
 extradata = av_malloc(4);
+if (!extradata)
+return AVERROR(ENOMEM);
 avctx-extradata_size = 4;
 AV_WL16(extradata, flags1);
 AV_WL16(extradata + 2, flags2);
 } else if (avctx-codec-id == AV_CODEC_ID_WMAV2) {
 extradata = av_mallocz(10);
+if (!extradata)
+return AVERROR(ENOMEM);
 avctx-extradata_size = 10;
 AV_WL32(extradata, flags1);
 AV_WL16(extradata + 4, flags2);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] x264: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 9fb483fede7207c1f3965e5ae1ac0ee82e4d7a4e

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:39 2015 +0200

x264: Check memory allocation

---

 libavcodec/libx264.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 841b824..d7d1df3 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -542,6 +542,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
 
 s = x264_encoder_headers(x4-enc, nal, nnal);
 avctx-extradata = p = av_malloc(s);
+if (!p)
+return AVERROR(ENOMEM);
 
 for (i = 0; i  nnal; i++) {
 /* Don't put the SEI in extradata. */
@@ -549,6 +551,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_INFO, %s\n, nal[i].p_payload+25);
 x4-sei_size = nal[i].i_payload;
 x4-sei  = av_malloc(x4-sei_size);
+if (!x4-sei)
+return AVERROR(ENOMEM);
 memcpy(x4-sei, nal[i].p_payload, nal[i].i_payload);
 continue;
 }

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] aacpsy: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 074a1b37325bf6d1483fc23ebf1255e78d998339

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:45:54 2015 +0200

aacpsy: Check memory allocation

---

 libavcodec/aacpsy.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index ac58968..6cfe3e3 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -298,6 +298,8 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 const float num_bark   = calc_bark((float)bandwidth);
 
 ctx-model_priv_data = av_mallocz(sizeof(AacPsyContext));
+if (!ctx-model_priv_data)
+return AVERROR(ENOMEM);
 pctx = (AacPsyContext*) ctx-model_priv_data;
 
 pctx-chan_bitrate = chan_bitrate;
@@ -349,6 +351,10 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 }
 
 pctx-ch = av_mallocz(sizeof(AacPsyChannel) * ctx-avctx-channels);
+if (!pctx-ch) {
+av_freep(pctx);
+return AVERROR(ENOMEM);
+}
 
 lame_window_init(pctx, ctx-avctx);
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] svq1: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 28fb80dcbf6f63eedfcfffc725a6bf0069d03fab

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:55:19 2015 +0200

svq1: Check memory allocation

---

 libavcodec/svq1enc.c |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 8677503..08d85b8 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -292,6 +292,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
 s-motion_val16[plane] = av_mallocz((s-m.mb_stride *
  (block_height + 2) + 1) *
 2 * sizeof(int16_t));
+if (!s-motion_val8[plane] || !s-motion_val16[plane])
+return AVERROR(ENOMEM);
 }
 
 s-m.mb_type = s-mb_type;
@@ -549,6 +551,12 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
 s-y_block_height * sizeof(int32_t));
 s-ssd_int8_vs_int16   = ssd_int8_vs_int16_c;
 
+if (!s-m.me.temp || !s-m.me.scratchpad || !s-m.me.map ||
+!s-m.me.score_map || !s-mb_type || !s-dummy) {
+svq1_encode_end(avctx);
+return AVERROR(ENOMEM);
+}
+
 if (ARCH_PPC)
 ff_svq1enc_init_ppc(s);
 if (ARCH_X86)
@@ -612,8 +620,15 @@ static int svq1_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
   s-frame_width  / (i ? 4 : 1),
   s-frame_height / (i ? 4 : 1),
   pict-linesize[i],
-  s-current_picture-linesize[i])  0)
+  s-current_picture-linesize[i])  0) {
+int j;
+for (j = 0; j  i; j++) {
+av_freep(s-motion_val8[j]);
+av_freep(s-motion_val16[j]);
+}
+av_freep(s-scratchbuf);
 return -1;
+}
 
 // avpriv_align_put_bits(s-pb);
 while (put_bits_count(s-pb)  31)

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] huffyuv: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 7d2a6826912b629f17f3b0c5268e334fa123c4c9

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:03 2015 +0200

huffyuv: Check memory allocation

---

 libavcodec/huffyuvenc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 6b3ff76..175b256 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -155,7 +155,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 s-version = 2;
 
 avctx-coded_frame = av_frame_alloc();
-if (!avctx-coded_frame)
+if (!avctx-extradata || !avctx-stats_out || !avctx-coded_frame)
 return AVERROR(ENOMEM);
 
 avctx-coded_frame-pict_type = AV_PICTURE_TYPE_I;

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] lcl: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: 8df5fbf0b0c0ba12b033e61c28fc240f4bccba47

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:21 2015 +0200

lcl: Check memory allocation

---

 libavcodec/lclenc.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
index 20841bc..2448b9e 100644
--- a/libavcodec/lclenc.c
+++ b/libavcodec/lclenc.c
@@ -135,6 +135,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
 assert(avctx-width  avctx-height);
 
 avctx-extradata= av_mallocz(8);
+if (!avctx-extradata)
+return AVERROR(ENOMEM);
 
 avctx-coded_frame = av_frame_alloc();
 if (!avctx-coded_frame)

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] xvid: Check memory allocation

2015-05-31 Thread Vittorio Giovara
Module: libav
Branch: master
Commit: fef2f4722bcbfe1c3802898b0f5deb6356132c91

Author:Vittorio Giovara vittorio.giov...@gmail.com
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Sun May 31 14:54:48 2015 +0200

xvid: Check memory allocation

---

 libavcodec/libxvid.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 46da773..97ff95b 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -276,6 +276,8 @@ static int xvid_strip_vol_header(AVCodecContext *avctx, 
AVPacket *pkt,
 /* We need to store the header, so extract it */
 if (!avctx-extradata) {
 avctx-extradata = av_malloc(vo_len);
+if (!avctx-extradata)
+return AVERROR(ENOMEM);
 memcpy(avctx-extradata, pkt-data, vo_len);
 avctx-extradata_size = vo_len;
 }
@@ -594,11 +596,15 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
 if (avctx-intra_matrix) {
 intra   = avctx-intra_matrix;
 x-intra_matrix = av_malloc(sizeof(unsigned char) * 64);
+if (!x-intra_matrix)
+return AVERROR(ENOMEM);
 } else
 intra = NULL;
 if (avctx-inter_matrix) {
 inter   = avctx-inter_matrix;
 x-inter_matrix = av_malloc(sizeof(unsigned char) * 64);
+if (!x-inter_matrix)
+return AVERROR(ENOMEM);
 } else
 inter = NULL;
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] Update changelog for v11.4

2015-05-31 Thread Reinhard Tartler
Module: libav
Branch: release/11
Commit: 0069d4597bda5723fbcae410784bbfa4750df706

Author:Reinhard Tartler siret...@tauware.de
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun May 24 10:36:42 2015 +0200

Update changelog for v11.4

---

 Changelog |   36 
 RELEASE   |2 +-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 6b8cabc..9fc1556 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,42 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version 11.4:
+
+ - h264: Make sure reinit failures mark the context as not initialized 
(CVE-2015-3417)
+ - msrle: Use FFABS to determine the frame size in msrle_decode_pal4 
(CVE-2015-3395)
+ - cavs: Remove an unneeded scratch buffer
+ - configure: Disable i686 for i586 and lower CPUs (debian/783082)
+ - mjpegenc: Fix JFIF header byte ordering (bug/808)
+ - nut: Make sure to clean up on read_header failure
+ - png: Set the color range as full range
+ - avi: Validate sample_size
+ - nut: Check chapter creation in decode_info_header
+ - alac: Reject rice_limit 0 if compression is used
+ - ape: Support _ files with nblock smaller than 64
+ - mux: Do not leave stale side data pointers in ff_interleave_add_packet()
+ - avresample: Reallocate the internal buffer to the correct size (bug/825)
+ - mpegts: Update the PSI/SI table only if the version change
+ - rtsp: Make sure we don't write too many transport entries into a fixed-size 
array
+ - rtpenc_jpeg: Handle case of picture dimensions not dividing by 8
+ - mov: Fix little endian audio detection
+ - x86: Put COPY3_IF_LT under HAVE_6REGS (gentoo/541930)
+ - roqvideoenc: set enc-avctx in roq_encode_init
+ - mp3: Properly use AVCodecContext API
+ - libvpx: Fix mixed use of av_malloc() and av_reallocp()
+ - Revert lavfi: always check av_expr_parse_and_eval() return value
+ - alsdec: only adapt order for positive max_order
+ - alsdec: check sample pointer range in revert_channel_correlation
+ - aacpsy: correct calculation of minath in psy_3gpp_init
+ - alsdec: limit avctx-bits_per_raw_sample to 32
+ - aasc: return correct buffer size from aasc_decode_frame
+ - matroskadec: fix crash when parsing invalid mkv
+ - avconv: do not overwrite the stream codec context for streamcopy
+ - webp: ensure that each transform is only used once
+ - h264_ps: properly check cropping parameters against overflow
+ - hevc: zero the correct variables on invalid crop parameters
+ - hevc: make the crop sizes unsigned
+
 version 11.3:
 
 - utvideodec: Handle slice_height being zero (CVE-2014-9604)
diff --git a/RELEASE b/RELEASE
index 8bb4222..1c7134d 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-11.3
+11.4

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits