Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter

2014-10-27 Thread arwa arif
On Mon, Oct 27, 2014 at 12:40 AM, Clément Bœsch u...@pkh.me wrote:

 On Mon, Oct 27, 2014 at 12:28:35AM +0530, arwa arif wrote:
  1. I think I understood what is giving you segmentation fault. The mask
  that I am creating is going out of bounds for the boundary pixels. I will
  try to fix it. But, I am curious why is it working on my laptop?

  2. Thank you Clement for the mode part. It made the code look smaller.
  Also, I chose numbers instead of alphabets because I was initially
  accessing the required values by considering the numbers as indices of  a
  matrix. If you want, I  can convert it to alphabets instead.

 It might be easier for maintaining and understanding the code since that's
 the convention of the specifications

  3. I think 4x can be done fast enough, but 3x will take time.

 Yeah, likely like hqx, right.

  4. I tried reading the hqx code, I am not very sure with what they have
  done in init part. It will be grateful if you can maybe explain the
  algorithm or maybe provide me with a link which explicitly explains it.
 

 In the init() callback the rgb2yuv map (which you can find in the local
 context) is initialized. Then you have the function rgb2yuv() to do the
 convert, which takes in argument that map and the rgb24 color to lookup
 in.

 [...]

 --
 Clément B.


I have done all the changes except rgb to yuv conversion. I will most
probably do it by tonight.


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


From 10b627af85029fa9164337f66101e9acc33d03c0 Mon Sep 17 00:00:00 2001
From: Arwa Arif arwaarif1...@gmail.com
Date: Sat, 25 Oct 2014 22:04:51 +0530
Subject: [PATCH] [PATCH]lavfi: add xbr filter

Makefile

allfilters.c

filters.texi

filters.texi

xbr-filter

xbr-filter
---
 doc/filters.texi |7 ++
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/vf_xbr.c |  285 ++
 4 files changed, 294 insertions(+)
 create mode 100644 libavfilter/vf_xbr.c

diff --git a/doc/filters.texi b/doc/filters.texi
index c70ddf3..5fa1d08 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9159,6 +9159,13 @@ Only deinterlace frames marked as interlaced.
 Default value is @samp{all}.
 @end table
 
+@section xbr
+
+A high-quality magnification filter which is designed for pixel art. It follows a set
+of edge-detection rules @url{http://www.libretro.com/forums/viewtopic.php?f=6t=134}.
+This filter was originally created by Hyllian. The current implementation scales the
+image by scale factor 2.
+
 @anchor{yadif}
 @section yadif
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6d868e7..2c56e38 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -198,6 +198,7 @@ OBJS-$(CONFIG_VIDSTABDETECT_FILTER)  += vidstabutils.o vf_vidstabdetect.
 OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER)   += vidstabutils.o vf_vidstabtransform.o
 OBJS-$(CONFIG_VIGNETTE_FILTER)   += vf_vignette.o
 OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
+OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
 OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
 OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
 OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index d88a9ad..2352d44 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -213,6 +213,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf);
 REGISTER_FILTER(VIGNETTE,   vignette,   vf);
 REGISTER_FILTER(W3FDIF, w3fdif, vf);
+REGISTER_FILTER(XBR,xbr,vf);
 REGISTER_FILTER(YADIF,  yadif,  vf);
 REGISTER_FILTER(ZMQ,zmq,vf);
 REGISTER_FILTER(ZOOMPAN,zoompan,vf);
diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c
new file mode 100644
index 000..9ecf15e
--- /dev/null
+++ b/libavfilter/vf_xbr.c
@@ -0,0 +1,285 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * Copyright (c) 2014 Arwa Arif arwaarif1...@gmail.com
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * 

Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter

2014-10-27 Thread Nicolas George
Le sextidi 6 brumaire, an CCXXIII, arwa arif a écrit :
 I have done all the changes except rgb to yuv conversion. I will most
 probably do it by tonight.

 +/*Convert RGB to Y'UV*/
 +int y = r * .299000 + g * .587000 + b * .114000;
 +int u = r * -.168736 + g * -.331264 + b * .50;
 +int v = r * .50 + g * -.418688 + b * -.081312;
 +
 +/*Add HQx filters threshold  return*/
 +return (y*48) + (u*7) + (v*6);

A bit of maths would greatly help simplifying the code here. I am too lazy
to make the computations myself, so according to PARI/GP, just copy-pasting
your formulas (and trimming useless zeros from the output to make it more
readable):

? y = r * .299000 + g * .587000 + b * .114000;
? u = r * -.168736 + g * -.331264 + b * .50;
? v = r * .50 + g * -.418688 + b * -.081312;
? (y*48) + (u*7) + (v*6)
%4 = 16.170848*r + (23.345024*g + 8.484128*b)

Since your numbers are all integers in the [-255;+255] range and your
computations are made on 32-bits integers, scaling everything by a factor K
would work for K between roughly 256 and 17. Using 65536 seems like a
good choice:

return (1059773 * r + 1529939 * g + 556016 * b)  16;

Of course, in this kind of case, a comment must be added to explain where
the numbers come from.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter

2014-10-27 Thread Clément Bœsch
On Mon, Oct 27, 2014 at 10:02:25AM +0100, Nicolas George wrote:
 Le sextidi 6 brumaire, an CCXXIII, arwa arif a écrit :
  I have done all the changes except rgb to yuv conversion. I will most
  probably do it by tonight.
 
  +/*Convert RGB to Y'UV*/
  +int y = r * .299000 + g * .587000 + b * .114000;
  +int u = r * -.168736 + g * -.331264 + b * .50;
  +int v = r * .50 + g * -.418688 + b * -.081312;
  +
  +/*Add HQx filters threshold  return*/
  +return (y*48) + (u*7) + (v*6);
 
 A bit of maths would greatly help simplifying the code here. I am too lazy
 to make the computations myself, so according to PARI/GP, just copy-pasting
 your formulas (and trimming useless zeros from the output to make it more
 readable):
 
 ? y = r * .299000 + g * .587000 + b * .114000;
 ? u = r * -.168736 + g * -.331264 + b * .50;
 ? v = r * .50 + g * -.418688 + b * -.081312;
 ? (y*48) + (u*7) + (v*6)
 %4 = 16.170848*r + (23.345024*g + 8.484128*b)
 
 Since your numbers are all integers in the [-255;+255] range and your
 computations are made on 32-bits integers, scaling everything by a factor K
 would work for K between roughly 256 and 17. Using 65536 seems like a
 good choice:
 
 return (1059773 * r + 1529939 * g + 556016 * b)  16;
 
 Of course, in this kind of case, a comment must be added to explain where
 the numbers come from.
 

The specs says it's the same algorithm as HQx, the code just needs to be
refactored, the integer convertion is already written there.

[...]

-- 
Clément B.


pgpC2vKXplT5Q.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec: read source timecode from pulldown component

2014-10-27 Thread tomas . hardin

On 2014-10-26 00:33, Mark Reid wrote:
On Sat, Oct 25, 2014 at 1:42 PM, Tomas Härdin 
tomas.har...@codemill.se

wrote:


On Fri, 2014-10-24 at 17:31 -0700, Mark Reid wrote:
 ---
  libavformat/mxf.h  |  1 +
  libavformat/mxfdec.c   | 31 +--
  tests/ref/lavf/mxf |  6 +++---
  tests/ref/lavf/mxf_d10 |  2 +-
  4 files changed, 34 insertions(+), 6 deletions(-)

 diff --git a/libavformat/mxf.h b/libavformat/mxf.h
 index 036c15e..5b95efa 100644

Looks good. Simple enough that it shouldn't cause any problems. Do you
have a spec for it, or is it just an undocumented Avid extension?



I found the uuids via the MXFDump util and pulldown objects are 
documented

in the aaf sdk

http://aaf.cvs.sourceforge.net/viewvc/aaf/AAF/doc/aafobjectspec-v1.1.pdf
(page 56)
http://sourceforge.net/p/bmxlib/libmxf/ci/master/tree/tools/MXFDump/AAFMetaDictionary.h#l1158


Check.

Taking the opportunity here to note that the strong ref resolving 
stuff

is getting a bit hairy. Could use some refactoring in the future
perhaps?



I was thinking the same thing, I'll try take a look into doing that and
send a refactoring patch in the future.
thanks for taking the time to review.


That'd be very cool :)

One huge improvement would be to change so that refs are stored in a 
map/hashmap. This would fix a potential problem with specially crafted 
files taking a long time to parse. If that's too much work for a simple 
refactoring run then I might add it as a suggested OPW task for next 
round.


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


[FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread greeshma
Hi,

how can we register new encoder file in the list of encoders.
i have added new encoder mlpenc.c and made patches accordingly.but i am not
able to convert .pcm file to .mlp file
and what are the command line AVoptions are to be added to convet .pcm file
to .mlp file(i have added sample_bits s24)


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


[FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread greeshma
Hi,

how can we register new encoder file in the list of encoders.
i have added new encoder mlpenc.c and made patches accordingly.but i am not
able to convert .pcm file to .mlp file
and what are the command line AVoptions are to be added to convet .pcm file
to .mlp file(i have added sample_bits s24)


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


[FFmpeg-devel] [PATCH] avformat/mxfdec: Fix false positive in infinite loop detector

2014-10-27 Thread Michael Niedermayer
Fixes Ticket4040

Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 libavformat/mxfdec.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index b01dd0c..a1abc34 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2211,6 +2211,13 @@ end:
 avio_seek(s-pb, mxf-run_in, SEEK_SET);
 }
 
+static uint64_t loop_detection_state(AVFormatContext *s)
+{
+MXFContext *mxf = s-priv_data;
+
+return avio_tell(s-pb) + 0xA987654321*!mxf-current_partition;
+}
+
 static int mxf_read_header(AVFormatContext *s)
 {
 MXFContext *mxf = s-priv_data;
@@ -2235,12 +2242,12 @@ static int mxf_read_header(AVFormatContext *s)
 
 while (!avio_feof(s-pb)) {
 const MXFMetadataReadTableEntry *metadata;
-if (avio_tell(s-pb) == last_pos) {
+if (loop_detection_state(s) == last_pos) {
 av_log(mxf-fc, AV_LOG_ERROR, MXF structure loop detected\n);
 return AVERROR_INVALIDDATA;
 }
 if ((1ULL61) % last_pos_index++ == 0)
-last_pos = avio_tell(s-pb);
+last_pos = loop_detection_state(s);
 if (klv_read_packet(klv, s-pb)  0) {
 /* EOF - seek to previous partition or stop */
 if(mxf_parse_handle_partition_or_eof(mxf) = 0)
-- 
1.7.9.5

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


Re: [FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread Michael Niedermayer
Hi

On Mon, Oct 27, 2014 at 08:54:11PM +0530, greeshma wrote:
 Hi,
 
 how can we register new encoder file in the list of encoders.
 i have added new encoder mlpenc.c and made patches accordingly.but i am not
 able to convert .pcm file to .mlp file

Best check the changes that where commited when other now included
encoders where added

you have to update
libavcodec/Makefile
libavcodec/allcodecs.c


 and what are the command line AVoptions are to be added to convet .pcm file
 to .mlp file(i have added sample_bits s24)

i do not understand the question


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

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


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


Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: Fix false positive in infinite loop detector

2014-10-27 Thread tomas . hardin

On 2014-10-27 16:27, Michael Niedermayer wrote:

Fixes Ticket4040

Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 libavformat/mxfdec.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index b01dd0c..a1abc34 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2211,6 +2211,13 @@ end:
 avio_seek(s-pb, mxf-run_in, SEEK_SET);
 }

+static uint64_t loop_detection_state(AVFormatContext *s)
+{
+MXFContext *mxf = s-priv_data;
+
+return avio_tell(s-pb) + 0xA987654321*!mxf-current_partition;
+}
+


What the hell? Just use a flag or something, or mxf-parsing_backward 
(preferably)



 static int mxf_read_header(AVFormatContext *s)
 {
 MXFContext *mxf = s-priv_data;
@@ -2235,12 +2242,12 @@ static int mxf_read_header(AVFormatContext *s)

 while (!avio_feof(s-pb)) {
 const MXFMetadataReadTableEntry *metadata;
-if (avio_tell(s-pb) == last_pos) {
+if (loop_detection_state(s) == last_pos) {
 av_log(mxf-fc, AV_LOG_ERROR, MXF structure loop 
detected\n);

 return AVERROR_INVALIDDATA;
 }
 if ((1ULL61) % last_pos_index++ == 0)


This looks extremely dubious, but I see 1c010fd03 was a stop gap to fix 
a an issue discovered by fuzzing. Why didn't anyone poke my on IRC about 
it?
I have furniture to move today, after that I might have some time to 
develop an non-awful fix.


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


Re: [FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread greeshma
Hi,

thanks,
I am trying to convert .raw/.pcm file to .mlp file using mlp encoder.I want
the command line options to be used for the conversion.

Greeshma Balabhadra
Pre final Undergraduate
IIT Guwahati
+91 7896366744
grees...@iitg.ernet.in


On Mon, Oct 27, 2014 at 9:07 PM, Michael Niedermayer michae...@gmx.at
wrote:

 Hi

 On Mon, Oct 27, 2014 at 08:54:11PM +0530, greeshma wrote:
  Hi,
 
  how can we register new encoder file in the list of encoders.
  i have added new encoder mlpenc.c and made patches accordingly.but i am
 not
  able to convert .pcm file to .mlp file

 Best check the changes that where commited when other now included
 encoders where added

 you have to update
 libavcodec/Makefile
 libavcodec/allcodecs.c


  and what are the command line AVoptions are to be added to convet .pcm
 file
  to .mlp file(i have added sample_bits s24)

 i do not understand the question


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

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

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


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


Re: [FFmpeg-devel] [PATCH] lavd/avfoundation: Fix compilation for non MAC OS devices by, conditional compilation of screen capture capabilities.

2014-10-27 Thread Michael Niedermayer
On Mon, Oct 27, 2014 at 02:55:34PM +0100, Thilo Borgmann wrote:
 Hi,
 
 fixes compilation for ios targets. Screen capturing needs a different approach
 on these.
 
 -Thilo

  avfoundation.m |8 
  1 file changed, 8 insertions(+)
 a2978de45c17b54579717b888dabd71a884d71d0  
 0001-lavd-avfoundation-Fix-compilation-for-non-MAC-OS-dev.patch
 From 22850a5035af612d4f6bd613002e7540e6d582ab Mon Sep 17 00:00:00 2001
 From: Thilo Borgmann thilo.borgm...@mail.de
 Date: Mon, 27 Oct 2014 15:20:27 +0100
 Subject: [PATCH] lavd/avfoundation: Fix compilation for non MAC OS devices by
  conditional compilation of screen capture capabilities.

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread Michael Niedermayer
On Mon, Oct 27, 2014 at 09:23:59PM +0530, greeshma wrote:
 Hi,
 
 thanks,
 I am trying to convert .raw/.pcm file to .mlp file using mlp encoder.I want
 the command line options to be used for the conversion.

./ffmpeg -i input.wav output.mlp

should work if there is a mlp encoder

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

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


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


Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: Fix false positive in infinite loop detector

2014-10-27 Thread Michael Niedermayer
On Mon, Oct 27, 2014 at 04:52:26PM +0100, tomas.har...@codemill.se wrote:
 On 2014-10-27 16:27, Michael Niedermayer wrote:
 Fixes Ticket4040
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libavformat/mxfdec.c |   11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)
 
 diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
 index b01dd0c..a1abc34 100644
 --- a/libavformat/mxfdec.c
 +++ b/libavformat/mxfdec.c
 @@ -2211,6 +2211,13 @@ end:
  avio_seek(s-pb, mxf-run_in, SEEK_SET);
  }
 
 +static uint64_t loop_detection_state(AVFormatContext *s)
 +{
 +MXFContext *mxf = s-priv_data;
 +
 +return avio_tell(s-pb) + 0xA987654321*!mxf-current_partition;
 +}
 +
 
 What the hell? Just use a flag or something, or
 mxf-parsing_backward (preferably)

i tried parsing_backward before posting this, sadly it didnt help
Ticket4040, at least not in mxf-current_partition place above or i
made some dumb mistake

mxf-current_partition != NULL was used as this was part of the
condition that made the 2 occurances of the same position diverge

The patch surely is ugly, i dont like it at all either ...


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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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


[FFmpeg-devel] OPW Qualification: Enable daemon mode for FFserver

2014-10-27 Thread Binathi Bingi
Hi there,

I am Binathi, applying for FOSS OPW Round 9, for contributing to FFmpeg.

As a part of my qualification task, I had been working on bug  #3731 open
defect ffserver daemon mode  [https://trac.ffmpeg.org/ticket/3731]

I changed two files and uploaded them onto my git repository [
https://github.com/Binathi/ffserver] to allow ffserver run in daemon mode
in ffmpeg 2.4.2 version

After making changes, you should do (from within your ffmpeg source code
directory)
[1]
./configure (Required, if you haven't done this before)
make ffserver
[2] copy ffserver.conf to /some/place/else/ and then do
 ./ffserver -f /some/place/else/ffserver.conf to start a new ffserver
instance running in daemon mode


Patch to ffserver.conf, 2 insertions

# '-' is the standard output.
CustomLog -

+# Suppress that if you don't want to launch ffserver as a daemon.
+Daemon

###

Patch to ffserver.c 2 deletions, 22 insertions

static int ffserver_debug;
+static int ffserver_daemon;
static int no_launch;
.
if (resolve_host(my_http_addr.sin_addr, arg) != 0) {
ERROR(%s:%d: Invalid host/IP address: %s\n, arg);}
}
-+else if (!av_strcasecmp(cmd, Daemon)) {
+ffserver_daemon = 1;
-WARNING(NoDaemon option has no effect, you should remove it\n);
} else if (!av_strcasecmp(cmd, RTSPPort)) {
.
static void opt_debug(void)
{
ffserver_debug = 1;
+ffserver_daemon = 1;
logfilename[0] = '-';

int main(int argc, char **argv)
{
struct sigaction sigact = { { 0 } };
int ret = 0;
+ffserver_daemon = 0;
config_filename = av_strdup(/etc/ffserver.conf);
.
compute_bandwidth();
+if(ffserver_daemon){
+int ffserver_id = 0;
+pid_t sid = 0;

+ffserver_id = fork(); // Create child process

+if (ffserver_id  0){
+printf(fork failed!\n); //Indication of failure
+exit(1);}

+if(ffserver_id  0){ //Parent process need to kill
   +exit(0);}

+sid = setsid(); //set new session
+if(sid  0){
+exit(1); //return failure   }

+open (/dev/null, O_RDWR);

+if (strcmp(logfilename, -) != 0) {
+close(1);}
}
/* signal init */
signal(SIGPIPE, SIG_IGN);
+if (ffserver_daemon)
+chdir(/);
if (http_server()  0) {

}


Cheers,
Binathi

living with taking zero risks is extremely risky! - Robert Sharma
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] OPW Qualification: Enable daemon mode for FFserver

2014-10-27 Thread Nicolas George
Le sextidi 6 brumaire, an CCXXIII, Binathi Bingi a écrit :
 I am Binathi, applying for FOSS OPW Round 9, for contributing to FFmpeg.
 
 As a part of my qualification task, I had been working on bug  #3731 open
 defect ffserver daemon mode  [https://trac.ffmpeg.org/ticket/3731]
 
 I changed two files and uploaded them onto my git repository [
 https://github.com/Binathi/ffserver] to allow ffserver run in daemon mode
 in ffmpeg 2.4.2 version

Thanks for the patch. There are still a few steps before getting it into
shape.

First, your repository must be a full clone of the FFmpeg repository, so you
can add your changes as commits, or in this particular case as a single
commit changing the files that needs changing.

Second, when sending patches to this mailing list, prepare them with git
format-patch, that will include full authorship information and comments.
It will also avoid the patch getting mangled by bad mail user agents. You
can also use git send-email, that will do the same and directly send it by
mail.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] avformat/mxfenc: AVC Intra support

2014-10-27 Thread Thomas Mundt
Hi, I´ve seen that there has been approach last month to implement AVC Intra 
mxf muxing. I tested the patches, but it didn´t work with any of my samples. 
Since there also has been discussions about the gpl restriction, I rewrote the 
patch. I had some basics, because I had written a working patch for myself some 
time ago, which was more of a hack and only worked with AVCI100 1080i50.
I hope this could be licenced to lgpl, because I got all labels from libmxf and 
libbmx and only used code snippets from avcodec/h264_parser.c
To keep h264 parsing simple and fast, I used the framesize for selecting the 
right Panasonic codec label. The framesize is fixed for Panasonic AVC Intra.

This patch only supports AVCI50/100. But in all flavours, i.e. with no SPS/PPS 
in header.

http://pastebin.com/v7gF1vDq

Thomas

  
 
ffmpeg avci mxf patch - Pastebin.com
--- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -40,8 +40,11 @@  
#include libavutil/timecode.h  #include libavutil/avassert.h  #include 
libavutil/ti...  
Auf pastebin.com anzeigen Vorschau nach Yahoo  
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread Reimar Döffinger
On Mon, Oct 27, 2014 at 05:16:53PM +0100, Michael Niedermayer wrote:
 On Mon, Oct 27, 2014 at 09:23:59PM +0530, greeshma wrote:
  Hi,
  
  thanks,
  I am trying to convert .raw/.pcm file to .mlp file using mlp encoder.I want
  the command line options to be used for the conversion.
 
 ./ffmpeg -i input.wav output.mlp
 
 should work if there is a mlp encoder

Doesn't that need both a MLP encoder and muxer?
Or if it's supposed to be raw data, adding it to rawenc.c (see
ff_truehd_muxer for an example)?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] new encoder function(urgent)

2014-10-27 Thread Michael Niedermayer
On Mon, Oct 27, 2014 at 06:25:59PM +0100, Reimar Döffinger wrote:
 On Mon, Oct 27, 2014 at 05:16:53PM +0100, Michael Niedermayer wrote:
  On Mon, Oct 27, 2014 at 09:23:59PM +0530, greeshma wrote:
   Hi,
   
   thanks,
   I am trying to convert .raw/.pcm file to .mlp file using mlp encoder.I 
   want
   the command line options to be used for the conversion.
  
  ./ffmpeg -i input.wav output.mlp
  
  should work if there is a mlp encoder
 
 Doesn't that need both a MLP encoder and muxer?
 Or if it's supposed to be raw data, adding it to rawenc.c (see
 ff_truehd_muxer for an example)?

its already in rawenc.c

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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


Re: [FFmpeg-devel] [PATCH] x86: use new gcc atomic built-ins if available

2014-10-27 Thread Michael Niedermayer
On Sat, Oct 25, 2014 at 10:32:57PM -0300, James Almer wrote:
 __sync built-ins are considered legacy and will be deprecated.
 These new memory model aware built-ins have been available since GCC 4.7.0
 
 Signed-off-by: James Almer jamr...@gmail.com
 ---
 https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/_005f_005fatomic-Builtins.html
 This is an RFC for a couple reasons.
 
 The first is the memory model parameter. The documentation mentions that the 
 __sync functions match the behavoir of the new __atomic functions when the 
 latter use the full barrier model (__ATOMIC_SEQ_CST), so i went with it for 
 consistency's sake. It may however be a good idea to check if any of the more 
 relaxed models available for these new functions can be used instead.
 It's worth mentioning that when i tested, gcc-tsan liked the __atomic load 
 and 
 store functions a lot more than __sync_synchronize(), regardless of memory 
 model.
 
 The second reason is __atomic_compare_exchange_n(), and how it differs from
 __sync_val_compare_and_swap().
 While the latter returns *ptr as it was before the operation, the former
 doesn't and instead copies *ptr to oldval if the result of the comparison is 
 false. This means that returning oldval will match the old behavoir without 
 having to change the wrapper.
 A disassemble example from libavutil/buffer.o however hints that the __atomic
 function may be slower because of it writting oldval.
 
 __sync_val_compare_and_swap:
  8e3: 48 89 d8movrax,rbx
  8e6: f0 48 0f b1 16  lock cmpxchg QWORD PTR [rsi],rdx
  8eb: 48 85 c0test   rax,rax
 
 __atomic_compare_exchange_n:
  8f0: 48 8d 4c 24 20  learcx,[rsp+0x20]
  [...]
  90c: 48 89 d8movrax,rbx
  90f: 48 89 5c 24 20  movQWORD PTR [rsp+0x20],rbx
  914: f0 48 0f b1 16  lock cmpxchg QWORD PTR [rsi],rdx
  919: 74 03   je 91e av_buffer_pool_get+0x3e
  91b: 48 89 01movQWORD PTR [rcx],rax
  91e: 48 8b 44 24 20  movrax,QWORD PTR [rsp+0x20]
  923: 48 85 c0test   rax,rax
 

 So the question is, do we keep using __sync_val_compare_and_swap as long as 
 gcc offers it (Which is probably a very long time), or immediately switch to 
 __atomic_compare_exchange_n if available?

id say we should favor whatever is faster


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

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


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


Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter

2014-10-27 Thread Clément Bœsch
On Tue, Oct 28, 2014 at 01:07:30AM +0530, arwa arif wrote:
[...]
 From 9c5fa6fa8f6091149570cded8ee65d232ae88e97 Mon Sep 17 00:00:00 2001
 From: Arwa Arif arwaarif1...@gmail.com
 Date: Sat, 25 Oct 2014 22:04:51 +0530
 Subject: [PATCH] [PATCH]lavfi: add xbr filter
 
 Makefile
 
 allfilters.c
 
 filters.texi
 
 filters.texi
 
 xbr-filter
 
 xbr-filter
 
 xbr-filter

Again, please drop these references

 ---
  doc/filters.texi |7 +
  libavfilter/Makefile |1 +
  libavfilter/allfilters.c |1 +
  libavfilter/vf_xbr.c |  317 
 ++
  4 files changed, 326 insertions(+)
  create mode 100644 libavfilter/vf_xbr.c
 
 diff --git a/doc/filters.texi b/doc/filters.texi
 index c70ddf3..5fa1d08 100644
 --- a/doc/filters.texi
 +++ b/doc/filters.texi
 @@ -9159,6 +9159,13 @@ Only deinterlace frames marked as interlaced.
  Default value is @samp{all}.
  @end table
  
 +@section xbr
 +
 +A high-quality magnification filter which is designed for pixel art. It 
 follows a set
 +of edge-detection rules 
 @url{http://www.libretro.com/forums/viewtopic.php?f=6t=134}.
 +This filter was originally created by Hyllian. The current implementation 
 scales the
 +image by scale factor 2.

image - input

 +
  @anchor{yadif}
  @section yadif
  
 diff --git a/libavfilter/Makefile b/libavfilter/Makefile
 index 6d868e7..2c56e38 100644
 --- a/libavfilter/Makefile
 +++ b/libavfilter/Makefile
 @@ -198,6 +198,7 @@ OBJS-$(CONFIG_VIDSTABDETECT_FILTER)  += 
 vidstabutils.o vf_vidstabdetect.
  OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER)   += vidstabutils.o 
 vf_vidstabtransform.o
  OBJS-$(CONFIG_VIGNETTE_FILTER)   += vf_vignette.o
  OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
 +OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
 diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
 index d88a9ad..2352d44 100644
 --- a/libavfilter/allfilters.c
 +++ b/libavfilter/allfilters.c
 @@ -213,6 +213,7 @@ void avfilter_register_all(void)
  REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf);
  REGISTER_FILTER(VIGNETTE,   vignette,   vf);
  REGISTER_FILTER(W3FDIF, w3fdif, vf);
 +REGISTER_FILTER(XBR,xbr,vf);
  REGISTER_FILTER(YADIF,  yadif,  vf);
  REGISTER_FILTER(ZMQ,zmq,vf);
  REGISTER_FILTER(ZOOMPAN,zoompan,vf);
 diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c
 new file mode 100644
 index 000..5c97173
 --- /dev/null
 +++ b/libavfilter/vf_xbr.c
 @@ -0,0 +1,317 @@
 +/*
 + * This file is part of FFmpeg.
 + *
 + * Copyright (c) 2014 Arwa Arif arwaarif1...@gmail.com
 + *
 + * FFmpeg 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.
 + *
 + * FFmpeg 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 FFmpeg; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
 + */
 +
 +/**
 + * @file
 + * XBR Filter is used for depixelization of image.
 + * This is based on Hyllian's 2xBR shader.

 + * 2xBR Filter v0.2.5 

trailing whitespace

 + * Reference : http://board.byuu.org/viewtopic.php?f=10t=2248

dead link, and replace Reference : by @see http://...;

Add a TODO with the following:
 - x3 and x4 scale
 - threading

 + */
 +
 +#include libavutil/opt.h
 +#include libavutil/avassert.h
 +#include libavutil/pixdesc.h
 +#include internal.h
 +
 +typedef struct {
 +uint32_t rgbtoyuv[124];
 +} xBRContext;
 +
 +/**
 +* Calculates the weight of difference of the pixels, by transforming these
 +* pixels into their Y'UV parts. It then uses the threshold used by HQx 
 filters:
 +* 48*Y + 7*U + 6*V, to give it those smooth looking edges.
 +**/

 +static int d(AVFrame *in,int x1,int y1,int x2,int y2,const uint32_t *r2y){

Here and several times below, wrong coding style.

 +
 +#define YMASK 0xff
 +#define UMASK 0x00ff00
 +#define VMASK 0xff
 +
 +int r1 = *(in-data[0] + y1 * in-linesize[0] + x1*3);
 +int g1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 1);
 +int b1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 2);
 +
 +int r2 = *(in-data[0] + y2 * in-linesize[0] + x2*3);
 +int g2 = *(in-data[0] + y2 * in-linesize[0] + x2*3 + 1);
 +int b2 = *(in-data[0] + y2 * 

Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter

2014-10-27 Thread Clément Bœsch
On Mon, Oct 27, 2014 at 08:54:11PM +0100, Clément Bœsch wrote:
[...]
 Can you add a FATE test similar to this? See tests/fate/filter-video.mak.

similar to hqx I meant

-- 
Clément B.


pgpnPv6t6IHk6.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mxfenc: AVC Intra support

2014-10-27 Thread Tomas Härdin
On Mon, 2014-10-27 at 17:21 +, Thomas Mundt wrote:
 Hi, I´ve seen that there has been approach last month to implement AVC Intra 
 mxf muxing. I tested the patches, but it didn´t work with any of my samples. 
 Since there also has been discussions about the gpl restriction, I rewrote 
 the patch. I had some basics, because I had written a working patch for 
 myself some time ago, which was more of a hack and only worked with AVCI100 
 1080i50.
 I hope this could be licenced to lgpl, because I got all labels from libmxf 
 and libbmx and only used code snippets from avcodec/h264_parser.c
 To keep h264 parsing simple and fast, I used the framesize for selecting the 
 right Panasonic codec label. The framesize is fixed for Panasonic AVC Intra.
 
 This patch only supports AVCI50/100. But in all flavours, i.e. with no 
 SPS/PPS in header.
 
 http://pastebin.com/v7gF1vDq
 
 Thomas

Could you rewrite it so you don't mix functional changes with
indentation changes? See mxf_write_mpegvideo_desc()
 
 +switch (pkt-size + extrasize) {
 +case 116736: // AVCI50 720p60
 +sc-codec_ul = mxf_h264_codec_uls[5];
 +break;
 +case 140800: // AVCI50 720p50
 +sc-codec_ul = mxf_h264_codec_uls[6];
 +break;

The magic values here stink. You should stick them next to
mxf_h264_codec_uls, perhaps using a struct like so:

  static const struct {
  UID uid;
  int packet_size;
  int profile;
  uint8_t interlaced;
  } mxf_h264_codec_uls[] = {
  {{ 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0a,0x04,0x01,0x02,0x02,0x01,0x32,0x20,0x01 
}, 0,  110, 0}, // AVC Intra 50 High 10
  {{ 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0a,0x04,0x01,0x02,0x02,0x01,0x32,0x21,0x01 
}, 232960, 0,   1}, // AVC Intra 50 1080i60
  //etc etc
  };
  static const int mxf_h264_num_codec_uls = 
sizeof(mxf_h264_codec_uls)/sizeof(mxf_h264_codec_uls[0]);

Then use a little for loop in mxf_parse_h264_frame() to find the
matching entry.

 +if (desc)
 +sc-component_depth = desc-comp[0].depth_minus1 + 1;

Seems unrelated?

In general I didn't check how similar this patch is to the GPL'd
version, so I'm going to trust that this doesn't share anything (except
the ULs, which come from the standards).

/Tomas



signature.asc
Description: This is a digitally signed message part
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for Opus in MPEG-TS

2014-10-27 Thread Kieran Kunhya
On 26 October 2014 21:32, Michael Niedermayer michae...@gmx.at wrote:
 On Sat, Oct 18, 2014 at 12:25:16AM +0100, Kieran Kunhya wrote:
 ---
  libavcodec/opus.c|   11 +---
  libavcodec/opus.h|9 +++
  libavcodec/opus_parser.c |  139 
 +-
  libavformat/mpegts.c |   54 +-
  4 files changed, 191 insertions(+), 22 deletions(-)

 looks ok, applied

 btw, do you have a test sample that you can share ?

http://www.obe.tv/Downloads/opus.ts for stereo
I need to make surround and other samples.

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


Re: [FFmpeg-devel] [PATCH] Disable chunked output for Icecast

2014-10-27 Thread Marvin Scholz
This is needed, I forgot completely about it. Icecast at the current 
version is not
able to handle chunked encoding correctly, so if ffmpeg uses chunked 
encoding it

must be disable for the Icecast protocol.

On 21 Aug 2014, at 23:04, Michael Niedermayer wrote:


On Wed, Aug 20, 2014 at 10:31:39AM +0300, Maksym Veremeyenko wrote:

hi,

attached patch fix input stream detection by Icecast that do not
understand chunked http input.


how can this issue/bug be reproduced ?

[...]

--
Michael GnuPG fingerprint: 
9FF2128B147EF6730BADF133611EC787040B0FAB


The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] Disable chunked output for Icecast

2014-10-27 Thread Michael Niedermayer
On Mon, Oct 27, 2014 at 10:57:44PM +0100, Marvin Scholz wrote:
 This is needed, I forgot completely about it. Icecast at the current
 version is not
 able to handle chunked encoding correctly, so if ffmpeg uses chunked
 encoding it
 must be disable for the Icecast protocol.

it seems a patch from someone else that adds the same line at about
the same place was applied and merged a while ago
so this should have been fixed

See 76c70e33d2244a688832f03b53862eb5d9ad3b01  
25a418082597408fcf4b6c9834d371ba46afc5a2

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

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


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


[FFmpeg-devel] [PATCH] lavu/atomic: add support for the new memory model aware gcc built-ins

2014-10-27 Thread James Almer
__sync built-ins are considered legacy and will be deprecated.
These new memory model aware built-ins have been available since GCC 4.7.0

Use them by default when available except for __atomic_compare_exchange_n(),
which is slower, and is instead implemented as a fallback for when and if gcc
removes the legacy __sync built-ins.

Signed-off-by: James Almer jamr...@gmail.com
---
 configure  |  4 +++-
 libavutil/atomic_gcc.h | 17 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 0a1b154..1913cb5 100755
--- a/configure
+++ b/configure
@@ -1602,6 +1602,7 @@ ARCH_FEATURES=
 
 BUILTIN_LIST=
 atomic_cas_ptr
+atomic_compare_exchange
 machine_rw_barrier
 MemoryBarrier
 mm_empty
@@ -2028,7 +2029,7 @@ simd_align_16_if_any=altivec neon sse
 symver_if_any=symver_asm_label symver_gnu_asm
 
 # threading support
-atomics_gcc_if=sync_val_compare_and_swap
+atomics_gcc_if_any=sync_val_compare_and_swap atomic_compare_exchange
 atomics_suncc_if=atomic_cas_ptr machine_rw_barrier
 atomics_win32_if=MemoryBarrier
 atomics_native_if_any=$ATOMICS_LIST
@@ -4681,6 +4682,7 @@ if ! disabled network; then
 fi
 
 check_builtin atomic_cas_ptr atomic.h void **ptr; void *oldval, *newval; 
atomic_cas_ptr(ptr, oldval, newval)
+check_builtin atomic_compare_exchange  int *ptr, *oldval; int newval; 
__atomic_compare_exchange_n(ptr, oldval, newval, 0, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST)
 check_builtin machine_rw_barrier mbarrier.h __machine_rw_barrier()
 check_builtin MemoryBarrier windows.h MemoryBarrier()
 check_builtin sarestart signal.h SA_RESTART
diff --git a/libavutil/atomic_gcc.h b/libavutil/atomic_gcc.h
index 2bb43c3..5f9fc49 100644
--- a/libavutil/atomic_gcc.h
+++ b/libavutil/atomic_gcc.h
@@ -28,27 +28,40 @@
 #define avpriv_atomic_int_get atomic_int_get_gcc
 static inline int atomic_int_get_gcc(volatile int *ptr)
 {
+#if HAVE_ATOMIC_COMPARE_EXCHANGE
+return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+#else
 __sync_synchronize();
 return *ptr;
+#endif
 }
 
 #define avpriv_atomic_int_set atomic_int_set_gcc
 static inline void atomic_int_set_gcc(volatile int *ptr, int val)
 {
+#if HAVE_ATOMIC_COMPARE_EXCHANGE
+__atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
+#else
 *ptr = val;
 __sync_synchronize();
+#endif
 }
 
 #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_gcc
 static inline int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc)
 {
+#if HAVE_ATOMIC_COMPARE_EXCHANGE
+return __atomic_add_fetch(ptr, inc, __ATOMIC_SEQ_CST);
+#else
 return __sync_add_and_fetch(ptr, inc);
+#endif
 }
 
 #define avpriv_atomic_ptr_cas atomic_ptr_cas_gcc
 static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
void *oldval, void *newval)
 {
+#if HAVE_SYNC_VAL_COMPARE_AND_SWAP
 #ifdef __ARMCC_VERSION
 // armcc will throw an error if ptr is not an integer type
 volatile uintptr_t *tmp = (volatile uintptr_t*)ptr;
@@ -56,6 +69,10 @@ static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
 #else
 return __sync_val_compare_and_swap(ptr, oldval, newval);
 #endif
+#else
+__atomic_compare_exchange_n(ptr, oldval, newval, 0, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST);
+return oldval;
+#endif
 }
 
 #endif /* AVUTIL_ATOMIC_GCC_H */
-- 
2.0.4

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