Re: [FFmpeg-devel] [PATCH] avfilter: add showfreqs filter

2015-08-05 Thread Clément Bœsch
On Tue, Aug 04, 2015 at 10:04:45PM +0200, Paul B Mahol wrote:
> ---
> 
> Is this correct?

There are some weird glitches in the high frequencies, so something might
be wrong here.

-- 
Clément B.


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


[FFmpeg-devel] [PATCH] vf_psnr: add psnr_avg to stats file.

2015-08-05 Thread Ronald S. Bultje
---
 libavfilter/vf_psnr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index f202df3..3c1dc81 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -174,6 +174,7 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
 c = s->is_rgb ? s->rgba_map[j] : j;
 fprintf(s->stats_file, "mse_%c:%0.2f ", s->comps[j], comp_mse[c]);
 }
+fprintf(s->stats_file, "psnr_avg:%0.2f ", get_psnr(mse, 1, 
s->average_max));
 for (j = 0; j < s->nb_components; j++) {
 c = s->is_rgb ? s->rgba_map[j] : j;
 fprintf(s->stats_file, "psnr_%c:%0.2f ", s->comps[j],
-- 
2.1.2

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


Re: [FFmpeg-devel] [PATCH] vf_psnr: add psnr_avg to stats file.

2015-08-05 Thread Paul B Mahol
Dana 5. 8. 2015. 13:31 osoba "Ronald S. Bultje" 
napisala je:
>
> ---
>  libavfilter/vf_psnr.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
> index f202df3..3c1dc81 100644
> --- a/libavfilter/vf_psnr.c
> +++ b/libavfilter/vf_psnr.c
> @@ -174,6 +174,7 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame
*main,
>  c = s->is_rgb ? s->rgba_map[j] : j;
>  fprintf(s->stats_file, "mse_%c:%0.2f ", s->comps[j],
comp_mse[c]);
>  }
> +fprintf(s->stats_file, "psnr_avg:%0.2f ", get_psnr(mse, 1,
s->average_max));
>  for (j = 0; j < s->nb_components; j++) {
>  c = s->is_rgb ? s->rgba_map[j] : j;
>  fprintf(s->stats_file, "psnr_%c:%0.2f ", s->comps[j],
> --
> 2.1.2

LGTM

>
> ___
> 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]lavf/mov: Support alac extradata in wave atom v2

2015-08-05 Thread Michael Niedermayer
On Mon, Aug 03, 2015 at 11:16:12PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #4747 and should not introduce any
> theoretical regressions.
> 
> Please review, Carl Eugen

>  mov.c |   22 ++
>  1 file changed, 22 insertions(+)
> ffe1a030382f6bc11a5a58ab3cd5e89f8a354529  patchalacwave2.diff
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 154d2f8..f3cb71f 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1435,6 +1435,28 @@ static int mov_read_wave(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  if (ret < 0)
>  return ret;
>  } else if (atom.size > 8) { /* to read frma, esds atoms */
> +if (st->codec->codec_id == AV_CODEC_ID_ALAC && atom.size >= 24) {
> +uint64_t buffer = avio_rb64(pb);
> +atom.size -= 8;
> +if (  (buffer & 0x) == MKBETAG('f','r','m','a')
> +&& buffer >> 32 <= atom.size
> +&& buffer >> 32 >= 8) {
> +avio_skip(pb, (buffer >> 32) - 8);
> +atom.size -= (buffer >> 32) - 8;

skiping the frma atom instead of passing it to mov_read_default()
(which might at some point in the future do somehing with it)
does not feel completely ideal

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


[FFmpeg-devel] [PATCH] avcodec/avcodec: Define CODEC_CAP_* based on AV_CODEC_CAP_*

2015-08-05 Thread Michael Niedermayer
From: Michael Niedermayer 

Avoid duplicating the literal numeric values

Signed-off-by: Michael Niedermayer 
---
 libavcodec/avcodec.h |   32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6b824d5..dfab977 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1019,14 +1019,14 @@ typedef struct RcOverride{
 /* /Fx */
 /* codec capabilities */
 
-#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band 
callback.
+#define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND ///< Decoder 
can use draw_horiz_band callback.
 /**
  * Codec uses get_buffer() for allocating buffers and supports custom 
allocators.
  * If not set, it might not use get_buffer() at all or use operations that
  * assume the buffer was allocated by avcodec_default_get_buffer.
  */
-#define CODEC_CAP_DR1 0x0002
-#define CODEC_CAP_TRUNCATED   0x0008
+#define CODEC_CAP_DR1 AV_CODEC_CAP_DR1
+#define CODEC_CAP_TRUNCATED   AV_CODEC_CAP_TRUNCATED
 #if FF_API_XVMC
 /* Codec can export data for HW decoding. This flag indicates that
  * the codec would call get_format() with list that might contain HW 
accelerated
@@ -1060,17 +1060,17 @@ typedef struct RcOverride{
  *   each output packet. If this flag is not set, the pts and duration will
  *   be determined by libavcodec from the input frame.
  */
-#define CODEC_CAP_DELAY   0x0020
+#define CODEC_CAP_DELAY   AV_CODEC_CAP_DELAY
 /**
  * Codec can be fed a final frame with a smaller size.
  * This can be used to prevent truncation of the last audio samples.
  */
-#define CODEC_CAP_SMALL_LAST_FRAME 0x0040
+#define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME
 #if FF_API_CAP_VDPAU
 /**
  * Codec can export data for HW decoding (VDPAU).
  */
-#define CODEC_CAP_HWACCEL_VDPAU0x0080
+#define CODEC_CAP_HWACCEL_VDPAUAV_CODEC_CAP_HWACCEL_VDPAU
 #endif
 /**
  * Codec can output multiple frames per AVPacket
@@ -1083,16 +1083,16 @@ typedef struct RcOverride{
  * prohibiting stream copy in many cases thus it should only be considered
  * as a last resort.
  */
-#define CODEC_CAP_SUBFRAMES0x0100
+#define CODEC_CAP_SUBFRAMESAV_CODEC_CAP_SUBFRAMES
 /**
  * Codec is experimental and is thus avoided in favor of non experimental
  * encoders
  */
-#define CODEC_CAP_EXPERIMENTAL 0x0200
+#define CODEC_CAP_EXPERIMENTAL AV_CODEC_CAP_EXPERIMENTAL
 /**
  * Codec should fill in channel configuration and samplerate instead of 
container
  */
-#define CODEC_CAP_CHANNEL_CONF 0x0400
+#define CODEC_CAP_CHANNEL_CONF AV_CODEC_CAP_CHANNEL_CONF
 #if FF_API_NEG_LINESIZES
 /**
  * @deprecated no codecs use this capability
@@ -1102,31 +1102,31 @@ typedef struct RcOverride{
 /**
  * Codec supports frame-level multithreading.
  */
-#define CODEC_CAP_FRAME_THREADS0x1000
+#define CODEC_CAP_FRAME_THREADSAV_CODEC_CAP_FRAME_THREADS
 /**
  * Codec supports slice-based (or partition-based) multithreading.
  */
-#define CODEC_CAP_SLICE_THREADS0x2000
+#define CODEC_CAP_SLICE_THREADSAV_CODEC_CAP_SLICE_THREADS
 /**
  * Codec supports changed parameters at any point.
  */
-#define CODEC_CAP_PARAM_CHANGE 0x4000
+#define CODEC_CAP_PARAM_CHANGE AV_CODEC_CAP_PARAM_CHANGE
 /**
  * Codec supports avctx->thread_count == 0 (auto).
  */
-#define CODEC_CAP_AUTO_THREADS 0x8000
+#define CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_AUTO_THREADS
 /**
  * Audio encoder supports receiving a different number of samples in each call.
  */
-#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x1
+#define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE
 /**
  * Codec is intra only.
  */
-#define CODEC_CAP_INTRA_ONLY   0x4000
+#define CODEC_CAP_INTRA_ONLY   AV_CODEC_CAP_INTRA_ONLY
 /**
  * Codec is lossless.
  */
-#define CODEC_CAP_LOSSLESS 0x8000
+#define CODEC_CAP_LOSSLESS AV_CODEC_CAP_LOSSLESS
 
 /**
  * HWAccel is experimental and is thus avoided in favor of non experimental
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] vf_psnr: add psnr_avg to stats file.

2015-08-05 Thread Ronald S. Bultje
Hi,

On Wed, Aug 5, 2015 at 7:56 AM, Paul B Mahol  wrote:

> Dana 5. 8. 2015. 13:31 osoba "Ronald S. Bultje" 
> napisala je:
> >
> > ---
> >  libavfilter/vf_psnr.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
> > index f202df3..3c1dc81 100644
> > --- a/libavfilter/vf_psnr.c
> > +++ b/libavfilter/vf_psnr.c
> > @@ -174,6 +174,7 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame
> *main,
> >  c = s->is_rgb ? s->rgba_map[j] : j;
> >  fprintf(s->stats_file, "mse_%c:%0.2f ", s->comps[j],
> comp_mse[c]);
> >  }
> > +fprintf(s->stats_file, "psnr_avg:%0.2f ", get_psnr(mse, 1,
> s->average_max));
> >  for (j = 0; j < s->nb_components; j++) {
> >  c = s->is_rgb ? s->rgba_map[j] : j;
> >  fprintf(s->stats_file, "psnr_%c:%0.2f ", s->comps[j],
> > --
> > 2.1.2
>
> LGTM


Applied.

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


Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: Define CODEC_CAP_* based on AV_CODEC_CAP_*

2015-08-05 Thread Ronald S. Bultje
Hi,

On Wed, Aug 5, 2015 at 9:15 AM, Michael Niedermayer 
wrote:

> From: Michael Niedermayer 
>
> Avoid duplicating the literal numeric values
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avcodec.h |   32 
>  1 file changed, 16 insertions(+), 16 deletions(-)


OK.

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


Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: Define CODEC_CAP_* based on AV_CODEC_CAP_*

2015-08-05 Thread Michael Niedermayer
On Wed, Aug 05, 2015 at 09:31:49AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Wed, Aug 5, 2015 at 9:15 AM, Michael Niedermayer 
> wrote:
> 
> > From: Michael Niedermayer 
> >
> > Avoid duplicating the literal numeric values
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/avcodec.h |   32 
> >  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> 
> OK.

applied

thx

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

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH] x86inc: warn if XOP integer FMA instruction emulation is impossible

2015-08-05 Thread Henrik Gramner
On Tue, Aug 4, 2015 at 9:01 PM, Ronald S. Bultje  wrote:
> lgtm.
>
> Ronald

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] png: Be more informative regarding signature errors

2015-08-05 Thread Clément Bœsch
On Wed, Aug 05, 2015 at 12:10:56PM +0200, Luca Barbato wrote:
> ffmpeg | branch: master | Luca Barbato  | Fri Jul 31 
> 14:24:08 2015 +0200| [4fee11ab05fc8569ef35c0ce86a60375c903eefb] | committer: 
> Luca Barbato
> 
> png: Be more informative regarding signature errors
> 
> Signed-off-by: Luca Barbato 
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fee11ab05fc8569ef35c0ce86a60375c903eefb
> ---
> 
>  libavcodec/pngdec.c |   20 +---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 4ca919b..5fa7a2d 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -18,6 +18,8 @@
>   * License along with Libav; if not, write to the Free Software
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
> +
> +#include "libavutil/avstring.h"
>  #include "libavutil/imgutils.h"
>  #include "avcodec.h"
>  #include "bytestream.h"
> @@ -414,9 +416,21 @@ static int decode_frame(AVCodecContext *avctx,
>  int ret;
>  
>  /* check signature */
> -if (buf_size < 8 ||
> -(memcmp(buf, ff_pngsig, 8) != 0 && memcmp(buf, ff_mngsig, 8) != 0)) {
> -av_log(avctx, AV_LOG_ERROR, "Invalid PNG signature (%d).\n", 
> buf_size);
> +if (buf_size < 8) {
> +av_log(avctx, AV_LOG_ERROR, "Not enough data %d\n",
> +   buf_size);
> +return AVERROR_INVALIDDATA;
> +}
> +if (memcmp(buf, ff_pngsig, 8) != 0 &&
> +memcmp(buf, ff_mngsig, 8) != 0) {
> +char signature[5 * 8 + 1] = { 0 };
> +int i;
> +for (i = 0; i < 8; i++) {

> +av_strlcatf(signature + i * 5, sizeof(signature) - i * 5,
> +" 0x%02x", buf[i]);

Unless I'm mistaken you want to either use snprintf, or strlcatf but
without the redundant +i*5 -i*5

> +}
> +av_log(avctx, AV_LOG_ERROR, "Invalid PNG signature %s\n",
> +   signature);
>  return AVERROR_INVALIDDATA;
>  }
>  

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread wm4
On Tue,  4 Aug 2015 22:09:57 -0700
Sasi Inguva  wrote:

> Compute individual stream durations in matroska muxer.
> Write them as string tags in the same format as mkvmerge tool does.
> 
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/matroskaenc.c| 79 
> +---
>  tests/fate/wavpack.mak   |  4 +--
>  tests/ref/acodec/tta |  4 +--
>  tests/ref/fate/binsub-mksenc |  2 +-
>  tests/ref/lavf/mkv   |  8 ++---
>  tests/ref/seek/lavf-mkv  | 44 
>  6 files changed, 105 insertions(+), 36 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 2d0d5f6..703abc3 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -44,6 +44,7 @@
>  #include "libavutil/mathematics.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/random_seed.h"
> +#include "libavutil/rational.h"
>  #include "libavutil/samplefmt.h"
>  #include "libavutil/sha.h"
>  #include "libavutil/stereo3d.h"
> @@ -131,6 +132,9 @@ typedef struct MatroskaMuxContext {
>  
>  int64_t last_track_timestamp[MAX_TRACKS];
>  
> +int64_t* stream_durations;
> +int64_t* stream_duration_offsets;
> +
>  int allow_raw_vfw;
>  } MatroskaMuxContext;
>  
> @@ -1151,12 +1155,12 @@ static int mkv_write_simpletag(AVIOContext *pb, 
> AVDictionaryEntry *t)
>  return 0;
>  }
>  
> -static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int 
> elementid,
> - unsigned int uid, ebml_master *tags)
> +static int mkv_write_tag_targets(AVFormatContext *s,
> + unsigned int elementid, unsigned int uid,
> + ebml_master *tags, ebml_master* tag)
>  {
>  MatroskaMuxContext *mkv = s->priv_data;
> -ebml_master tag, targets;
> -AVDictionaryEntry *t = NULL;
> +ebml_master targets;
>  int ret;
>  
>  if (!tags->pos) {
> @@ -1166,11 +1170,24 @@ static int mkv_write_tag(AVFormatContext *s, 
> AVDictionary *m, unsigned int eleme
>  *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
>  }
>  
> -tag = start_ebml_master(s->pb, MATROSKA_ID_TAG,0);
> +*tag = start_ebml_master(s->pb, MATROSKA_ID_TAG,0);
>  targets = start_ebml_master(s->pb, MATROSKA_ID_TAGTARGETS, 0);
>  if (elementid)
>  put_ebml_uint(s->pb, elementid, uid);
>  end_ebml_master(s->pb, targets);
> +return 0;
> +}
> +
> +static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int 
> elementid,
> + unsigned int uid, ebml_master *tags)
> +{
> +ebml_master tag;
> +int ret;
> +AVDictionaryEntry *t = NULL;
> +
> +ret = mkv_write_tag_targets(s, elementid, uid, tags, &tag);
> +if (ret < 0)
> +return ret;
>  
>  while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
>  if (av_strcasecmp(t->key, "title") &&
> @@ -1220,6 +1237,25 @@ static int mkv_write_tags(AVFormatContext *s)
>  if (ret < 0) return ret;
>  }
>  
> +if (!mkv->is_live) {
> +for (i = 0; i < s->nb_streams; i++) {
> +ebml_master tag_target;
> +ebml_master tag;
> +
> +mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, 
> &tags, &tag_target);
> +
> +tag = start_ebml_master(s->pb, MATROSKA_ID_SIMPLETAG, 0);
> +put_ebml_string(s->pb, MATROSKA_ID_TAGNAME, "DURATION");
> +mkv->stream_duration_offsets[i] = avio_tell(s->pb);
> +
> +// Reserve space to write duration as a 20-byte string.
> +// 2 (ebml id) + 1 (data size) + 20 (data)
> +put_ebml_void(s->pb, 23);
> +end_ebml_master(s->pb, tag);
> +end_ebml_master(s->pb, tag_target);
> +}
> +}
> +
>  for (i = 0; i < s->nb_chapters; i++) {
>  AVChapter *ch = s->chapters[i];
>  
> @@ -1430,6 +1466,10 @@ static int mkv_write_header(AVFormatContext *s)
>  }
>  end_ebml_master(pb, segment_info);
>  
> +// initialize stream_duration fields
> +mkv->stream_durations = av_mallocz(s->nb_streams * sizeof(int64_t));
> +mkv->stream_duration_offsets = av_mallocz(s->nb_streams * 
> sizeof(int64_t));
> +
>  ret = mkv_write_tracks(s);
>  if (ret < 0)
>  return ret;
> @@ -1801,6 +1841,11 @@ static int mkv_write_packet_internal(AVFormatContext 
> *s, AVPacket *pkt, int add_
>  }
>  
>  mkv->duration = FFMAX(mkv->duration, ts + duration);
> +
> +if (mkv->stream_durations)
> +mkv->stream_durations[pkt->stream_index] =
> +FFMAX(mkv->stream_durations[pkt->stream_index], ts + duration);
> +
>  return 0;
>  }
>  
> @@ -1978,6 +2023,28 @@ static int mkv_write_trailer(AVFormatContext *s)
>  avio_seek(pb, mkv->duration_offset, SEEK_SET);
>  put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
>  
> +// update stream durations
> +if 

Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-05 Thread Pedro Arthur
New patch with the green line bug fixed.
Now I intend to speedup the work on the vertical scaling and also try to
reduce
the performance gap.

2015-07-29 10:05 GMT-03:00 Michael Niedermayer :

> On Tue, Jul 28, 2015 at 11:39:59PM -0300, Pedro Arthur wrote:
> > > do you think this patch would be ready to push to main ffmpeg once
> > > this (and any other remaining) issues are fixed
> > > or is there still some speed loss ?
> > >
> > I think I should work a bit more on it, in my tests some cases there is
>
> ok
>
>
> > still 3% speed loss.
> > Usualy it occurs when the vertical filter size is ~1 so it processes one
> > line at a time. I think
> > if we process lines in "batches"  it can be improved. But it is more
> > complex to implement
> > because for example there is filters which skips some lines, and the
> memory
> > required will
> > be increased.
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many that live deserve death. And some that die deserve life. Can you give
> it to them? Then do not be too eager to deal out death in judgement. For
> even the very wise cannot see all ends. -- Gandalf
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
diff --git a/libswscale/Makefile b/libswscale/Makefile
index a60b057..d876e75 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -14,6 +14,7 @@ OBJS = hscale_fast_bilinear.o   \
swscale_unscaled.o   \
utils.o  \
yuv2rgb.o\
+   slice.o  \
 
 OBJS-$(CONFIG_SHARED)+= log2_tab.o
 
diff --git a/libswscale/slice.c b/libswscale/slice.c
new file mode 100644
index 000..f882557
--- /dev/null
+++ b/libswscale/slice.c
@@ -0,0 +1,554 @@
+#include "swscale_internal.h"
+
+static void free_lines(SwsSlice *s)
+{
+int i;
+for (i = 0; i < 2; ++i) {
+int n = s->plane[i].available_lines;
+int j;
+for (j = 0; j < n; ++j) {
+av_freep(&s->plane[i].line[j]);
+if (s->is_ring)
+   s->plane[i].line[j+n] = NULL;
+}
+}
+
+for (i = 0; i < 4; ++i)
+memset(s->plane[i].line, 0, sizeof(uint8_t*) * s->plane[i].available_lines * (s->is_ring ? 3 : 1));
+s->should_free_lines = 0;
+}
+
+/*
+ slice lines contains extra bytes for vetorial code thus @size
+ is the allocated memory size and @width is the number of pixels 
+*/
+static int alloc_lines(SwsSlice *s, int size, int width)
+{
+int i;
+int idx[2] = {3, 2};
+
+s->should_free_lines = 1;
+s->width = width;
+
+for (i = 0; i < 2; ++i) {
+int n = s->plane[i].available_lines;
+int j;
+int ii = idx[i];
+
+av_assert0(n == s->plane[ii].available_lines);
+for (j = 0; j < n; ++j) {
+// chroma plane line U and V are expected to be contiguous in memory
+// by mmx vertical scaler code
+s->plane[i].line[j] = av_malloc(size * 2 + 32);
+if (!s->plane[i].line[j]) {
+free_lines(s);
+return AVERROR(ENOMEM);
+}
+s->plane[ii].line[j] = s->plane[i].line[j] + size + 16; 
+if (s->is_ring) {
+   s->plane[i].line[j+n] = s->plane[i].line[j];
+   s->plane[ii].line[j+n] = s->plane[ii].line[j];
+}
+}
+}
+
+return 0;
+}
+
+static int alloc_slice(SwsSlice *s, enum AVPixelFormat fmt, int lumLines, int chrLines, int h_sub_sample, int v_sub_sample, int ring)
+{
+int i;
+int size[4] = { lumLines,
+chrLines,
+chrLines,
+lumLines };
+
+s->h_chr_sub_sample = h_sub_sample;
+s->v_chr_sub_sample = v_sub_sample;
+s->fmt = fmt;
+s->is_ring = ring;
+s->should_free_lines = 0;
+
+for (i = 0; i < 4; ++i) {
+int n = size[i] * ( ring == 0 ? 1 : 3);
+s->plane[i].line = av_mallocz_array(sizeof(uint8_t*), n);
+if (!s->plane[i].line) 
+return AVERROR(ENOMEM);
+
+s->plane[i].tmp = ring ? s->plane[i].line + size[i] * 2 : NULL;
+s->plane[i].available_lines = size[i];
+s->plane[i].sliceY = 0;
+s->plane[i].sliceH = 0;
+}
+return 0;
+}
+
+static void free_slice(SwsSlice *s)
+{
+int i;
+if (s) {
+if (s->should_free_lines)
+free_lines(s);
+for (i = 0; i < 4; ++i) {
+av_freep(&s->plane[i].line);
+s->plane[i].tmp = NULL;
+}
+}
+}
+
+int ff_rotate_slice(SwsSlice *s, int lum, int chr)
+{
+int i;
+if (lum) {
+for (i = 0; i <

[FFmpeg-devel] [PATCH] avfilter: add showfreqs filter

2015-08-05 Thread Paul B Mahol
---
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/avf_showfreqs.c | 360 
 3 files changed, 362 insertions(+)
 create mode 100644 libavfilter/avf_showfreqs.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 1865e49..049bbe8 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -256,6 +256,7 @@ OBJS-$(CONFIG_ADRAWGRAPH_FILTER) += 
f_drawgraph.o
 OBJS-$(CONFIG_AVECTORSCOPE_FILTER)   += avf_avectorscope.o
 OBJS-$(CONFIG_CONCAT_FILTER) += avf_concat.o
 OBJS-$(CONFIG_SHOWCQT_FILTER)+= avf_showcqt.o
+OBJS-$(CONFIG_SHOWFREQS_FILTER)  += avf_showfreqs.o
 OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)   += avf_showspectrum.o
 OBJS-$(CONFIG_SHOWVOLUME_FILTER) += avf_showvolume.o
 OBJS-$(CONFIG_SHOWWAVES_FILTER)  += avf_showwaves.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f8e97bc..63a274a 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -271,6 +271,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(AVECTORSCOPE,   avectorscope,   avf);
 REGISTER_FILTER(CONCAT, concat, avf);
 REGISTER_FILTER(SHOWCQT,showcqt,avf);
+REGISTER_FILTER(SHOWFREQS,  showfreqs,  avf);
 REGISTER_FILTER(SHOWSPECTRUM,   showspectrum,   avf);
 REGISTER_FILTER(SHOWVOLUME, showvolume, avf);
 REGISTER_FILTER(SHOWWAVES,  showwaves,  avf);
diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
new file mode 100644
index 000..0961db0
--- /dev/null
+++ b/libavfilter/avf_showfreqs.c
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * 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
+ */
+
+#include 
+
+#include "libavcodec/avfft.h"
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+#include "avfilter.h"
+#include "internal.h"
+
+enum DisplayMode  { LINE, BAR, DOT, NB_MODES };
+enum DisplayScale { LINEAR, SQRT, CBRT, LOG, NB_SCALES };
+enum WindowFunc   { WFUNC_NONE, WFUNC_HANN, WFUNC_HAMMING, WFUNC_BLACKMAN, 
NB_WFUNC };
+
+typedef struct ShowFreqsContext {
+const AVClass *class;
+int w, h;
+FFTContext *fft;   ///< Real Discrete Fourier Transform context
+int fft_bits;  ///< number of bits (FFT window size = 
1outputs[0];
+static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
+static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
+
+/* set input audio formats */
+formats = ff_make_format_list(sample_fmts);
+if (!formats)
+return AVERROR(ENOMEM);
+ff_formats_ref(formats, &inlink->out_formats);
+
+layouts = ff_all_channel_layouts();
+if (!layouts)
+return AVERROR(ENOMEM);
+ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
+
+formats = ff_all_samplerates();
+if (!formats)
+return AVERROR(ENOMEM);
+ff_formats_ref(formats, &inlink->out_samplerates);
+
+/* set output video format */
+formats = ff_make_format_list(pix_fmts);
+if (!formats)
+return AVERROR(ENOMEM);
+ff_formats_ref(formats, &outlink->in_formats);
+
+return 0;
+}
+
+static int config_output(AVFilterLink *outlink)
+{
+AVFilterContext *ctx = outlink->src;
+AVFilterLink *inlink = ctx->inputs[0];
+ShowFreqsContext *s = ctx->priv;
+unsigned win_size;
+int i, fft_bits;
+
+outlink->w = s->w;
+outlink->h = s->h;
+
+/* FFT window size (precision) according to the requested output frame 
height */
+for (fft_bits = 1; 1 << fft_bits < 2 * outlink->w; fft_bits++);
+win_size = 1 << fft_bits;
+
+/* (re-)configuration if the video output changed (or first init) */
+if (fft_bits != s->fft_bits) {
+av_fft_end(s->fft);
+s->fft = av_fft_init(fft_bits, 0);
+if (!s->fft) {
+av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
+   "The wind

Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread Sasi Inguva
yes. it does .
http://stackoverflow.com/questions/18688971/c-char-array-initialization
 and from an example in Initialization from strings in
http://en.cppreference.com/w/c/language/array_initialization .

On Wed, Aug 5, 2015 at 9:48 AM, wm4  wrote:

> On Tue,  4 Aug 2015 22:09:57 -0700
> Sasi Inguva  wrote:
>
> > Compute individual stream durations in matroska muxer.
> > Write them as string tags in the same format as mkvmerge tool does.
> >
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavformat/matroskaenc.c| 79
> +---
> >  tests/fate/wavpack.mak   |  4 +--
> >  tests/ref/acodec/tta |  4 +--
> >  tests/ref/fate/binsub-mksenc |  2 +-
> >  tests/ref/lavf/mkv   |  8 ++---
> >  tests/ref/seek/lavf-mkv  | 44 
> >  6 files changed, 105 insertions(+), 36 deletions(-)
> >
> > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> > index 2d0d5f6..703abc3 100644
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -44,6 +44,7 @@
> >  #include "libavutil/mathematics.h"
> >  #include "libavutil/opt.h"
> >  #include "libavutil/random_seed.h"
> > +#include "libavutil/rational.h"
> >  #include "libavutil/samplefmt.h"
> >  #include "libavutil/sha.h"
> >  #include "libavutil/stereo3d.h"
> > @@ -131,6 +132,9 @@ typedef struct MatroskaMuxContext {
> >
> >  int64_t last_track_timestamp[MAX_TRACKS];
> >
> > +int64_t* stream_durations;
> > +int64_t* stream_duration_offsets;
> > +
> >  int allow_raw_vfw;
> >  } MatroskaMuxContext;
> >
> > @@ -1151,12 +1155,12 @@ static int mkv_write_simpletag(AVIOContext *pb,
> AVDictionaryEntry *t)
> >  return 0;
> >  }
> >
> > -static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned
> int elementid,
> > - unsigned int uid, ebml_master *tags)
> > +static int mkv_write_tag_targets(AVFormatContext *s,
> > + unsigned int elementid, unsigned int
> uid,
> > + ebml_master *tags, ebml_master* tag)
> >  {
> >  MatroskaMuxContext *mkv = s->priv_data;
> > -ebml_master tag, targets;
> > -AVDictionaryEntry *t = NULL;
> > +ebml_master targets;
> >  int ret;
> >
> >  if (!tags->pos) {
> > @@ -1166,11 +1170,24 @@ static int mkv_write_tag(AVFormatContext *s,
> AVDictionary *m, unsigned int eleme
> >  *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
> >  }
> >
> > -tag = start_ebml_master(s->pb, MATROSKA_ID_TAG,0);
> > +*tag = start_ebml_master(s->pb, MATROSKA_ID_TAG,0);
> >  targets = start_ebml_master(s->pb, MATROSKA_ID_TAGTARGETS, 0);
> >  if (elementid)
> >  put_ebml_uint(s->pb, elementid, uid);
> >  end_ebml_master(s->pb, targets);
> > +return 0;
> > +}
> > +
> > +static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned
> int elementid,
> > + unsigned int uid, ebml_master *tags)
> > +{
> > +ebml_master tag;
> > +int ret;
> > +AVDictionaryEntry *t = NULL;
> > +
> > +ret = mkv_write_tag_targets(s, elementid, uid, tags, &tag);
> > +if (ret < 0)
> > +return ret;
> >
> >  while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
> >  if (av_strcasecmp(t->key, "title") &&
> > @@ -1220,6 +1237,25 @@ static int mkv_write_tags(AVFormatContext *s)
> >  if (ret < 0) return ret;
> >  }
> >
> > +if (!mkv->is_live) {
> > +for (i = 0; i < s->nb_streams; i++) {
> > +ebml_master tag_target;
> > +ebml_master tag;
> > +
> > +mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, i
> + 1, &tags, &tag_target);
> > +
> > +tag = start_ebml_master(s->pb, MATROSKA_ID_SIMPLETAG, 0);
> > +put_ebml_string(s->pb, MATROSKA_ID_TAGNAME, "DURATION");
> > +mkv->stream_duration_offsets[i] = avio_tell(s->pb);
> > +
> > +// Reserve space to write duration as a 20-byte string.
> > +// 2 (ebml id) + 1 (data size) + 20 (data)
> > +put_ebml_void(s->pb, 23);
> > +end_ebml_master(s->pb, tag);
> > +end_ebml_master(s->pb, tag_target);
> > +}
> > +}
> > +
> >  for (i = 0; i < s->nb_chapters; i++) {
> >  AVChapter *ch = s->chapters[i];
> >
> > @@ -1430,6 +1466,10 @@ static int mkv_write_header(AVFormatContext *s)
> >  }
> >  end_ebml_master(pb, segment_info);
> >
> > +// initialize stream_duration fields
> > +mkv->stream_durations = av_mallocz(s->nb_streams * sizeof(int64_t));
> > +mkv->stream_duration_offsets = av_mallocz(s->nb_streams *
> sizeof(int64_t));
> > +
> >  ret = mkv_write_tracks(s);
> >  if (ret < 0)
> >  return ret;
> > @@ -1801,6 +1841,11 @@ static int
> mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
> >  }
> >
> >  mkv->duration = FFMAX(mkv->duration, ts + dura

[FFmpeg-devel] [PATCH] checkasm: Remove unnecessary include

2015-08-05 Thread Henrik Gramner
---
 tests/checkasm/checkasm.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 520397c..4eb14dd 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -33,10 +33,6 @@
 #include 
 #endif
 
-#if ARCH_X86
-#include "libavutil/x86/cpu.h"
-#endif
-
 #if HAVE_SETCONSOLETEXTATTRIBUTE
 #include 
 #define COLOR_REDFOREGROUND_RED
-- 
1.8.3.2

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


Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread wm4
On Wed, 5 Aug 2015 10:00:45 -0700
Sasi Inguva  wrote:

> yes. it does .
> http://stackoverflow.com/questions/18688971/c-char-array-initialization
>  and from an example in Initialization from strings in
> http://en.cppreference.com/w/c/language/array_initialization .

Looks ok to me then.

Have you checked whether your patch includes the last frame duration? I
think mkvmerge does. It's particularly interesting for subtitles, where
the durations are essentially arbitrary.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread Sasi Inguva
yes. it computes duration as  max ( packet-timestamp + packet-duration)

On Wed, Aug 5, 2015 at 10:08 AM, wm4  wrote:

> On Wed, 5 Aug 2015 10:00:45 -0700
> Sasi Inguva  wrote:
>
> > yes. it does .
> > http://stackoverflow.com/questions/18688971/c-char-array-initialization
> >  and from an example in Initialization from strings in
> > http://en.cppreference.com/w/c/language/array_initialization .
>
> Looks ok to me then.
>
> Have you checked whether your patch includes the last frame duration? I
> think mkvmerge does. It's particularly interesting for subtitles, where
> the durations are essentially arbitrary.
> ___
> 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


[FFmpeg-devel] [PATCH] lavc: propagate hwaccel errors

2015-08-05 Thread wm4
At least the new videotoolbox decoder does not actually set a frame if
end_frame fails. This causes the API to return success and signals that
a picture was decoded, even though AVFrame->data[0] is NULL.

Fix this by propagating end_frame errors.
---
Untested. I'm hoping that the errors will be propagated down to the
decode API call correctly.
---
 libavcodec/h264_picture.c | 3 ++-
 libavcodec/hevc.c | 5 -
 libavcodec/mpeg12dec.c| 9 +++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 81d90d7..04bbf02 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -172,7 +172,8 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, 
int in_setup)
 }
 
 if (avctx->hwaccel) {
-if (avctx->hwaccel->end_frame(avctx) < 0)
+err = avctx->hwaccel->end_frame(avctx);
+if (err < 0)
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
 }
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 7f79189..d8da18d 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2896,9 +2896,12 @@ static int hevc_decode_frame(AVCodecContext *avctx, void 
*data, int *got_output,
 return ret;
 
 if (avctx->hwaccel) {
-if (s->ref && avctx->hwaccel->end_frame(avctx) < 0)
+if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ff_hevc_unref_frame(s, s->ref, ~0);
+return ret;
+}
 } else {
 /* verify the SEI checksum */
 if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1250d53..453cd6a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1723,9 +1723,11 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 
 if (s->avctx->hwaccel &&
 (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
-if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");
+return ret;
+}
 }
 
 for (i = 0; i < 4; i++) {
@@ -2082,9 +2084,12 @@ static int slice_end(AVCodecContext *avctx, AVFrame 
*pict)
 return 0;
 
 if (s->avctx->hwaccel) {
-if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+int ret = s->avctx->hwaccel->end_frame(s->avctx);
+if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+return ret;
+}
 }
 
 /* end of slice reached */
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Add support for font names

2015-08-05 Thread Niklesh Lalwani
> I didn't mean this - it's ok for the value to be 0, but it's
> not ok for it to be some huge number that will cause you to
> read beyond the end of the buffer. So like you did for the other
> variable length fields, you need to sanity check this against the total
> packet size.
>
> > +t3xg_ptr += 2;
> > +for (i = 0; i < m->ftab_entries; i++) {
> > +m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
> > +if (!m->ftab_temp) {
> > +mov_text_cleanup_ftab(m);
> > +return AVERROR(ENOMEM);
> > +}
> > +m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
> > +t3xg_ptr += 2;
> > +m->ftab_temp->font_name_length = *t3xg_ptr++;
> > +if (!m->ftab_temp->font_name_length) {
> > +m->ftab_entries = 0;
> > +return -1;
> > +}
>
> Similarly here. The fontname length could be too long. We know it is
> not allowed to be more than 20, but you also need to verify against
> total packet size.
>
>
Yes, my bad. Updated the patch.

Thanks,
Niklesh
From 90f466bb6a5d3cd24d7ea4d9fd8a2915cc68cdb2 Mon Sep 17 00:00:00 2001
From: Niklesh 
Date: Thu, 6 Aug 2015 00:06:15 +0530
Subject: [PATCH] movtextdec.c: Add support for font names

Signed-off-by: Niklesh 
---
 libavcodec/movtextdec.c | 109 ++--
 1 file changed, 106 insertions(+), 3 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 869358c..451056c 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -36,10 +36,17 @@
 #define HCLR_BOX   (1<<2)
 
 typedef struct {
+uint16_t fontID;
+uint8_t font_name_length;
+uint8_t font[20];
+} FontRecord;
+
+typedef struct {
 uint16_t style_start;
 uint16_t style_end;
 uint8_t style_flag;
 uint8_t fontsize;
+uint16_t style_fontID;
 } StyleBox;
 
 typedef struct {
@@ -56,11 +63,13 @@ typedef struct {
 StyleBox *s_temp;
 HighlightBox h;
 HilightcolorBox c;
+FontRecord **ftab;
+FontRecord *ftab_temp;
 uint8_t box_flags;
-uint16_t style_entries;
+uint16_t style_entries, ftab_entries;
 uint64_t tracksize;
 int size_var;
-int count_s;
+int count_s, count_f;
 } MovTextContext;
 
 typedef struct {
@@ -80,6 +89,80 @@ static void mov_text_cleanup(MovTextContext *m)
 }
 }
 
+static void mov_text_cleanup_ftab(MovTextContext *m)
+{
+int i;
+for(i = 0; i < m->count_f; i++) {
+av_freep(&m->ftab[i]);
+}
+av_freep(&m->ftab);
+}
+
+static int mov_text_t3xg(AVCodecContext *avctx, MovTextContext *m)
+{
+char *t3xg_ptr = avctx->extradata;
+int i, tracksize;
+
+tracksize = 38; /* Size till ftab_entries */
+if (avctx->extradata_size < tracksize)
+return -1;
+
+m->ftab_entries = 0;
+// Display Flags
+t3xg_ptr += 4;
+// Alignment
+t3xg_ptr += 2;
+// Background Color
+t3xg_ptr += 4;
+// BoxRecord
+t3xg_ptr += 8;
+// StyleRecord
+t3xg_ptr += 12;
+// FontRecord
+// FontRecord Size
+t3xg_ptr += 4;
+// ftab
+t3xg_ptr += 4;
+
+tracksize += 2;
+if (avctx->extradata_size < tracksize)
+return -1;
+
+m->ftab_entries = AV_RB16(t3xg_ptr);
+t3xg_ptr += 2;
+
+for (i = 0; i < m->ftab_entries; i++) {
+
+tracksize += 3;
+if (avctx->extradata_size < tracksize) {
+m->ftab_entries = 0;
+return -1;
+}
+m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
+if (!m->ftab_temp) {
+mov_text_cleanup_ftab(m);
+return AVERROR(ENOMEM);
+}
+m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
+t3xg_ptr += 2;
+m->ftab_temp->font_name_length = *t3xg_ptr++;
+
+tracksize = tracksize + m->ftab_temp->font_name_length;
+if ((avctx->extradata_size < tracksize) || (m->ftab_temp->font_name_length > 20)) {
+m->ftab_entries = 0;
+return -1;
+}
+memcpy(m->ftab_temp->font, t3xg_ptr, m->ftab_temp->font_name_length);
+av_dynarray_add(&m->ftab, &m->count_f, m->ftab_temp);
+if (!m->ftab) {
+mov_text_cleanup_ftab(m);
+return AVERROR(ENOMEM);
+}
+t3xg_ptr = t3xg_ptr + 3 + m->ftab[i]->font_name_length;
+}
+return 0;
+}
+
 static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
 {
 m->box_flags |= HLIT_BOX;
@@ -118,7 +201,7 @@ static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
 tsmb += 2;
 m->s_temp->style_end = AV_RB16(tsmb);
 tsmb += 2;
-// fontID = AV_RB16(tsmb);
+m->s_temp->style_fontID = AV_RB16(tsmb);
 tsmb += 2;
 m->s_temp->style_flag = AV_RB8(tsmb);
 tsmb++;
@@ -147,6 +230,7 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
 MovTextContext *m)
 {
 int i = 0;
+int j = 0;
 int text_pos = 0;
 while 

Re: [FFmpeg-devel] [PATCH] ffplay: do not block audio thread on WIN32

2015-08-05 Thread Marton Balint


On Tue, 4 Aug 2015, Michael Niedermayer wrote:


On Tue, Aug 04, 2015 at 01:00:52AM +0200, Marton Balint wrote:

The windows SDL audio driver plays the old data in the buffer in a loop if it
is not updated in time. So instead of waiting for data and blocking the the
audio thread, return silence if no data is available.

Should fix ticket #2289.


ive no means to test but if it works then should be ok



I have tested in on a win32 build.


also send me your public SSH key for git push access



Did that, and applied the patch to git master.

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


Re: [FFmpeg-devel] [libav-devel] [PATCH 0/20] removal of deprecated features

2015-08-05 Thread Andreas Cadhalpun
On 04.08.2015 07:57, Reimar Döffinger wrote:
> I do have on more proposal, but the problem is it needs someone to do the 
> work.
> For each removed feature, prepare documentation "a monkey could follow" on how
> to replace it (you could call it a transition guide).
> Even better, a script that automates it where reasonable.

I think this is a very good idea.

> In some cases it is just a matter of copy-pasting some existing wrapper code,
> particularly if we remove that wrapper code it is useful if people still have
> it available in the new release.
> If it's just a few hours of someone's time who even doesn't need to understand
> the code, I think we can very confidently say "not really our problem" if some
> applications still use it.

Agreed.

> If we that way find out that there are non-trivial cases or cases where the 
> code
> gets a lot more complicated it might be a hint the new API is still crap and 
> we
> maybe should come up with something better first.

A more complete usage list for the deprecated APIs is:

FF_API_PIX_FMT: 71
amide avbin avifile bino blender chromium-browser dff dolphin-emu dvbcut
dvswitch ffdiaporama ffmpeg2theora ffmpegthumbnailer ffmpegthumbs ffms2
fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders gnash gpac
gst-libav1.0 guvcview harvid hedgewars info-beamer jugglemaster karlyriceditor
kino kodi lightspark lebiniou libam7xxx libavg libde265 libextractor
libquicktime linphone lives lynkeos.app mlt mplayer mplayer2 mrpt opal
opencv openmw openscenegraph ovito paraview performous pjproject qutecom
rbdoom3bfg renpy shotdetect sflphone strigi survex transcode vcmi vlc vtk vtk6
vxl wxsvg x264 xjadeo xpra yorick-av zoneminder

FF_API_AVFRAME_LAVC: 53
alsa-plugins amarok aubio avbin blender chromaprint dff dolphin-emu dvbcut
ffdiaporama ffmpegthumbnailer ffmpegthumbs fuse-emulator-utils gazebo
gmerlin-avdecoder gmerlin-encoders goldendict gpac gst-libav1.0 hedgewars
info-beamer jugglemaster kino libavg libextractor libquicktime lightspark
linphone mplayer mplayer2 mrpt opal opencv openscenegraph ovito paraview
performous pianopar qutecom renpy shotdetect spek squeezelite transcode
vcmi vlc vtk vtk6 vxl xine-lib-1.2 xpra yorick-av zoneminder

FF_API_GET_BUFFER: 9
avifile dvswitch gmerlin-avdecoder gst-libav1.0 libavg mplayer mplayer2 openmw
openscenegraph

FF_API_AUDIOCONVERT: 7
alsa-plugins cantata ffdiaporama moc mplayer2 mpv vlc

FF_API_SWS_CPU_CAPS: 6
fuse-emulator-utils kodi mlt mplayer2 vlc zoneminder

FF_API_DEINTERLACE: 5
blender dff ffmpegthumbnailer ffmpegthumbs vxl

FF_API_AVFRAME_LAVC(qscale): 3
ffmpeg2theora kodi xine-lib-1.2

FF_API_CODEC_ID: 3
chromium-browser dvswitch ffms2

FF_API_CONTEXT_SIZE: 3
mplayer mplayer2 xine-lib-1.2

FF_API_REQUEST_CHANNELS: 3
mplayer mplayer2 renpy

FF_API_AV_REVERSE: 2
mplayer mplayer2

FF_API_AVCODEC_RESAMPLE: 2
mlt mplayer

FF_API_DESTRUCT_PACKET: 2
lives openmw

FF_API_AVFILTERBUFFER: 2
ffdiaporama pianobar

FF_API_AVFILTERPAD_PUBLIC: 1
mplayer

FF_API_VIMA_DECODER: 1
mplayer



FF_API_PIX_FMT and FF_API_AVFRAME_LAVC are still widely used, but the
"patch-monkey" could deal with the changes and also with FF_API_AUDIOCONVERT,
FF_API_SWS_CPU_CAPS, FF_API_CODEC_ID, FF_API_CONTEXT_SIZE,
FF_API_REQUEST_CHANNELS and FF_API_VIMA_DECODER.

Regarding FF_API_GET_BUFFER, get_buffer should be replaced with get_buffer2,
but it's not clear how release_buffer/reget_buffer should be replaced.
Can someone explain/document this?

To get rid of FF_API_DEINTERLACE, one should 'use yadif (in libavfilter) 
instead'.
Well, ... how?

Then, as part of FF_API_AVFRAME_LAVC(qscale), the fields qscale_table, qstride 
and
qscale_type of AVFrame are to be removed, but (at least in FFmpeg) these are 
used by
the not deprecated functions av_frame_set_qp_table and av_frame_get_qp_table, 
so they
shouldn't be removed. Anyway it's not clear how to replace their usage. 

Why is FF_API_AV_REVERSE deprecated?
It is used in FFmpeg's libavutil/eval.c.

One should 'use libswresample instead' of FF_API_AVCODEC_RESAMPLE.
A more detailed explanation would be good.

Same holds for FF_API_DESTRUCT_PACKET, where one should 'use the AVBuffer API
instead'.

For FF_API_AVFILTERBUFFER no replacement is documented.

FF_API_AVFILTERPAD_PUBLIC should be replaced by avfilter_pad_get_name and
avfilter_pad_get_type, but it seems that mplayer also uses others.

Better documentation would surely be helpful.

> Btw. the magic option to enable compatibility is still somewhat useful as it 
> lists
> and allows testing the specific changes that are coming up. But I agree it's 
> only
> a minor help.

The problem with such a magic option is that it combines the disadvantages of
removing and not removing: Programs using the old API get broken by default
and the deprecated functionality remains in the code base.

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc: propagate hwaccel errors

2015-08-05 Thread wm4
At least the new videotoolbox decoder does not actually set a frame if
end_frame fails. This causes the API to return success and signals that
a picture was decoded, even though AVFrame->data[0] is NULL.

Fix this by propagating end_frame errors.
---
Now more correct.

Confirmed to fix a problem when videotoolbox refuses to decode
something. Hevc and mpeg are untested.
---
 libavcodec/h264.c | 3 ++-
 libavcodec/h264_picture.c | 3 ++-
 libavcodec/h264_slice.c   | 8 ++--
 libavcodec/hevc.c | 5 -
 libavcodec/mpeg12dec.c| 9 +++--
 5 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8b575be..c4ab3fa 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1844,7 +1844,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
 if (avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)
 decode_postinit(h, 1);
 
-ff_h264_field_end(h, &h->slice_ctx[0], 0);
+if ((ret = ff_h264_field_end(h, &h->slice_ctx[0], 0)) < 0)
+return ret;
 
 /* Wait for second field. */
 *got_frame = 0;
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 81d90d7..04bbf02 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -172,7 +172,8 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, 
int in_setup)
 }
 
 if (avctx->hwaccel) {
-if (avctx->hwaccel->end_frame(avctx) < 0)
+err = avctx->hwaccel->end_frame(avctx);
+if (err < 0)
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
 }
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b088392..48f501b 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1170,15 +1170,19 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
 if (h->current_slice) {
 av_assert0(!h->setup_finished);
 if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
-ff_h264_field_end(h, h->slice_ctx, 1);
+ret = ff_h264_field_end(h, h->slice_ctx, 1);
 h->current_slice = 0;
+if (ret < 0)
+return ret;
 } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field 
&& h->nal_unit_type  == NAL_IDR_SLICE) {
 av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n");
-ff_h264_field_end(h, h->slice_ctx, 1);
+ret = ff_h264_field_end(h, h->slice_ctx, 1);
 h->current_slice = 0;
 ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
 ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
 h->cur_pic_ptr = NULL;
+if (ret < 0)
+return ret;
 } else
 return AVERROR_INVALIDDATA;
 }
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 7f79189..d8da18d 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2896,9 +2896,12 @@ static int hevc_decode_frame(AVCodecContext *avctx, void 
*data, int *got_output,
 return ret;
 
 if (avctx->hwaccel) {
-if (s->ref && avctx->hwaccel->end_frame(avctx) < 0)
+if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ff_hevc_unref_frame(s, s->ref, ~0);
+return ret;
+}
 } else {
 /* verify the SEI checksum */
 if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1250d53..453cd6a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1723,9 +1723,11 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 
 if (s->avctx->hwaccel &&
 (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
-if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");
+return ret;
+}
 }
 
 for (i = 0; i < 4; i++) {
@@ -2082,9 +2084,12 @@ static int slice_end(AVCodecContext *avctx, AVFrame 
*pict)
 return 0;
 
 if (s->avctx->hwaccel) {
-if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+int ret = s->avctx->hwaccel->end_frame(s->avctx);
+if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+return ret;
+}
 }
 
 /* end of slice reached */
-- 
2.5.0

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

Re: [FFmpeg-devel] [libav-devel] [PATCH 0/20] removal of deprecated features

2015-08-05 Thread Reimar Döffinger
On 05.08.2015, at 21:31, Andreas Cadhalpun  
wrote:
>> Btw. the magic option to enable compatibility is still somewhat useful as it 
>> lists
>> and allows testing the specific changes that are coming up. But I agree it's 
>> only
>> a minor help.
> 
> The problem with such a magic option is that it combines the disadvantages of
> removing and not removing: Programs using the old API get broken by default
> and the deprecated functionality remains in the code base.

TLDR: the real advantage would be support for test automation.
Maybe the default should be the other way round, but I think you are missing 
the point.
How otherwise will you tell people what will be removed for the next release?
Documentation? Nobody reads it until they have a problem.
Mailing list? Nobody has time to read that amount of traffic.
(feel free to put "nobody" in quotation marks in your mind)
Just wait until the release and watch the panic as everyone has to hurry to 
support it?
Even if everyone knew what was going to be removed, how would they test? 
Manually editing files??
For those who have a proper setup with testing, such an option would just mean 
having a configuration with it set to test upcoming removals (and never have to 
edit that configuration, to e.g. manually set what to remove).
Sure, it would be broken much of the time probably, but run e.g. "make -k" and 
you have an idea how bad it is, you can piece by piece work on fixing it, have 
a time plan to have it pass by the time the next release is due, complain to us 
if there is something you don't think is reasonable etc.
And except for the "broken much of the time", we are one of those users that 
could use it ourselves.
Or has anyone who proposed removals ever tested on anything even approaching 
our full FATE test (in particular different architectures)?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-devel] [PATCH 0/20] removal of deprecated features

2015-08-05 Thread Andreas Cadhalpun
On 05.08.2015 22:07, Reimar Döffinger wrote:
> On 05.08.2015, at 21:31, Andreas Cadhalpun  
> wrote:
>>> Btw. the magic option to enable compatibility is still somewhat useful as 
>>> it lists
>>> and allows testing the specific changes that are coming up. But I agree 
>>> it's only
>>> a minor help.
>>
>> The problem with such a magic option is that it combines the disadvantages of
>> removing and not removing: Programs using the old API get broken by default
>> and the deprecated functionality remains in the code base.
> 
> TLDR: the real advantage would be support for test automation.

If it's broken by default, it's not really good for testing.

> Maybe the default should be the other way round,

That's an essential difference.

> but I think you are missing the point.
> How otherwise will you tell people what will be removed for the next release?

Maybe mention it in the release notes?

> Documentation? Nobody reads it until they have a problem.

How should one find out about a magic option if one doesn't read the 
documentation?

> Mailing list? Nobody has time to read that amount of traffic.
> (feel free to put "nobody" in quotation marks in your mind)
> Just wait until the release and watch the panic as everyone has to hurry to 
> support it?
> Even if everyone knew what was going to be removed, how would they test?
> Manually editing files??
> For those who have a proper setup with testing, such an option would just 
> mean having a
> configuration with it set to test upcoming removals (and never have to edit 
> that
> configuration, to e.g. manually set what to remove).

One could already '#define LIB*_MAJOR_VERSION 100' for testing the deprecations.

> Sure, it would be broken much of the time probably, but run e.g. "make -k" 
> and you have
> an idea how bad it is, you can piece by piece work on fixing it, have a time 
> plan to have
> it pass by the time the next release is due, complain to us if there is 
> something you don't
> think is reasonable etc.
> And except for the "broken much of the time", we are one of those users that 
> could use
> it ourselves.
> Or has anyone who proposed removals ever tested on anything even approaching 
> our full
> FATE test (in particular different architectures)?

Such an option might be useful, but I wouldn't rely on many using it.

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Add support for font names

2015-08-05 Thread Philip Langdale
On Thu, 6 Aug 2015 00:12:07 +0530
Niklesh Lalwani  wrote:

> From 90f466bb6a5d3cd24d7ea4d9fd8a2915cc68cdb2 Mon Sep 17 00:00:00 2001
> From: Niklesh 
> Date: Thu, 6 Aug 2015 00:06:15 +0530
> Subject: [PATCH] movtextdec.c: Add support for font names
> 
> Signed-off-by: Niklesh 
> ---
>  libavcodec/movtextdec.c | 109
> ++-- 1 file changed, 106
> insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index 869358c..451056c 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -36,10 +36,17 @@
>  #define HCLR_BOX   (1<<2)
>  
>  typedef struct {
> +uint16_t fontID;
> +uint8_t font_name_length;
> +uint8_t font[20];
> +} FontRecord;
> +
> +typedef struct {
>  uint16_t style_start;
>  uint16_t style_end;
>  uint8_t style_flag;
>  uint8_t fontsize;
> +uint16_t style_fontID;
>  } StyleBox;
>  
>  typedef struct {
> @@ -56,11 +63,13 @@ typedef struct {
>  StyleBox *s_temp;
>  HighlightBox h;
>  HilightcolorBox c;
> +FontRecord **ftab;
> +FontRecord *ftab_temp;
>  uint8_t box_flags;
> -uint16_t style_entries;
> +uint16_t style_entries, ftab_entries;
>  uint64_t tracksize;
>  int size_var;
> -int count_s;
> +int count_s, count_f;
>  } MovTextContext;
>  
>  typedef struct {
> @@ -80,6 +89,80 @@ static void mov_text_cleanup(MovTextContext *m)
>  }
>  }
>  
> +static void mov_text_cleanup_ftab(MovTextContext *m)
> +{
> +int i;
> +for(i = 0; i < m->count_f; i++) {
> +av_freep(&m->ftab[i]);
> +}
> +av_freep(&m->ftab);
> +}
> +
> +static int mov_text_t3xg(AVCodecContext *avctx, MovTextContext *m)

I'm pretty sure it's "tx3g"

> +{
> +char *t3xg_ptr = avctx->extradata;
> +int i, tracksize;
> +
> +tracksize = 38; /* Size till ftab_entries */

I'd say box size. It's not technically a track.

And make the 38 a constant.

> +if (avctx->extradata_size < tracksize)
> +return -1;
> +
> +m->ftab_entries = 0;
> +// Display Flags
> +t3xg_ptr += 4;
> +// Alignment
> +t3xg_ptr += 2;
> +// Background Color
> +t3xg_ptr += 4;
> +// BoxRecord
> +t3xg_ptr += 8;
> +// StyleRecord
> +t3xg_ptr += 12;
> +// FontRecord
> +// FontRecord Size
> +t3xg_ptr += 4;
> +// ftab
> +t3xg_ptr += 4;
> +
> +tracksize += 2;
> +if (avctx->extradata_size < tracksize)
> +return -1;

Why not just initialize tracksize to 40? The extra += 2 isn't optional.

> +
> +m->ftab_entries = AV_RB16(t3xg_ptr);
> +t3xg_ptr += 2;
> +
> +for (i = 0; i < m->ftab_entries; i++) {
> +
> +tracksize += 3;
> +if (avctx->extradata_size < tracksize) {
> +m->ftab_entries = 0;
> +return -1;
> +}

You need to clean up any ftab entries that have already been processed.

> +m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
> +if (!m->ftab_temp) {
> +mov_text_cleanup_ftab(m);
> +return AVERROR(ENOMEM);
> +}
> +m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
> +t3xg_ptr += 2;
> +m->ftab_temp->font_name_length = *t3xg_ptr++;
> +
> +tracksize = tracksize + m->ftab_temp->font_name_length;
> +if ((avctx->extradata_size < tracksize) ||
> (m->ftab_temp->font_name_length > 20)) {
> +m->ftab_entries = 0;
> +return -1;
> +}
> +memcpy(m->ftab_temp->font, t3xg_ptr,
> m->ftab_temp->font_name_length);
> +av_dynarray_add(&m->ftab, &m->count_f, m->ftab_temp);
> +if (!m->ftab) {
> +mov_text_cleanup_ftab(m);
> +return AVERROR(ENOMEM);
> +}

I didn't think about this before, but there's no need to store the font
name and length in your FontRecord in this way. Just store it as a
normal null terminated string. Then you don't need the size and do can
do normal string manipulation on it later (like using av_bprintf with
'%s').

> +t3xg_ptr = t3xg_ptr + 3 + m->ftab[i]->font_name_length;
> +}
> +return 0;
> +}
> +
>  static int decode_hlit(const uint8_t *tsmb, MovTextContext *m,
> AVPacket *avpkt) {
>  m->box_flags |= HLIT_BOX;
> @@ -118,7 +201,7 @@ static int decode_styl(const uint8_t *tsmb,
> MovTextContext *m, AVPacket *avpkt) tsmb += 2;
>  m->s_temp->style_end = AV_RB16(tsmb);
>  tsmb += 2;
> -// fontID = AV_RB16(tsmb);
> +m->s_temp->style_fontID = AV_RB16(tsmb);
>  tsmb += 2;
>  m->s_temp->style_flag = AV_RB8(tsmb);
>  tsmb++;
> @@ -147,6 +230,7 @@ static int text_to_ass(AVBPrint *buf, const char
> *text, const char *text_end, MovTextContext *m)
>  {
>  int i = 0;
> +int j = 0;
>  int text_pos = 0;
>  while (text < text_end) {
>  if (m->box_flags & STYL_BOX) {
> @@ -164,6 +248,14 @@ static int text_to_ass(AVBPrint *buf, const char
> *text, const char *text_end, if (m->s[i]->

Re: [FFmpeg-devel] [PATCH] checkasm: Remove unnecessary include

2015-08-05 Thread Carl Eugen Hoyos
Henrik Gramner  gramner.com> writes:

> -#if ARCH_X86
> -#include "libavutil/x86/cpu.h"
> -#endif

Please just push such changes, no need to send a patch...

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread wm4
On Tue,  4 Aug 2015 22:09:57 -0700
Sasi Inguva  wrote:

> Compute individual stream durations in matroska muxer.
> Write them as string tags in the same format as mkvmerge tool does.
> 
> Signed-off-by: Sasi Inguva 
> ---

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2

2015-08-05 Thread Michael Niedermayer
On Tue, Aug 04, 2015 at 08:05:17PM +0800, 周晓勇 wrote:
> From 71478e642fac00b12b313723ee83acdfef732fd1 Mon Sep 17 00:00:00 2001
> From: ZhouXiaoyong 
> Date: Tue, 4 Aug 2015 16:28:02 +0800
> Subject: [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2
> 
> 
> Signed-off-by: ZhouXiaoyong 
> ---
>  libavcodec/mips/h264pred_init_mips.c |   1 -
>  libavcodec/mips/h264pred_mips.h  |   7 +-
>  libavcodec/mips/h264pred_mmi.c   | 459 
> +--
>  3 files changed, 226 insertions(+), 241 deletions(-)

applied

thanks

[...]
-- 
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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2

2015-08-05 Thread Ronald S. Bultje
Hi,

On Tue, Aug 4, 2015 at 8:05 AM, 周晓勇  wrote:

> From 71478e642fac00b12b313723ee83acdfef732fd1 Mon Sep 17 00:00:00 2001
> From: ZhouXiaoyong 
> Date: Tue, 4 Aug 2015 16:28:02 +0800
> Subject: [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2
>
>
> Signed-off-by: ZhouXiaoyong 
> ---
>  libavcodec/mips/h264pred_init_mips.c |   1 -
>  libavcodec/mips/h264pred_mips.h  |   7 +-
>  libavcodec/mips/h264pred_mmi.c   | 459
> +--
>  3 files changed, 226 insertions(+), 241 deletions(-)

 [..]

> void ff_pred16x16_vertical_8_mmi(uint8_t *src, ptrdiff_t stride)
>  {
>  __asm__ volatile (
> -"dsubu $2, %0, %1   \r\n"
> -"daddu $3, %0, $0   \r\n"
> -"ldl $4, 7($2)  \r\n"
> -"ldr $4, 0($2)  \r\n"
> -"ldl $5, 15($2) \r\n"
> -"ldr $5, 8($2)  \r\n"
> -"dli $6, 0x10   \r\n"
> +"dli $8, 16 \r\n"
> +"gsldlc1 $f2, 7(%[srcA])\r\n"
> +"gsldrc1 $f2, 0(%[srcA])\r\n"
> +"gsldlc1 $f4, 15(%[srcA])   \r\n"
> +"gsldrc1 $f4, 8(%[srcA])\r\n"
>  "1: \r\n"
> -"sdl $4, 7($3)  \r\n"
> -"sdr $4, 0($3)  \r\n"
> -"sdl $5, 15($3) \r\n"
> -"sdr $5, 8($3)  \r\n"
> -"daddu $3, %1   \r\n"
> -"daddiu $6, -1  \r\n"
> -"bnez $6, 1b\r\n"
> -::"r"(src),"r"(stride)
> -: "$2","$3","$4","$5","$6","memory"
> +"gssdlc1 $f2, 7(%[src]) \r\n"
> +"gssdrc1 $f2, 0(%[src]) \r\n"
> +"gssdlc1 $f4, 15(%[src])\r\n"
> +"gssdrc1 $f4, 8(%[src]) \r\n"
> +"daddu %[src], %[src], %[stride]\r\n"
> +"daddi $8, $8, -1   \r\n"
> +"bnez $8, 1b\r\n"
> +: [src]"+&r"(src)
> +: [stride]"r"(stride),[srcA]"r"(src-stride)
> +: "$8","$f2","$f4"
>  );
>  }


So... I'm confused. You're replacing one type of optimizations with
another. What happened? Was the old optimization bad? Was it for an old cpu
type and is yours for a newer one? Something else?

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Support alac extradata in wave atom v2

2015-08-05 Thread Carl Eugen Hoyos
On Wednesday 05 August 2015 02:39:38 pm Michael Niedermayer wrote:
> On Mon, Aug 03, 2015 at 11:16:12PM +0200, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch fixes ticket #4747 and should not introduce any
> > theoretical regressions.
> >
> > Please review, Carl Eugen
> >
> >  mov.c |   22 ++
> >  1 file changed, 22 insertions(+)
> > ffe1a030382f6bc11a5a58ab3cd5e89f8a354529  patchalacwave2.diff
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 154d2f8..f3cb71f 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -1435,6 +1435,28 @@ static int mov_read_wave(MOVContext *c,
> > AVIOContext *pb, MOVAtom atom) if (ret < 0)
> >  return ret;
> >  } else if (atom.size > 8) { /* to read frma, esds atoms */
> > +if (st->codec->codec_id == AV_CODEC_ID_ALAC && atom.size >= 24)
> > { +uint64_t buffer = avio_rb64(pb);
> > +atom.size -= 8;
> > +if (  (buffer & 0x) == MKBETAG('f','r','m','a')
> > +&& buffer >> 32 <= atom.size
> > +&& buffer >> 32 >= 8) {
> > +avio_skip(pb, (buffer >> 32) - 8);
> > +atom.size -= (buffer >> 32) - 8;
>
> skiping the frma atom instead of passing it to mov_read_default()
> (which might at some point in the future do somehing with it)
> does not feel completely ideal

New patch attached.

Thank you, Carl Eugen
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 154d2f8..157c5c1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1417,7 +1417,8 @@ static int mov_read_svq3(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
-int ret;
+int ret, seek_back = 0;
+int64_t position;
 
 if (c->fc->nb_streams < 1)
 return 0;
@@ -1435,8 +1436,26 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (ret < 0)
 return ret;
 } else if (atom.size > 8) { /* to read frma, esds atoms */
+if (   st->codec->codec_id == AV_CODEC_ID_ALAC
+&& atom.size >= 24
+&& !ffio_ensure_seekback(pb, atom.size)) {
+seek_back = 1;
+position = avio_tell(pb);
+}
 if ((ret = mov_read_default(c, pb, atom)) < 0)
 return ret;
+if (seek_back && !st->codec->extradata_size) {
+av_assert0(position == avio_seek(pb, position, SEEK_SET));
+#define ALAC_EXTRADATA_SIZE 36
+st->codec->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!st->codec->extradata)
+return AVERROR(ENOMEM);
+st->codec->extradata_size = ALAC_EXTRADATA_SIZE;
+AV_WB32(st->codec->extradata, ALAC_EXTRADATA_SIZE);
+AV_WB32(st->codec->extradata + 4, MKTAG('a','l','a','c'));
+avio_read(pb, st->codec->extradata + 12, 24);
+avio_skip(pb, atom.size - 24);
+}
 } else
 avio_skip(pb, atom.size);
 return 0;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/matroska: Write stream durations in metadata, in the format of mkvmerge.

2015-08-05 Thread Sasi Inguva
Thanks.

On Wed, Aug 5, 2015 at 1:37 PM, wm4  wrote:

> On Tue,  4 Aug 2015 22:09:57 -0700
> Sasi Inguva  wrote:
>
> > Compute individual stream durations in matroska muxer.
> > Write them as string tags in the same format as mkvmerge tool does.
> >
> > Signed-off-by: Sasi Inguva 
> > ---
>
> Pushed.
> ___
> 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] [libav-devel] [PATCH 0/20] removal of deprecated features

2015-08-05 Thread wm4
On Wed, 5 Aug 2015 21:31:38 +0200
Andreas Cadhalpun  wrote:

> On 04.08.2015 07:57, Reimar Döffinger wrote:
> > I do have on more proposal, but the problem is it needs someone to do the 
> > work.
> > For each removed feature, prepare documentation "a monkey could follow" on 
> > how
> > to replace it (you could call it a transition guide).
> > Even better, a script that automates it where reasonable.
> 
> I think this is a very good idea.
> 
> > In some cases it is just a matter of copy-pasting some existing wrapper 
> > code,
> > particularly if we remove that wrapper code it is useful if people still 
> > have
> > it available in the new release.
> > If it's just a few hours of someone's time who even doesn't need to 
> > understand
> > the code, I think we can very confidently say "not really our problem" if 
> > some
> > applications still use it.
> 
> Agreed.
> 
> > If we that way find out that there are non-trivial cases or cases where the 
> > code
> > gets a lot more complicated it might be a hint the new API is still crap 
> > and we
> > maybe should come up with something better first.
> 
> A more complete usage list for the deprecated APIs is:
> 
> FF_API_PIX_FMT: 71
> amide avbin avifile bino blender chromium-browser dff dolphin-emu dvbcut
> dvswitch ffdiaporama ffmpeg2theora ffmpegthumbnailer ffmpegthumbs ffms2
> fuse-emulator-utils gazebo gmerlin-avdecoder gmerlin-encoders gnash gpac
> gst-libav1.0 guvcview harvid hedgewars info-beamer jugglemaster karlyriceditor
> kino kodi lightspark lebiniou libam7xxx libavg libde265 libextractor
> libquicktime linphone lives lynkeos.app mlt mplayer mplayer2 mrpt opal
> opencv openmw openscenegraph ovito paraview performous pjproject qutecom
> rbdoom3bfg renpy shotdetect sflphone strigi survex transcode vcmi vlc vtk vtk6
> vxl wxsvg x264 xjadeo xpra yorick-av zoneminder
> 
> FF_API_AVFRAME_LAVC: 53
> alsa-plugins amarok aubio avbin blender chromaprint dff dolphin-emu dvbcut
> ffdiaporama ffmpegthumbnailer ffmpegthumbs fuse-emulator-utils gazebo
> gmerlin-avdecoder gmerlin-encoders goldendict gpac gst-libav1.0 hedgewars
> info-beamer jugglemaster kino libavg libextractor libquicktime lightspark
> linphone mplayer mplayer2 mrpt opal opencv openscenegraph ovito paraview
> performous pianopar qutecom renpy shotdetect spek squeezelite transcode
> vcmi vlc vtk vtk6 vxl xine-lib-1.2 xpra yorick-av zoneminder
> 
> FF_API_GET_BUFFER: 9
> avifile dvswitch gmerlin-avdecoder gst-libav1.0 libavg mplayer mplayer2 openmw
> openscenegraph
> 
> FF_API_AUDIOCONVERT: 7
> alsa-plugins cantata ffdiaporama moc mplayer2 mpv vlc
> 
> FF_API_SWS_CPU_CAPS: 6
> fuse-emulator-utils kodi mlt mplayer2 vlc zoneminder
> 
> FF_API_DEINTERLACE: 5
> blender dff ffmpegthumbnailer ffmpegthumbs vxl
> 
> FF_API_AVFRAME_LAVC(qscale): 3
> ffmpeg2theora kodi xine-lib-1.2
> 
> FF_API_CODEC_ID: 3
> chromium-browser dvswitch ffms2
> 
> FF_API_CONTEXT_SIZE: 3
> mplayer mplayer2 xine-lib-1.2
> 
> FF_API_REQUEST_CHANNELS: 3
> mplayer mplayer2 renpy
> 
> FF_API_AV_REVERSE: 2
> mplayer mplayer2
> 
> FF_API_AVCODEC_RESAMPLE: 2
> mlt mplayer
> 
> FF_API_DESTRUCT_PACKET: 2
> lives openmw
> 
> FF_API_AVFILTERBUFFER: 2
> ffdiaporama pianobar
> 
> FF_API_AVFILTERPAD_PUBLIC: 1
> mplayer
> 
> FF_API_VIMA_DECODER: 1
> mplayer

Well, you sure like to list a lot of projects. But what you don't say
is that many of these are either definitely dead (mplayer2 comes to
mind), or are ancient releases of software which fixed their API usage
later (like my own project, and probably most other reasonable active
projects).

Why do we have to suffer because Debian tries to compile ancient
releases against newer ffmpeg/libav releases? (How does that even make
sense?)

And then there's the category of projects that are "alive", but barely
care about anything unless being severely prodded. I'm not sure why we
should suffer forever just to accommodate these projects. They had more
than enough time.

I feel like I'm repeating myself and others, but I don't remember
whether you acknowledged these arguments.

> Better documentation would surely be helpful.

Many of these are non-trivial. Project authors either update their
code, or the project dies. It's simple. If you don't want this, keep an
old ffmpeg/libav package around for them. But you distro peoples want a
single libavcodec package, no matter how much this fucking tortures
everyone.

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


Re: [FFmpeg-devel] [PATCH] lavc: propagate hwaccel errors

2015-08-05 Thread Philip Langdale
On Wed,  5 Aug 2015 21:59:19 +0200
wm4  wrote:

> At least the new videotoolbox decoder does not actually set a frame if
> end_frame fails. This causes the API to return success and signals
> that a picture was decoded, even though AVFrame->data[0] is NULL.
> 
> Fix this by propagating end_frame errors.
> ---
> Now more correct.
> 
> Confirmed to fix a problem when videotoolbox refuses to decode
> something. Hevc and mpeg are untested.

Looks reasonable, though I see vc1dec has the same problem.

> ---
>  libavcodec/h264.c | 3 ++-
>  libavcodec/h264_picture.c | 3 ++-
>  libavcodec/h264_slice.c   | 8 ++--
>  libavcodec/hevc.c | 5 -
>  libavcodec/mpeg12dec.c| 9 +++--
>  5 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 8b575be..c4ab3fa 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -1844,7 +1844,8 @@ static int h264_decode_frame(AVCodecContext
> *avctx, void *data, if (avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)
>  decode_postinit(h, 1);
>  
> -ff_h264_field_end(h, &h->slice_ctx[0], 0);
> +if ((ret = ff_h264_field_end(h, &h->slice_ctx[0], 0)) < 0)
> +return ret;
>  
>  /* Wait for second field. */
>  *got_frame = 0;
> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
> index 81d90d7..04bbf02 100644
> --- a/libavcodec/h264_picture.c
> +++ b/libavcodec/h264_picture.c
> @@ -172,7 +172,8 @@ int ff_h264_field_end(H264Context *h,
> H264SliceContext *sl, int in_setup) }
>  
>  if (avctx->hwaccel) {
> -if (avctx->hwaccel->end_frame(avctx) < 0)
> +err = avctx->hwaccel->end_frame(avctx);
> +if (err < 0)
>  av_log(avctx, AV_LOG_ERROR,
> "hardware accelerator failed to decode
> picture\n"); }
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index b088392..48f501b 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1170,15 +1170,19 @@ int ff_h264_decode_slice_header(H264Context
> *h, H264SliceContext *sl) if (h->current_slice) {
>  av_assert0(!h->setup_finished);
>  if (h->cur_pic_ptr && FIELD_PICTURE(h) &&
> h->first_field) {
> -ff_h264_field_end(h, h->slice_ctx, 1);
> +ret = ff_h264_field_end(h, h->slice_ctx, 1);
>  h->current_slice = 0;
> +if (ret < 0)
> +return ret;
>  } else if (h->cur_pic_ptr && !FIELD_PICTURE(h)
> && !h->first_field && h->nal_unit_type  == NAL_IDR_SLICE) { av_log(h,
> AV_LOG_WARNING, "Broken frame packetizing\n");
> -ff_h264_field_end(h, h->slice_ctx, 1);
> +ret = ff_h264_field_end(h, h->slice_ctx, 1);
>  h->current_slice = 0;
>  ff_thread_report_progress(&h->cur_pic_ptr->tf,
> INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
> 1); h->cur_pic_ptr = NULL;
> +if (ret < 0)
> +return ret;
>  } else
>  return AVERROR_INVALIDDATA;
>  }
> diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> index 7f79189..d8da18d 100644
> --- a/libavcodec/hevc.c
> +++ b/libavcodec/hevc.c
> @@ -2896,9 +2896,12 @@ static int hevc_decode_frame(AVCodecContext
> *avctx, void *data, int *got_output, return ret;
>  
>  if (avctx->hwaccel) {
> -if (s->ref && avctx->hwaccel->end_frame(avctx) < 0)
> +if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {
>  av_log(avctx, AV_LOG_ERROR,
> "hardware accelerator failed to decode
> picture\n");
> +ff_hevc_unref_frame(s, s->ref, ~0);
> +return ret;
> +}
>  } else {
>  /* verify the SEI checksum */
>  if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded
> && diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 1250d53..453cd6a 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1723,9 +1723,11 @@ static int mpeg_field_start(MpegEncContext *s,
> const uint8_t *buf, int buf_size) 
>  if (s->avctx->hwaccel &&
>  (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
> -if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
> +if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
>  av_log(avctx, AV_LOG_ERROR,
> "hardware accelerator failed to decode first
> field\n");
> +return ret;
> +}
>  }
>  
>  for (i = 0; i < 4; i++) {
> @@ -2082,9 +2084,12 @@ static int slice_end(AVCodecContext *avctx,
> AVFrame *pict) return 0;
>  
>  if (s->avctx->hwaccel) {
> -if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
> +int ret = s->avctx->hwaccel->end_frame(s->avctx);
> +if (ret < 0) {
>  av_log(avctx, AV_LOG_ERROR,
> "hard

Re: [FFmpeg-devel] [libav-devel] [PATCH 0/20] removal of deprecated features

2015-08-05 Thread Michael Niedermayer
On Thu, Jul 30, 2015 at 05:05:12PM +0200, Andreas Cadhalpun wrote:
[...]

IMO {

trivial API, like identifers with different names or wrapers
that are identical except having 1 argument less.
That is API which does not require any testing to ensure its future
function and correctness, should be kept as long as they are needed
by a distribution.

non trivial API, which has a volunteer maintaining and testing it
and has one or more fate tests ensuring its fully functional and
correct could be similarly kept as long as that person is testing
and maintaining it

the rest should be removed once it has been deprecated for a
sufficient period of time.

Its a bit unprofessional to break/remove API every 1-2 years

}

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Add support for font names

2015-08-05 Thread Niklesh Lalwani
On Thu, Aug 6, 2015 at 2:02 AM, Philip Langdale  wrote:

> On Thu, 6 Aug 2015 00:12:07 +0530
> Niklesh Lalwani  wrote:
>
> > From 90f466bb6a5d3cd24d7ea4d9fd8a2915cc68cdb2 Mon Sep 17 00:00:00 2001
> > From: Niklesh 
> > Date: Thu, 6 Aug 2015 00:06:15 +0530
> > Subject: [PATCH] movtextdec.c: Add support for font names
> >
> > Signed-off-by: Niklesh 
> > ---
> >  libavcodec/movtextdec.c | 109
> > ++-- 1 file changed, 106
> > insertions(+), 3 deletions(-)
> >
> > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> > index 869358c..451056c 100644
> > --- a/libavcodec/movtextdec.c
> > +++ b/libavcodec/movtextdec.c
> > @@ -36,10 +36,17 @@
> >  #define HCLR_BOX   (1<<2)
> >
> >  typedef struct {
> > +uint16_t fontID;
> > +uint8_t font_name_length;
> > +uint8_t font[20];
> > +} FontRecord;
> > +
> > +typedef struct {
> >  uint16_t style_start;
> >  uint16_t style_end;
> >  uint8_t style_flag;
> >  uint8_t fontsize;
> > +uint16_t style_fontID;
> >  } StyleBox;
> >
> >  typedef struct {
> > @@ -56,11 +63,13 @@ typedef struct {
> >  StyleBox *s_temp;
> >  HighlightBox h;
> >  HilightcolorBox c;
> > +FontRecord **ftab;
> > +FontRecord *ftab_temp;
> >  uint8_t box_flags;
> > -uint16_t style_entries;
> > +uint16_t style_entries, ftab_entries;
> >  uint64_t tracksize;
> >  int size_var;
> > -int count_s;
> > +int count_s, count_f;
> >  } MovTextContext;
> >
> >  typedef struct {
> > @@ -80,6 +89,80 @@ static void mov_text_cleanup(MovTextContext *m)
> >  }
> >  }
> >
> > +static void mov_text_cleanup_ftab(MovTextContext *m)
> > +{
> > +int i;
> > +for(i = 0; i < m->count_f; i++) {
> > +av_freep(&m->ftab[i]);
> > +}
> > +av_freep(&m->ftab);
> > +}
> > +
> > +static int mov_text_t3xg(AVCodecContext *avctx, MovTextContext *m)
>
> I'm pretty sure it's "tx3g"
>
> > +{
> > +char *t3xg_ptr = avctx->extradata;
> > +int i, tracksize;
> > +
> > +tracksize = 38; /* Size till ftab_entries */
>
> I'd say box size. It's not technically a track.
>
> And make the 38 a constant.
>
> > +if (avctx->extradata_size < tracksize)
> > +return -1;
> > +
> > +m->ftab_entries = 0;
> > +// Display Flags
> > +t3xg_ptr += 4;
> > +// Alignment
> > +t3xg_ptr += 2;
> > +// Background Color
> > +t3xg_ptr += 4;
> > +// BoxRecord
> > +t3xg_ptr += 8;
> > +// StyleRecord
> > +t3xg_ptr += 12;
> > +// FontRecord
> > +// FontRecord Size
> > +t3xg_ptr += 4;
> > +// ftab
> > +t3xg_ptr += 4;
> > +
> > +tracksize += 2;
> > +if (avctx->extradata_size < tracksize)
> > +return -1;
>
> Why not just initialize tracksize to 40? The extra += 2 isn't optional.
>
> > +
> > +m->ftab_entries = AV_RB16(t3xg_ptr);
> > +t3xg_ptr += 2;
> > +
> > +for (i = 0; i < m->ftab_entries; i++) {
> > +
> > +tracksize += 3;
> > +if (avctx->extradata_size < tracksize) {
> > +m->ftab_entries = 0;
> > +return -1;
> > +}
>
> You need to clean up any ftab entries that have already been processed.
>
> > +m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
> > +if (!m->ftab_temp) {
> > +mov_text_cleanup_ftab(m);
> > +return AVERROR(ENOMEM);
> > +}
> > +m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
> > +t3xg_ptr += 2;
> > +m->ftab_temp->font_name_length = *t3xg_ptr++;
> > +
> > +tracksize = tracksize + m->ftab_temp->font_name_length;
> > +if ((avctx->extradata_size < tracksize) ||
> > (m->ftab_temp->font_name_length > 20)) {
> > +m->ftab_entries = 0;
> > +return -1;
> > +}
> > +memcpy(m->ftab_temp->font, t3xg_ptr,
> > m->ftab_temp->font_name_length);
> > +av_dynarray_add(&m->ftab, &m->count_f, m->ftab_temp);
> > +if (!m->ftab) {
> > +mov_text_cleanup_ftab(m);
> > +return AVERROR(ENOMEM);
> > +}
>
> I didn't think about this before, but there's no need to store the font
> name and length in your FontRecord in this way. Just store it as a
> normal null terminated string. Then you don't need the size and do can
> do normal string manipulation on it later (like using av_bprintf with
> '%s').
>

Yes, I can do that and add a null character at the end after memcopy, but I
thought I'll define the structs as close as possible to the Records defined
in 3GPP spec.
Also, I think I should not limit the length to 20. Ideally, it is a uint8_t
value. In that case, I'll need to malloc the size of font length.

Rest all updated.

Thanks,
Niklesh


> > +t3xg_ptr = t3xg_ptr + 3 + m->ftab[i]->font_name_length;
> > +}
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2

2015-08-05 Thread 周晓勇
this is just another implement using C1 float registers, and the patch make 
functions more readable.
i think using C1 registers may reduce the load of general registers.
gsldlc1 and gsldrc1 are similar to ldl and ldr only different with which 
register to use.


在2015-08-06 05:29:58,周晓勇写道:
> Hi,
> 
> On Tue, Aug 4, 2015 at 8:05 AM, 周晓勇  wrote:
> 
> > From 71478e642fac00b12b313723ee83acdfef732fd1 Mon Sep 17 00:00:00 2001
> > From: ZhouXiaoyong 
> > Date: Tue, 4 Aug 2015 16:28:02 +0800
> > Subject: [PATCH 1/2] avcodec: loongson optimized h264pred with mmi v2
> >
> >
> > Signed-off-by: ZhouXiaoyong 
> > ---
> >  libavcodec/mips/h264pred_init_mips.c |   1 -
> >  libavcodec/mips/h264pred_mips.h  |   7 +-
> >  libavcodec/mips/h264pred_mmi.c   | 459
> > +--
> >  3 files changed, 226 insertions(+), 241 deletions(-)
> 
>  [..]
> 
> > void ff_pred16x16_vertical_8_mmi(uint8_t *src, ptrdiff_t stride)
> >  {
> >  __asm__ volatile (
> > -"dsubu $2, %0, %1   \r\n"
> > -"daddu $3, %0, $0   \r\n"
> > -"ldl $4, 7($2)  \r\n"
> > -"ldr $4, 0($2)  \r\n"
> > -"ldl $5, 15($2) \r\n"
> > -"ldr $5, 8($2)  \r\n"
> > -"dli $6, 0x10   \r\n"
> > +"dli $8, 16 \r\n"
> > +"gsldlc1 $f2, 7(%[srcA])\r\n"
> > +"gsldrc1 $f2, 0(%[srcA])\r\n"
> > +"gsldlc1 $f4, 15(%[srcA])   \r\n"
> > +"gsldrc1 $f4, 8(%[srcA])\r\n"
> >  "1: \r\n"
> > -"sdl $4, 7($3)  \r\n"
> > -"sdr $4, 0($3)  \r\n"
> > -"sdl $5, 15($3) \r\n"
> > -"sdr $5, 8($3)  \r\n"
> > -"daddu $3, %1   \r\n"
> > -"daddiu $6, -1  \r\n"
> > -"bnez $6, 1b\r\n"
> > -::"r"(src),"r"(stride)
> > -: "$2","$3","$4","$5","$6","memory"
> > +"gssdlc1 $f2, 7(%[src]) \r\n"
> > +"gssdrc1 $f2, 0(%[src]) \r\n"
> > +"gssdlc1 $f4, 15(%[src])\r\n"
> > +"gssdrc1 $f4, 8(%[src]) \r\n"
> > +"daddu %[src], %[src], %[stride]\r\n"
> > +"daddi $8, $8, -1   \r\n"
> > +"bnez $8, 1b\r\n"
> > +: [src]"+&r"(src)
> > +: [stride]"r"(stride),[srcA]"r"(src-stride)
> > +: "$8","$f2","$f4"
> >  );
> >  }
> 
> 
> So... I'm confused. You're replacing one type of optimizations with
> another. What happened? Was the old optimization bad? Was it for an old cpu
> type and is yours for a newer one? Something else?
> 
> Ronald
> ___
> 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] movtextdec.c: Add support for font names

2015-08-05 Thread Philip Langdale
On Thu, 6 Aug 2015 07:13:07 +0530
Niklesh Lalwani  wrote:

> On Thu, Aug 6, 2015 at 2:02 AM, Philip Langdale 
> wrote:
> 
> > On Thu, 6 Aug 2015 00:12:07 +0530
> > Niklesh Lalwani  wrote:
> >
> > > From 90f466bb6a5d3cd24d7ea4d9fd8a2915cc68cdb2 Mon Sep 17 00:00:00
> > > 2001 From: Niklesh 
> > > Date: Thu, 6 Aug 2015 00:06:15 +0530
> > > Subject: [PATCH] movtextdec.c: Add support for font names
> > >
> > > Signed-off-by: Niklesh 
> > > ---
> > >  libavcodec/movtextdec.c | 109
> > > ++-- 1 file changed,
> > > 106 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> > > index 869358c..451056c 100644
> > > --- a/libavcodec/movtextdec.c
> > > +++ b/libavcodec/movtextdec.c
> > > @@ -36,10 +36,17 @@
> > >  #define HCLR_BOX   (1<<2)
> > >
> > >  typedef struct {
> > > +uint16_t fontID;
> > > +uint8_t font_name_length;
> > > +uint8_t font[20];
> > > +} FontRecord;
> > > +
> > > +typedef struct {
> > >  uint16_t style_start;
> > >  uint16_t style_end;
> > >  uint8_t style_flag;
> > >  uint8_t fontsize;
> > > +uint16_t style_fontID;
> > >  } StyleBox;
> > >
> > >  typedef struct {
> > > @@ -56,11 +63,13 @@ typedef struct {
> > >  StyleBox *s_temp;
> > >  HighlightBox h;
> > >  HilightcolorBox c;
> > > +FontRecord **ftab;
> > > +FontRecord *ftab_temp;
> > >  uint8_t box_flags;
> > > -uint16_t style_entries;
> > > +uint16_t style_entries, ftab_entries;
> > >  uint64_t tracksize;
> > >  int size_var;
> > > -int count_s;
> > > +int count_s, count_f;
> > >  } MovTextContext;
> > >
> > >  typedef struct {
> > > @@ -80,6 +89,80 @@ static void mov_text_cleanup(MovTextContext *m)
> > >  }
> > >  }
> > >
> > > +static void mov_text_cleanup_ftab(MovTextContext *m)
> > > +{
> > > +int i;
> > > +for(i = 0; i < m->count_f; i++) {
> > > +av_freep(&m->ftab[i]);
> > > +}
> > > +av_freep(&m->ftab);
> > > +}
> > > +
> > > +static int mov_text_t3xg(AVCodecContext *avctx, MovTextContext
> > > *m)
> >
> > I'm pretty sure it's "tx3g"
> >
> > > +{
> > > +char *t3xg_ptr = avctx->extradata;
> > > +int i, tracksize;
> > > +
> > > +tracksize = 38; /* Size till ftab_entries */
> >
> > I'd say box size. It's not technically a track.
> >
> > And make the 38 a constant.
> >
> > > +if (avctx->extradata_size < tracksize)
> > > +return -1;
> > > +
> > > +m->ftab_entries = 0;
> > > +// Display Flags
> > > +t3xg_ptr += 4;
> > > +// Alignment
> > > +t3xg_ptr += 2;
> > > +// Background Color
> > > +t3xg_ptr += 4;
> > > +// BoxRecord
> > > +t3xg_ptr += 8;
> > > +// StyleRecord
> > > +t3xg_ptr += 12;
> > > +// FontRecord
> > > +// FontRecord Size
> > > +t3xg_ptr += 4;
> > > +// ftab
> > > +t3xg_ptr += 4;
> > > +
> > > +tracksize += 2;
> > > +if (avctx->extradata_size < tracksize)
> > > +return -1;
> >
> > Why not just initialize tracksize to 40? The extra += 2 isn't
> > optional.
> >
> > > +
> > > +m->ftab_entries = AV_RB16(t3xg_ptr);
> > > +t3xg_ptr += 2;
> > > +
> > > +for (i = 0; i < m->ftab_entries; i++) {
> > > +
> > > +tracksize += 3;
> > > +if (avctx->extradata_size < tracksize) {
> > > +m->ftab_entries = 0;
> > > +return -1;
> > > +}
> >
> > You need to clean up any ftab entries that have already been
> > processed.
> >
> > > +m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
> > > +if (!m->ftab_temp) {
> > > +mov_text_cleanup_ftab(m);
> > > +return AVERROR(ENOMEM);
> > > +}
> > > +m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
> > > +t3xg_ptr += 2;
> > > +m->ftab_temp->font_name_length = *t3xg_ptr++;
> > > +
> > > +tracksize = tracksize + m->ftab_temp->font_name_length;
> > > +if ((avctx->extradata_size < tracksize) ||
> > > (m->ftab_temp->font_name_length > 20)) {
> > > +m->ftab_entries = 0;
> > > +return -1;
> > > +}
> > > +memcpy(m->ftab_temp->font, t3xg_ptr,
> > > m->ftab_temp->font_name_length);
> > > +av_dynarray_add(&m->ftab, &m->count_f, m->ftab_temp);
> > > +if (!m->ftab) {
> > > +mov_text_cleanup_ftab(m);
> > > +return AVERROR(ENOMEM);
> > > +}
> >
> > I didn't think about this before, but there's no need to store the
> > font name and length in your FontRecord in this way. Just store it
> > as a normal null terminated string. Then you don't need the size
> > and do can do normal string manipulation on it later (like using
> > av_bprintf with '%s').
> >
> 
> Yes, I can do that and add a null character at the end after memcopy,
> but I thought I'll define the structs as close as possible to the
> Records defined in 3GPP spec.
> Also, I think I should not limit the length to 20. Ideally, it is a
> uint8_t value

[FFmpeg-devel] Questions about ffmpeg h264_qsv

2015-08-05 Thread Ron
Hi,
 I have some questions about ffmpeg h264_qsv with Intel media sdk.
  
 1. The command 'ffmpeg -i in.mp4 -an -c:v h264_qsv out.mp4' to encode 
sucessful, how can I make the qsv decoder work?
   I disabled h264 decoder in 'libavcodec/allcodecs.c' to make  h264_qsv 
decoder work, error messages as follow:
 'ffmpeg -i in.mp4 -an -c:v h264_qsv out.mp4' ,(h264 parser error !!!)
  libavcodec 56. 49.101 / 56. 49.101
 libavformat56. 40.101 / 56. 40.101
 libavdevice56.  4.100 / 56.  4.100
 libavfilter 5. 25.100 /  5. 25.100
 libswscale  3.  1.101 /  3.  1.101
 libswresample   1.  2.101 /  1.  2.101
 libpostproc53.  3.100 / 53.  3.100
[NULL @ 0x3413760] AVC: nal size 268435457
[NULL @ 0x3413760] missing picture in access unit with size 66365
[h264_qsv @ 0x3412540] Only 8-bit YUV420 streams are supported.
[NULL @ 0x3413760] AVC: nal size 268435457
[NULL @ 0x3413760] missing picture in access unit with size 66365
[h264_qsv @ 0x3412540] Only 8-bit YUV420 streams are supported.
[NULL @ 0x3413760] AVC: nal size 268435457
[NULL @ 0x3413760] missing picture in access unit with size 66365
[h264_qsv @ 0x3412540] Only 8-bit YUV420 streams are supported.
[NULL @ 0x3413760] AVC: nal size 268435457
[NULL @ 0x3413760] missing picture in access unit with size 66365
[h264_qsv @ 0x3412540] Only 8-bit YUV420 streams are supported.
[NULL @ 0x3413760] AVC: nal size 268435457
 
'ffmpeg -i in.264 -c:v h264_qsv out.mp4' ,  qsv decoder work sucessful but 
missing header!!!
 
[h264_qsv @ 0x3678a30] Packet header is not contained in global 
extradata, corrupted stream or invalid MP4/AVCC bitstream
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
 Last message repeated 8 times
[h264_qsv @ 0x3678a30] Packet header is not contained in global 
extradata, corrupted stream or invalid MP4/AVCC bitstream
Last message repeated 4 times
[h264_qsv @ 0x3678a30] Packet header is not contained in global 
extradata, corrupted stream or invalid MP4/AVCC bitstream
Last message repeated 5 times
 
2.  libavcodec/qsvenc.c, function:init_video_param, line 124, 
 
'q->param.mfx.MaxKbps  = avctx->bit_rate / 1000;'  why not 
'q->param.mfx.MaxKbps  = avctx->rc_max_rate / 1000;'
 3. Many hwacc registed in the source  file 'libavcodec/allcodecs.c', How to 
use it? Try 'ffmpeg -hwacc h264_qsv ' failed.
  
  
 Thanks!!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Add support for font names

2015-08-05 Thread Niklesh Lalwani
Changes incorporated.
Updated patch attached.

Thanks,
Niklesh

On Thu, Aug 6, 2015 at 7:51 AM, Philip Langdale  wrote:

> On Thu, 6 Aug 2015 07:13:07 +0530
> Niklesh Lalwani  wrote:
>
> > On Thu, Aug 6, 2015 at 2:02 AM, Philip Langdale 
> > wrote:
> >
> > > On Thu, 6 Aug 2015 00:12:07 +0530
> > > Niklesh Lalwani  wrote:
> > >
> > > > From 90f466bb6a5d3cd24d7ea4d9fd8a2915cc68cdb2 Mon Sep 17 00:00:00
> > > > 2001 From: Niklesh 
> > > > Date: Thu, 6 Aug 2015 00:06:15 +0530
> > > > Subject: [PATCH] movtextdec.c: Add support for font names
> > > >
> > > > Signed-off-by: Niklesh 
> > > > ---
> > > >  libavcodec/movtextdec.c | 109
> > > > ++-- 1 file changed,
> > > > 106 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> > > > index 869358c..451056c 100644
> > > > --- a/libavcodec/movtextdec.c
> > > > +++ b/libavcodec/movtextdec.c
> > > > @@ -36,10 +36,17 @@
> > > >  #define HCLR_BOX   (1<<2)
> > > >
> > > >  typedef struct {
> > > > +uint16_t fontID;
> > > > +uint8_t font_name_length;
> > > > +uint8_t font[20];
> > > > +} FontRecord;
> > > > +
> > > > +typedef struct {
> > > >  uint16_t style_start;
> > > >  uint16_t style_end;
> > > >  uint8_t style_flag;
> > > >  uint8_t fontsize;
> > > > +uint16_t style_fontID;
> > > >  } StyleBox;
> > > >
> > > >  typedef struct {
> > > > @@ -56,11 +63,13 @@ typedef struct {
> > > >  StyleBox *s_temp;
> > > >  HighlightBox h;
> > > >  HilightcolorBox c;
> > > > +FontRecord **ftab;
> > > > +FontRecord *ftab_temp;
> > > >  uint8_t box_flags;
> > > > -uint16_t style_entries;
> > > > +uint16_t style_entries, ftab_entries;
> > > >  uint64_t tracksize;
> > > >  int size_var;
> > > > -int count_s;
> > > > +int count_s, count_f;
> > > >  } MovTextContext;
> > > >
> > > >  typedef struct {
> > > > @@ -80,6 +89,80 @@ static void mov_text_cleanup(MovTextContext *m)
> > > >  }
> > > >  }
> > > >
> > > > +static void mov_text_cleanup_ftab(MovTextContext *m)
> > > > +{
> > > > +int i;
> > > > +for(i = 0; i < m->count_f; i++) {
> > > > +av_freep(&m->ftab[i]);
> > > > +}
> > > > +av_freep(&m->ftab);
> > > > +}
> > > > +
> > > > +static int mov_text_t3xg(AVCodecContext *avctx, MovTextContext
> > > > *m)
> > >
> > > I'm pretty sure it's "tx3g"
> > >
> > > > +{
> > > > +char *t3xg_ptr = avctx->extradata;
> > > > +int i, tracksize;
> > > > +
> > > > +tracksize = 38; /* Size till ftab_entries */
> > >
> > > I'd say box size. It's not technically a track.
> > >
> > > And make the 38 a constant.
> > >
> > > > +if (avctx->extradata_size < tracksize)
> > > > +return -1;
> > > > +
> > > > +m->ftab_entries = 0;
> > > > +// Display Flags
> > > > +t3xg_ptr += 4;
> > > > +// Alignment
> > > > +t3xg_ptr += 2;
> > > > +// Background Color
> > > > +t3xg_ptr += 4;
> > > > +// BoxRecord
> > > > +t3xg_ptr += 8;
> > > > +// StyleRecord
> > > > +t3xg_ptr += 12;
> > > > +// FontRecord
> > > > +// FontRecord Size
> > > > +t3xg_ptr += 4;
> > > > +// ftab
> > > > +t3xg_ptr += 4;
> > > > +
> > > > +tracksize += 2;
> > > > +if (avctx->extradata_size < tracksize)
> > > > +return -1;
> > >
> > > Why not just initialize tracksize to 40? The extra += 2 isn't
> > > optional.
> > >
> > > > +
> > > > +m->ftab_entries = AV_RB16(t3xg_ptr);
> > > > +t3xg_ptr += 2;
> > > > +
> > > > +for (i = 0; i < m->ftab_entries; i++) {
> > > > +
> > > > +tracksize += 3;
> > > > +if (avctx->extradata_size < tracksize) {
> > > > +m->ftab_entries = 0;
> > > > +return -1;
> > > > +}
> > >
> > > You need to clean up any ftab entries that have already been
> > > processed.
> > >
> > > > +m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
> > > > +if (!m->ftab_temp) {
> > > > +mov_text_cleanup_ftab(m);
> > > > +return AVERROR(ENOMEM);
> > > > +}
> > > > +m->ftab_temp->fontID = AV_RB16(t3xg_ptr);
> > > > +t3xg_ptr += 2;
> > > > +m->ftab_temp->font_name_length = *t3xg_ptr++;
> > > > +
> > > > +tracksize = tracksize + m->ftab_temp->font_name_length;
> > > > +if ((avctx->extradata_size < tracksize) ||
> > > > (m->ftab_temp->font_name_length > 20)) {
> > > > +m->ftab_entries = 0;
> > > > +return -1;
> > > > +}
> > > > +memcpy(m->ftab_temp->font, t3xg_ptr,
> > > > m->ftab_temp->font_name_length);
> > > > +av_dynarray_add(&m->ftab, &m->count_f, m->ftab_temp);
> > > > +if (!m->ftab) {
> > > > +mov_text_cleanup_ftab(m);
> > > > +return AVERROR(ENOMEM);
> > > > +}
> > >
> > > I didn't think about this before, but there's no need to store the
> > > font name and length in your FontRecord in this way. Just store it
> >