Re: [libav-devel] [PATCH] {v,a}f_showinfo: print frame side data

2014-03-23 Thread Luca Barbato
On 24/03/14 06:03, Anton Khirnov wrote:
> ---
> Switched replaygain printing to the new API with the struct instead of binary 
> data
> ---

Looks ok.

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


Re: [libav-devel] [PATCH 07/10] lavu: add a pixel format for new VDA hwaccel

2014-03-23 Thread Luca Barbato
On 24/03/14 03:20, Vittorio Giovara wrote:
> On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
>> From: Anton Khirnov 
>>
>> The current hwaccel is broken and cannot be fixed in a compatible
>> way. It will be deprecated and replaced with a new one.
>> ---
>>  doc/APIchanges  | 3 +++
>>  libavutil/pixdesc.c | 4 
>>  libavutil/pixfmt.h  | 1 +
>>  libavutil/version.h | 2 +-
>>  4 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 38d18bc..6d030a7 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -13,6 +13,9 @@ libavutil: 2013-12-xx
>>
>>  API changes, most recent first:
>>
>> +2014-xx-xx - xxx - lavu 53.7.0 - pixfmt.h
>> +  Add AV_PIX_FMT_VDA for new-style VDA acceleration.
>> +
>>  2014-xx-xx - xxx - lavu 53.06.0 - pixfmt.h
>>Add RGBA64 pixel format and variants.
>>
>> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
>> index d0e6919..14dc9f5 100644
>> --- a/libavutil/pixdesc.c
>> +++ b/libavutil/pixdesc.c
>> @@ -1483,6 +1483,10 @@ const AVPixFmtDescriptor 
>> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>>  },
>>  .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
>>  },
>> +[AV_PIX_FMT_VDA] = {
>> +.name = "vda",
>> +.flags = AV_PIX_FMT_FLAG_HWACCEL,
>> +},
>>  };
> 
> no .log2_chroma_w/h?
> 

Monsieur de Lapalice states:
"Opaque pixel formats are opaque"

I'll add a note about it in the wiki soon.

lu

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


[libav-devel] [PATCH] {v,a}f_showinfo: print frame side data

2014-03-23 Thread Anton Khirnov
---
Switched replaygain printing to the new API with the struct instead of binary 
data
---
 libavfilter/af_ashowinfo.c |  110 
 libavfilter/vf_showinfo.c  |   55 ++
 2 files changed, 165 insertions(+)

diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index 99d9dde..e9649d9 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -30,7 +30,10 @@
 #include "libavutil/attributes.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
+#include "libavutil/downmix_info.h"
+#include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
+#include "libavutil/replaygain.h"
 #include "libavutil/samplefmt.h"
 
 #include "audio.h"
@@ -66,6 +69,99 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&s->plane_checksums);
 }
 
+static void dump_matrixenc(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+enum AVMatrixEncoding enc;
+
+av_log(ctx, AV_LOG_INFO, "matrix encoding: ");
+
+if (sd->size < sizeof(enum AVMatrixEncoding)) {
+av_log(ctx, AV_LOG_INFO, "invalid data");
+return;
+}
+
+enc = *(enum AVMatrixEncoding *)sd->data;
+switch (enc) {
+case AV_MATRIX_ENCODING_NONE:   av_log(ctx, AV_LOG_INFO, "none");  
  break;
+case AV_MATRIX_ENCODING_DOLBY:  av_log(ctx, AV_LOG_INFO, "Dolby"); 
  break;
+case AV_MATRIX_ENCODING_DPLII:  av_log(ctx, AV_LOG_INFO, "Dolby 
Pro Logic II");  break;
+case AV_MATRIX_ENCODING_DPLIIX: av_log(ctx, AV_LOG_INFO, "Dolby 
Pro Logic IIx"); break;
+case AV_MATRIX_ENCODING_DPLIIZ: av_log(ctx, AV_LOG_INFO, "Dolby 
Pro Logic IIz"); break;
+case AV_MATRIX_ENCODING_DOLBYEX:av_log(ctx, AV_LOG_INFO, "Dolby 
EX");break;
+case AV_MATRIX_ENCODING_DOLBYHEADPHONE: av_log(ctx, AV_LOG_INFO, "Dolby 
Headphone"); break;
+default:av_log(ctx, AV_LOG_WARNING, 
"unknown");  break;
+}
+}
+
+static void dump_downmix(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+AVDownmixInfo *di;
+
+av_log(ctx, AV_LOG_INFO, "downmix: ");
+if (sd->size < sizeof(*di)) {
+av_log(ctx, AV_LOG_INFO, "invalid data");
+return;
+}
+
+di = (AVDownmixInfo *)sd->data;
+
+av_log(ctx, AV_LOG_INFO, "preferred downmix type - ");
+switch (di->preferred_downmix_type) {
+case AV_DOWNMIX_TYPE_LORO:av_log(ctx, AV_LOG_INFO, "Lo/Ro");   
   break;
+case AV_DOWNMIX_TYPE_LTRT:av_log(ctx, AV_LOG_INFO, "Lt/Rt");   
   break;
+case AV_DOWNMIX_TYPE_DPLII:   av_log(ctx, AV_LOG_INFO, "Dolby Pro Logic 
II"); break;
+default:  av_log(ctx, AV_LOG_WARNING, "unknown");  
   break;
+}
+
+av_log(ctx, AV_LOG_INFO, " Mix levels: center %f (%f ltrt) - "
+   "surround %f (%f ltrt) - lfe %f",
+   di->center_mix_level, di->center_mix_level_ltrt,
+   di->surround_mix_level, di->surround_mix_level_ltrt,
+   di->lfe_mix_level);
+}
+
+static void print_gain(AVFilterContext *ctx, const char *str, int32_t gain)
+{
+av_log(ctx, AV_LOG_INFO, "%s - ", str);
+if (gain == INT32_MIN)
+av_log(ctx, AV_LOG_INFO, "unknown");
+else
+av_log(ctx, AV_LOG_INFO, "%f", gain / 10.0f);
+av_log(ctx, AV_LOG_INFO, ", ");
+}
+
+static void print_peak(AVFilterContext *ctx, const char *str, uint32_t peak)
+{
+av_log(ctx, AV_LOG_INFO, "%s - ", str);
+if (!peak)
+av_log(ctx, AV_LOG_INFO, "unknown");
+else
+av_log(ctx, AV_LOG_INFO, "%f", (float)peak / UINT32_MAX);
+av_log(ctx, AV_LOG_INFO, ", ");
+}
+
+static void dump_replaygain(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+AVReplayGain *rg;
+
+av_log(ctx, AV_LOG_INFO, "replaygain: ");
+if (sd->size < sizeof(*rg)) {
+av_log(ctx, AV_LOG_INFO, "invalid data");
+return;
+}
+rg = (AVReplayGain*)sd->data;
+
+print_gain(ctx, "track gain", rg->track_gain);
+print_peak(ctx, "track peak", rg->track_peak);
+print_gain(ctx, "album gain", rg->album_gain);
+print_peak(ctx, "album peak", rg->album_peak);
+}
+
+static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", 
sd->type, sd->size);
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -104,6 +200,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 av_log(ctx, AV_LOG_INFO, "%08"PRIX32" ", s->plane_checksums[i]);
 av_log(ctx, AV_LOG_INFO, "]\n");
 
+for (i = 0; i < buf->nb_side_data; i++) {
+AVFrameSideData *sd = buf->side_data[i];
+
+av_log(ctx, AV_LOG_INFO, "  side data - ");
+switch (sd->type) {
+case AV_FRAME_DATA_MATRIXENCODING: dump_matrixenc (ctx, sd); break;
+case AV_FRAME_DATA_DOWNMIX_INFO:   dump_dow

Re: [libav-devel] [PATCH 06/10] lavc: add hwaccel private data and init/uninit callbacks

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> ---
>  libavcodec/avcodec.h  | 23 +++
>  libavcodec/internal.h |  5 +
>  libavcodec/utils.c| 34 ++
>  3 files changed, 58 insertions(+), 4 deletions(-)

I think there should be another minor bump here.

> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 264305d..a1d0ae5 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2945,6 +2945,29 @@ typedef struct AVHWAccel {
>   * AVCodecContext.release_buffer().
>   */
>  int frame_priv_data_size;
> +
> +/**
> + * Initialize the hwaccel private data.
> + *
> + * This will be called from ff_get_format(), after hwaccel and
> + * hwaccel_context are set and the hwaccel private data in 
> AVCodecInternal
> + * is allocated.
> + */
> +int (*init)(AVCodecContext *avctx);
> +
> +/**
> + * Uninitialize the hwaccel private data.
> + *
> + * This will be called from get_format() or avcodec_close(), after 
> hwaccel
> + * and hwaccel_context are already uninitialized.
> + */
> +int (*uninit)(AVCodecContext *avctx);
> +
> +/**
> + * Size of the private data to allocate in
> + * AVCodecInternal.hwaccel_priv_data.
> + */
> +int priv_data_size;
>  } AVHWAccel;
>
>  /**
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index 64765a2..17de2d5 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -95,6 +95,11 @@ typedef struct AVCodecInternal {
>   * packet into every function.
>   */
>  AVPacket *pkt;
> +
> +/**
> + * hwaccel-specific private data
> + */
> +void *hwaccel_priv_data;
>  } AVCodecInternal;
>
>  struct AVCodecDefault {
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e52d915..5ca7534 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -858,16 +858,37 @@ int ff_get_format(AVCodecContext *avctx, const enum 
> AVPixelFormat *fmt)
>  if (!desc)
>  return AV_PIX_FMT_NONE;
>
> +if (avctx->hwaccel && avctx->hwaccel->uninit)
> +avctx->hwaccel->uninit(avctx);
> +av_freep(&avctx->internal->hwaccel_priv_data);
> +avctx->hwaccel = NULL;
> +
>  if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
> -avctx->hwaccel = find_hwaccel(avctx->codec_id, ret);
> -if (!avctx->hwaccel) {
> +AVHWAccel *hwaccel;
> +int err;
> +
> +hwaccel = find_hwaccel(avctx->codec_id, ret);
> +if (!hwaccel) {
>  av_log(avctx, AV_LOG_ERROR,
> "Could not find an AVHWAccel for the pixel format: %s",
> desc->name);
>  return AV_PIX_FMT_NONE;
>  }
> -} else {
> -avctx->hwaccel = NULL;
> +
> +if (hwaccel->priv_data_size) {
> +avctx->internal->hwaccel_priv_data = 
> av_mallocz(hwaccel->priv_data_size);
> +if (!avctx->internal->hwaccel_priv_data)
> +return AV_PIX_FMT_NONE;
> +}
> +
> +if (hwaccel->init) {
> +err = hwaccel->init(avctx);
> +if (err < 0) {
> +av_freep(&avctx->internal->hwaccel_priv_data);
> +return AV_PIX_FMT_NONE;
> +}
> +}
> +avctx->hwaccel = hwaccel;
>  }
>
>  return ret;
> @@ -1653,6 +1674,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
>  for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++)
>  av_buffer_pool_uninit(&pool->pools[i]);
>  av_freep(&avctx->internal->pool);
> +
> +if (avctx->hwaccel && avctx->hwaccel->uninit)
> +avctx->hwaccel->uninit(avctx);
> +av_freep(&avctx->internal->hwaccel_priv_data);
> +
>  av_freep(&avctx->internal);
>  }
>

Looks ok, but I wouldn't mind a second opinion.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 01/10] lavc: add an internal wrapper around get_format()

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> It will be useful in the following commits.
> ---
>  libavcodec/8bps.c   |  2 +-
>  libavcodec/h263dec.c|  2 +-
>  libavcodec/h264_slice.c | 10 +-
>  libavcodec/internal.h   |  7 +++
>  libavcodec/mpeg12dec.c  |  4 ++--
>  libavcodec/utils.c  |  5 +
>  libavcodec/vc1dec.c |  2 +-
>  7 files changed, 22 insertions(+), 10 deletions(-)
>

OK I think.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 02/10] lavc: set AVCodecContext.hwaccel in ff_get_format()

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> This way each decoder does not have to do the same thing manually.
> ---
>  libavcodec/h263dec.c|  1 -
>  libavcodec/h264_slice.c |  2 --
>  libavcodec/internal.h   |  9 -
>  libavcodec/mpeg12dec.c  |  2 --
>  libavcodec/utils.c  | 48 +---
>  libavcodec/vc1dec.c |  1 -
>  6 files changed, 33 insertions(+), 30 deletions(-)
>
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 602dafa..ddc3b01 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -108,7 +108,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
>  return AVERROR(ENOSYS);
>  }
>  s->codec_id= avctx->codec->id;
> -avctx->hwaccel = ff_find_hwaccel(avctx);
>
>  /* for h263, we allocate the images after having read the header */
>  if (avctx->codec->id != AV_CODEC_ID_H263 &&
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index 683dead..d6a25c4 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1081,8 +1081,6 @@ static int h264_slice_header_init(H264Context *h, int 
> reinit)
>h->sps.num_units_in_tick, den, 1 << 30);
>  }
>
> -h->avctx->hwaccel = ff_find_hwaccel(h->avctx);
> -
>  if (reinit)
>  ff_h264_free_tables(h, 0);
>  h->first_field   = 0;
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index eb91b6a..64765a2 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -103,15 +103,6 @@ struct AVCodecDefault {
>  };
>
>  /**
> - * Return the hardware accelerated codec for codec codec_id and
> - * pixel format pix_fmt.
> - *
> - * @param avctx The codec context containing the codec_id and pixel format.
> - * @return the hardware accelerated codec, or NULL if none was found.
> - */
> -AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx);
> -
> -/**
>   * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
>   * If there is no such matching pair then size is returned.
>   */
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index b8e7d36..c3f06dc 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1295,7 +1295,6 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
>  } // MPEG-2
>
>  avctx->pix_fmt = mpeg_get_pixelformat(avctx);
> -avctx->hwaccel = ff_find_hwaccel(avctx);
>  // until then pix_fmt may be changed right after codec init
>  #if FF_API_XVMC
>  if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
> @@ -2126,7 +2125,6 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
>  s->low_delay= 1;
>
>  avctx->pix_fmt = mpeg_get_pixelformat(avctx);
> -avctx->hwaccel = ff_find_hwaccel(avctx);
>
>  #if FF_API_XVMC
>  if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) &&
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 2b3c00a..e52d915 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -836,9 +836,41 @@ enum AVPixelFormat avcodec_default_get_format(struct 
> AVCodecContext *s, const en
>  return fmt[0];
>  }
>
> +static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
> +   enum AVPixelFormat pix_fmt)
> +{
> +AVHWAccel *hwaccel = NULL;
> +
> +while ((hwaccel = av_hwaccel_next(hwaccel)))
> +if (hwaccel->id == codec_id
> +&& hwaccel->pix_fmt == pix_fmt)
> +return hwaccel;
> +return NULL;
> +}
> +
> +

nit: extra line added

>  int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
>  {
> -return avctx->get_format(avctx, fmt);
> +const AVPixFmtDescriptor *desc;
> +enum AVPixelFormat ret = avctx->get_format(avctx, fmt);
> +
> +desc = av_pix_fmt_desc_get(ret);
> +if (!desc)
> +return AV_PIX_FMT_NONE;
> +
> +if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
> +avctx->hwaccel = find_hwaccel(avctx->codec_id, ret);
> +if (!avctx->hwaccel) {
> +av_log(avctx, AV_LOG_ERROR,
> +   "Could not find an AVHWAccel for the pixel format: %s",
> +   desc->name);
> +return AV_PIX_FMT_NONE;
> +}
> +} else {
> +avctx->hwaccel = NULL;
> +}
> +
> +return ret;
>  }
>
>  #if FF_API_AVFRAME_LAVC
> @@ -2181,20 +2213,6 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
>  return hwaccel ? hwaccel->next : first_hwaccel;
>  }
>
> -AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx)
> -{
> -enum AVCodecID codec_id = avctx->codec->id;
> -enum AVPixelFormat pix_fmt = avctx->pix_fmt;
> -
> -AVHWAccel *hwaccel = NULL;
> -
> -while ((hwaccel = av_hwaccel_next(hwaccel)))
> -if (hwaccel->id == codec_id
> -&& hwaccel->pix_fmt == pix_fmt)
> -return hwaccel;
> -return NULL;
> -}
> -
>  int av_lockmgr_register(int (*cb

Re: [libav-devel] [PATCH 03/10] lavc: document which parts of AVHWAccel are private.

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> ---
>  libavcodec/avcodec.h | 7 +++
>  1 file changed, 7 insertions(+)
>
OK
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 04/10] hwaccel: rename priv_data_size to frame_priv_data_size

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> This describes more accurately what this field is for.
> ---
>  libavcodec/avcodec.h  | 4 ++--
>  libavcodec/dxva2_h264.c   | 2 +-
>  libavcodec/dxva2_mpeg2.c  | 2 +-
>  libavcodec/dxva2_vc1.c| 4 ++--
>  libavcodec/h264_slice.c   | 4 ++--
>  libavcodec/mpegvideo.c| 4 ++--
>  libavcodec/vdpau_h264.c   | 2 +-
>  libavcodec/vdpau_mpeg12.c | 4 ++--
>  libavcodec/vdpau_mpeg4.c  | 4 ++--
>  libavcodec/vdpau_vc1.c| 4 ++--
>  10 files changed, 17 insertions(+), 17 deletions(-)
>

Probably OK but I think you should bump avcodec's minor.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 05/10] hwaccel: propagate the private context

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> ---
>  libavcodec/pthread_frame.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> index 1af8ff5..558a518 100644
> --- a/libavcodec/pthread_frame.c
> +++ b/libavcodec/pthread_frame.c
> @@ -206,6 +206,7 @@ static int update_context_from_thread(AVCodecContext 
> *dst, AVCodecContext *src,
>
>  dst->hwaccel = src->hwaccel;
>  dst->hwaccel_context = src->hwaccel_context;
> +dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
>  }
>
>  if (for_user) {

ok
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 07/10] lavu: add a pixel format for new VDA hwaccel

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 24, 2014 at 3:01 AM, Luca Barbato  wrote:
> From: Anton Khirnov 
>
> The current hwaccel is broken and cannot be fixed in a compatible
> way. It will be deprecated and replaced with a new one.
> ---
>  doc/APIchanges  | 3 +++
>  libavutil/pixdesc.c | 4 
>  libavutil/pixfmt.h  | 1 +
>  libavutil/version.h | 2 +-
>  4 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 38d18bc..6d030a7 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2013-12-xx
>
>  API changes, most recent first:
>
> +2014-xx-xx - xxx - lavu 53.7.0 - pixfmt.h
> +  Add AV_PIX_FMT_VDA for new-style VDA acceleration.
> +
>  2014-xx-xx - xxx - lavu 53.06.0 - pixfmt.h
>Add RGBA64 pixel format and variants.
>
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index d0e6919..14dc9f5 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -1483,6 +1483,10 @@ const AVPixFmtDescriptor 
> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>  },
>  .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
>  },
> +[AV_PIX_FMT_VDA] = {
> +.name = "vda",
> +.flags = AV_PIX_FMT_FLAG_HWACCEL,
> +},
>  };

no .log2_chroma_w/h?

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


[libav-devel] [PATCH 03/10] lavc: document which parts of AVHWAccel are private.

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

---
 libavcodec/avcodec.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7beb277..fd5f300 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2888,6 +2888,13 @@ typedef struct AVHWAccel {
  */
 int capabilities;
 
+/*
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavcodec and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *
+ */
 struct AVHWAccel *next;
 
 /**
-- 
1.8.5.2 (Apple Git-48)

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


[libav-devel] [PATCH 08/10] vda: use hwaccel private data for internal bitstream buffer

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

---
 libavcodec/vda.h  |  6 +++---
 libavcodec/vda_h264.c | 50 +++---
 2 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/libavcodec/vda.h b/libavcodec/vda.h
index 987b94f..1189e41 100644
--- a/libavcodec/vda.h
+++ b/libavcodec/vda.h
@@ -112,17 +112,17 @@ struct vda_context {
 OSType  cv_pix_fmt_type;
 
 /**
- * The current bitstream buffer.
+ * unused
  */
 uint8_t *priv_bitstream;
 
 /**
- * The current size of the bitstream.
+ * unused
  */
 int priv_bitstream_size;
 
 /**
- * The reference size used for fast reallocation.
+ * unused
  */
 int priv_allocated_size;
 };
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index 6c1845a..72b0c78 100644
--- a/libavcodec/vda_h264.c
+++ b/libavcodec/vda_h264.c
@@ -28,6 +28,17 @@
 #include "h264.h"
 #include "vda.h"
 
+typedef struct VDAContext {
+// The current bitstream buffer.
+uint8_t *bitstream;
+
+// The current size of the bitstream.
+int  bitstream_size;
+
+// The reference size used for fast reallocation.
+int  allocated_size;
+} VDAContext;
+
 /* Decoder callback that adds the VDA frame to the queue in display order. */
 static void vda_decoder_callback(void *vda_hw_ctx,
  CFDictionaryRef user_info,
@@ -46,15 +57,15 @@ static void vda_decoder_callback(void *vda_hw_ctx,
 vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer);
 }
 
-static int vda_sync_decode(struct vda_context *vda_ctx)
+static int vda_sync_decode(VDAContext *ctx, struct vda_context *vda_ctx)
 {
 OSStatus status;
 CFDataRef coded_frame;
 uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames
 
 coded_frame = CFDataCreate(kCFAllocatorDefault,
-   vda_ctx->priv_bitstream,
-   vda_ctx->priv_bitstream_size);
+   ctx->bitstream,
+   ctx->bitstream_size);
 
 status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);
 
@@ -71,12 +82,13 @@ static int vda_h264_start_frame(AVCodecContext *avctx,
 av_unused const uint8_t *buffer,
 av_unused uint32_t size)
 {
+VDAContext *vda = avctx->internal->hwaccel_priv_data;
 struct vda_context *vda_ctx = avctx->hwaccel_context;
 
 if (!vda_ctx->decoder)
 return -1;
 
-vda_ctx->priv_bitstream_size = 0;
+vda->bitstream_size = 0;
 
 return 0;
 }
@@ -85,24 +97,25 @@ static int vda_h264_decode_slice(AVCodecContext *avctx,
  const uint8_t *buffer,
  uint32_t size)
 {
+VDAContext *vda = avctx->internal->hwaccel_priv_data;
 struct vda_context *vda_ctx = avctx->hwaccel_context;
 void *tmp;
 
 if (!vda_ctx->decoder)
 return -1;
 
-tmp = av_fast_realloc(vda_ctx->priv_bitstream,
-  &vda_ctx->priv_allocated_size,
-  vda_ctx->priv_bitstream_size + size + 4);
+tmp = av_fast_realloc(vda->bitstream,
+  &vda->allocated_size,
+  vda->bitstream_size + size + 4);
 if (!tmp)
 return AVERROR(ENOMEM);
 
-vda_ctx->priv_bitstream = tmp;
+vda->bitstream = tmp;
 
-AV_WB32(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size, size);
-memcpy(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size + 4, buffer, 
size);
+AV_WB32(vda->bitstream + vda->bitstream_size, size);
+memcpy(vda->bitstream + vda->bitstream_size + 4, buffer, size);
 
-vda_ctx->priv_bitstream_size += size + 4;
+vda->bitstream_size += size + 4;
 
 return 0;
 }
@@ -110,14 +123,15 @@ static int vda_h264_decode_slice(AVCodecContext *avctx,
 static int vda_h264_end_frame(AVCodecContext *avctx)
 {
 H264Context *h  = avctx->priv_data;
+VDAContext *vda = avctx->internal->hwaccel_priv_data;
 struct vda_context *vda_ctx = avctx->hwaccel_context;
 AVFrame *frame  = &h->cur_pic_ptr->f;
 int status;
 
-if (!vda_ctx->decoder || !vda_ctx->priv_bitstream)
+if (!vda_ctx->decoder || !vda->bitstream)
 return -1;
 
-status = vda_sync_decode(vda_ctx);
+status = vda_sync_decode(vda, vda_ctx);
 frame->data[3] = (void*)vda_ctx->cv_buffer;
 
 if (status)
@@ -217,11 +231,15 @@ int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
 if (vda_ctx->decoder)
 status = VDADecoderDestroy(vda_ctx->decoder);
 
-av_freep(&vda_ctx->priv_bitstream);
-
 return status;
 }
 
+static void vda_h264_uninit(AVCodecContext *avctx)
+{
+VDAContext *vda = avctx->internal->priv_data;
+av_freep(&vda->bi

[libav-devel] [PATCH 09/10] lavc: Add new vda hwaccel

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

It leverages the new hwaccel 1.2 features:

- get_buffer2 is never called
- the internal context is automatically initialized/deinitialized

Signed-off-by: Luca Barbato 
---
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/h264_slice.c   |  23 -
 libavcodec/vda.c  |  64 
 libavcodec/vda.h  |  53 ++
 libavcodec/vda_h264.c | 248 --
 libavcodec/vda_internal.h |  33 ++
 7 files changed, 412 insertions(+), 11 deletions(-)
 create mode 100644 libavcodec/vda.c
 create mode 100644 libavcodec/vda_internal.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 1b5a044..5908011 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -67,6 +67,7 @@ OBJS-$(CONFIG_RDFT)+= rdft.o 
$(RDFT-OBJS-yes)
 OBJS-$(CONFIG_SINEWIN) += sinewin.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VAAPI)   += vaapi.o
+OBJS-$(CONFIG_VDA) += vda.o
 OBJS-$(CONFIG_VDPAU)   += vdpau.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ed6d7ff..7b061e6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -79,6 +79,7 @@ void avcodec_register_all(void)
 REGISTER_HWACCEL(H264_DXVA2,h264_dxva2);
 REGISTER_HWACCEL(H264_VAAPI,h264_vaapi);
 REGISTER_HWACCEL(H264_VDA,  h264_vda);
+REGISTER_HWACCEL(H264_VDA_OLD,  h264_vda_old);
 REGISTER_HWACCEL(H264_VDPAU,h264_vdpau);
 REGISTER_HWACCEL(MPEG1_VDPAU,   mpeg1_vdpau);
 REGISTER_HWACCEL(MPEG2_DXVA2,   mpeg2_dxva2);
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 73c0740..eb4adde 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -153,6 +153,7 @@ static const enum AVPixelFormat 
h264_hwaccel_pixfmt_list_420[] = {
 #endif
 #if CONFIG_H264_VDA_HWACCEL
 AV_PIX_FMT_VDA_VLD,
+AV_PIX_FMT_VDA,
 #endif
 #if CONFIG_H264_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
@@ -170,6 +171,7 @@ static const enum AVPixelFormat 
h264_hwaccel_pixfmt_list_jpeg_420[] = {
 #endif
 #if CONFIG_H264_VDA_HWACCEL
 AV_PIX_FMT_VDA_VLD,
+AV_PIX_FMT_VDA,
 #endif
 #if CONFIG_H264_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
@@ -247,10 +249,23 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
 av_assert0(!pic->f.data[0]);
 
 pic->tf.f = &pic->f;
-ret = ff_thread_get_buffer(h->avctx, &pic->tf, pic->reference ?
-   AV_GET_BUFFER_FLAG_REF : 0);
-if (ret < 0)
-goto fail;
+
+if (h->avctx->pix_fmt == AV_PIX_FMT_VDA) {
+/* the VDA framework handles its surfaces internally, so we
+ * do not call get_buffer at all;
+ * create a dummy buffer here until we get the real one later */
+pic->f.buf[0] = av_buffer_alloc(1);
+pic->f.width  = h->avctx->width;
+pic->f.height = h->avctx->height;
+pic->f.format = h->avctx->pix_fmt;
+if (!pic->f.buf[0])
+goto fail;
+} else {
+ret = ff_thread_get_buffer(h->avctx, &pic->tf, pic->reference ?
+   AV_GET_BUFFER_FLAG_REF : 0);
+if (ret < 0)
+goto fail;
+}
 
 h->linesize   = pic->f.linesize[0];
 h->uvlinesize = pic->f.linesize[1];
diff --git a/libavcodec/vda.c b/libavcodec/vda.c
new file mode 100644
index 000..60f0b77
--- /dev/null
+++ b/libavcodec/vda.c
@@ -0,0 +1,64 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "libavutil/mem.h"
+
+#include "vda.h"
+#include "vda_internal.h"
+
+#if CONFIG_H264_VDA_HWACCEL
+AVVDAContext *av_vda_alloc_context(void)
+{
+AVVDAContext *ret = av_mallocz(sizeof(*ret));
+
+if (ret)
+ret->output_callback = ff_vda_output_callback;
+
+return ret;
+}
+
+int av_vda_default_init(AVCodecContext *avctx)
+{
+avctx->hwaccel_context = av_vda_alloc_context();
+if (!avctx->hwaccel_context)
+return AVERROR(ENOMEM);
+return ff_vda_default_init(avctx);
+}
+
+void av_vda_

[libav-devel] [PATCH 06/10] lavc: add hwaccel private data and init/uninit callbacks

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

---
 libavcodec/avcodec.h  | 23 +++
 libavcodec/internal.h |  5 +
 libavcodec/utils.c| 34 ++
 3 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 264305d..a1d0ae5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2945,6 +2945,29 @@ typedef struct AVHWAccel {
  * AVCodecContext.release_buffer().
  */
 int frame_priv_data_size;
+
+/**
+ * Initialize the hwaccel private data.
+ *
+ * This will be called from ff_get_format(), after hwaccel and
+ * hwaccel_context are set and the hwaccel private data in AVCodecInternal
+ * is allocated.
+ */
+int (*init)(AVCodecContext *avctx);
+
+/**
+ * Uninitialize the hwaccel private data.
+ *
+ * This will be called from get_format() or avcodec_close(), after hwaccel
+ * and hwaccel_context are already uninitialized.
+ */
+int (*uninit)(AVCodecContext *avctx);
+
+/**
+ * Size of the private data to allocate in
+ * AVCodecInternal.hwaccel_priv_data.
+ */
+int priv_data_size;
 } AVHWAccel;
 
 /**
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 64765a2..17de2d5 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -95,6 +95,11 @@ typedef struct AVCodecInternal {
  * packet into every function.
  */
 AVPacket *pkt;
+
+/**
+ * hwaccel-specific private data
+ */
+void *hwaccel_priv_data;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e52d915..5ca7534 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -858,16 +858,37 @@ int ff_get_format(AVCodecContext *avctx, const enum 
AVPixelFormat *fmt)
 if (!desc)
 return AV_PIX_FMT_NONE;
 
+if (avctx->hwaccel && avctx->hwaccel->uninit)
+avctx->hwaccel->uninit(avctx);
+av_freep(&avctx->internal->hwaccel_priv_data);
+avctx->hwaccel = NULL;
+
 if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
-avctx->hwaccel = find_hwaccel(avctx->codec_id, ret);
-if (!avctx->hwaccel) {
+AVHWAccel *hwaccel;
+int err;
+
+hwaccel = find_hwaccel(avctx->codec_id, ret);
+if (!hwaccel) {
 av_log(avctx, AV_LOG_ERROR,
"Could not find an AVHWAccel for the pixel format: %s",
desc->name);
 return AV_PIX_FMT_NONE;
 }
-} else {
-avctx->hwaccel = NULL;
+
+if (hwaccel->priv_data_size) {
+avctx->internal->hwaccel_priv_data = 
av_mallocz(hwaccel->priv_data_size);
+if (!avctx->internal->hwaccel_priv_data)
+return AV_PIX_FMT_NONE;
+}
+
+if (hwaccel->init) {
+err = hwaccel->init(avctx);
+if (err < 0) {
+av_freep(&avctx->internal->hwaccel_priv_data);
+return AV_PIX_FMT_NONE;
+}
+}
+avctx->hwaccel = hwaccel;
 }
 
 return ret;
@@ -1653,6 +1674,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
 for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++)
 av_buffer_pool_uninit(&pool->pools[i]);
 av_freep(&avctx->internal->pool);
+
+if (avctx->hwaccel && avctx->hwaccel->uninit)
+avctx->hwaccel->uninit(avctx);
+av_freep(&avctx->internal->hwaccel_priv_data);
+
 av_freep(&avctx->internal);
 }
 
-- 
1.8.5.2 (Apple Git-48)

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


[libav-devel] [PATCH 04/10] hwaccel: rename priv_data_size to frame_priv_data_size

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

This describes more accurately what this field is for.
---
 libavcodec/avcodec.h  | 4 ++--
 libavcodec/dxva2_h264.c   | 2 +-
 libavcodec/dxva2_mpeg2.c  | 2 +-
 libavcodec/dxva2_vc1.c| 4 ++--
 libavcodec/h264_slice.c   | 4 ++--
 libavcodec/mpegvideo.c| 4 ++--
 libavcodec/vdpau_h264.c   | 2 +-
 libavcodec/vdpau_mpeg12.c | 4 ++--
 libavcodec/vdpau_mpeg4.c  | 4 ++--
 libavcodec/vdpau_vc1.c| 4 ++--
 10 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fd5f300..264305d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2938,13 +2938,13 @@ typedef struct AVHWAccel {
 int (*end_frame)(AVCodecContext *avctx);
 
 /**
- * Size of HW accelerator private data.
+ * Size of per-frame HW accelerator private data.
  *
  * Private data is allocated with av_mallocz() before
  * AVCodecContext.get_buffer() and deallocated after
  * AVCodecContext.release_buffer().
  */
-int priv_data_size;
+int frame_priv_data_size;
 } AVHWAccel;
 
 /**
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 663eb7d..33db673 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -449,5 +449,5 @@ AVHWAccel ff_h264_dxva2_hwaccel = {
 .start_frame= dxva2_h264_start_frame,
 .decode_slice   = dxva2_h264_decode_slice,
 .end_frame  = dxva2_h264_end_frame,
-.priv_data_size = sizeof(struct dxva2_picture_context),
+.frame_priv_data_size = sizeof(struct dxva2_picture_context),
 };
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index b6c2361..59b55e5 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -276,5 +276,5 @@ AVHWAccel ff_mpeg2_dxva2_hwaccel = {
 .start_frame= dxva2_mpeg2_start_frame,
 .decode_slice   = dxva2_mpeg2_decode_slice,
 .end_frame  = dxva2_mpeg2_end_frame,
-.priv_data_size = sizeof(struct dxva2_picture_context),
+.frame_priv_data_size = sizeof(struct dxva2_picture_context),
 };
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index b2614dd..e5f893f 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -279,7 +279,7 @@ AVHWAccel ff_wmv3_dxva2_hwaccel = {
 .start_frame= dxva2_vc1_start_frame,
 .decode_slice   = dxva2_vc1_decode_slice,
 .end_frame  = dxva2_vc1_end_frame,
-.priv_data_size = sizeof(struct dxva2_picture_context),
+.frame_priv_data_size = sizeof(struct dxva2_picture_context),
 };
 #endif
 
@@ -291,5 +291,5 @@ AVHWAccel ff_vc1_dxva2_hwaccel = {
 .start_frame= dxva2_vc1_start_frame,
 .decode_slice   = dxva2_vc1_decode_slice,
 .end_frame  = dxva2_vc1_end_frame,
-.priv_data_size = sizeof(struct dxva2_picture_context),
+.frame_priv_data_size = sizeof(struct dxva2_picture_context),
 };
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d6a25c4..73c0740 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -258,8 +258,8 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
 if (h->avctx->hwaccel) {
 const AVHWAccel *hwaccel = h->avctx->hwaccel;
 av_assert0(!pic->hwaccel_picture_private);
-if (hwaccel->priv_data_size) {
-pic->hwaccel_priv_buf = av_buffer_allocz(hwaccel->priv_data_size);
+if (hwaccel->frame_priv_data_size) {
+pic->hwaccel_priv_buf = 
av_buffer_allocz(hwaccel->frame_priv_data_size);
 if (!pic->hwaccel_priv_buf)
 return AVERROR(ENOMEM);
 pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 0fc77e8..79f1b4c 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -460,8 +460,8 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture 
*pic)
 
 if (s->avctx->hwaccel) {
 assert(!pic->hwaccel_picture_private);
-if (s->avctx->hwaccel->priv_data_size) {
-pic->hwaccel_priv_buf = 
av_buffer_allocz(s->avctx->hwaccel->priv_data_size);
+if (s->avctx->hwaccel->frame_priv_data_size) {
+pic->hwaccel_priv_buf = 
av_buffer_allocz(s->avctx->hwaccel->frame_priv_data_size);
 if (!pic->hwaccel_priv_buf) {
 av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed 
(hwaccel private data allocation)\n");
 return -1;
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index 7aa17ef..32e9c28 100644
--- a/libavcodec/vdpau_h264.c
+++ b/libavcodec/vdpau_h264.c
@@ -212,5 +212,5 @@ AVHWAccel ff_h264_vdpau_hwaccel = {
 .start_frame= vdpau_h264_start_frame,
 .end_frame  = vdpau_h264_end_frame,
 .decode_slice   = vdpau_h264_decode_slice,
-.priv_data_size = sizeof(struct vdpau_picture_context),
+.frame_priv_data_size = sizeof(struct vdpau_picture_context),
 };
diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
index 0f92c

[libav-devel] [PATCH 05/10] hwaccel: propagate the private context

2014-03-23 Thread Luca Barbato
---
 libavcodec/pthread_frame.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 1af8ff5..558a518 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -206,6 +206,7 @@ static int update_context_from_thread(AVCodecContext *dst, 
AVCodecContext *src,
 
 dst->hwaccel = src->hwaccel;
 dst->hwaccel_context = src->hwaccel_context;
+dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
 }
 
 if (for_user) {
-- 
1.8.5.2 (Apple Git-48)

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


[libav-devel] [PATCH 10/10] avconv: Support VDA hwaccel

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

Signed-off-by: Luca Barbato 
---
 Makefile |   1 +
 avconv.h |   2 +
 avconv_opt.c |   3 ++
 avconv_vda.c | 134 +++
 4 files changed, 140 insertions(+)
 create mode 100644 avconv_vda.c

diff --git a/Makefile b/Makefile
index 2453dfd..8836d4f 100644
--- a/Makefile
+++ b/Makefile
@@ -75,6 +75,7 @@ $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += 
cmdutils.o))
 
 OBJS-avconv   += avconv_opt.o avconv_filter.o
 OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
+OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o
 
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr base64
 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
diff --git a/avconv.h b/avconv.h
index c912fae..de3fee5 100644
--- a/avconv.h
+++ b/avconv.h
@@ -52,6 +52,7 @@ enum HWAccelID {
 HWACCEL_NONE = 0,
 HWACCEL_AUTO,
 HWACCEL_VDPAU,
+HWACCEL_VDA,
 };
 
 typedef struct HWAccel {
@@ -403,5 +404,6 @@ FilterGraph *init_simple_filtergraph(InputStream *ist, 
OutputStream *ost);
 int avconv_parse_options(int argc, char **argv);
 
 int vdpau_init(AVCodecContext *s);
+int vda_init(AVCodecContext *s);
 
 #endif /* AVCONV_H */
diff --git a/avconv_opt.c b/avconv_opt.c
index 7bc41c9..e561763 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -57,6 +57,9 @@ const HWAccel hwaccels[] = {
 #if HAVE_VDPAU_X11
 { "vdpau", vdpau_init, HWACCEL_VDPAU, AV_PIX_FMT_VDPAU },
 #endif
+#if CONFIG_VDA
+{ "vda",   vda_init,   HWACCEL_VDA,   AV_PIX_FMT_VDA },
+#endif
 { 0 },
 };
 
diff --git a/avconv_vda.c b/avconv_vda.c
new file mode 100644
index 000..40f87c4
--- /dev/null
+++ b/avconv_vda.c
@@ -0,0 +1,134 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/vda.h"
+#include "libavutil/imgutils.h"
+
+#include "avconv.h"
+
+typedef struct VDAContext {
+AVFrame *tmp_frame;
+} VDAContext;
+
+static int vda_retrieve_data(AVCodecContext *s, AVFrame *frame)
+{
+InputStream *ist = s->opaque;
+VDAContext  *vda = ist->hwaccel_ctx;
+CVPixelBufferRef pixbuf = (CVPixelBufferRef)frame->data[3];
+OSType pixel_format = CVPixelBufferGetPixelFormatType(pixbuf);
+CVReturn err;
+uint8_t *data[4] = { 0 };
+int linesize[4] = { 0 };
+int planes, ret, i;
+
+av_frame_unref(vda->tmp_frame);
+
+switch (pixel_format) {
+case kCVPixelFormatType_420YpCbCr8Planar: vda->tmp_frame->format = 
AV_PIX_FMT_YUV420P; break;
+case kCVPixelFormatType_422YpCbCr8:   vda->tmp_frame->format = 
AV_PIX_FMT_UYVY422; break;
+default:
+av_log(NULL, AV_LOG_ERROR,
+   "Unsupported pixel format: %u\n", pixel_format);
+return AVERROR(ENOSYS);
+}
+
+vda->tmp_frame->width  = frame->width;
+vda->tmp_frame->height = frame->height;
+ret = av_frame_get_buffer(vda->tmp_frame, 32);
+if (ret < 0)
+return ret;
+
+err = CVPixelBufferLockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
+if (err != kCVReturnSuccess) {
+av_log(NULL, AV_LOG_ERROR, "Error locking the pixel buffer.\n");
+return AVERROR_UNKNOWN;
+}
+
+if (CVPixelBufferIsPlanar(pixbuf)) {
+
+planes = CVPixelBufferGetPlaneCount(pixbuf);
+for (i = 0; i < planes; i++) {
+data[i] = CVPixelBufferGetBaseAddressOfPlane(pixbuf, i);
+linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(pixbuf, i);
+}
+} else {
+data[0] = CVPixelBufferGetBaseAddress(pixbuf);
+linesize[0] = CVPixelBufferGetBytesPerRow(pixbuf);
+}
+
+av_image_copy(vda->tmp_frame->data, vda->tmp_frame->linesize,
+  data, linesize, vda->tmp_frame->format,
+  frame->width, frame->height);
+
+ret = av_frame_copy_props(vda->tmp_frame, frame);
+if (ret < 0)
+return ret;
+
+av_frame_unref(frame);
+av_frame_move_ref(frame, vda->tmp_frame);
+
+return 0;
+}
+
+static void vda_uninit(AVCodecContext *s)
+{
+InputStream *ist = s->opaque;
+VDAContext  *vda = ist->hwaccel_ctx;
+
+ist->hwaccel_uninit= NULL;
+ist->hwaccel_retrieve_data = NULL;
+
+av_frame_free(&vda->tmp_frame);
+
+av_vda_default_free(s);
+av_freep(&ist->hwaccel_ct

[libav-devel] [PATCH 07/10] lavu: add a pixel format for new VDA hwaccel

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

The current hwaccel is broken and cannot be fixed in a compatible
way. It will be deprecated and replaced with a new one.
---
 doc/APIchanges  | 3 +++
 libavutil/pixdesc.c | 4 
 libavutil/pixfmt.h  | 1 +
 libavutil/version.h | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 38d18bc..6d030a7 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2013-12-xx
 
 API changes, most recent first:
 
+2014-xx-xx - xxx - lavu 53.7.0 - pixfmt.h
+  Add AV_PIX_FMT_VDA for new-style VDA acceleration.
+
 2014-xx-xx - xxx - lavu 53.06.0 - pixfmt.h
   Add RGBA64 pixel format and variants.
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index d0e6919..14dc9f5 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1483,6 +1483,10 @@ const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
 },
+[AV_PIX_FMT_VDA] = {
+.name = "vda",
+.flags = AV_PIX_FMT_FLAG_HWACCEL,
+},
 };
 
 FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e86ec7e..870e3cf 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -196,6 +196,7 @@ enum AVPixelFormat {
 AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 
16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
 AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 
16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
 
+AV_PIX_FMT_VDA,  ///< HW acceleration through VDA, data[3] 
contains a CVPixelBufferRef
 AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 
 #if FF_API_PIX_FMT
diff --git a/libavutil/version.h b/libavutil/version.h
index 36070b2..d680979 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR  6
+#define LIBAVUTIL_VERSION_MINOR  7
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.8.5.2 (Apple Git-48)

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


[libav-devel] [PATCH 02/10] lavc: set AVCodecContext.hwaccel in ff_get_format()

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

This way each decoder does not have to do the same thing manually.
---
 libavcodec/h263dec.c|  1 -
 libavcodec/h264_slice.c |  2 --
 libavcodec/internal.h   |  9 -
 libavcodec/mpeg12dec.c  |  2 --
 libavcodec/utils.c  | 48 +---
 libavcodec/vc1dec.c |  1 -
 6 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 602dafa..ddc3b01 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -108,7 +108,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 return AVERROR(ENOSYS);
 }
 s->codec_id= avctx->codec->id;
-avctx->hwaccel = ff_find_hwaccel(avctx);
 
 /* for h263, we allocate the images after having read the header */
 if (avctx->codec->id != AV_CODEC_ID_H263 &&
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 683dead..d6a25c4 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1081,8 +1081,6 @@ static int h264_slice_header_init(H264Context *h, int 
reinit)
   h->sps.num_units_in_tick, den, 1 << 30);
 }
 
-h->avctx->hwaccel = ff_find_hwaccel(h->avctx);
-
 if (reinit)
 ff_h264_free_tables(h, 0);
 h->first_field   = 0;
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index eb91b6a..64765a2 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -103,15 +103,6 @@ struct AVCodecDefault {
 };
 
 /**
- * Return the hardware accelerated codec for codec codec_id and
- * pixel format pix_fmt.
- *
- * @param avctx The codec context containing the codec_id and pixel format.
- * @return the hardware accelerated codec, or NULL if none was found.
- */
-AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx);
-
-/**
  * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
  * If there is no such matching pair then size is returned.
  */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index b8e7d36..c3f06dc 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1295,7 +1295,6 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 } // MPEG-2
 
 avctx->pix_fmt = mpeg_get_pixelformat(avctx);
-avctx->hwaccel = ff_find_hwaccel(avctx);
 // until then pix_fmt may be changed right after codec init
 #if FF_API_XVMC
 if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
@@ -2126,7 +2125,6 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
 s->low_delay= 1;
 
 avctx->pix_fmt = mpeg_get_pixelformat(avctx);
-avctx->hwaccel = ff_find_hwaccel(avctx);
 
 #if FF_API_XVMC
 if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) &&
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2b3c00a..e52d915 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -836,9 +836,41 @@ enum AVPixelFormat avcodec_default_get_format(struct 
AVCodecContext *s, const en
 return fmt[0];
 }
 
+static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
+   enum AVPixelFormat pix_fmt)
+{
+AVHWAccel *hwaccel = NULL;
+
+while ((hwaccel = av_hwaccel_next(hwaccel)))
+if (hwaccel->id == codec_id
+&& hwaccel->pix_fmt == pix_fmt)
+return hwaccel;
+return NULL;
+}
+
+
 int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
 {
-return avctx->get_format(avctx, fmt);
+const AVPixFmtDescriptor *desc;
+enum AVPixelFormat ret = avctx->get_format(avctx, fmt);
+
+desc = av_pix_fmt_desc_get(ret);
+if (!desc)
+return AV_PIX_FMT_NONE;
+
+if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+avctx->hwaccel = find_hwaccel(avctx->codec_id, ret);
+if (!avctx->hwaccel) {
+av_log(avctx, AV_LOG_ERROR,
+   "Could not find an AVHWAccel for the pixel format: %s",
+   desc->name);
+return AV_PIX_FMT_NONE;
+}
+} else {
+avctx->hwaccel = NULL;
+}
+
+return ret;
 }
 
 #if FF_API_AVFRAME_LAVC
@@ -2181,20 +2213,6 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
 return hwaccel ? hwaccel->next : first_hwaccel;
 }
 
-AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx)
-{
-enum AVCodecID codec_id = avctx->codec->id;
-enum AVPixelFormat pix_fmt = avctx->pix_fmt;
-
-AVHWAccel *hwaccel = NULL;
-
-while ((hwaccel = av_hwaccel_next(hwaccel)))
-if (hwaccel->id == codec_id
-&& hwaccel->pix_fmt == pix_fmt)
-return hwaccel;
-return NULL;
-}
-
 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
 {
 if (lockmgr_cb) {
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index caf33fb..b04e22d 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5597,7 +5597,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
 avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts)

[libav-devel] [PATCH 01/10] lavc: add an internal wrapper around get_format()

2014-03-23 Thread Luca Barbato
From: Anton Khirnov 

It will be useful in the following commits.
---
 libavcodec/8bps.c   |  2 +-
 libavcodec/h263dec.c|  2 +-
 libavcodec/h264_slice.c | 10 +-
 libavcodec/internal.h   |  7 +++
 libavcodec/mpeg12dec.c  |  4 ++--
 libavcodec/utils.c  |  5 +
 libavcodec/vc1dec.c |  2 +-
 7 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index cfeb486..3fd15e0 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -159,7 +159,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 c->planemap[0] = 0; // 1st plane is palette indexes
 break;
 case 24:
-avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
+avctx->pix_fmt = ff_get_format(avctx, pixfmt_rgb24);
 c->planes  = 3;
 c->planemap[0] = 2; // 1st plane is red
 c->planemap[1] = 1; // 2nd plane is green
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 6c2f322..602dafa 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -57,7 +57,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 if (avctx->codec->id == AV_CODEC_ID_MSS2)
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 else
-avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
+avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
 s->unrestricted_mv = 1;
 
 /* select sub codec */
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 897c8eb..683dead 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1011,11 +1011,11 @@ static enum AVPixelFormat get_pixel_format(H264Context 
*h)
 return h->avctx->color_range == AVCOL_RANGE_JPEG ? 
AV_PIX_FMT_YUVJ422P
  : 
AV_PIX_FMT_YUV422P;
 } else {
-return h->avctx->get_format(h->avctx, h->avctx->codec->pix_fmts ?
-h->avctx->codec->pix_fmts :
-h->avctx->color_range == 
AVCOL_RANGE_JPEG ?
-h264_hwaccel_pixfmt_list_jpeg_420 :
-h264_hwaccel_pixfmt_list_420);
+return ff_get_format(h->avctx, h->avctx->codec->pix_fmts ?
+ h->avctx->codec->pix_fmts :
+ h->avctx->color_range == AVCOL_RANGE_JPEG ?
+ h264_hwaccel_pixfmt_list_jpeg_420 :
+ h264_hwaccel_pixfmt_list_420);
 }
 break;
 default:
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 9f7213c..eb91b6a 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -186,4 +186,11 @@ int ff_set_dimensions(AVCodecContext *s, int width, int 
height);
 int ff_side_data_update_matrix_encoding(AVFrame *frame,
 enum AVMatrixEncoding matrix_encoding);
 
+/**
+ * Select the (possibly hardware accelerated) pixel format.
+ * This is a wrapper around AVCodecContext.get_format() and should be used
+ * instead of calling get_format() directly.
+ */
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt);
+
 #endif /* AVCODEC_INTERNAL_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 2095eea..b8e7d36 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1188,12 +1188,12 @@ static enum AVPixelFormat 
mpeg_get_pixelformat(AVCodecContext *avctx)
 #if FF_API_XVMC
 FF_DISABLE_DEPRECATION_WARNINGS
 if (avctx->xvmc_acceleration)
-return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
+return ff_get_format(avctx, pixfmt_xvmc_mpg2_420);
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif /* FF_API_XVMC */
 
 if (s->chroma_format < 2)
-return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
+return ff_get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
 else if (s->chroma_format == 2)
 return AV_PIX_FMT_YUV422P;
 else
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c88b346..2b3c00a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -836,6 +836,11 @@ enum AVPixelFormat avcodec_default_get_format(struct 
AVCodecContext *s, const en
 return fmt[0];
 }
 
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
+{
+return avctx->get_format(avctx, fmt);
+}
+
 #if FF_API_AVFRAME_LAVC
 void avcodec_get_frame_defaults(AVFrame *frame)
 {
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index f8340ee..caf33fb 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5594,7 +5594,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
 if (!avctx->extradata_size || !avctx->extradata)
 return -1;
 if (!(avctx->flags & CODEC_FLAG_GRAY))
-avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
+avctx->pix_fmt = ff_get_forma

[libav-devel] New VDA hwaccel

2014-03-23 Thread Luca Barbato
I managed to get the new vda hwaccel working on a third party player correctly
and works decently with avconv.

The changes by Anton made hwaccel slightly nicer already (I'm calling it
hwaccel 1.2 since it is a good step further in the right direction), next I'd
hide the custom alloc/setup/free function in avcodec_open2/close
and make available the frame rendering that happens in avcodec_${hwaccel}
in decode_video2.

Optional parameters and activation would be fed through the avdictionary.

That way hwaccel would be seamless (but not as fast as possible) for everybody
and still letting thinkering (and top speed) for those that care.

(the usual suspects should get working patches soon)

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


Re: [libav-devel] [PATCH] avconv: More descriptive message about framedrop

2014-03-23 Thread Luca Barbato
On 24/03/14 01:24, Vittorio Giovara wrote:
> From: Luca Barbato 
> 
> Signed-off-by: Vittorio Giovara 
> ---
>  avconv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 13e6778..10f0eef 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -512,7 +512,9 @@ static void do_video_out(AVFormatContext *s,
>  in_picture->pts != AV_NOPTS_VALUE &&
>  in_picture->pts < ost->sync_opts) {
>  nb_frames_drop++;
> -av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
> +av_log(NULL, AV_LOG_WARNING,
> +   "*** dropping frame %d from stream %d at ts %"PRId64"\n",
> +   ost->frame_number, ost->st->index, in_picture->pts);
>  return;
>  }
>  
> 

Push it as your since you redid it =)

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


Re: [libav-devel] [PATCH 2/2] hls: Add an option to prepend a baseurl to the playlist entries

2014-03-23 Thread Vittorio Giovara
On Tue, Mar 18, 2014 at 9:19 PM, Luca Barbato  wrote:
> Useful to generate playlists with absolute paths.
> ---
>  doc/muxers.texi  | 3 +++
>  libavformat/hlsenc.c | 4 
>  2 files changed, 7 insertions(+)
>

probably ok
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] segment: Add an option to prepend a string to the list entries

2014-03-23 Thread Vittorio Giovara
On Tue, Mar 18, 2014 at 9:18 PM, Luca Barbato  wrote:
> From: Enrique Arizón Benito 
>
> Useful to generate lists with absolute urls.
>
> Signed-off-by: Luca Barbato 
> ---
>
> This version has some formatting nits removed and docs added, feel free
> to clean up the documentation if it feels too terse.
>
>  doc/muxers.texi   | 3 +++
>  libavformat/segment.c | 5 +
>  2 files changed, 8 insertions(+)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 143e595..cf5e016 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -480,6 +480,9 @@ Set segment duration to @var{t} seconds.
>  Generate also a listfile named @var{name}.
>  @item segment_list_size @var{size}
>  Overwrite the listfile once it reaches @var{size} entries.
> +@item segment_list_entry_prefix @var{prefix}
> +Prepend @var{prefix} to each entry. Useful to generate absolute paths,
> +has the parser consuming it unable to use relative ones.

What does this mean?

Other parts are ok.
Vittorio

>  @item segment_wrap @var{limit}
>  Wrap around segment index once it reaches @var{limit}.
>  @end table
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index d79a327..390263c 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -37,6 +37,7 @@ typedef struct {
>  AVFormatContext *avf;
>  char *format;  /**< Set by a private option. */
>  char *list;/**< Set by a private option. */
> +char *entry_prefix;/**< Set by a private option. */
>  int  list_type;/**< Set by a private option. */
>  float time;/**< Set by a private option. */
>  int  size; /**< Set by a private option. */
> @@ -97,6 +98,9 @@ static int segment_hls_window(AVFormatContext *s, int last)
>  for (i = FFMAX(0, seg->number - seg->size);
>   i < seg->number; i++) {
>  avio_printf(seg->pb, "#EXTINF:%d,\n", (int)seg->time);
> +if (seg->entry_prefix != NULL) {
> +avio_printf(seg->pb, "%s", seg->entry_prefix);
> +}
>  av_get_frame_filename(buf, sizeof(buf), s->filename, i);
>  avio_printf(seg->pb, "%s\n", buf);
>  }
> @@ -363,6 +367,7 @@ static const AVOption options[] = {
>  {   "flat","plain list (default)",0, 
>   AV_OPT_TYPE_CONST,  {.i64 = LIST_FLAT}, 0, 0, E, "list_type" },
>  {   "hls", "Apple HTTP Live Streaming compatible",0, 
>   AV_OPT_TYPE_CONST,  {.i64 = LIST_HLS},  0, 0, E, "list_type" },
>  { "segment_wrap",  "number after which the index wraps",  
> OFFSET(wrap),AV_OPT_TYPE_INT,{.i64 = 0}, 0, INT_MAX, E },
> +{ "segment_list_entry_prefix",  "base url prefix for segments",   
> OFFSET(entry_prefix), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E },
>  { "individual_header_trailer", "write header/trailer to each segment", 
> OFFSET(individual_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
>  { "write_header_trailer", "write a header to the first segment and a 
> trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_INT, 
> {.i64 = 1}, 0, 1, E },
>  { NULL },
> --
> 1.8.3.4 (Apple Git-47)
>
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel



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

Re: [libav-devel] [PATCH] Fixed miscellaneous coding standard violation.

2014-03-23 Thread Vittorio Giovara
Hello,

please use : K&R formatting cosmetics as title for patches
like this one.

On Thu, Mar 20, 2014 at 3:02 AM, Tanja Batchelor
 wrote:
> ---
>  libavformat/mpeg.c | 82 
> +++---
>  1 file changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> index 7430bb0..99112ac 100644
> --- a/libavformat/mpeg.c
> +++ b/libavformat/mpeg.c
> @@ -38,15 +38,15 @@ static int check_pes(uint8_t *p, uint8_t *end){

you have to add a space between ) and {

>  &&((p[4] & 0xC0) == 0x00 || (p[4]&0xC0)>>2 == (p[6]&0xF0));

don't start lines with && or ||

>
>  for(p+=3; p -if((*p&0xC0) == 0x40) p+=2;
> -if((*p&0xF0) == 0x20){
> +if ((*p&0xC0) == 0x40) p += 2;
> +if ((*p&0xF0) == 0x20){
>  pes1= p[0]&p[2]&p[4]&1;
> -}else if((*p&0xF0) == 0x30){
> +} else if ((*p&0xF0) == 0x30){
>  pes1= p[0]&p[2]&p[4]&p[5]&p[7]&p[9]&1;
> -}else
> +} else

please remove { } from single line comments

>  pes1 = *p == 0x0F;
>
> -return pes1||pes2;
> +return pes1 || pes2;
>  }
>
>  static int check_pack_header(const uint8_t *buf) {
> @@ -60,35 +60,35 @@ static int mpegps_probe(AVProbeData *p)
>  int i;
>  int score=0;

add a space before and after  =
>
> -for(i=0; ibuf_size; i++){
> +for (i = 0; i < p->buf_size; i++) {
>  code = (code<<8) + p->buf[i];
>  if ((code & 0xff00) == 0x100) {
>  int len= p->buf[i+1] << 8 | p->buf[i+2];
>  int pes= check_pes(p->buf+i, p->buf+p->buf_size);
>  int pack = check_pack_header(p->buf+i);

space before and after +

> -if(code == SYSTEM_HEADER_START_CODE) sys++;
> -else if(code == PACK_START_CODE && pack) pspack++;
> -else if((code & 0xf0) == VIDEO_ID &&  pes) vid++;
> +if (code == SYSTEM_HEADER_START_CODE) sys++;
> +else if (code == PACK_START_CODE && pack) pspack++;
> +else if ((code & 0xf0) == VIDEO_ID &&  pes) vid++;
>  // skip pes payload to avoid start code emulation for private
>  // and audio streams

>
>  //02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1

add a space after //

> @@ -218,7 +218,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
>  startcode = find_next_start_code(s->pb, &size, &m->header_state);
>  last_sync = avio_tell(s->pb);
>  if (startcode < 0){
> -if(s->pb->eof_reached)
> +if (s->pb->eof_reached)
>  return AVERROR_EOF;
>  //FIXME we should remember header_state

same

>  return AVERROR(EAGAIN);
> @@ -332,11 +332,11 @@ static int mpegps_read_pes_header(AVFormatContext *s,
>  }
>  }
>  }
> -if(header_len < 0)
> +if (header_len < 0)
>  goto error_redo;
>  avio_skip(s->pb, header_len);
>  }
> -else if( c!= 0xf )
> +else if (c!= 0xf)
>  goto redo;
>
>  if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
> @@ -355,12 +355,12 @@ static int mpegps_read_pes_header(AVFormatContext *s,
>  }
>  }
>  }
> -if(len<0)
> +if (len < 0)
>  goto error_redo;
> -if(dts != AV_NOPTS_VALUE && ppos){
> +if (dts != AV_NOPTS_VALUE && ppos){
>  int i;
> -for(i=0; inb_streams; i++){
> -if(startcode == s->streams[i]->id &&
> +for (i = 0; i < s->nb_streams; i++){
> +if (startcode == s->streams[i]->id &&
> s->pb->seekable /* index useless on streams anyway */) {
>  ff_reduce_index(s, i);
>  av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, 
> AVINDEX_KEYFRAME /* FIXME keyframe? */);

this is kinda a long line, you should try to return when you go past
column 80-85

> @@ -390,41 +390,41 @@ static int mpegps_read_packet(AVFormatContext *s,
>  if (len < 0)
>  return len;
>
> -if(startcode == 0x1bd) {
> +if (startcode == 0x1bd) {
>  dvdaudio_substream_type = avio_r8(s->pb);
>  avio_skip(s->pb, 3);
>  len -= 4;
>  }

The kind of nits here are for your improvement, I'll push a correct version.
If you wish to submit more cosmetics I do recommend using
https://wiki.libav.org/CodingStyle/Uncrustify
Thanks for your contribution.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Remove dcbzl check for e500v1 and e500v2 architectures

2014-03-23 Thread Luca Barbato
On 24/03/14 00:55, Vittorio Giovara wrote:
> From: Peter Krefting 
> 
> The DCBZL instruction is not available for the e500v1 and e500v2
> architectures, but may still be recognized by the toolchain, so we need to
> remove the test for it explicitly for these architectures.
> 
> References: PowerPC™ e500 Core Family Reference Manual (Freescale)
> 
> Found-by: Ståle Kristoffersen 
> 
> Signed-off-by: Vittorio Giovara 
> ---
>  configure | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configure b/configure
> index b80d389..aeed6b6 100755
> --- a/configure
> +++ b/configure
> @@ -3178,10 +3178,12 @@ elif enabled ppc; then
>  e500v2)
>  cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
>  disable altivec
> +disable dcbzl
>  ;;
>  e500)
>  cpuflags="-mcpu=8540 -mhard-float"
>  disable altivec
> +disable dcbzl
>  ;;
>  esac
>  
> 

Looks fine.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] avconv: More descriptive message about framedrop

2014-03-23 Thread Vittorio Giovara
From: Luca Barbato 

Signed-off-by: Vittorio Giovara 
---
 avconv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/avconv.c b/avconv.c
index 13e6778..10f0eef 100644
--- a/avconv.c
+++ b/avconv.c
@@ -512,7 +512,9 @@ static void do_video_out(AVFormatContext *s,
 in_picture->pts != AV_NOPTS_VALUE &&
 in_picture->pts < ost->sync_opts) {
 nb_frames_drop++;
-av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
+av_log(NULL, AV_LOG_WARNING,
+   "*** dropping frame %d from stream %d at ts %"PRId64"\n",
+   ost->frame_number, ost->st->index, in_picture->pts);
 return;
 }
 
-- 
1.8.3.4 (Apple Git-47)

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


Re: [libav-devel] [PATCH 6/6] avconv: don't warn on multiple frames per packet for codecs that expect it

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> ---
>  avconv.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Ok.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: print verbose per-stream transcoding statistics

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> ---
>  avconv.c |   92 
> +-
>  avconv.h |   14 ++
>  2 files changed, 105 insertions(+), 1 deletion(-)
>

Ok I think.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/6] avconv: split printing the final statistics into a separate function

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> ---
>  avconv.c |   66 
> ++
>  1 file changed, 36 insertions(+), 30 deletions(-)
>
> diff --git a/avconv.c b/avconv.c
> index 9c597e7..d29b92b 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -736,6 +736,40 @@ static int poll_filters(void)
>  return ret;
>  }
>
> +static void print_final_stats(int64_t total_size)
> +{
> +uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
> +uint64_t data_size = 0;
> +float percent = -1.0;
> +int i;
> +
> +for (i = 0; i < nb_output_streams; i++) {
> +OutputStream *ost = output_streams[i];
> +switch (ost->st->codec->codec_type) {
> +case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
> +case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
> +default: other_size += ost->data_size; break;
> +}
> +extra_size += ost->st->codec->extradata_size;
> +data_size  += ost->data_size;
> +}
> +
> +if (data_size && total_size >= data_size)
> +percent = 100.0 * (total_size - data_size) / data_size;
> +
> +av_log(NULL, AV_LOG_INFO, "\n");
> +av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other 
> streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
> +   video_size / 1024.0,
> +   audio_size / 1024.0,
> +   other_size / 1024.0,
> +   extra_size / 1024.0);
> +if (percent >= 0.0)
> +av_log(NULL, AV_LOG_INFO, "%f%%", percent);
> +else
> +av_log(NULL, AV_LOG_INFO, "unknown");
> +av_log(NULL, AV_LOG_INFO, "\n");
> +}
> +
>  static void print_report(int is_last_report, int64_t timer_start)
>  {
>  char buf[1024];
> @@ -852,37 +886,9 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>
>  fflush(stderr);
>
> -if (is_last_report) {
> -uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size 
> = 0;
> -uint64_t data_size = 0;
> -float percent = -1.0;
> +if (is_last_report)
> +print_final_stats(total_size);
>
> -for (i = 0; i < nb_output_streams; i++) {
> -OutputStream *ost = output_streams[i];
> -switch (ost->st->codec->codec_type) {
> -case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
> -case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
> -default: other_size += ost->data_size; break;
> -}
> -extra_size += ost->st->codec->extradata_size;
> -data_size  += ost->data_size;
> -}
> -
> -if (data_size && total_size >= data_size)
> -percent = 100.0 * (total_size - data_size) / data_size;
> -
> -av_log(NULL, AV_LOG_INFO, "\n");
> -av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other 
> streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
> -   video_size / 1024.0,
> -   audio_size / 1024.0,
> -   other_size / 1024.0,
> -   extra_size / 1024.0);
> -if (percent >= 0.0)
> -av_log(NULL, AV_LOG_INFO, "%f%%", percent);
> -else
> -av_log(NULL, AV_LOG_INFO, "unknown");
> -av_log(NULL, AV_LOG_INFO, "\n");
> -}
>  }
>
>  static void flush_encoders(void)
> --
> 1.7.10.4
>
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Ok I think

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


Re: [libav-devel] [PATCH 3/6] avconv: rewrite output data size tracking

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> Store a variable per OutputStream instead of globals for
> audio/video/extradata. This makes the code simpler and cleaner and fixes
> 2pass with multiple output streams.
> ---
>  avconv.c |   46 +++---
>  avconv.h |4 
>  2 files changed, 27 insertions(+), 23 deletions(-)
>
> diff --git a/avconv.c b/avconv.c
> index 468ed76..9c597e7 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -84,9 +84,6 @@ const int program_birth_year = 2000;
>
>  static FILE *vstats_file;
>
> -static int64_t video_size = 0;
> -static int64_t audio_size = 0;
> -static int64_t extra_size = 0;
>  static int nb_frames_drop = 0;
>
>
> @@ -370,6 +367,8 @@ static void write_frame(AVFormatContext *s, AVPacket 
> *pkt, OutputStream *ost)
>  }
>  ost->last_mux_dts = pkt->dts;
>
> +ost->data_size += pkt->size;
> +
>  pkt->stream_index = ost->index;
>  ret = av_interleaved_write_frame(s, pkt);
>  if (ret < 0) {
> @@ -420,8 +419,6 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
> *ost,
>  pkt.duration = av_rescale_q(pkt.duration, enc->time_base, 
> ost->st->time_base);
>
>  write_frame(s, &pkt, ost);
> -
> -audio_size += pkt.size;
>  }
>  }
>
> @@ -572,7 +569,6 @@ static void do_video_out(AVFormatContext *s,
>
>  write_frame(s, &pkt, ost);
>  *frame_size = pkt.size;
> -video_size += pkt.size;
>
>  /* if two pass, output log */
>  if (ost->logfile && enc->stats_out) {
> @@ -623,9 +619,9 @@ static void do_video_stats(OutputStream *ost, int 
> frame_size)
>  ti1 = 0.01;
>
>  bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0;
> -avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
> +avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0;
>  fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s 
> avg_br= %7.1fkbits/s ",
> -   (double)video_size / 1024, ti1, bitrate, avg_bitrate);
> +   (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate);
>  fprintf(vstats_file, "type= %c\n", 
> av_get_picture_type_char(enc->coded_frame->pict_type));
>  }
>  }
> @@ -857,17 +853,30 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  fflush(stderr);
>
>  if (is_last_report) {
> -int64_t raw   = audio_size + video_size + extra_size;
> +uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size 
> = 0;
> +uint64_t data_size = 0;
>  float percent = -1.0;
>
> -if (raw)
> -percent = 100.0 * (total_size - raw) / raw;
> +for (i = 0; i < nb_output_streams; i++) {
> +OutputStream *ost = output_streams[i];
> +switch (ost->st->codec->codec_type) {
> +case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
> +case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
> +default: other_size += ost->data_size; break;
> +}
> +extra_size += ost->st->codec->extradata_size;
> +data_size  += ost->data_size;
> +}
> +
> +if (data_size && total_size >= data_size)
> +percent = 100.0 * (total_size - data_size) / data_size;
>
>  av_log(NULL, AV_LOG_INFO, "\n");
> -av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global 
> headers:%1.0fkB muxing overhead: ",
> +av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other 
> streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
> video_size / 1024.0,
> audio_size / 1024.0,
> -   extra_size / 1024.0,
> +   other_size / 1024.0,
> +   extra_size / 1024.0);
>  if (percent >= 0.0)
>  av_log(NULL, AV_LOG_INFO, "%f%%", percent);
>  else
> @@ -897,18 +906,15 @@ static void flush_encoders(void)
>  for (;;) {
>  int (*encode)(AVCodecContext*, AVPacket*, const AVFrame*, int*) 
> = NULL;
>  const char *desc;
> -int64_t *size;
>
>  switch (ost->st->codec->codec_type) {
>  case AVMEDIA_TYPE_AUDIO:
>  encode = avcodec_encode_audio2;
>  desc   = "Audio";
> -size   = &audio_size;
>  break;
>  case AVMEDIA_TYPE_VIDEO:
>  encode = avcodec_encode_video2;
>  desc   = "Video";
> -size   = &video_size;
>  break;
>  default:
>  stop_encoding = 1;
> @@ -926,7 +932,6 @@ static void flush_encoders(void)
>  av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc);
>  exit_program(1);
>  }
> -*size += ret;
>  if (ost->logfile && enc->stat

Re: [libav-devel] [PATCH 2/6] avconv: explicitly report when the muxing overhead is unknown

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> ---
>  avconv.c |   10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/avconv.c b/avconv.c
> index 789bc3b..468ed76 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -858,17 +858,21 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>
>  if (is_last_report) {
>  int64_t raw   = audio_size + video_size + extra_size;
> -float percent = 0.0;
> +float percent = -1.0;
>
>  if (raw)
>  percent = 100.0 * (total_size - raw) / raw;
>
>  av_log(NULL, AV_LOG_INFO, "\n");
> -av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global 
> headers:%1.0fkB muxing overhead %f%%\n",
> +av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global 
> headers:%1.0fkB muxing overhead: ",
> video_size / 1024.0,
> audio_size / 1024.0,
> extra_size / 1024.0,
> -   percent);
> +if (percent >= 0.0)
> +av_log(NULL, AV_LOG_INFO, "%f%%", percent);
> +else
> +av_log(NULL, AV_LOG_INFO, "unknown");
> +av_log(NULL, AV_LOG_INFO, "\n");
>  }
>  }

ok
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/6] avconv: remove unused nb_frames_dup

2014-03-23 Thread Vittorio Giovara
On Mon, Mar 17, 2014 at 11:19 AM, Anton Khirnov  wrote:
> Frame duplication now happens in vf_fps.
> ---
>  avconv.c |7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>

Probably ok.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Remove dcbzl check for e500v1 and e500v2 architectures

2014-03-23 Thread Vittorio Giovara
From: Peter Krefting 

The DCBZL instruction is not available for the e500v1 and e500v2
architectures, but may still be recognized by the toolchain, so we need to
remove the test for it explicitly for these architectures.

References: PowerPC™ e500 Core Family Reference Manual (Freescale)

Found-by: Ståle Kristoffersen 

Signed-off-by: Vittorio Giovara 
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index b80d389..aeed6b6 100755
--- a/configure
+++ b/configure
@@ -3178,10 +3178,12 @@ elif enabled ppc; then
 e500v2)
 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
 disable altivec
+disable dcbzl
 ;;
 e500)
 cpuflags="-mcpu=8540 -mhard-float"
 disable altivec
+disable dcbzl
 ;;
 esac
 
-- 
1.8.3.4 (Apple Git-47)

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

Re: [libav-devel] [PATCH] configure: Always use both sysroot and isysroot

2014-03-23 Thread Janne Grunau
On 2014-03-23 20:23:42 +0100, Vittorio Giovara wrote:
> 
> Attached patch simplifies iOS configure lines.

simplifies how? I don't think I have anything in my configure command
which could be removed after this patch.

see https://fate.libav.org/armv7-apple-darwin-xcode5/20140320182122 or
https://fate.libav.org/armv8-apple-darwin-xcode51/20140320200845 for
examples. The config lines are long but most of is due to the complicated
fate setup.

> From 40296347384e5d975885ab94b04956f8ffbd15f7 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Sun, 23 Mar 2014 17:57:32 +0100
> Subject: [PATCH] Always pass the configure option sysroot to --sysroot and
>  -isysroot.
> 
> On darwin, --sysroot may be ignored.
> ---
>  configure | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure b/configure
> index 0b90d7d..70b69f8 100755
> --- a/configure
> +++ b/configure
> @@ -3398,6 +3398,9 @@ if test -n "$sysroot"; then
>  gcc|llvm_gcc|clang)
>  add_cppflags --sysroot="$sysroot"
>  add_ldflags --sysroot="$sysroot"
> +# On Darwin --sysroot may be ignored, -isysroot always affects headers and 
> linking
> +add_cppflags -isysroot "$sysroot"
> +add_ldflags -isysroot "$sysroot"

The description in the gcc man page is a little strange but at least
clang from Xcode 5.1 properly passes the --sysroot parameter to ld's
-syslibroot

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


Re: [libav-devel] [PATCH 1/2] BRender PIX image decoder

2014-03-23 Thread Vittorio Giovara
On Sun, Mar 23, 2014 at 6:26 PM, Justin Ruggles
 wrote:
> On 03/22/2014 10:54 PM, Vittorio Giovara wrote:
>> From: Aleksi Nurmi 
>>
>> Further enhancements by Vittorio Giovara and Paul B Mahol.
>>
>> Signed-off-by: Vittorio Giovara 
>> ---
>> I think I addressed all comments.
>> Vittorio
>>
>>  Changelog   |   1 +
>>  doc/general.texi|   2 +
>>  libavcodec/Makefile |   1 +
>>  libavcodec/allcodecs.c  |   1 +
>>  libavcodec/avcodec.h|   1 +
>>  libavcodec/brenderpix.c | 288 
>> 
>>  libavcodec/codec_desc.c |   7 ++
>>  libavcodec/version.h|   4 +-
>>  libavformat/img2.c  |   1 +
>>  9 files changed, 304 insertions(+), 2 deletions(-)
>>  create mode 100644 libavcodec/brenderpix.c
>
> For XRGB you need to go through and make all the alpha opaque since
> you're outputting ARGB.

I've added locally

// make alpha opaque for XRGB
if (hdr.format == 7)
for (i = 0; i < frame->linesize[0]; i += 4)
frame->data[i] = 0xFF;

just after image_copy_plane.
Vittorio

>
> -Justin
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] OpenEXR decoder

2014-03-23 Thread Vittorio Giovara
On Sun, Mar 23, 2014 at 6:55 PM, Justin Ruggles
 wrote:
> On 03/23/2014 11:07 AM, Vittorio Giovara wrote:
>> +// skip any number of 0 until you get to the pixel type
>> +while (bytestream2_get_bytes_left(&ch_gb) > 0 &&
>> +   bytestream2_get_byte(&ch_gb))
>> +continue;
>
> That doesn't do what it says it does.
>

Locally amended to  // skip until you get to a 0

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


[libav-devel] [PATCH] configure: Always use both sysroot and isysroot

2014-03-23 Thread Vittorio Giovara
From: *Carl Eugen Hoyos* 

Hi!

Attached patch simplifies iOS configure lines.

Please comment, Carl Eugen
From 40296347384e5d975885ab94b04956f8ffbd15f7 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 23 Mar 2014 17:57:32 +0100
Subject: [PATCH] Always pass the configure option sysroot to --sysroot and
 -isysroot.

On darwin, --sysroot may be ignored.
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 0b90d7d..70b69f8 100755
--- a/configure
+++ b/configure
@@ -3398,6 +3398,9 @@ if test -n "$sysroot"; then
 gcc|llvm_gcc|clang)
 add_cppflags --sysroot="$sysroot"
 add_ldflags --sysroot="$sysroot"
+# On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
+add_cppflags -isysroot "$sysroot"
+add_ldflags -isysroot "$sysroot"
 ;;
 tms470)
 add_cppflags -I"$sysinclude"
-- 
1.8.5.2 (Apple Git-48)

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

Re: [libav-devel] [PATCH] Announce Release 10

2014-03-23 Thread Tim Walker
On 23 Mar 2014, at 19:25, Anton Khirnov  wrote:

> 
> On Sun, 23 Mar 2014 14:09:29 -0400, Reinhard Tartler  
> wrote:
>> 
>> 
>> +March 23, 2014
>> +
>> +After several months spent finalizing, we are now pleased to announce
>> +the release of Libav "Eks".
> 
> Libav 10
> 
> Looks good to me otherwise.

For consistency with the release/9 announcement, should be:

> we are now pleased to announce the release of Libav 10 "Eks".


Alternatively, we could use:

> we are now pleased to announce the release of Libav 10 (codename "Eks").


…or something similar.

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


Re: [libav-devel] [PATCH] Announce Release 10

2014-03-23 Thread Reinhard Tartler
On Sun, Mar 23, 2014 at 2:25 PM, Anton Khirnov  wrote:
>> diff --git a/src/news b/src/news
>> index 876e818..751321f 100644
>> --- a/src/news
>> +++ b/src/news
>> @@ -1,5 +1,68 @@
>>  News
>>
>> +March 23, 2014
>> +
>> +After several months spent finalizing, we are now pleased to announce
>> +the release of Libav "Eks".
>
> Libav 10
>
> Looks good to me otherwise.

Thanks for the feedback.

pushed.



-- 
regards,
Reinhard
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Announce Release 10

2014-03-23 Thread Anton Khirnov

On Sun, 23 Mar 2014 14:09:29 -0400, Reinhard Tartler  
wrote:
> ---
>  src/download | 26 -
>  src/news | 63 
> 
>  2 files changed, 75 insertions(+), 14 deletions(-)
> 
> diff --git a/src/download b/src/download
> index 21c9891..d32d686 100644
> --- a/src/download
> +++ b/src/download
> @@ -201,23 +201,21 @@ and much faster bug fixes such as additional features 
> and security patches.
>  Libav 10 "Eks"
>  
>  
> -10 beta 2 has been released on 2014-03-14. It is the latest beta snapshot 
> from
> -the version 10 release branch. The final release is not finished yet. Please
> -give us feedback and use our  href="https://bugzilla.libav.org";>Bugzilla
> -for filing bugs.
> +10 has been released on 2014-03-23. Please give us feedback and use
> +our https://bugzilla.libav.org";>Bugzilla for filing bugs.
>  
>  
>  
> -Download XZ tarball  
> -MD5
> -SHA1
> -PGP signature
> -Download gzip 
> tarball  
> -MD5
> -SHA1
> -PGP signature
> -Changelog
> -Release Notes
> +Download XZ tarball  
> +MD5
> +SHA1
> +PGP signature
> +Download gzip tarball  
> +MD5
> +SHA1
> +PGP signature
> +Changelog
> +Release Notes
>  
>  
>  Libav 9 "plain 9"
> diff --git a/src/news b/src/news
> index 876e818..751321f 100644
> --- a/src/news
> +++ b/src/news
> @@ -1,5 +1,68 @@
>  News
>  
> +March 23, 2014
> +
> +After several months spent finalizing, we are now pleased to announce
> +the release of Libav "Eks".

Libav 10

Looks good to me otherwise.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata

2014-03-23 Thread Tim Walker
On 23 Mar 2014, at 18:29, Derek Buitenhuis  wrote:

> On 3/23/2014 5:09 PM, Tim Walker wrote:
>> AFAICT, neither your nor Luca's backport seem to free the context extradata.
> 
> For some reason I was under the impression that it was done automatically.
> 
> - Derek

Looks like it, though an awful lot of encoders free it explicitly anyway.

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


Re: [libav-devel] [PATCH] Announce Release 10

2014-03-23 Thread Vittorio Giovara
On Sun, Mar 23, 2014 at 7:09 PM, Reinhard Tartler  wrote:
> ---
>  src/download | 26 -
>  src/news | 63 
> 
>  2 files changed, 75 insertions(+), 14 deletions(-)
>
> diff --git a/src/download b/src/download
> index 21c9891..d32d686 100644
> --- a/src/download
> +++ b/src/download
> @@ -201,23 +201,21 @@ and much faster bug fixes such as additional features 
> and security patches.
>  Libav 10 "Eks"
>
>  
> -10 beta 2 has been released on 2014-03-14. It is the latest beta snapshot 
> from
> -the version 10 release branch. The final release is not finished yet. Please
> -give us feedback and use our  href="https://bugzilla.libav.org";>Bugzilla
> -for filing bugs.
> +10 has been released on 2014-03-23. Please give us feedback and use
> +our https://bugzilla.libav.org";>Bugzilla for filing bugs.
>  
>
>  
> -Download XZ tarball  
> -MD5
> -SHA1
> -PGP signature
> -Download gzip 
> tarball  
> -MD5
> -SHA1
> -PGP signature
> -Changelog
> -Release Notes
> +Download XZ tarball  
> +MD5
> +SHA1
> +PGP signature
> +Download gzip tarball  
> +MD5
> +SHA1
> +PGP signature
> +Changelog
> +Release Notes
>  
>
>  Libav 9 "plain 9"
> diff --git a/src/news b/src/news
> index 876e818..751321f 100644
> --- a/src/news
> +++ b/src/news
> @@ -1,5 +1,68 @@
>  News
>
> +March 23, 2014
> +
> +After several months spent finalizing, we are now pleased to announce
> +the release of Libav "Eks".
> +
> +
> +
> +One of the main features of this release is the addition of
> +reference-counted data buffers to Libav and their use in various
> +structures. Specifically, the data buffers used by AVPacket
> +and AVFrame can now be reference counted, which should
> +allow to significantly simplify many use cases. In addition,
> +reference-counted AVFrames> can now be used in libavfilter, avoiding the
> +need for a separate libavfilter-specific frame structure. Frames can now
> +be passed straight from the decoders into filters or from filters to
> +encoders.
> +
> +
> +
> +These additions made it necessary to bump the major versions of 
> libavcodec,
> +libavformat, libavdevice, libavfilter,
> +and libavutil, which was accompanied by dropping some old
> +deprecated APIs. These libraries are thus not ABI- or API- compatible
> +with the previous release. All the other libraries (libavresample and
> +libswscale) remain ABI- and API-compatible.
> +
> +
> +
> +Another major point is the inclusion of the HEVC (AKA H.265, the
> +successor of H.264) decoder in the main codebase. It was started in 2012
> +as a Libav Google Summer of Code project by Guillaume Martres and
> +subsequently completed with the assistance of the OpenHEVC project and
> +several Libav developers.
> +
> +
> +
> +As usual, this release also contains support for other new formats, many
> +smaller new features and countless bug fixes. We can highlight
> +a native VP9 decoder, with encoding provided through
> +libvpx, native decoders for WebP, JPEG 2000, and AIC, as well as
> +improved WavPack support with encoding through libwavpack, support for
> +more AAC flavors (LD - low delay, ELD - enhanced low delay),
> +slice multithreading in libavfilter, or muxing chapters in
> +ASF. Furthermore a few new filters have been introduced, namely
> +compand, to change audio dynamics, framepack, to create stereoscopic
> +videos, asetpts, to set audio pts, and interlace, to convert progressive
> +video to interlaced. Finally there is more fine-grained detection of
> +host and target libc, which should allow better portability to various
> +cross compilation scenarios.
> +
> +
> +
> +See the
> + href="http://git.libav.org/?p=libav.git;a=blob;f=Changelog;hb=refs/tags/v10";>Changelog
>  file
> +for a fuller list of significant changes.
> +
> +
> +
> +You can download the new release, as usual,
> +from our download page.
> +
> +
> +
>  March 14, 2014
>  
>  We are happy to update three release branches: Today, we provide you with

LGTM.
And \o/
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Announce Release 10

2014-03-23 Thread Reinhard Tartler
---
 src/download | 26 -
 src/news | 63 
 2 files changed, 75 insertions(+), 14 deletions(-)

diff --git a/src/download b/src/download
index 21c9891..d32d686 100644
--- a/src/download
+++ b/src/download
@@ -201,23 +201,21 @@ and much faster bug fixes such as additional features and 
security patches.
 Libav 10 "Eks"
 
 
-10 beta 2 has been released on 2014-03-14. It is the latest beta snapshot from
-the version 10 release branch. The final release is not finished yet. Please
-give us feedback and use our https://bugzilla.libav.org";>Bugzilla
-for filing bugs.
+10 has been released on 2014-03-23. Please give us feedback and use
+our https://bugzilla.libav.org";>Bugzilla for filing bugs.
 
 
 
-Download XZ tarball  
-MD5
-SHA1
-PGP signature
-Download gzip tarball  
-MD5
-SHA1
-PGP signature
-Changelog
-Release Notes
+Download XZ tarball  
+MD5
+SHA1
+PGP signature
+Download gzip tarball  
+MD5
+SHA1
+PGP signature
+Changelog
+Release Notes
 
 
 Libav 9 "plain 9"
diff --git a/src/news b/src/news
index 876e818..751321f 100644
--- a/src/news
+++ b/src/news
@@ -1,5 +1,68 @@
 News
 
+March 23, 2014
+
+After several months spent finalizing, we are now pleased to announce
+the release of Libav "Eks".
+
+
+
+One of the main features of this release is the addition of
+reference-counted data buffers to Libav and their use in various
+structures. Specifically, the data buffers used by AVPacket
+and AVFrame can now be reference counted, which should
+allow to significantly simplify many use cases. In addition,
+reference-counted AVFrames> can now be used in libavfilter, avoiding the
+need for a separate libavfilter-specific frame structure. Frames can now
+be passed straight from the decoders into filters or from filters to
+encoders.
+
+
+
+These additions made it necessary to bump the major versions of 
libavcodec,
+libavformat, libavdevice, libavfilter,
+and libavutil, which was accompanied by dropping some old
+deprecated APIs. These libraries are thus not ABI- or API- compatible
+with the previous release. All the other libraries (libavresample and
+libswscale) remain ABI- and API-compatible.
+
+
+
+Another major point is the inclusion of the HEVC (AKA H.265, the
+successor of H.264) decoder in the main codebase. It was started in 2012
+as a Libav Google Summer of Code project by Guillaume Martres and
+subsequently completed with the assistance of the OpenHEVC project and
+several Libav developers.
+
+
+
+As usual, this release also contains support for other new formats, many
+smaller new features and countless bug fixes. We can highlight
+a native VP9 decoder, with encoding provided through
+libvpx, native decoders for WebP, JPEG 2000, and AIC, as well as
+improved WavPack support with encoding through libwavpack, support for
+more AAC flavors (LD - low delay, ELD - enhanced low delay),
+slice multithreading in libavfilter, or muxing chapters in
+ASF. Furthermore a few new filters have been introduced, namely
+compand, to change audio dynamics, framepack, to create stereoscopic
+videos, asetpts, to set audio pts, and interlace, to convert progressive
+video to interlaced. Finally there is more fine-grained detection of
+host and target libc, which should allow better portability to various
+cross compilation scenarios.
+
+
+
+See the 
+http://git.libav.org/?p=libav.git;a=blob;f=Changelog;hb=refs/tags/v10";>Changelog
 file
+for a fuller list of significant changes.
+
+
+
+You can download the new release, as usual,
+from our download page.
+
+
+
 March 14, 2014
 
 We are happy to update three release branches: Today, we provide you with
-- 
1.8.3.2

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


Re: [libav-devel] [PATCH] OpenEXR decoder

2014-03-23 Thread Justin Ruggles
On 03/23/2014 11:07 AM, Vittorio Giovara wrote:
> +// skip any number of 0 until you get to the pixel type
> +while (bytestream2_get_bytes_left(&ch_gb) > 0 &&
> +   bytestream2_get_byte(&ch_gb))
> +continue;

That doesn't do what it says it does.

-Justin

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


Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata

2014-03-23 Thread Derek Buitenhuis
On 3/23/2014 5:09 PM, Tim Walker wrote:
> AFAICT, neither your nor Luca's backport seem to free the context extradata.

For some reason I was under the impression that it was done automatically.

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


Re: [libav-devel] [PATCH 1/2] BRender PIX image decoder

2014-03-23 Thread Justin Ruggles
On 03/22/2014 10:54 PM, Vittorio Giovara wrote:
> From: Aleksi Nurmi 
> 
> Further enhancements by Vittorio Giovara and Paul B Mahol.
> 
> Signed-off-by: Vittorio Giovara 
> ---
> I think I addressed all comments.
> Vittorio
> 
>  Changelog   |   1 +
>  doc/general.texi|   2 +
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/brenderpix.c | 288 
> 
>  libavcodec/codec_desc.c |   7 ++
>  libavcodec/version.h|   4 +-
>  libavformat/img2.c  |   1 +
>  9 files changed, 304 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/brenderpix.c

For XRGB you need to go through and make all the alpha opaque since
you're outputting ARGB.

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


Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata

2014-03-23 Thread Tim Walker
On 23 Mar 2014, at 15:36, Derek Buitenhuis  wrote:

> From: Michael Niedermayer 
> 
> This allows muxing properly into Matroska and MP4.
> 
> Signed-off-by: Michael Niedermayer 
> Signed-off-by: Derek Buitenhuis 
> ---
> libavcodec/libx265.c | 13 +++--
> 1 file changed, 11 insertions(+), 2 deletions(-)

AFAICT, neither your nor Luca's backport seem to free the context extradata.

Most (if not all) encoders seem to do this.

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


Re: [libav-devel] [PATCH 2/2] libx265: Only use one memcpy for headers

2014-03-23 Thread Tim Walker
On 23 Mar 2014, at 15:47, Derek Buitenhuis  wrote:

> On 3/23/2014 2:36 PM, Derek Buitenhuis wrote:
>> +memcpy(buf, nal[0].payload, ctx->header_size);
> 
> URG, I forgot to --amend before sending.
> 
> Locally, it is:
> 
>memcpy(ctx->header, nal[0].payload, ctx->header_size);
> 
> - Derek

I'd use nal->payload myself, though I'm not sure which, if any, would be 
preferred.

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


Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata

2014-03-23 Thread Diego Biurrun
On Sun, Mar 23, 2014 at 02:36:06PM +, Derek Buitenhuis wrote:
> From: Michael Niedermayer 
> 
> This allows muxing properly into Matroska and MP4.
> 
> Signed-off-by: Michael Niedermayer 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/libx265.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)

Use just "libx265:" as subject prefix.

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


[libav-devel] [PATCH] RELEASE_NOTES: mention new filters

2014-03-23 Thread Vittorio Giovara
---
 doc/RELEASE_NOTES | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES
index b258e30..478bc1d 100644
--- a/doc/RELEASE_NOTES
+++ b/doc/RELEASE_NOTES
@@ -30,9 +30,12 @@ new features and countless bug fixes. We can highlight a 
native VP9 decoder,
 with encoding provided through libvpx, native decoders for WebP, JPEG 2000, and
 AIC, as well as improved WavPack support with encoding through libwavpack,
 support for more AAC flavors (LD - low delay, ELD - enhanced low delay), slice
-multithreading in libavfilter, or muxing chapters in ASF. Furthermore there is
-more fine-grained detection of host and target libc, which should allow better
-portability to various cross compilation scenarios.
+multithreading in libavfilter, or muxing chapters in ASF. Furthermore a few new
+filters have been introduced, namely compand, to change audio dynamics, 
framepack,
+to create stereoscopic videos, asetpts, to set audio pts, and interlace, to 
convert
+progressive video to interlaced. Finally there is more fine-grained detection 
of
+host and target libc, which should allow better portability to various cross
+compilation scenarios.
 
 See the Changelog file for a fuller list of significant changes.
 
-- 
1.8.3.4 (Apple Git-47)

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


Re: [libav-devel] [PATCH] avcodec: correctly adjust deprecation guards

2014-03-23 Thread Luca Barbato
On 23/03/14 01:29, Vittorio Giovara wrote:
> ---
>  libavcodec/options_table.h |  2 ++
>  libavcodec/utils.c | 10 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 

Probably ok.

lu

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


Re: [libav-devel] [PATCH] Add replaygain side data type and code for parsing replaygain tags.

2014-03-23 Thread Luca Barbato
On 23/03/14 16:13, Anton Khirnov wrote:
> ---
> In the previous iteration I forgot to adapt the gain parsing code to the
> definition of unknown == INT32_MIN. Fixed here.
> ---

Ok.

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


Re: [libav-devel] Libav release 10

2014-03-23 Thread Reinhard Tartler
On Sat, Mar 22, 2014 at 8:45 PM, Vittorio Giovara
 wrote:
> On Sat, Mar 22, 2014 at 7:25 PM, Luca Barbato  wrote:
>> Hi, after enough testing we are confident about being ready to have the
>> first non-beta release for Libav 10 this Sunday.
>>
>> The files will materialize in 24 hours, IF somebody has something he
>> wants in, that's the last call.
>
> The first one fixes compiling lavc with a bumped lavu, the second
> version with a bumped lavc: http://patches.libav.org/patch/48291/ or
> the more complete http://patches.libav.org/patch/48786/
>
> WRT security I only have http://patches.libav.org/patch/48110/ and
> http://patches.libav.org/patch/48044/ left.

AFAIUI, None of them are in master yet. Please make sure that the
commit messages of those patches include a CC: libav-sta...@libav.org
line before pushing them to master.

Otherwise, they indeed seem to be good candidates for release/10

-- 
regards,
Reinhard
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Add replaygain side data type and code for parsing replaygain tags.

2014-03-23 Thread Anton Khirnov
---
In the previous iteration I forgot to adapt the gain parsing code to the
definition of unknown == INT32_MIN. Fixed here.
---
 doc/APIchanges   |7 +++
 libavcodec/avcodec.h |6 ++
 libavcodec/version.h |2 +-
 libavformat/replaygain.c |  154 ++
 libavformat/replaygain.h |   31 ++
 libavutil/Makefile   |1 +
 libavutil/frame.h|4 ++
 libavutil/replaygain.h   |   51 +++
 libavutil/version.h  |2 +-
 9 files changed, 256 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/replaygain.c
 create mode 100644 libavformat/replaygain.h
 create mode 100644 libavutil/replaygain.h

diff --git a/doc/APIchanges b/doc/APIchanges
index 120ba83..afeec8c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,13 @@ libavutil: 2013-12-xx
 
 API changes, most recent first:
 
+2014-02-xx - xxx - lavu 53.07.0 - frame.h, replaygain.h
+  Add AV_FRAME_DATA_REPLAYGAIN for exporting replaygain tags.
+  Add a new header replaygain.h with the AVReplayGain struct.
+
+2014-02-xx - xxx - lavc 55.36.0 - avcodec.h
+  Add AV_PKT_DATA_REPLAYGAIN for exporting replaygain tags.
+
 2014-02-xx - xxx - lavf 55.13.0 - avformat.h
   Add AVStream.side_data and AVStream.nb_side_data for exporting stream-global
   side data (e.g. replaygain tags, video rotation)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a870a2b..4fda36e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -923,6 +923,12 @@ enum AVPacketSideDataType {
  * @endcode
  */
 AV_PKT_DATA_H263_MB_INFO,
+
+/**
+ * This side data should be associated with an audio stream and contains
+ * ReplayGain information in form of the AVReplayGain struct.
+ */
+AV_PKT_DATA_REPLAYGAIN,
 };
 
 typedef struct AVPacketSideData {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d2f80ad..47166f7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 55
-#define LIBAVCODEC_VERSION_MINOR 35
+#define LIBAVCODEC_VERSION_MINOR 36
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/replaygain.c b/libavformat/replaygain.c
new file mode 100644
index 000..cf4dbf8
--- /dev/null
+++ b/libavformat/replaygain.c
@@ -0,0 +1,154 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * replaygain tags parsing
+ */
+
+#include 
+#include 
+#include 
+
+#include "libavutil/avstring.h"
+#include "libavutil/dict.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
+#include "libavutil/replaygain.h"
+
+#include "avformat.h"
+#include "replaygain.h"
+
+static int32_t parse_gain(const char *gain)
+{
+char *fraction;
+int  scale = 1;
+int32_t mb = 0;
+int db;
+
+if (!gain)
+return INT32_MIN;
+
+gain += strspn(gain, " \t");
+
+db = strtol(gain, &fraction, 0);
+if (*fraction++ == '.') {
+while (av_isdigit(*fraction) && scale) {
+mb += scale * (*fraction - '0');
+scale /= 10;
+fraction++;
+}
+}
+
+if (abs(db) > (INT32_MAX - mb) / 10)
+return INT32_MIN;
+
+return db * 10 + FFSIGN(db) * mb;
+}
+
+static uint32_t parse_peak(const uint8_t *peak)
+{
+int64_t val = 0;
+int64_t scale = 1;
+
+if (!peak)
+return 0;
+
+peak += strspn(peak, " \t");
+
+if (peak[0] == '1' && peak[1] == '.')
+return UINT32_MAX;
+else if (!(peak[0] == '0' && peak[1] == '.'))
+return 0;
+
+peak += 2;
+
+while (av_isdigit(*peak)) {
+int digit = *peak - '0';
+
+if (scale > INT64_MAX / 10)
+break;
+
+val= 10 * val + digit;
+scale *= 10;
+
+peak++;
+}
+
+return av_rescale(val, UINT32_MAX, scale);
+}
+
+static int replaygain_export(AVStream *st,
+ const uint8_t *track_gain, const uint8_t 
*track_peak,
+ const uint8_t *album_gain, const uint8_t 
*album_peak)
+{
+AVPacketSideData *sd, *tmp;
+A

Re: [libav-devel] [PATCH 2/2] libx265: Only use one memcpy for headers

2014-03-23 Thread Luca Barbato
On 23/03/14 15:47, Derek Buitenhuis wrote:
> On 3/23/2014 2:36 PM, Derek Buitenhuis wrote:
>> +memcpy(buf, nal[0].payload, ctx->header_size);
> 
> URG, I forgot to --amend before sending.
> 
> Locally, it is:
> 
> memcpy(ctx->header, nal[0].payload, ctx->header_size);
> 

Seems fine.

lu

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


[libav-devel] [PATCH] libx265: Write global extradata when requested

2014-03-23 Thread Luca Barbato
From: Michael Niedermayer 

Matroska, MP4 and other containers do require it.

Signed-off-by: Derek Buitenhuis 
Signed-off-by: Luca Barbato 
---

Review in patch form: the commit message was confusing,
the message about the padding is unnecessary information
(av_malloc itself allocs more bytes than stated in certain
platforms).

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

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index a6e4193..b779c37 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -190,7 +190,7 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 for (i = 0; i < nnal; i++)
 ctx->header_size += nal[i].sizeBytes;

-ctx->header = av_malloc(ctx->header_size);
+ctx->header = av_malloc(ctx->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
 if (!ctx->header) {
 av_log(avctx, AV_LOG_ERROR,
"Cannot allocate HEVC header of size %d.\n", ctx->header_size);
@@ -204,6 +204,14 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 buf += nal[i].sizeBytes;
 }

+if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+avctx->extradata_size = ctx->header_size;
+avctx->extradata  = ctx->header;
+
+ctx->header_size = 0;
+ctx->header  = NULL;
+}
+
 return 0;
 }

--
1.8.5.2 (Apple Git-48)

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


Re: [libav-devel] [PATCH 3/9] Add replaygain side data type and code for parsing replaygain tags.

2014-03-23 Thread Anton Khirnov

On Fri, 21 Mar 2014 11:28:54 +0100, Alessandro Ghedini  
wrote:
> On gio, mar 20, 2014 at 08:11:33 +0100, Anton Khirnov wrote:
> > 
> > On Tue, 18 Mar 2014 19:19:16 +0100, Alessandro Ghedini 
> >  wrote:
> > > On mar, mar 18, 2014 at 06:26:42 +0100, Anton Khirnov wrote:
> > > > +int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
> > > > +{
> > > > +const AVDictionaryEntry *tg, *tp, *ag, *ap;
> > > > +
> > > > +tg = av_dict_get(metadata, "REPLAYGAIN_TRACK_GAIN", NULL, 0);
> > > > +tp = av_dict_get(metadata, "REPLAYGAIN_TRACK_PEAK", NULL, 0);
> > > > +ag = av_dict_get(metadata, "REPLAYGAIN_ALBUM_GAIN", NULL, 0);
> > > > +ap = av_dict_get(metadata, "REPLAYGAIN_ALBUM_PEAK", NULL, 0);
> > > > +
> > > > +return replaygain_export(st,
> > > > + tg ? tg->value : NULL,
> > > > + tp ? tp->value : NULL,
> > > > + ag ? ag->value : NULL,
> > > > + ap ? ap->value : NULL);
> > > 
> > > I was wondering if it'd be possible to make this support LAME's XING/Info
> > > header as well, or better, make this so that it'd be possible to add 
> > > support
> > > for the XING thing later if one wanted to do so.
> > > 
> > > With the proposed interface the information from the LAME header would 
> > > need to
> > > be added directly to the stream metadata (from mp3dec.c I'd imagine) as
> > > REPLAYGAIN_* tags (e.g. if they are not present already), but I'm not 
> > > sure if
> > > that would be acceptable.
> > 
> > No need to go through metadata I think, we could adapt the internal API 
> > directly
> > for this. Shouldn't be very hard to do.
> 
> Ok, so this is what I've come up with:
> 
> * Make replaygain_export() take numbers (int32_t or whatever) directly
> * Move the parse_*() calls to ff_replaygain_export()
> * Export replaygain_export() in replaygain.h as well.
> * Maybe rename ff_replaygain_export() to ff_replaygain_metadata_export()?
> * Maybe rename replaygain_export() to ff_replaygain_export()?
> 
> So basically, one would normally still call ff_replaygain_export() for the
> "default" metadata parsing, but if custom decoding is needed (like in the case
> of LAME), replaygain_export() would be called directly with the values already
> decoded, so that the AV_PKT_DATA_REPLAYGAIN creation is not duplicated.
> 
> I'm still not sure what to do in the case where both LAME header and
> REPLAYGAIN_* tags are present (not sure if it makes a lot of sense to have
> multiple AV_PKT_DATA_REPLAYGAIN, though I guess it wouldn't hurt either).
> 

It would hurt actually, we do not allow duplicate side data of the same type.
The demuxer will just have to pick one (or perhaps make it a private option)

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] libx265: Only use one memcpy for headers

2014-03-23 Thread Derek Buitenhuis
On 3/23/2014 2:36 PM, Derek Buitenhuis wrote:
> +memcpy(buf, nal[0].payload, ctx->header_size);

URG, I forgot to --amend before sending.

Locally, it is:

memcpy(ctx->header, nal[0].payload, ctx->header_size);

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


[libav-devel] [PATCH 2/2] libx265: Only use one memcpy for headers

2014-03-23 Thread Derek Buitenhuis
They're guaranteed by the x265 API to be contiguous in memory.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/libx265.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 1cc1d71..d4b7b46 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -80,7 +80,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
 {
 libx265Context *ctx = avctx->priv_data;
 x265_nal *nal;
-uint8_t *buf;
 int sar_num, sar_den;
 int nnal;
 int ret;
@@ -199,11 +198,7 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 return AVERROR(ENOMEM);
 }
 
-buf = ctx->header;
-for (i = 0; i < nnal; i++) {
-memcpy(buf, nal[i].payload, nal[i].sizeBytes);
-buf += nal[i].sizeBytes;
-}
+memcpy(buf, nal[0].payload, ctx->header_size);
 
 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
 avctx->extradata_size = ctx->header_size;
-- 
1.9.0

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


[libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata

2014-03-23 Thread Derek Buitenhuis
From: Michael Niedermayer 

This allows muxing properly into Matroska and MP4.

Signed-off-by: Michael Niedermayer 
Signed-off-by: Derek Buitenhuis 
---
 libavcodec/libx265.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index a6e4193..1cc1d71 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -190,10 +190,11 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 for (i = 0; i < nnal; i++)
 ctx->header_size += nal[i].sizeBytes;
 
-ctx->header = av_malloc(ctx->header_size);
+ctx->header = av_malloc(ctx->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
 if (!ctx->header) {
 av_log(avctx, AV_LOG_ERROR,
-   "Cannot allocate HEVC header of size %d.\n", ctx->header_size);
+   "Cannot allocate HEVC header of size %d (%d with padding).\n",
+   ctx->header_size, ctx->header_size + 
FF_INPUT_BUFFER_PADDING_SIZE);
 libx265_encode_close(avctx);
 return AVERROR(ENOMEM);
 }
@@ -204,6 +205,14 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 buf += nal[i].sizeBytes;
 }
 
+if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+avctx->extradata_size = ctx->header_size;
+avctx->extradata  = ctx->header;
+
+ctx->header_size = 0;
+ctx->header  = NULL;
+}
+
 return 0;
 }
 
-- 
1.9.0

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


Re: [libav-devel] [PATCH] PAF demuxer and decoder

2014-03-23 Thread Luca Barbato
On 23/03/14 10:41, Vittorio Giovara wrote:
> From: Paul B Mahol 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: Luca Barbato 
> ---
> With a saner audio section now.
> Vittorio
> 

Fine for me.

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


Re: [libav-devel] [PATCH] vf_scale: use cached swscale context

2014-03-23 Thread Janne Grunau
On 2014-03-22 14:38:53 +0100, Vittorio Giovara wrote:
> On Tuesday, March 18, 2014, Luca Barbato  wrote:
> 
> > On 12/03/14 18:27, Vittorio Giovara wrote:
> > > ---
> > >  libavfilter/vf_scale.c | 20 +++-
> > >  1 file changed, 7 insertions(+), 13 deletions(-)
> >
> > I'm not sure we want to have a scaler for same-pixel-same-size frames.
> >
> 
> This function will allocate a different context (and release the old
> one) only if the parameters change.

The point Luca was trying to make is that you're removing:

| -if (inlink->w == outlink->w && inlink->h == outlink->h &&
| -inlink->format == outlink->format)
| -scale->sws = NULL;

which avoids scaling if input and output format and size are identical.

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


Re: [libav-devel] [PATCH] PAF demuxer and decoder

2014-03-23 Thread Kostya Shishkov
On Sun, Mar 23, 2014 at 10:41:30AM +0100, Vittorio Giovara wrote:
> From: Paul B Mahol 
> 
> Signed-off-by: Vittorio Giovara 
> Signed-off-by: Luca Barbato 
> ---
> With a saner audio section now.
> Vittorio
> 
>  Changelog|   1 +
>  doc/general.texi |   4 +
>  libavcodec/Makefile  |   2 +
>  libavcodec/allcodecs.c   |   2 +
>  libavcodec/avcodec.h |   2 +
>  libavcodec/codec_desc.c  |  14 ++
>  libavcodec/paf.c | 449 
> +++
>  libavcodec/version.h |   4 +-
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/paf.c| 267 
>  libavformat/version.h|   2 +-
>  12 files changed, 746 insertions(+), 3 deletions(-)
>  create mode 100644 libavcodec/paf.c
>  create mode 100644 libavformat/paf.c

at least I don't have more nits
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] PAF demuxer and decoder

2014-03-23 Thread Vittorio Giovara
From: Paul B Mahol 

Signed-off-by: Vittorio Giovara 
Signed-off-by: Luca Barbato 
---
With a saner audio section now.
Vittorio

 Changelog|   1 +
 doc/general.texi |   4 +
 libavcodec/Makefile  |   2 +
 libavcodec/allcodecs.c   |   2 +
 libavcodec/avcodec.h |   2 +
 libavcodec/codec_desc.c  |  14 ++
 libavcodec/paf.c | 449 +++
 libavcodec/version.h |   4 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/paf.c| 267 
 libavformat/version.h|   2 +-
 12 files changed, 746 insertions(+), 3 deletions(-)
 create mode 100644 libavcodec/paf.c
 create mode 100644 libavformat/paf.c

diff --git a/Changelog b/Changelog
index 5c67e11..185fb5e 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version :
 - libx265 encoder
 - shuffleplanes filter
+- Amazing Studio PAF playback support
 
 
 version 10:
diff --git a/doc/general.texi b/doc/general.texi
index 8c0cb1b..dd71ca1 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -179,6 +179,8 @@ library:
 @item American Laser Games MM   @tab   @tab X
 @tab Multimedia format used in games like Mad Dog McCree.
 @item 3GPP AMR  @tab X @tab X
+@item Amazing Studio Packed Animation File  @tab   @tab X
+@tab Multimedia format used in game Heart Of Darkness.
 @item Apple HTTP Live Streaming @tab   @tab X
 @item ASF   @tab X @tab X
 @item AVI   @tab X @tab X
@@ -486,6 +488,7 @@ following image formats are supported:
 @item 8SVX fibonacci @tab @tab  X
 @item A64 multicolor @tab  X  @tab
 @tab Creates video suitable to be played on a commodore 64 (multicolor 
mode).
+@item Amazing Studio PAF Video @tab @tab  X
 @item American Laser Games MM  @tab@tab X
 @tab Used in games like Mad Dog McCree.
 @item AMV Video  @tab @tab  X
@@ -774,6 +777,7 @@ following image formats are supported:
 @tab encoding supported through external library libopencore-amrnb
 @item AMR-WB @tab  E  @tab  X
 @tab encoding supported through external library libvo-amrwbenc
+@item Amazing Studio PAF Audio @tab @tab  X
 @item Apple lossless audio   @tab  X  @tab  X
 @tab QuickTime fourcc 'alac'
 @item ATRAC1 @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3d178a1..0c234a8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -271,6 +271,8 @@ OBJS-$(CONFIG_MXPEG_DECODER)   += mxpegdec.o
 OBJS-$(CONFIG_NELLYMOSER_DECODER)  += nellymoserdec.o nellymoser.o
 OBJS-$(CONFIG_NELLYMOSER_ENCODER)  += nellymoserenc.o nellymoser.o
 OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
+OBJS-$(CONFIG_PAF_VIDEO_DECODER)   += paf.o
+OBJS-$(CONFIG_PAF_AUDIO_DECODER)   += paf.o
 OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o
 OBJS-$(CONFIG_PAM_ENCODER) += pamenc.o
 OBJS-$(CONFIG_PBM_DECODER) += pnmdec.o pnm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ed6d7ff..0e3dc9e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -198,6 +198,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(MTS2,  mts2);
 REGISTER_DECODER(MXPEG, mxpeg);
 REGISTER_DECODER(NUV,   nuv);
+REGISTER_DECODER(PAF_VIDEO, paf_video);
 REGISTER_ENCDEC (PAM,   pam);
 REGISTER_ENCDEC (PBM,   pbm);
 REGISTER_ENCDEC (PCX,   pcx);
@@ -319,6 +320,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(MPC7,  mpc7);
 REGISTER_DECODER(MPC8,  mpc8);
 REGISTER_ENCDEC (NELLYMOSER,nellymoser);
+REGISTER_DECODER(PAF_AUDIO, paf_audio);
 REGISTER_DECODER(QCELP, qcelp);
 REGISTER_DECODER(QDM2,  qdm2);
 REGISTER_ENCDEC (RA_144,ra_144);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7beb277..55e2d05 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -284,6 +284,7 @@ enum AVCodecID {
 AV_CODEC_ID_HNM4_VIDEO,
 AV_CODEC_ID_HEVC,
 AV_CODEC_ID_FIC,
+AV_CODEC_ID_PAF_VIDEO,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
@@ -432,6 +433,7 @@ enum AVCodecID {
 AV_CODEC_ID_COMFORT_NOISE,
 AV_CODEC_ID_TAK,
 AV_CODEC_ID_METASOUND,
+AV_CODEC_ID_PAF_AUDIO,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 2ad5326..85cc4f1 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1092,6 +1092,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name =