[FFmpeg-devel] [PATCH] Cherry-pick commit 6803a298f4338c19c3032d2417c6e857eb6d95be Support for MIPS cpu P6600

2016-10-05 Thread shivraj.patil
From: Shivraj Patil 

Signed-off-by: Shivraj Patil 
Signed-off-by: Michael Niedermayer 
---
 configure |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 5b069eb..64142e7 100755
--- a/configure
+++ b/configure
@@ -4336,7 +4336,7 @@ elif enabled mips; then
 enable mips32r2
 disable msa
 ;;
-p5600|i6400)
+p5600|i6400|p6600)
 disable mipsdsp
 disable mipsdspr2
 ;;
@@ -4401,6 +4401,10 @@ elif enabled mips; then
 enable mips64r6
 check_cflags "-mtune=i6400 -mabi=64" && check_cflags 
"-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
 ;;
+p6600)
+enable mips64r6
+check_cflags "-mtune=p6600 -mabi=64" && check_cflags 
"-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
+;;
 esac
 else
 # We do not disable anything. Is up to the user to disable the 
unwanted features.
-- 
1.7.9.5

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


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

2016-10-05 Thread Vittorio Giovara
On Wed, Oct 5, 2016 at 10:07 PM, Michael Niedermayer
 wrote:
> On Wed, Oct 05, 2016 at 05:25:33PM -0400, Vittorio Giovara wrote:
>> This matrix needs to be applied after all others have (currently only
>> display matrix from trak), but cannot be handled in movie box, since
>> streams are not allocated yet.
>>
>> So store it in main context and if not identity, apply it when appropriate,
>> handling the case when trak display matrix is identity and when it is not.
>
> do you have a testcase for this which you can share ?
>
> thx
>
> [...]
> --

I created one for the occasion
https://www.dropbox.com/s/w2uu37o11rvoz1q/moviedispmat.mp4?dl=1
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] pixdesc: Order function prototypes semantically

2016-10-05 Thread Timothy Gu
On Mon, Aug 22, 2016 at 5:53 AM Michael Niedermayer 
wrote:

> On Sun, Aug 21, 2016 at 05:09:00PM -0700, Timothy Gu wrote:
> > ---
> >  libavutil/pixdesc.h | 194
> ++--
> >  1 file changed, 97 insertions(+), 97 deletions(-)
>
> LGTM
>
> thx
>

Applied, thanks.

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


Re: [FFmpeg-devel] [PATCH 2/2] pixfmt: Use enum assignment for aliases

2016-10-05 Thread Timothy Gu
On Tue, Aug 23, 2016 at 12:28 PM Michael Niedermayer 
wrote:

> On Sun, Aug 21, 2016 at 05:09:01PM -0700, Timothy Gu wrote:
> > This way, Doxygen is happier as aliases are now grouped together, and
> > it never handled #define's in an enum well in the first place.
> >
> > Y400A already exists as an enum assignment.
> > ---
> >  libavutil/pixfmt.h | 6 ++
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > index 6f71ac0..efc3714 100644
> > --- a/libavutil/pixfmt.h
> > +++ b/libavutil/pixfmt.h
> > @@ -77,7 +77,7 @@ enum AVPixelFormat {
> >  #if FF_API_XVMC
> >  AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common
> packet passing
> >  AV_PIX_FMT_XVMC_MPEG2_IDCT,
> > -#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT
> > +AV_PIX_FMT_XVMC = AV_PIX_FMT_XVMC_MPEG2_IDCT,
> >  #endif /* FF_API_XVMC */
> >  AV_PIX_FMT_UYVY422,   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
> >  AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2
> Y3
> > @@ -178,6 +178,7 @@ enum AVPixelFormat {
> >  AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb
> sample per 2x1 Y samples), little-endian
> >  AV_PIX_FMT_VDA_VLD,///< hardware decoding through VDA
> >  AV_PIX_FMT_GBRP,  ///< planar GBR 4:4:4 24bpp
> > +AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
> >  AV_PIX_FMT_GBRP9BE,   ///< planar GBR 4:4:4 27bpp, big-endian
> >  AV_PIX_FMT_GBRP9LE,   ///< planar GBR 4:4:4 27bpp, little-endian
> >  AV_PIX_FMT_GBRP10BE,  ///< planar GBR 4:4:4 30bpp, big-endian
> > @@ -308,9 +309,6 @@ enum AVPixelFormat {
> >  AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS
> if you want to link with shared libav* because the number of formats might
> differ between versions
> >  };
> >
> > -#define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A
> > -#define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP
> > -
> >  #if AV_HAVE_BIGENDIAN
> >  #   define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
> >  #else
>
> probably ok
>
> thx
>

Applied, thanks.

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


Re: [FFmpeg-devel] [PATCH] lavf/segment: provide a virtual AVIOContext representing all the segments

2016-10-05 Thread James Almer
On 10/5/2016 2:33 AM, Rodger Combs wrote:
> This allows the use of muxers like matroska, which attempt to seek even
> when an AVIOContext doesn't set `seekable`, without concern for a rouge
> seek leading the muxer to overwrite the wrong data in a later segment.

For the record, this behavior in Matroska will stop after my CRC32 patchset.

As an example of this, take the first of the fate-lavf-mkv commands, the one
that creates a file with an attachment, and make it output to a non seekable
protocol. The result will have the Attachments master being corrupted as it
tried in vain to jump back to the beginning of the master to write the
element size long after having flushed.

After patch 9 of said set, this scenario is fixed as far as i could see.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsvenc_h264: fix segfault when a53 SEI is not available

2016-10-05 Thread Michael Niedermayer
On Wed, Oct 05, 2016 at 11:35:08PM +0200, Michael Niedermayer wrote:
> On Wed, Oct 05, 2016 at 09:34:25AM -0400, Nablet Developer wrote:
> > Signed-off-by: Nablet Developer 
> > ---
> >  libavcodec/qsvenc_h264.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> applied

actually, before applying, one question

you have set the author for your git to "Nablet Developer"
is this intended? Do you not want your name to be in the Author field ?
If you dont mind your name to be in the author field then please
resubmit the patch with correct Author

[...]

thx

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


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

2016-10-05 Thread Vittorio Giovara
This matrix needs to be applied after all others have (currently only
display matrix from trak), but cannot be handled in movie box, since
streams are not allocated yet.

So store it in main context and if not identity, apply it when appropriate,
handling the case when trak display matrix is identity and when it is not.

Signed-off-by: Vittorio Giovara 
---
Please keep my in CC.
Vittorio

 libavformat/isom.h |  2 ++
 libavformat/mov.c  | 63 +-
 2 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 2246fed..2aeb8fa 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -238,6 +238,8 @@ typedef struct MOVContext {
 uint8_t *decryption_key;
 int decryption_key_len;
 int enable_drefs;
+
+int32_t movie_display_matrix[3][3]; ///< display matrix from mvhd
 } MOVContext;
 
 int ff_mp4_read_descr_len(AVIOContext *pb);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a15c8d1..26b332c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1211,6 +1211,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+int i;
 int64_t creation_time;
 int version = avio_r8(pb); /* version */
 avio_rb24(pb); /* flags */
@@ -1238,7 +1239,12 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 avio_skip(pb, 10); /* reserved */
 
-avio_skip(pb, 36); /* display matrix */
+/* movie display matrix, store it in main context and use it later on */
+for (i = 0; i < 3; i++) {
+c->movie_display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point
+c->movie_display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point
+c->movie_display_matrix[i][2] = avio_rb32(pb); //  2.30 fixed point
+}
 
 avio_rb32(pb); /* preview time */
 avio_rb32(pb); /* preview duration */
@@ -3798,9 +3804,24 @@ static int mov_read_meta(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
+// return 0 when matrix is identity, 1 otherwise
+#define IS_MATRIX_FULL(matrix)   \
+(matrix[0][0] != (1 << 16) ||\
+ matrix[1][1] != (1 << 16) ||\
+ matrix[2][2] != (1 << 30) ||\
+ matrix[0][1] || matrix[0][2] || \
+ matrix[1][0] || matrix[1][2] || \
+ matrix[2][0] || matrix[2][1])
+
+// fixed point to double
+#define CONV_FP(x, sh) ((double) (x)) / (1 << sh)
+
+// double to fixed point
+#define CONV_DB(x, sh) (int32_t) ((x) * (1 << sh))
+
 static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-int i;
+int i, j, e;
 int width;
 int height;
 int display_matrix[3][3];
@@ -3855,13 +3876,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 // save the matrix and add rotate metadata when it is not the default
 // identity
-if (display_matrix[0][0] != (1 << 16) ||
-display_matrix[1][1] != (1 << 16) ||
-display_matrix[2][2] != (1 << 30) ||
-display_matrix[0][1] || display_matrix[0][2] ||
-display_matrix[1][0] || display_matrix[1][2] ||
-display_matrix[2][0] || display_matrix[2][1]) {
-int i, j;
+if (IS_MATRIX_FULL(display_matrix)) {
 double rotate;
 
 av_freep(>display_matrix);
@@ -3884,13 +3899,41 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 }
 }
 
+// if movie display matrix is not identity, and if this is a video track
+if (IS_MATRIX_FULL(c->movie_display_matrix) && width && height) {
+// if trak display matrix was identity, just copy the movie one
+if (!sc->display_matrix) {
+sc->display_matrix = av_malloc(sizeof(int32_t) * 9);
+if (!sc->display_matrix)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < 3; i++)
+for (j = 0; j < 3; j++)
+sc->display_matrix[i * 3 + j] = 
c->movie_display_matrix[i][j];
+} else { // otherwise multiply the two and store the result
+double val = 0;
+for (i = 0; i < 3; i++) {
+for (j = 0; j < 3; j++) {
+int sh = j == 2 ? 30 : 16;
+for (e = 0; e < 3; e++) {
+val += CONV_FP(display_matrix[i][e], sh) *
+   CONV_FP(c->movie_display_matrix[e][j], sh);
+}
+sc->display_matrix[i * 3 + j] = CONV_DB(val, sh);
+val = 0;
+}
+}
+}
+}
+
 // transform the display width/height according to the matrix
 // to keep the same scale, use [width height 1<<16]
 if (width && height && sc->display_matrix) {
 double disp_transform[2];
 
 for (i = 0; i < 2; i++)
-disp_transform[i] = hypot(display_matrix[i][0], 

Re: [FFmpeg-devel] [PATCH] added possibility to set first to ninth audio language for RIFF taged files (e.g. avi files)

2016-10-05 Thread Michael Niedermayer
On Sun, Oct 02, 2016 at 07:01:05PM +0200, Florian Diemer wrote:
> ---
> Sorry but the first patch was improperly formatted.
> 
> 
> According to this page 
> (http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/RIFF.html#Info) it is 
> possible
> to add language information ("IAS1" (first language) to "IAS9" (ninth 
> language)) to RIFF tagged files (as RIFF Info Tags).
> Programs such as VLC media player or MediaInfo can properly read and display 
> this information. Allowing to set this tags
> with the -metadata option while encoding, would simplify the process.
> ---
>  libavformat/riffenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied

thx

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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


Re: [FFmpeg-devel] [PATCH] avcodec/qsvenc_h264: fix segfault when a53 SEI is not available

2016-10-05 Thread Michael Niedermayer
On Wed, Oct 05, 2016 at 09:34:25AM -0400, Nablet Developer wrote:
> Signed-off-by: Nablet Developer 
> ---
>  libavcodec/qsvenc_h264.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thx

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] Bug fix:- renamed the macro variable which causes segfault for mips r6

2016-10-05 Thread Michael Niedermayer
On Wed, Oct 05, 2016 at 05:52:24PM +0530, shivraj.pa...@imgtec.com wrote:
> From: Shivraj Patil 
> 
> Signed-off-by: Shivraj Patil 
> ---
>  libavutil/mips/generic_macros_msa.h |   12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

applied

thx

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH 0/4] V12 - SCTE-35 support

2016-10-05 Thread Marton Balint


On Tue, 4 Oct 2016, Josh de Kock wrote:


On 01/10/2016 18:27, Carlos Fernandez Sanz wrote:
- Addresses new comments such as like idx value checking and filename 

checking


Carlos Fernandez (4):
  Adding SCTE-35 CUI codec
  SCTE-35 extraction from mpegts
  SCTE-35 support in hlsenc
  Correct Indentation

 libavcodec/avcodec.h|   2 +
 libavcodec/codec_desc.c |   6 +
 libavformat/Makefile|   2 +-
 libavformat/hlsenc.c| 120 ---
 libavformat/mpegts.c|  48 -
 libavformat/scte_35.c   | 527 



 libavformat/scte_35.h   |  86 
 7 files changed, 764 insertions(+), 27 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h



There's been a fair amount of opposition to this set by a few other 
developers. The main concerns were regarding the timestamps,and how in 
STCE35 the PTS/DTS can represent both future video packets and others 
which signify the beginning of the commercial.


The other thing which was fairly ambiguous was how it would work with 
FFmpeg's timestamps due to how the AVPacket would not contain valid 
timestamps (how they'd only be in the data). There may be any number of 
timestamp values within in the AVPacket data stream, and while this may 
work for one stream, if you add more than one stream there would be no 
way to sync streams.




I don't understand the timestamp issue. SCTE packet PTS/DTS values do not 
represent the cue points. They represent the position of the incoming 
SCTE sections compared to the PCR.


Putting SCTE35 support in another library like Upipe was suggested as 
well.


Which functionality? Getting SCTE data from mpegts as a data stream 
totally makes sense IMHO.


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


Re: [FFmpeg-devel] [PATCH]lavu/hwaccel_vaapi: Add a fixme for the missing byte_order check

2016-10-05 Thread Mark Thompson
On 05/10/16 19:02, Carl Eugen Hoyos wrote:
> 2016-10-05 16:39 GMT+02:00 Mark Thompson :
>> On 05/10/16 13:06, Carl Eugen Hoyos wrote:
>>>
>>> I cannot test here but afaict, the current implementation of
>>> vaapi_pix_fmt_from_fourcc() can't be correct.
> 
>>> +// FIXME: Take VAImageFormat->byte_order into account
>>>  static struct {
>>>  unsigned int fourcc;
>>>  unsigned int rt_format;
> 
>> Have you found / had reported to you some case which
>> causes a problem here?  If so, please could you offer some
>> more detail about it (especially the driver being used).
> 
> No, I wouldn't even know how to use the code in question.
> 
>> In the cases I know of, the VAImageFormat structures are
>> are all hard-coded such that the fourcc is really the only
>> meaningful information in them:
> 
> So the byte_order field in VAImageFormat has no meaning
> and is completely useless?

Mostly yes, I think.  As you observe in the links below, it is hard-coded in 
the two main drivers to be either undefined or VA_LSB_FIRST.

>> 
> 
> This link was the reason for my mail.
> 
>> * 
>> 
> 
> Not sure if this makes sense...

Looking at 

 at the same time might make the use of that table clearer.

>> This is reflected by the use in hwcontext_vaapi.c, which only
>> fetches the driver's version of the structure in order to pass
>> it back in vaCreateImage() calls - the other fields are never
>> touched at all.
> 
> This sounds as if there is no mapping from VAImageFormat
> to AVPixelFormat but I misunderstand this, no?

The fourcc (which is VAImageFormat.fourcc) is the thing which is actually used 
for the mapping.  The other components do not add anything to the 
interpretation, so they are ignored.  Indeed, the fourcc by itself is used in 
most other places (vaCreateSurfaces(), notably), while only vaCreateImage() 
takes the VAImageFormat argument.

>> So, I don't think this comment adds any value.
> 
> Do I understand correctly that one of the RGB formats
> work correctly on your (little-endian) system (and looks
> ugly if you replace it with anything else)?

I'm not sure what what you mean by this question?  The mapping works correctly 
for all of the supported RGB formats in the table, though I agree that if I 
modified the code to be incorrect then the output would be wrong.

For example, I can do screen capture in X with:

ffmpeg -y -vaapi_device /dev/dri/renderD128 -video_size 1920x1080 -framerate 30 
-f x11grab -i :0 -vf 'hwupload,scale_vaapi=1920:1080:nv12' -c:v h264_vaapi 
out.mp4

which captures in bgr0, uploads it to the GPU, converts it to nv12 and encodes 
it as H.264 there.  Alternatively, I can add 'format=rgb0' at the start of the 
filter chain to convert and upload in a different RGB format, and that produces 
the correct output too.

Thanks,

- Mark

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


[FFmpeg-devel] [PATCH 2/2] lavf/mp3enc: write encoder delay/padding upon closing

2016-10-05 Thread Jon Toohill
---
 libavformat/mp3enc.c | 34 +++---
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index de63401..ddf4b93 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -111,6 +111,8 @@ typedef struct MP3Context {
 uint64_t bag[XING_NUM_BAGS];
 int initial_bitrate;
 int has_variable_bitrate;
+int delay;
+int padding;
 
 /* index of the audio stream */
 int audio_stream_idx;
@@ -247,12 +249,7 @@ static int mp3_write_xing(AVFormatContext *s)
 ffio_fill(dyn_ctx, 0, 8); // empty replaygain fields
 avio_w8(dyn_ctx, 0);  // unknown encoding flags
 avio_w8(dyn_ctx, 0);  // unknown abr/minimal bitrate
-
-// encoder delay
-if (par->initial_padding - 528 - 1 >= 1 << 12) {
-av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
-}
-avio_wb24(dyn_ctx, FFMAX(par->initial_padding - 528 - 1, 0)<<12);
+avio_wb24(dyn_ctx, 0);// empty encoder delay/padding
 
 avio_w8(dyn_ctx,   0); // misc
 avio_w8(dyn_ctx,   0); // mp3gain
@@ -345,10 +342,24 @@ static int mp3_write_audio_packet(AVFormatContext *s, 
AVPacket *pkt)
 #endif
 
 if (mp3->xing_offset) {
+uint8_t *side_data = NULL;
+int side_data_size = 0;
+
 mp3_xing_add_frame(mp3, pkt);
 mp3->audio_size += pkt->size;
 mp3->audio_crc   = av_crc(av_crc_get_table(AV_CRC_16_ANSI_LE),
   mp3->audio_crc, pkt->data, pkt->size);
+
+side_data = av_packet_get_side_data(pkt,
+AV_PKT_DATA_SKIP_SAMPLES,
+_data_size);
+if (side_data && side_data_size >= 10) {
+mp3->padding = AV_RL32(side_data + 4) + 528 + 1;
+if (!mp3->delay)
+mp3->delay =  FFMAX(AV_RL32(side_data) - 528 - 1, 0);
+} else {
+mp3->padding = 0;
+}
 }
 }
 
@@ -381,7 +392,7 @@ static void mp3_update_xing(AVFormatContext *s)
 AVReplayGain *rg;
 uint16_t tag_crc;
 uint8_t *toc;
-int i, rg_size;
+int i, rg_size, delay;
 
 /* replace "Xing" identification string with "Info" for CBR files. */
 if (!mp3->has_variable_bitrate)
@@ -422,6 +433,15 @@ static void mp3_update_xing(AVFormatContext *s)
 }
 }
 
+/* write encoder delay/padding */
+if (mp3->delay >= 1 << 12) {
+av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
+}
+if (mp3->padding >= 1 << 12) {
+av_log(s, AV_LOG_WARNING, "Too many samples of trailing padding.\n");
+}
+AV_WB24(mp3->xing_frame + mp3->xing_offset + 141, (mp3->delay << 12) + 
mp3->padding);
+
 AV_WB32(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 8, 
mp3->audio_size);
 AV_WB16(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 4, 
mp3->audio_crc);
 
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 0/2] Fix gapless encoding/remuxing for MP3

2016-10-05 Thread Jon Toohill
Round trip wav->mp3->wav now preserves the correct number of samples.
Remuxing mp3->mp3 with -c:a copy also preserves any existing gapless
metadata in the Info tag.

The code in libmp3lame.c to set AV_PKT_DATA_SKIP_SAMPLES was mostly
copied from libopusenc.c.

Jon Toohill (2):
  lavc/libmp3lame: send encoder delay/padding in packet side data
  lavf/mp3enc: write encoder delay/padding upon closing

 libavcodec/libmp3lame.c | 26 +-
 libavformat/mp3enc.c| 34 +++---
 2 files changed, 52 insertions(+), 8 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 1/2] lavc/libmp3lame: send encoder delay/padding in packet side data

2016-10-05 Thread Jon Toohill
---
 libavcodec/libmp3lame.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 5642264..b3ba0d8 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -50,6 +50,7 @@ typedef struct LAMEContext {
 int reservoir;
 int joint_stereo;
 int abr;
+int delay_sent;
 float *samples_flt[2];
 AudioFrameQueue afq;
 AVFloatDSPContext *fdsp;
@@ -185,7 +186,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 {
 LAMEContext *s = avctx->priv_data;
 MPADecodeHeader hdr;
-int len, ret, ch;
+int len, ret, ch, discard_padding;
 int lame_result;
 uint32_t h;
 
@@ -269,6 +270,29 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 ff_af_queue_remove(>afq, avctx->frame_size, >pts,
>duration);
 
+discard_padding = avctx->frame_size - avpkt->duration;
+// Check if subtraction resulted in an overflow
+if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
+av_packet_unref(avpkt);
+av_free(avpkt);
+return AVERROR(EINVAL);
+}
+if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding 
> 0) {
+uint8_t* side_data = av_packet_new_side_data(avpkt,
+ 
AV_PKT_DATA_SKIP_SAMPLES,
+ 10);
+if(!side_data) {
+av_packet_unref(avpkt);
+av_free(avpkt);
+return AVERROR(ENOMEM);
+}
+if (!s->delay_sent) {
+AV_WL32(side_data, avctx->initial_padding);
+s->delay_sent = 1;
+}
+AV_WL32(side_data + 4, discard_padding);
+}
+
 avpkt->size = len;
 *got_packet_ptr = 1;
 }
-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [PATCH 3/4] lavc/utils: avcodec_string: dump field order when known

2016-10-05 Thread Michael Niedermayer
On Mon, Oct 03, 2016 at 11:49:38PM -0500, Rodger Combs wrote:
> ---
>  libavcodec/utils.c | 15 +++
>  1 file changed, 15 insertions(+)

LGTM

thx

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

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] [PATCH 3/3] lavf/mp3dec: read encoder delay/padding from Info tag

2016-10-05 Thread Jon Toohill
On Wed, Oct 5, 2016 at 11:03 AM, wm4  wrote:

> On Wed, 5 Oct 2016 10:42:13 -0700
> Jon Toohill  wrote:
>
> > On Wed, Oct 5, 2016 at 10:40 AM, Jon Toohill 
> wrote:
> >
> > > On Tue, Oct 4, 2016 at 7:19 AM, wm4  wrote:
> > >
> > >> On Mon,  3 Oct 2016 17:45:08 -0700
> > >> Jon Toohill  wrote:
> > >>
> > >> > Muxers can check AVCodecParameters.initial_padding for the
> > >> > encoder+decoder delay, and read the AV_PKT_DATA_SKIP_SAMPLES
> > >> > side data from the last packet for the encoder padding.
> > >> >
> > >> > This change also fixes the first_discard_sample calculation
> > >> > which erroneously included the decoder delay. Decoder delay
> > >> > is already accounted for in st->skip_samples. The affected
> > >> > FATE tests have been updated accordingly.
> > >> > ---
> > >> >  libavformat/mp3dec.c |  3 ++-
> > >> >  tests/ref/fate/audiomatch-square-mp3 |  2 +-
> > >> >  tests/ref/fate/gapless-mp3   | 10 +-
> > >> >  3 files changed, 8 insertions(+), 7 deletions(-)
> > >> >
> > >> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> > >> > index 56c7f8c..e8b2428 100644
> > >> > --- a/libavformat/mp3dec.c
> > >> > +++ b/libavformat/mp3dec.c
> > >> > @@ -239,9 +239,10 @@ static void mp3_parse_info_tag(AVFormatContext
> > >> *s, AVStream *st,
> > >> >
> > >> >  mp3->start_pad = v>>12;
> > >> >  mp3->  end_pad = v&4095;
> > >> > +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> > >> >  st->start_skip_samples = mp3->start_pad + 528 + 1;
> > >> >  if (mp3->frames) {
> > >> > -st->first_discard_sample = -mp3->end_pad + 528 + 1 +
> > >> mp3->frames * (int64_t)spf;
> > >> > +st->first_discard_sample = -mp3->end_pad + mp3->frames
> *
> > >> (int64_t)spf;
> > >>
> > >> How does mixing these even make sense?
> > >>
> > >
> > > mp3enc.c already uses initial_padding for the encoder delay, and as you
> > > previously pointed out, mp3dec.c already uses
> AV_PKT_START_SKIP_SAMPLES for
> > > the encoder delay. I'm not attempting to solve the inconsistency in
> this
> > > patch set.
> > >
> >
> > err, *mp3dec.c already uses AV_PKT_DATA_SKIP_SAMPLES for the encoder
> > padding. Sorry for the confusion.
> >
>
> Not solving the inconsistency is problematic - but the worse issue is
> that you seem to introduce inconsistencies. In my current opinion, the
> packet side data and the initial_padding fields do the same (i.e.
> duplicated API), so only one of them can or should be used. Your patch
> seems to require the decoder to use them both, though.
>

That's a fair point; I'll send a revised patch set that doesn't change
mp3dec.c.

Note that I don't think I can get away from having libmp3lame.c set
AVCodecContext.initial_padding, since that field is used by the
AudioFrameQueue (and other encoders rely on it as well).

___
> 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 5/5] af_hdcd: add experimental 20 and 24-bit decoding support

2016-10-05 Thread Burt P.
applied

split into two commits

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


Re: [FFmpeg-devel] [PATCH 3/3] lavf/mp3dec: read encoder delay/padding from Info tag

2016-10-05 Thread wm4
On Wed, 5 Oct 2016 10:42:13 -0700
Jon Toohill  wrote:

> On Wed, Oct 5, 2016 at 10:40 AM, Jon Toohill  wrote:
> 
> > On Tue, Oct 4, 2016 at 7:19 AM, wm4  wrote:
> >  
> >> On Mon,  3 Oct 2016 17:45:08 -0700
> >> Jon Toohill  wrote:
> >>  
> >> > Muxers can check AVCodecParameters.initial_padding for the
> >> > encoder+decoder delay, and read the AV_PKT_DATA_SKIP_SAMPLES
> >> > side data from the last packet for the encoder padding.
> >> >
> >> > This change also fixes the first_discard_sample calculation
> >> > which erroneously included the decoder delay. Decoder delay
> >> > is already accounted for in st->skip_samples. The affected
> >> > FATE tests have been updated accordingly.
> >> > ---
> >> >  libavformat/mp3dec.c |  3 ++-
> >> >  tests/ref/fate/audiomatch-square-mp3 |  2 +-
> >> >  tests/ref/fate/gapless-mp3   | 10 +-
> >> >  3 files changed, 8 insertions(+), 7 deletions(-)
> >> >
> >> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> >> > index 56c7f8c..e8b2428 100644
> >> > --- a/libavformat/mp3dec.c
> >> > +++ b/libavformat/mp3dec.c
> >> > @@ -239,9 +239,10 @@ static void mp3_parse_info_tag(AVFormatContext  
> >> *s, AVStream *st,  
> >> >
> >> >  mp3->start_pad = v>>12;
> >> >  mp3->  end_pad = v&4095;
> >> > +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> >> >  st->start_skip_samples = mp3->start_pad + 528 + 1;
> >> >  if (mp3->frames) {
> >> > -st->first_discard_sample = -mp3->end_pad + 528 + 1 +  
> >> mp3->frames * (int64_t)spf;  
> >> > +st->first_discard_sample = -mp3->end_pad + mp3->frames *  
> >> (int64_t)spf;
> >>
> >> How does mixing these even make sense?
> >>  
> >
> > mp3enc.c already uses initial_padding for the encoder delay, and as you
> > previously pointed out, mp3dec.c already uses AV_PKT_START_SKIP_SAMPLES for
> > the encoder delay. I'm not attempting to solve the inconsistency in this
> > patch set.
> >  
> 
> err, *mp3dec.c already uses AV_PKT_DATA_SKIP_SAMPLES for the encoder
> padding. Sorry for the confusion.
> 

Not solving the inconsistency is problematic - but the worse issue is
that you seem to introduce inconsistencies. In my current opinion, the
packet side data and the initial_padding fields do the same (i.e.
duplicated API), so only one of them can or should be used. Your patch
seems to require the decoder to use them both, though.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] af_hdcd: add mono as a supported channel layout

2016-10-05 Thread Burt P.
applied

--
Burt

On Sun, Oct 2, 2016 at 2:46 AM, Burt P  wrote:
> Signed-off-by: Burt P 
> ---
>  libavfilter/af_hdcd.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
> index 90b6b64..6f35c09 100644
> --- a/libavfilter/af_hdcd.c
> +++ b/libavfilter/af_hdcd.c
> @@ -1724,6 +1724,9 @@ static int query_formats(AVFilterContext *ctx)
>  };
>  int ret;
>
> +ret = ff_add_channel_layout(, AV_CH_LAYOUT_MONO);
> +if (ret < 0)
> +return ret;
>  ret = ff_add_channel_layout(, AV_CH_LAYOUT_STEREO);
>  if (ret < 0)
>  return ret;
> @@ -1822,7 +1825,7 @@ static int config_input(AVFilterLink *inlink) {
>  s->cdt_ms, s->state[0].sustain_reset );
>
>  if (inlink->channels != 2 && s->process_stereo) {
> -av_log(ctx, AV_LOG_WARNING, "process_stereo disabled (channels = 
> %d)", inlink->channels);
> +av_log(ctx, AV_LOG_WARNING, "process_stereo disabled (channels = 
> %d)\n", inlink->channels);
>  s->process_stereo = 0;
>  }
>  av_log(ctx, AV_LOG_VERBOSE, "Process mode: %s\n",
> --
> 2.7.4
>



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


Re: [FFmpeg-devel] [PATCH]lavu/hwaccel_vaapi: Add a fixme for the missing byte_order check

2016-10-05 Thread Carl Eugen Hoyos
2016-10-05 16:39 GMT+02:00 Mark Thompson :
> On 05/10/16 13:06, Carl Eugen Hoyos wrote:
>>
>> I cannot test here but afaict, the current implementation of
>> vaapi_pix_fmt_from_fourcc() can't be correct.

>> +// FIXME: Take VAImageFormat->byte_order into account
>>  static struct {
>>  unsigned int fourcc;
>>  unsigned int rt_format;

> Have you found / had reported to you some case which
> causes a problem here?  If so, please could you offer some
> more detail about it (especially the driver being used).

No, I wouldn't even know how to use the code in question.

> In the cases I know of, the VAImageFormat structures are
> are all hard-coded such that the fourcc is really the only
> meaningful information in them:

So the byte_order field in VAImageFormat has no meaning
and is completely useless?

> 

This link was the reason for my mail.

> * 
> 

Not sure if this makes sense...

> This is reflected by the use in hwcontext_vaapi.c, which only
> fetches the driver's version of the structure in order to pass
> it back in vaCreateImage() calls - the other fields are never
> touched at all.

This sounds as if there is no mapping from VAImageFormat
to AVPixelFormat but I misunderstand this, no?

> So, I don't think this comment adds any value.

Do I understand correctly that one of the RGB formats
work correctly on your (little-endian) system (and looks
ugly if you replace it with anything else)?

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


Re: [FFmpeg-devel] [PATCH 4/5] af_hdcd: hdcd_scan() and hdcd_integrate() handle stereo and single channel

2016-10-05 Thread Burt P.
applied

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


Re: [FFmpeg-devel] [PATCH 1/5] af_hdcd: allow all HDCD sample rates

2016-10-05 Thread Burt P.
applied

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


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-10-05 Thread Pallavi Kumari
I am looking for mentor(s). Kindly let me know if anyone interested.

On Tue, Sep 27, 2016 at 2:22 PM, Pallavi Kumari 
wrote:

> Lou, Jean thanks for your suggestions. I will go through them meanwhile I
> have finished a rough sketch of the idea. Please find it at [1].
>
> [1]  https://wiki.mozilla.org/Atana/idea
>
> On Tue, Sep 27, 2016 at 11:33 AM, Jean First  wrote:
>
>> On Sun Sep 25 2016 14:32:25 GMT+0200 (CEST), Pallavi Kumari wrote:
>>
>> [...]
>>
>> > I want to propose the idea of implementing filters for ffmpeg that would
>> > give different audio fingerprints for an audio which could be reused by
>> > other people for variety of applications. Goal of this system is given a
>> > song as a input, it would spits out similar sounding songs. Some of its
>> > applications are:
>> [...]
>>
>> Hi Pallavi,
>>
>> Your work could also be useful for applications similar to
>> https://github.com/stendardo/shenidam
>> Good luck with your work.
>>
>> Kind Regards,
>> Jean
>> ___
>> 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 3/3] lavf/mp3dec: read encoder delay/padding from Info tag

2016-10-05 Thread Jon Toohill
On Tue, Oct 4, 2016 at 9:10 AM, Michael Niedermayer 
wrote:

> On Mon, Oct 03, 2016 at 05:45:08PM -0700, Jon Toohill wrote:
> > Muxers can check AVCodecParameters.initial_padding for the
> > encoder+decoder delay, and read the AV_PKT_DATA_SKIP_SAMPLES
> > side data from the last packet for the encoder padding.
> >
> > This change also fixes the first_discard_sample calculation
> > which erroneously included the decoder delay. Decoder delay
> > is already accounted for in st->skip_samples. The affected
> > FATE tests have been updated accordingly.
> > ---
> >  libavformat/mp3dec.c |  3 ++-
> >  tests/ref/fate/audiomatch-square-mp3 |  2 +-
> >  tests/ref/fate/gapless-mp3   | 10 +-
> >  3 files changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> > index 56c7f8c..e8b2428 100644
> > --- a/libavformat/mp3dec.c
> > +++ b/libavformat/mp3dec.c
> > @@ -239,9 +239,10 @@ static void mp3_parse_info_tag(AVFormatContext *s,
> AVStream *st,
> >
> >  mp3->start_pad = v>>12;
> >  mp3->  end_pad = v&4095;
> > +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> >  st->start_skip_samples = mp3->start_pad + 528 + 1;
> >  if (mp3->frames) {
> > -st->first_discard_sample = -mp3->end_pad + 528 + 1 +
> mp3->frames * (int64_t)spf;
> > +st->first_discard_sample = -mp3->end_pad + mp3->frames *
> (int64_t)spf;
> >  st->last_discard_sample = mp3->frames * (int64_t)spf;
> >  }
> >  if (!st->start_time)
> > diff --git a/tests/ref/fate/audiomatch-square-mp3
> b/tests/ref/fate/audiomatch-square-mp3
> > index 8de55c2..05176a0 100644
> > --- a/tests/ref/fate/audiomatch-square-mp3
> > +++ b/tests/ref/fate/audiomatch-square-mp3
> > @@ -1 +1 @@
> > -presig: 0 postsig:0 c: 0.9447 lenerr:0
> > +presig: 0 postsig:-529 c: 0.9334 lenerr:-529
>
> isnt this exactly correct before and wrong after this change ?
>
> zero signal before and zero signal after the original is what one would
> expect and equal length and high correlation
>
> every number that changes gets worse
>

Michael - you're right, this patch is incorrect currently. I had mistakenly
convinced myself that mp3dec.c was overcompensating for the decoder delay.

I also found that LAME itself writes the encoder padding + decoder delay
into the trailing padding field (e.g. for an input where 468 samples of
padding are added by the encoder, the Info tag contains the value 997).
I'll send a revised patch set.


> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Never trust a computer, one day, it may think you are the virus. -- Compn
>
> ___
> 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 3/3] lavf/mp3dec: read encoder delay/padding from Info tag

2016-10-05 Thread Jon Toohill
On Tue, Oct 4, 2016 at 7:19 AM, wm4  wrote:

> On Mon,  3 Oct 2016 17:45:08 -0700
> Jon Toohill  wrote:
>
> > Muxers can check AVCodecParameters.initial_padding for the
> > encoder+decoder delay, and read the AV_PKT_DATA_SKIP_SAMPLES
> > side data from the last packet for the encoder padding.
> >
> > This change also fixes the first_discard_sample calculation
> > which erroneously included the decoder delay. Decoder delay
> > is already accounted for in st->skip_samples. The affected
> > FATE tests have been updated accordingly.
> > ---
> >  libavformat/mp3dec.c |  3 ++-
> >  tests/ref/fate/audiomatch-square-mp3 |  2 +-
> >  tests/ref/fate/gapless-mp3   | 10 +-
> >  3 files changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> > index 56c7f8c..e8b2428 100644
> > --- a/libavformat/mp3dec.c
> > +++ b/libavformat/mp3dec.c
> > @@ -239,9 +239,10 @@ static void mp3_parse_info_tag(AVFormatContext *s,
> AVStream *st,
> >
> >  mp3->start_pad = v>>12;
> >  mp3->  end_pad = v&4095;
> > +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> >  st->start_skip_samples = mp3->start_pad + 528 + 1;
> >  if (mp3->frames) {
> > -st->first_discard_sample = -mp3->end_pad + 528 + 1 +
> mp3->frames * (int64_t)spf;
> > +st->first_discard_sample = -mp3->end_pad + mp3->frames *
> (int64_t)spf;
>
> How does mixing these even make sense?
>

mp3enc.c already uses initial_padding for the encoder delay, and as you
previously pointed out, mp3dec.c already uses AV_PKT_START_SKIP_SAMPLES for
the encoder delay. I'm not attempting to solve the inconsistency in this
patch set.


> >  st->last_discard_sample = mp3->frames * (int64_t)spf;
> >  }
> >  if (!st->start_time)
> > diff --git a/tests/ref/fate/audiomatch-square-mp3
> b/tests/ref/fate/audiomatch-square-mp3
> > index 8de55c2..05176a0 100644
> > --- a/tests/ref/fate/audiomatch-square-mp3
> > +++ b/tests/ref/fate/audiomatch-square-mp3
> > @@ -1 +1 @@
> > -presig: 0 postsig:0 c: 0.9447 lenerr:0
> > +presig: 0 postsig:-529 c: 0.9334 lenerr:-529
> > diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3
> > index ebe7bfa..8b80bfc 100644
> > --- a/tests/ref/fate/gapless-mp3
> > +++ b/tests/ref/fate/gapless-mp3
> > @@ -1,5 +1,5 @@
> > -37534a3bcc3ef306e8c5ebfcfedfc41c *tests/data/fate/gapless-mp3.out-1
> > -c96c3ae7bd3300fd2f4debac222de5b7
> > -0cd1cdbcfd5cdbf6270cd98219bf31cd *tests/data/fate/gapless-mp3.out-2
> > -c96c3ae7bd3300fd2f4debac222de5b7
> > -9d3d8ba8a61b534f2d02ee648d6a8229 *tests/data/fate/gapless-mp3.out-3
> > +81695be427d45e8be4d527a6b2af2a85 *tests/data/fate/gapless-mp3.out-1
> > +c7879a827ab017364774069268d9a267
> > +62d074296f8c84a5f86a6afdd7bab459 *tests/data/fate/gapless-mp3.out-2
> > +c7879a827ab017364774069268d9a267
> > +e931f3fe1ba25e0d5eece4977c4061a9 *tests/data/fate/gapless-mp3.out-3
> ___
> 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 2/3] lavf/mov: improve `tref/chap` chapter handling

2016-10-05 Thread Michael Niedermayer
On Tue, Oct 04, 2016 at 09:27:53PM -0500, Rodger Combs wrote:
> 3 parts:
> - Supports multiple chapter streams
> - Exports regular text chapter streams as opaque data. This prevents consumers
>   from showing chapters as if they were regular subtitle streams.
> - Exports video chapter streams as thumbnails, and provides the first one as
>   an attached_pic.
> ---
>  libavformat/isom.h |  3 ++-
>  libavformat/mov.c  | 54 
> +++---
>  2 files changed, 49 insertions(+), 8 deletions(-)

Confirming that the bug is fixed
in absence of other comments (like from people who have better knowledge
of mov/mp4) i think this if ok to apply

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/utils: ignore outlier subtitle and data stream end times as well

2016-10-05 Thread Michael Niedermayer
On Wed, Oct 05, 2016 at 07:38:21AM -0500, Rodger Combs wrote:
> ---
>  libavformat/utils.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)

patchset LGTM

thx

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


Re: [FFmpeg-devel] [PATCH] lavf/segment: provide a virtual AVIOContext representing all the segments

2016-10-05 Thread Michael Niedermayer
On Wed, Oct 05, 2016 at 12:33:54AM -0500, Rodger Combs wrote:
> This allows the use of muxers like matroska, which attempt to seek even
> when an AVIOContext doesn't set `seekable`, without concern for a rouge
> seek leading the muxer to overwrite the wrong data in a later segment.
> ---
>  doc/muxers.texi   |  17 
>  libavformat/segment.c | 276 
> +-
>  libavformat/version.h |   2 +-
>  3 files changed, 223 insertions(+), 72 deletions(-)

This improves segment output with nut
Acked-by: Michael
Tested-by: Michael

thanks

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


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


Re: [FFmpeg-devel] [PATCH] Changelog: Add CUVID entries

2016-10-05 Thread Philip Langdale
On Wed, 5 Oct 2016 13:09:06 +0200
Carl Eugen Hoyos  wrote:

> 2016-10-05 5:56 GMT+02:00 Philip Langdale :
> > From: Philip Langdale 
> >
> > Signed-off-by: Philip Langdale 
> > ---
> >  Changelog | 3 +++
> >  1 file changed, 3 insertions(+)  
> 
> Please make this one line, I don't think flushing has
> to be mentioned.

Updated and pushed.

Thanks,

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


[FFmpeg-devel] [PATCH 2/2] lavf/utils: avoid using programs for duration when there's only one

2016-10-05 Thread Rodger Combs
This allows us to be more selective about the streams we derive durations from
(specifically, ignoring text streams with outlier end times) in the common case
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d19cc5e..1aa3b50 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2582,7 +2582,7 @@ static void update_stream_timings(AVFormatContext *ic)
 if (start_time != INT64_MAX) {
 ic->start_time = start_time;
 if (end_time != INT64_MIN) {
-if (ic->nb_programs) {
+if (ic->nb_programs > 1) {
 for (i = 0; i < ic->nb_programs; i++) {
 p = ic->programs[i];
 if (p->start_time != AV_NOPTS_VALUE && p->end_time > 
p->start_time)
-- 
2.10.0

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


[FFmpeg-devel] [PATCH 1/2] lavf/utils: ignore outlier subtitle and data stream end times as well

2016-10-05 Thread Rodger Combs
---
 libavformat/utils.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3acb260..d19cc5e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2524,7 +2524,7 @@ static int has_duration(AVFormatContext *ic)
  */
 static void update_stream_timings(AVFormatContext *ic)
 {
-int64_t start_time, start_time1, start_time_text, end_time, end_time1;
+int64_t start_time, start_time1, start_time_text, end_time, end_time1, 
end_time_text;
 int64_t duration, duration1, filesize;
 int i;
 AVStream *st;
@@ -2533,6 +2533,7 @@ static void update_stream_timings(AVFormatContext *ic)
 start_time = INT64_MAX;
 start_time_text = INT64_MAX;
 end_time   = INT64_MIN;
+end_time_text   = INT64_MIN;
 duration   = INT64_MIN;
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
@@ -2549,7 +2550,10 @@ static void update_stream_timings(AVFormatContext *ic)
  
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
 if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= 
INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
 end_time1 += start_time1;
-end_time = FFMAX(end_time, end_time1);
+if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || 
st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
+end_time_text = FFMAX(end_time_text, end_time1);
+else
+end_time = FFMAX(end_time, end_time1);
 }
 for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) {
 if (p->start_time == AV_NOPTS_VALUE || p->start_time > 
start_time1)
@@ -2569,6 +2573,12 @@ static void update_stream_timings(AVFormatContext *ic)
 else if (start_time > start_time_text)
 av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
starttime %f\n", start_time_text / (float)AV_TIME_BASE);
 
+if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text - 
end_time < AV_TIME_BASE)) {
+end_time = end_time_text;
+} else if (end_time < end_time_text) {
+av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
endtime %f\n", end_time_text / (float)AV_TIME_BASE);
+}
+
 if (start_time != INT64_MAX) {
 ic->start_time = start_time;
 if (end_time != INT64_MIN) {
-- 
2.10.0

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


[FFmpeg-devel] [PATCH]lavu/hwaccel_vaapi: Add a fixme for the missing byte_order check

2016-10-05 Thread Carl Eugen Hoyos
Hi!

I cannot test here but afaict, the current implementation of 
vaapi_pix_fmt_from_fourcc() can't be correct.

Please comment, Carl Eugen
From 52b0af32b965c2fce23afe8b57289e497f17f011 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Wed, 5 Oct 2016 14:04:25 +0200
Subject: [PATCH] lavu/hwcontext_vaapi: Add a fixme for the missing byte_order
 check.

---
 libavutil/hwcontext_vaapi.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 92fa235..3319839 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -92,6 +92,7 @@ typedef struct VAAPISurfaceMap {
 }
 // The map fourcc <-> pix_fmt isn't bijective because of the annoying U/V
 // plane swap cases.  The frame handling below tries to hide these.
+// FIXME: Take VAImageFormat->byte_order into account
 static struct {
 unsigned int fourcc;
 unsigned int rt_format;
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH] Changelog: Add CUVID entries

2016-10-05 Thread Carl Eugen Hoyos
2016-10-05 5:56 GMT+02:00 Philip Langdale :
> From: Philip Langdale 
>
> Signed-off-by: Philip Langdale 
> ---
>  Changelog | 3 +++
>  1 file changed, 3 insertions(+)

Please make this one line, I don't think flushing has
to be mentioned.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] lavc/parser: export field order if not already set

2016-10-05 Thread Michael Niedermayer
On Mon, Oct 03, 2016 at 11:49:36PM -0500, Rodger Combs wrote:
> Some codecs set this in the parser, but not the decoder
> ---
>  libavcodec/parser.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/parser.c b/libavcodec/parser.c
> index 2c8fc69..30cfc55 100644
> --- a/libavcodec/parser.c
> +++ b/libavcodec/parser.c
> @@ -182,6 +182,11 @@ int av_parser_parse2(AVCodecParserContext *s, 
> AVCodecContext *avctx,
>  index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
>  poutbuf_size, buf, buf_size);
>  av_assert0(index > -0x2000); // The API does not allow returning 
> AVERROR codes
> +#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
> +if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> +FILL(field_order);
> +}

LGTM

thx

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

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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


Re: [FFmpeg-devel] [PATCH] libavformat/utils: ignore outlier subtitle and data stream end times as well

2016-10-05 Thread Michael Niedermayer
On Mon, Oct 03, 2016 at 08:10:18PM -0500, Rodger Combs wrote:
> ---
>  libavformat/utils.c | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 3acb260..ce68408 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2524,7 +2524,7 @@ static int has_duration(AVFormatContext *ic)
>   */
>  static void update_stream_timings(AVFormatContext *ic)
>  {
> -int64_t start_time, start_time1, start_time_text, end_time, end_time1;
> +int64_t start_time, start_time1, start_time_text, end_time, end_time1, 
> end_time_text;
>  int64_t duration, duration1, filesize;
>  int i;
>  AVStream *st;
> @@ -2533,6 +2533,7 @@ static void update_stream_timings(AVFormatContext *ic)
>  start_time = INT64_MAX;
>  start_time_text = INT64_MAX;
>  end_time   = INT64_MIN;
> +end_time_text   = INT64_MIN;
>  duration   = INT64_MIN;
>  for (i = 0; i < ic->nb_streams; i++) {
>  st = ic->streams[i];
> @@ -2549,7 +2550,10 @@ static void update_stream_timings(AVFormatContext *ic)
>   
> AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
>  if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 
> <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
>  end_time1 += start_time1;
> -end_time = FFMAX(end_time, end_time1);
> +if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || 
> st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
> +end_time_text = FFMAX(end_time_text, end_time1);
> +else
> +end_time = FFMAX(end_time, end_time1);
>  }
>  for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) {
>  if (p->start_time == AV_NOPTS_VALUE || p->start_time > 
> start_time1)
> @@ -2569,10 +2573,15 @@ static void update_stream_timings(AVFormatContext *ic)
>  else if (start_time > start_time_text)
>  av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
> starttime %f\n", start_time_text / (float)AV_TIME_BASE);
>  
> +if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text 
> - end_time < AV_TIME_BASE))
> +end_time = end_time_text;
> +else if (end_time < end_time_text)

please add {} between if /else  this simplifies any possible future
diffs as adding a line in the future would otherwise need more lines
changed (to add  {})



> +av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
> endtime %f\n", end_time_text / (float)AV_TIME_BASE);
> +

>  if (start_time != INT64_MAX) {
>  ic->start_time = start_time;
>  if (end_time != INT64_MIN) {
> -if (ic->nb_programs) {
> +if (ic->nb_programs > 1) {

should be a seperate commit

LGTM otherwise

thanks

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


Re: [FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API

2016-10-05 Thread wm4
On Tue, 4 Oct 2016 20:26:49 +0200
Michael Niedermayer  wrote:

> On Tue, Oct 04, 2016 at 06:33:48PM +0200, wm4 wrote:
> > Some API users (in particular ffmpeg.c) check the best effort timestamp
> > only.
> > ---
> > Using guess_correct_pts() - not sure what I was thinking.
> > ---
> >  libavcodec/utils.c | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)  
> 
> LGTM
> 
> thx
> 
> [...]

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


[FFmpeg-devel] [PATCH] d3d11va: use the proper slice index

2016-10-05 Thread Steve Lhomme
The slice index expected by D3D11VA is the one from the texture not from the
array or texture/slices.

In VLC the slices we provide the decoder don't start from 0 and thus pictures
appear in bogus order. With possible crashes and corruptions when using an
invalid index.

--
* forgot to bump the micro version
* get rid of DXVA_CONTEXT_SURFACE
---
 libavcodec/dxva2.c  | 12 +++-
 libavcodec/dxva2_internal.h |  3 ---
 libavcodec/version.h|  2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index f68df86..e168233 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -42,8 +42,18 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext 
*avctx,
 unsigned i;
 
 for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++)
-if (DXVA_CONTEXT_SURFACE(avctx, ctx, i) == surface)
+#if CONFIG_D3D11VA
+if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && 
ctx->d3d11va.surface[i] == surface)
+{
+D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+ID3D11VideoDecoderOutputView_GetDesc(ctx->d3d11va.surface[i], 
);
+return viewDesc.Texture2D.ArraySlice;
+}
+#endif
+#if CONFIG_DXVA2
+if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == 
surface)
 return i;
+#endif
 
 assert(0);
 return 0;
diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
index ad89f82..24adb99 100644
--- a/libavcodec/dxva2_internal.h
+++ b/libavcodec/dxva2_internal.h
@@ -70,7 +70,6 @@ typedef union {
 #if CONFIG_D3D11VA && CONFIG_DXVA2
 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
 #define DXVA_CONTEXT_COUNT(avctx, ctx)  (avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
-#define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface[i] : ctx->dxva2.surface[i])
 #define DXVA_CONTEXT_DECODER(avctx, ctx)(avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)  (*(avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? >d3d11va.report_id : >dxva2.report_id))
 #define DXVA_CONTEXT_CFG(avctx, ctx)(avctx->pix_fmt == 
AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
@@ -80,7 +79,6 @@ typedef union {
 #elif CONFIG_DXVA2
 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->dxva2.workaround)
 #define DXVA_CONTEXT_COUNT(avctx, ctx)  (ctx->dxva2.surface_count)
-#define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (ctx->dxva2.surface[i])
 #define DXVA_CONTEXT_DECODER(avctx, ctx)(ctx->dxva2.decoder)
 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)  (*(>dxva2.report_id))
 #define DXVA_CONTEXT_CFG(avctx, ctx)(ctx->dxva2.cfg)
@@ -90,7 +88,6 @@ typedef union {
 #elif CONFIG_D3D11VA
 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->d3d11va.workaround)
 #define DXVA_CONTEXT_COUNT(avctx, ctx)  (ctx->d3d11va.surface_count)
-#define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (ctx->d3d11va.surface[i])
 #define DXVA_CONTEXT_DECODER(avctx, ctx)(ctx->d3d11va.decoder)
 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)  (*(>d3d11va.report_id))
 #define DXVA_CONTEXT_CFG(avctx, ctx)(ctx->d3d11va.cfg)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index de7280f..7e30a16 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  60
+#define LIBAVCODEC_VERSION_MINOR  61
 #define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.8.2

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