[FFmpeg-devel] [PATCH 4/4] nvenc: Try and do interlaced encoding.

2015-01-05 Thread Philip Langdale
Doesn't work.

Signed-off-by: Philip Langdale 
---
 libavcodec/libnvenc.c  | 7 +++
 libavcodec/libnvenc.h  | 3 +++
 libavcodec/nvencoder.c | 6 --
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libnvenc.c b/libavcodec/libnvenc.c
index 3c64234..83587a6 100644
--- a/libavcodec/libnvenc.c
+++ b/libavcodec/libnvenc.c
@@ -189,6 +189,9 @@ static av_cold int ff_libnvenc_init(AVCodecContext *avctx)
 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
 nvenc_ctx->nvenc_cfg.enableRepeatSPSPPS = 0;
 
+if (avctx->flags & CODEC_FLAG_INTERLACED_DCT)
+nvenc_ctx->nvenc_cfg.interlaced = 1;
+
 // Allocate list of x264 options
 x264_argc = 0;
 x264_argv = av_calloc(255, sizeof(char*));
@@ -299,6 +302,10 @@ static int ff_libnvenc_encode(AVCodecContext *avctx, 
AVPacket *pkt, const AVFram
 nvenc_frame.width  = avctx->width;
 nvenc_frame.height = avctx->height;
 nvenc_frame.format = map_avpixfmt_bufferformat(avctx->pix_fmt);
+if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
+nvenc_frame.interlaced = 1;
+nvenc_frame.top_field_first = frame->top_field_first;
+}
 }
 
 // Setup output
diff --git a/libavcodec/libnvenc.h b/libavcodec/libnvenc.h
index 63b5d67..76cb379 100644
--- a/libavcodec/libnvenc.h
+++ b/libavcodec/libnvenc.h
@@ -91,6 +91,7 @@ typedef struct nvenc_cfg_t
 uint32_tsliceMode;
 uint32_tsliceModeData;
 uint32_tdisableDeblockingFilterIDC;
+boolinterlaced;
 
 // x264-style list of options
 char  **x264_paramv;
@@ -112,6 +113,8 @@ typedef struct nvenc_frame_t
 uint32_tframe_type;
 boolforce_idr;
 boolforce_intra;
+boolinterlaced;
+booltop_field_first;
 } nvenc_frame_t;
 
 /**
diff --git a/libavcodec/nvencoder.c b/libavcodec/nvencoder.c
index 2135f55..198ee09 100644
--- a/libavcodec/nvencoder.c
+++ b/libavcodec/nvencoder.c
@@ -478,7 +478,7 @@ static bool initialize(nvencoder_t *nvenc, nvenc_cfg_t 
*nvenc_cfg)
 nvenc->config.profileGUID   = map_profile(nvenc_cfg->profile);
 nvenc->config.gopLength = nvenc_cfg->gopLength;
 nvenc->config.frameIntervalP= 1 + nvenc_cfg->numBFrames;
-nvenc->config.frameFieldMode= 
NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME;
+nvenc->config.frameFieldMode= nvenc_cfg->interlaced ? 
NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD : NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME;
 nvenc->config.mvPrecision   = NV_ENC_MV_PRECISION_QUARTER_PEL;
 
 //NV_ENC_CODEC_CONFIG rate-control
@@ -563,7 +563,9 @@ static bool encode_frame(nvencoder_t *nvenc, nvenc_frame_t 
*nvenc_frame, bool *o
 pic_params.inputBuffer = nvenc->i_buffer[nvenc->current_i % 
MAX_BUFFERS];
 pic_params.outputBitstream = nvenc->o_buffer[nvenc->current_o % 
MAX_BUFFERS];
 pic_params.bufferFmt   = nvenc->buffer_fmt;
-pic_params.pictureStruct   = NV_ENC_PIC_STRUCT_FRAME;
+pic_params.pictureStruct   = nvenc_frame->interlaced ?
+ nvenc_frame->top_field_first ? 
NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM : NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP :
+ NV_ENC_PIC_STRUCT_FRAME;
 pic_params.frameIdx= nvenc_frame->frame_idx;
 if (nvenc_frame->force_idr)
 pic_params.encodePicFlags |= NV_ENC_PIC_FLAG_FORCEIDR;
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 2/4] Set bdirect mode

2015-01-05 Thread Philip Langdale
Signed-off-by: Philip Langdale 
---
 libavcodec/libnvenc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/libavcodec/libnvenc.c b/libavcodec/libnvenc.c
index 6ba150e..3c64234 100644
--- a/libavcodec/libnvenc.c
+++ b/libavcodec/libnvenc.c
@@ -208,6 +208,23 @@ static av_cold int ff_libnvenc_init(AVCodecContext *avctx)
 OPT_NUMSTR("nal_hrd", nvenc_ctx->nal_hrd);
 OPT_NUMSTR("8x8dct", nvenc_ctx->dct8x8);
 
+switch (nvenc_ctx->direct_pred) {
+case 0:
+  nvenc_ctx->nvenc_cfg.bdirectMode = 1;
+  break;
+case 1:
+  nvenc_ctx->nvenc_cfg.bdirectMode = 3;
+  break;
+case 2:
+  nvenc_ctx->nvenc_cfg.bdirectMode = 2;
+  break;
+case 3:
+  nvenc_ctx->nvenc_cfg.bdirectMode = 0;
+  break;
+default:
+  break;
+}
+
 // x264-style extra parameters
 if (nvenc_ctx->x264_params) {
 AVDictionary *param_dict = NULL;
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 3/4] Implement b frame support.

2015-01-05 Thread Philip Langdale
To support b frames, we need to implement a queue of buffers, so that
frames can be held, pending their future reference frames. The nvenc
docs say that we need (num b frames) + 4 buffers, and the maximum
number of b frames is 16, so we need 20 buffers.

While we could allocate them dynamically, it's a small enough quantity
that static allocation and a poor man's circular queue are sufficient.

Note that we need to aggressively fetch output frames on every
iteration to avoid falling behind - as every b frame will have delayed
output.

Signed-off-by: Philip Langdale 
---
 libavcodec/nvencoder.c | 86 +++---
 libavcodec/nvencoder.h |  9 --
 2 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/libavcodec/nvencoder.c b/libavcodec/nvencoder.c
index f1d432f..2135f55 100644
--- a/libavcodec/nvencoder.c
+++ b/libavcodec/nvencoder.c
@@ -384,24 +384,26 @@ static bool allocate_io(nvencoder_t *nvenc)
 create_input_buffer.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_UNCACHED;
 create_input_buffer.bufferFmt  = nvenc->buffer_fmt;
 
-nvenc_status = nvenc->api.nvEncCreateInputBuffer(nvenc->inst, 
&create_input_buffer);
-if (nvenc_status == NV_ENC_SUCCESS)
-{
-nvenc->i_buffer = create_input_buffer.inputBuffer;
-create_input_buffer.inputBuffer = NULL;
-}
-
-// Output buffer
-memset(&create_bitstream_buffer, 0, sizeof(create_bitstream_buffer));
-create_bitstream_buffer.version= NV_ENC_CREATE_BITSTREAM_BUFFER_VER;
-create_bitstream_buffer.size   = nvenc->init_params.maxEncodeWidth * 
nvenc->init_params.maxEncodeHeight;
-create_bitstream_buffer.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED;
-
-nvenc_status = nvenc->api.nvEncCreateBitstreamBuffer(nvenc->inst, 
&create_bitstream_buffer);
-if (nvenc_status == NV_ENC_SUCCESS)
-{
-nvenc->o_buffer = create_bitstream_buffer.bitstreamBuffer;
-create_bitstream_buffer.bitstreamBuffer = NULL;
+// Output buffers
+for (uint32_t i = 0; i < MAX_BUFFERS; i++) {
+  nvenc_status = nvenc->api.nvEncCreateInputBuffer(nvenc->inst, 
&create_input_buffer);
+  if (nvenc_status == NV_ENC_SUCCESS)
+  {
+  nvenc->i_buffer[i] = create_input_buffer.inputBuffer;
+  create_input_buffer.inputBuffer = NULL;
+  }
+
+  memset(&create_bitstream_buffer, 0, sizeof(create_bitstream_buffer));
+  create_bitstream_buffer.version= NV_ENC_CREATE_BITSTREAM_BUFFER_VER;
+  create_bitstream_buffer.size   = nvenc->init_params.maxEncodeWidth * 
nvenc->init_params.maxEncodeHeight;
+  create_bitstream_buffer.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED;
+
+  nvenc_status = nvenc->api.nvEncCreateBitstreamBuffer(nvenc->inst, 
&create_bitstream_buffer);
+  if (nvenc_status == NV_ENC_SUCCESS)
+  {
+  nvenc->o_buffer[i] = create_bitstream_buffer.bitstreamBuffer;
+  create_bitstream_buffer.bitstreamBuffer = NULL;
+  }
 }
 
 return true;
@@ -410,17 +412,18 @@ static bool allocate_io(nvencoder_t *nvenc)
 static void deallocate_io(nvencoder_t *nvenc)
 {
 // Output buffer
-if (nvenc->o_buffer)
-{
-nvenc->api.nvEncDestroyBitstreamBuffer(nvenc->inst, nvenc->o_buffer);
-nvenc->o_buffer = NULL;
-}
-
-// Input buffer
-if (nvenc->i_buffer)
-{
-nvenc->api.nvEncDestroyInputBuffer(nvenc->inst, nvenc->i_buffer);
-nvenc->i_buffer = NULL;
+for (uint32_t i = 0; i < MAX_BUFFERS; i++) {
+  if (nvenc->o_buffer[i])
+  {
+  nvenc->api.nvEncDestroyBitstreamBuffer(nvenc->inst, 
nvenc->o_buffer[i]);
+  nvenc->o_buffer[i] = NULL;
+  }
+  // Input buffer
+  if (nvenc->i_buffer[i])
+  {
+  nvenc->api.nvEncDestroyInputBuffer(nvenc->inst, nvenc->i_buffer[i]);
+  nvenc->i_buffer[i] = NULL;
+  }
 }
 }
 
@@ -557,8 +560,8 @@ static bool encode_frame(nvencoder_t *nvenc, nvenc_frame_t 
*nvenc_frame, bool *o
 pic_params.version = NV_ENC_PIC_PARAMS_VER;
 pic_params.inputWidth  = nvenc_frame->width;
 pic_params.inputHeight = nvenc_frame->height;
-pic_params.inputBuffer = nvenc->i_buffer;
-pic_params.outputBitstream = nvenc->o_buffer;
+pic_params.inputBuffer = nvenc->i_buffer[nvenc->current_i % 
MAX_BUFFERS];
+pic_params.outputBitstream = nvenc->o_buffer[nvenc->current_o % 
MAX_BUFFERS];
 pic_params.bufferFmt   = nvenc->buffer_fmt;
 pic_params.pictureStruct   = NV_ENC_PIC_STRUCT_FRAME;
 pic_params.frameIdx= nvenc_frame->frame_idx;
@@ -572,11 +575,15 @@ static bool encode_frame(nvencoder_t *nvenc, 
nvenc_frame_t *nvenc_frame, bool *o
 if (nvenc_status == NV_ENC_SUCCESS)
 {
 *output = true;
+nvenc->current_i++;
+nvenc->current_o++;
 return true;
 }
 if (nvenc_status == NV_ENC_ERR_NEED_MORE_INPUT)
 {
 *output = false;
+nve

[FFmpeg-devel] [PATCH 0/4] Improvements the nvidia's nvenc implementation

2015-01-05 Thread Philip Langdale
As promised, here are my current stack of improvements over the base
implementation. The interlacing one is probably pointless as the hardware
doesn't seem to support it, but you'll know better than me.

And hopefully you can explain the black magic in the DAR calculation.

Philip Langdale (4):
  Correctly set Display Aspect Ratio in nvenc.
  Set bdirect mode
  Implement b frame support.
  nvenc: Try and do interlaced encoding.

 libavcodec/libnvenc.c  |  26 +
 libavcodec/libnvenc.h  |   5 +++
 libavcodec/nvencoder.c | 100 ++---
 libavcodec/nvencoder.h |   9 -
 4 files changed, 92 insertions(+), 48 deletions(-)

-- 
2.1.0

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


[FFmpeg-devel] [PATCH 1/4] Correctly set Display Aspect Ratio in nvenc.

2015-01-05 Thread Philip Langdale
The encoder writes the display aspect ratio into the output frames, which a
good player will respect, so let's make sure it's correct.

The 1.02 scale factor is black magic, but produces correct results. I don't
know what nvenc is doing.

Signed-off-by: Philip Langdale 
---
 libavcodec/libnvenc.c  | 2 ++
 libavcodec/libnvenc.h  | 2 ++
 libavcodec/nvencoder.c | 8 
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libnvenc.c b/libavcodec/libnvenc.c
index d81e04a..6ba150e 100644
--- a/libavcodec/libnvenc.c
+++ b/libavcodec/libnvenc.c
@@ -129,6 +129,8 @@ static av_cold int ff_libnvenc_init(AVCodecContext *avctx)
 // Basic
 nvenc_ctx->nvenc_cfg.width= avctx->width;
 nvenc_ctx->nvenc_cfg.height   = avctx->height;
+nvenc_ctx->nvenc_cfg.darWidth = 1024 * avctx->width * 
avctx->sample_aspect_ratio.num / avctx->sample_aspect_ratio.den;
+nvenc_ctx->nvenc_cfg.darHeight= 1024 * avctx->height * 1.02;
 nvenc_ctx->nvenc_cfg.frameRateNum = avctx->time_base.den;
 nvenc_ctx->nvenc_cfg.frameRateDen = avctx->time_base.num * 
avctx->ticks_per_frame;
 
diff --git a/libavcodec/libnvenc.h b/libavcodec/libnvenc.h
index 42718a2..63b5d67 100644
--- a/libavcodec/libnvenc.h
+++ b/libavcodec/libnvenc.h
@@ -48,6 +48,8 @@ typedef struct nvenc_cfg_t
 // Basic
 uint32_twidth;
 uint32_theight;
+uint32_tdarWidth;
+uint32_tdarHeight;
 uint32_tframeRateNum;
 uint32_tframeRateDen;
 
diff --git a/libavcodec/nvencoder.c b/libavcodec/nvencoder.c
index 06eb68b..f1d432f 100644
--- a/libavcodec/nvencoder.c
+++ b/libavcodec/nvencoder.c
@@ -517,8 +517,8 @@ static bool initialize(nvencoder_t *nvenc, nvenc_cfg_t 
*nvenc_cfg)
 nvenc->init_params.presetGUID = NV_ENC_PRESET_HQ_GUID;
 nvenc->init_params.encodeWidth= nvenc_cfg->width;
 nvenc->init_params.encodeHeight   = nvenc_cfg->height;
-nvenc->init_params.darWidth   = nvenc_cfg->width;
-nvenc->init_params.darHeight  = nvenc_cfg->height;
+nvenc->init_params.darWidth   = nvenc_cfg->darWidth;
+nvenc->init_params.darHeight  = nvenc_cfg->darHeight;
 nvenc->init_params.frameRateNum   = nvenc_cfg->frameRateNum;
 nvenc->init_params.frameRateDen   = nvenc_cfg->frameRateDen;
 nvenc->init_params.enableEncodeAsync  = 0;
@@ -696,8 +696,8 @@ static bool reconfig(nvencoder_t *nvenc, nvenc_cfg_t 
*nvenc_cfg)
 // Update initial encoder parameters that likely changed
 nvenc->init_params.encodeWidth  = nvenc_cfg->width;
 nvenc->init_params.encodeHeight = nvenc_cfg->height;
-nvenc->init_params.darWidth = nvenc_cfg->width;
-nvenc->init_params.darWidth = nvenc_cfg->height;
+nvenc->init_params.darWidth = nvenc_cfg->darWidth;
+nvenc->init_params.darHeight= nvenc_cfg->darHeight;
 nvenc->init_params.frameRateNum = nvenc_cfg->frameRateNum;
 nvenc->init_params.frameRateDen = nvenc_cfg->frameRateDen;
 nvenc->init_params.encodeConfig->rcParams.averageBitRate = 
nvenc_cfg->avgBitRate;
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_idet: Add analyze_interlaced_flag mode

2015-01-05 Thread tim nicholson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 05/01/15 16:57, Michael Niedermayer wrote:
> On Mon, Jan 05, 2015 at 01:00:41PM +, tim nicholson wrote:
>> On 01/01/15 01:56, Michael Niedermayer wrote:
>>> This should allow us to insert idet before scale and let scale have 
>>> interl=-1 as default in that case
>>
>> Good thinking.
>>
>> How would interl=-1 then get set as default for auto inserted filters.
>> Or did I miss something?
> 
> it maybe could be set when the filter togeter with idet is inserted
> i havnt implemented that yet though, idet doesnt support every format
> that scale supports so it cant be done unconditionally
> 

Ahh, right.

Am I correct in thinking that currently there is no command line way to
globally override the default (interl=0) so that any auto inserted
filters use the required settings? I see nothing in sws_flags.

I am sort of thinking of a kind of partial implementation workaround
where a file is probed and the command line auto constructed based on
what is found, then provided the format is OK the default can be
changed. This would also be useful in all sorts of other ways when auto
inserted filters are likely.

> [...]



- -- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBCAAGBQJUq5BuAAoJEAwL/ESLC/yDK0YIAIa1jjr9i8k9krY5HhNi7L05
YQrjDZMHZ+35D+sMgeX1/4M/tKNT09bhKhY0YFwIf2v5IDNpGCq7NjfOLuoTntSt
P/KFlij9J3zjIhs/nqNt/oKBQRF1ZbFYaQlszeNk84DONHT9qNxODgL959tRpJIx
sepbuJQfYMJcIYwuggGk3UR04iO/IFdqSABJfuuuQGNehuLPS7m0LnYbZ1Tjtco9
YvDQOJduMiZ96lV6EZDZSb/wxYiyHQWRu2qBcdlkQSpjzOV1qR28DOzcYO+ebDSf
Z4phc8j97vuiHrr+YAQSVXG0B3+/avfWIRFq3oh+rFnW0T5WqcgeDYqGh/O5VT4=
=gWUO
-END PGP SIGNATURE-
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: read project_name metadata

2015-01-05 Thread Clément Bœsch
On Mon, Jan 05, 2015 at 04:53:05PM -0800, Mark Reid wrote:
> Hi,
> MXF files generated by Media Composer or LibMXF can contain a
> project name property in the Preface. Lots of existing samples have them.
> 
> http://samples.ffmpeg.org/MXF/issue2160/PW0805A0V01.4C5B5636.EFA330.mxf
> project_name: DNX145 PW Test
> 
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3450/WriteAvidMXFgenerated/5502_0010_v1.mxf
> project_name: Rombus
> 
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3100/1sec_mxf_test_Video5270C795.mxf
> project_name: NVB_DOOD
> 
> i can also provide more samples if needed.
> 
> ---
>  libavformat/mxfdec.c | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 4715169..23d9c73 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -279,6 +279,7 @@ static const uint8_t mxf_encrypted_triplet_key[]  
>  = { 0x06,0x0e,0x2b,0x
>  static const uint8_t mxf_encrypted_essence_container[] = { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00
>  };
>  static const uint8_t mxf_random_index_pack_key[]   = { 
> 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00
>  };
>  static const uint8_t mxf_sony_mpeg4_extradata[]= { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00
>  };
> +static const uint8_t mxf_avid_project_name[]   = { 
> 0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf
>  };
>  
>  #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
>  
> @@ -2087,6 +2088,19 @@ static int mxf_read_identification_metadata(void *arg, 
> AVIOContext *pb, int tag,
>  return 0;
>  }
>  
> +static int mxf_read_preface_metadata(void *arg, AVIOContext *pb, int tag, 
> int size, UID uid, int64_t klv_offset)
> +{
> +MXFContext *mxf = arg;
> +AVFormatContext *s = mxf->fc;
> +int ret;
> +char *str = NULL;
> +
> +if (tag >= 0x8000 && (IS_KLV_KEY(uid, mxf_avid_project_name))) {
> +SET_STR_METADATA(pb, "project_name", str);
> +}
> +return 0;
> +}
> +

Would it make sense to use "title"? (That's the internal metadata name we
use to re-map automatically in a bunch of other formats).

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-05 Thread Anshul Maheshwari
On Tue, Jan 6, 2015 at 5:47 AM, Michael Niedermayer 
wrote:

> On Mon, Jan 05, 2015 at 06:20:15PM +0530, Anshul wrote:
> > On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> > > the table is constant and does not change, theres no need to have
> > > a copy of it in each context or to "make it every time decode is
> > > called"
> > > a simple static uint8_t parity_table[256];
> > > or even
> > > static const uint8_t parity_table[256] = {...}
> > >
> > done
> >  +int row_cnt;
> >  +struct Screen screen[2];
> >  +int active_screen;
> >  +uint8_t cursor_row;
> >  +uint8_t cursor_column;
> >  +AVBPrint buffer;
> >  +int erase_display_memory;
> >  +int rollup;
> >  +enum  cc_mode mode;
> >  +int64_t start_time;
> >  +/* visible screen time */
> >  +int64_t startv_time;
> >  +int64_t end_time;
> >  +char prev_cmd[2];
> >  +/* buffer to store pkt data */
> >  +AVBufferRef *pktbuf;
> > >>> as you memcopy the data each time, theres no need for a AVBufferRef
> > >>> a simple uint8_t * would do the same
> > >>> but i think not even that is needed,
> > >>> all uses of the data go through process_cc608() it would be
> > >>> very simply to strip one bit in the arguments there, so no rewriting
> > >>> of the table would be needed
> > >>>
> > >>> [...]
> > >> cant do that, for error resistance we need to escape 1st byte
> > >> if parity does not match, for escaping I write 0x7f instead of
> > >> whatever data is. Some closed caption insert-er don't care much for
> parity
> > >> when they are not using the data.
> > >>
> > >> I was using AVBufferRef instead of uint8_t * , so that I don't have to
> > >> take care for length,
> > >> and length and data are in one context. and there is already lot of
> > >> error handling is
> > >> done while realloc, means I don't have to copy buffer pointer
> somewhere,
> > >> if realloc fails.
> > >> and in future if someone want to make data channel 1  and data
> channel 2
> > >> to be processed
> > >> in parallel,  then he may use reference thing too.
> > >> still its my opinion, if you think uint8_t will have better
> performance,
> > >> I will change it to that.
> > > if you prefer AVBufferRef, feel free to keep using it, i dont think
> > > its the optimal choice though.
> > >
> > > Also isnt there some maximum size for these buffers ?
> > > (this would allow using a fixed size buffer and avoid the need for
> > >  dealing with allocation failures)
> > >
> > There is nothing similar inside spec cc608. since its line 21 data,
> > there must
> > be something in vertical ancillary specification. I have to search for
> > that spec.
> > if you can find about max limit of vanc packet, then ccaption can not
> > exceed
> > with that.
> >  +static void handle_char(CCaptionSubContext *ctx, char hi, char lo,
> int64_t pts)
> >  +{
> >  +struct Screen *screen = get_writing_screen(ctx);
> >  +char *row = screen->characters[ctx->cursor_row] +
> ctx->cursor_column;
> >  +
> >  +SET_FLAG(screen->row_used,ctx->cursor_row);
> >  +
> >  +*row++ = hi;
> >  +ctx->cursor_column++;
> >  +if(lo) {
> >  +*row++ = lo;
> >  +ctx->cursor_column++;
> >  +}
> >  +*row = 0;
> > >>> this code appears to lack validity checks on the column index
> > >> Added in todo list, will do it while implementing backspace.
> > > out of array accesses are not a "todo for later" they are a
> > > critical issue that could allow an attacker to potentially execute
> > > arbitrary code, that has to be fixed before the patch can be applied
> > done, took you comment wrongly.
> > >
> > > [...]
> > >
> > >
> > >
> > >> +static int decode(AVCodecContext *avctx, void *data, int *got_sub,
> AVPacket *avpkt)
> > >> +{
> > >> +CCaptionSubContext *ctx = avctx->priv_data;
> > >> +AVSubtitle *sub = data;
> > >> +uint8_t *bptr = NULL;
> > >> +int len = avpkt->size;
> > >> +int ret = 0;
> > >> +int i;
> > >> +
> > >> +if ( ctx->pktbuf->size < len) {
> > >> +ret = av_buffer_realloc(&ctx->pktbuf, len);
> > >> +if(ret)
> > >> +len = ctx->pktbuf->size;
> > >> +}
> > > error checks in ffmpeg  are <0 not != 0
> > > also i doubt that it makes sense to continue with a truncated packet
> > > and if the code does continue with a data buffer that failed to
> > > reallocate that would at least need an error/warning message so the
> > > user knows why what she sees is corrupted
> > done
> >
> > attached new patchs, for column number, I have done lots of changes,
> > you might want to reread the patch.
>
> [...]
>
> > +/**
> > + * @param ctx closed caption context just to print log
> > + */
> > +static void write_char (CCaptionSubContext *ctx, char *row, int col,
> char ch)
> > +{
> > +if(col < SCREEN_COLUMNS)
> > +row[col] = ch;
> > +/* We have extra space at

Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: support USLT tags

2015-01-05 Thread wm4
On Mon, 5 Jan 2015 21:10:31 +0100
Michael Niedermayer  wrote:

> On Mon, Jan 05, 2015 at 06:56:20PM +0100, wm4 wrote:
> > I think this turned out pretty terrible. There's no good way to add new
> > custom tags that write to AVFormatContext->metadata.
> > ---
> >  libavformat/id3v2.c | 50 ++
> >  1 file changed, 50 insertions(+)
> 
> do you have a sample mp3 with such tag ?
> 
> [...]
> 

international.mp3 on incoming.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] x86/swr: fix pack_8ch functions on compilers without aligned stack

2015-01-05 Thread James Almer
Signed-off-by: James Almer 
---
I don't have MSVC or ICL 10.x, so i only tested this with gcc after forcing 
HAVE_ALIGNED_STACK to 0 in config.asm

 libswresample/x86/audio_convert.asm| 39 --
 libswresample/x86/audio_convert_init.c |  4 ++--
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/libswresample/x86/audio_convert.asm 
b/libswresample/x86/audio_convert.asm
index f02370c..397febd 100644
--- a/libswresample/x86/audio_convert.asm
+++ b/libswresample/x86/audio_convert.asm
@@ -305,26 +305,36 @@ pack_6ch_%2_to_%1_u_int %+ SUFFIX
 %endif
 %endmacro
 
+%define PACK_8CH_GPRS (ARCH_X86_64 * 4) + 5 + HAVE_ALIGNED_STACK + ARCH_X86_32
+
 %macro PACK_8CH 5-7
-cglobal pack_8ch_%2_to_%1_%3, 2,10,10, ARCH_X86_32*32, dst, src, len, src1, 
src2, src3, src4, src5, src6, src7
+cglobal pack_8ch_%2_to_%1_%3, 2,PACK_8CH_GPRS,10, ARCH_X86_32*48, dst, src, 
len, src1, src2, src3, src4, src5, src6, src7
 mov dstq, [dstq]
 %if ARCH_X86_32
 DEFINE_ARGS dst, src, src2, src3, src4, src5, src6
 %define lend dword r2m
 %define src1q r0q
-%define src1m r1mp
+%define src1m dword [rsp+32]
+%if HAVE_ALIGNED_STACK == 0
+DEFINE_ARGS dst, src, src2, src3, src5, src6
+%define src4q r0q
+%define src4m dword [rsp+36]
+%endif
 %define src7q r0q
-%define src7m r3mp
+%define src7m dword [rsp+40]
 mov dstm, dstq
 %endif
 movsrc7q, [srcq+7*gprsize]
 movsrc6q, [srcq+6*gprsize]
-movsrc5q, [srcq+5*gprsize]
-movsrc4q, [srcq+4*gprsize]
 %if ARCH_X86_32
 mov src7m, src7q
 %endif
+movsrc5q, [srcq+5*gprsize]
+movsrc4q, [srcq+4*gprsize]
 movsrc3q, [srcq+3*gprsize]
+%if ARCH_X86_32 && HAVE_ALIGNED_STACK == 0
+mov src4m, src4q
+%endif
 movsrc2q, [srcq+2*gprsize]
 movsrc1q, [srcq+1*gprsize]
 mov srcq, [srcq]
@@ -343,7 +353,11 @@ cglobal pack_8ch_%2_to_%1_%3, 2,10,10, ARCH_X86_32*32, 
dst, src, len, src1, src2
 jne pack_8ch_%2_to_%1_u_int %+ SUFFIX
 test src3q, mmsize-1
 jne pack_8ch_%2_to_%1_u_int %+ SUFFIX
+%if ARCH_X86_32 && HAVE_ALIGNED_STACK == 0
+test src4m, mmsize-1
+%else
 test src4q, mmsize-1
+%endif
 jne pack_8ch_%2_to_%1_u_int %+ SUFFIX
 test src5q, mmsize-1
 jne pack_8ch_%2_to_%1_u_int %+ SUFFIX
@@ -361,7 +375,11 @@ pack_8ch_%2_to_%1_u_int %+ SUFFIX
 subsrc1q, srcq
 subsrc2q, srcq
 subsrc3q, srcq
+%if ARCH_X86_64 || HAVE_ALIGNED_STACK
 subsrc4q, srcq
+%else
+subsrc4m, srcq
+%endif
 subsrc5q, srcq
 subsrc6q, srcq
 %if ARCH_X86_64
@@ -383,12 +401,15 @@ pack_8ch_%2_to_%1_u_int %+ SUFFIX
 mov%3 m0, [srcq  ]
 mov%3 m1, [srcq+src1q]
 mov%3 m2, [srcq+src2q]
+%if ARCH_X86_32 && HAVE_ALIGNED_STACK == 0
+movsrc4q, src4m
+%endif
 mov%3 m3, [srcq+src3q]
+mov%3 m4, [srcq+src4q]
+mov%3 m5, [srcq+src5q]
 %if ARCH_X86_32
 movsrc7q, src7m
 %endif
-mov%3 m4, [srcq+src4q]
-mov%3 m5, [srcq+src5q]
 mov%3 m6, [srcq+src6q]
 mov%3 m7, [srcq+src7q]
 
@@ -583,7 +604,6 @@ PACK_6CH float, int32, a, 2, 2, INT32_TO_FLOAT_N, 
INT32_TO_FLOAT_INIT
 PACK_6CH int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 PACK_6CH int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 
-%if HAVE_ALIGNED_STACK
 PACK_8CH float, float, u, 2, 2, NOP_N, NOP_N
 PACK_8CH float, float, a, 2, 2, NOP_N, NOP_N
 
@@ -591,7 +611,6 @@ PACK_8CH float, int32, u, 2, 2, INT32_TO_FLOAT_N, 
INT32_TO_FLOAT_INIT
 PACK_8CH float, int32, a, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
 PACK_8CH int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 PACK_8CH int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
-%endif
 
 INIT_XMM ssse3
 UNPACK_2CH int16, int16, u, 1, 1, NOP_N, NOP_N
@@ -611,7 +630,6 @@ PACK_6CH float, int32, a, 2, 2, INT32_TO_FLOAT_N, 
INT32_TO_FLOAT_INIT
 PACK_6CH int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 PACK_6CH int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 
-%if HAVE_ALIGNED_STACK
 PACK_8CH float, float, u, 2, 2, NOP_N, NOP_N
 PACK_8CH float, float, a, 2, 2, NOP_N, NOP_N
 
@@ -619,7 +637,6 @@ PACK_8CH float, int32, u, 2, 2, INT32_TO_FLOAT_N, 
INT32_TO_FLOAT_INIT
 PACK_8CH float, int32, a, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
 PACK_8CH int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
 PACK_8CH int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
-%endif
 
 INIT_YMM avx
 CONV float, int32, u, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
diff --git a/libswresample/x86/audio_convert_init.c 
b/libswresample/x86/audio_convert_init.c
index b38889f..acb97d8 100644
--- a/libswresample/x86/audio_convert_init.c
+++ b/libswresample/x86/audio_convert_init.c
@@ -117,7 +117,7 @@ MULTI_CAPS_FUNC(SSE2, sse2)
 if(   out_fmt == AV_SAMPLE_FMT_S32  && in_fmt == 
AV_SAMPLE_FMT_FLTP)
 ac->simd_f =  ff_pa

[FFmpeg-devel] [PATCH] avutil/opencl: don't include config.h

2015-01-05 Thread James Almer
It's not an installed header. Use libavutil/avconfig.h instead.

Signed-off-by: James Almer 
---
Untested as i don't have an OpenCL SDK installed.

 configure  | 2 +-
 libavutil/opencl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 50458ea..de6975c 100755
--- a/configure
+++ b/configure
@@ -1629,6 +1629,7 @@ HAVE_LIST_CMDLINE="
 
 HAVE_LIST_PUB="
 bigendian
+CL_cl_h
 fast_unaligned
 incompatible_libav_abi
 "
@@ -1640,7 +1641,6 @@ HEADERS_LIST="
 asm_types_h
 cdio_paranoia_h
 cdio_paranoia_paranoia_h
-CL_cl_h
 dev_bktr_ioctl_bt848_h
 dev_bktr_ioctl_meteor_h
 dev_ic_bt8xx_h
diff --git a/libavutil/opencl.h b/libavutil/opencl.h
index 4655cba..67306da 100644
--- a/libavutil/opencl.h
+++ b/libavutil/opencl.h
@@ -32,7 +32,7 @@
 #ifndef LIBAVUTIL_OPENCL_H
 #define LIBAVUTIL_OPENCL_H
 
-#include "config.h"
+#include "libavutil/avconfig.h"
 #if HAVE_CL_CL_H
 #include 
 #else
-- 
2.2.1

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


Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/unsharp opencl optimization

2015-01-05 Thread Wei Gao
2015-01-06 0:47 GMT+08:00 Titov, Alexey :

> Hi Wei,
> I will double check using yuv.
> What opencl platform/device you are running it on?
> Also, can you point me to /testfile/blueangles.m4v so I can reproduce
> correct and not correct outputs?
>
> Thanks!
>
Hi
  Number of platforms: 1
  Platform Profile:FULL_PROFILE
  Platform Version:  OpenCL 1.2 AMD-APP (1016.4)
  Platform Name: AMD Accelerated Parallel
Processing
  Platform Vendor:   Advanced Micro Devices,
Inc.


  Platform Name:AMD Accelerated Parallel
Processing
  Number of devices:   2
  Device Type:   CL_DEVICE_TYPE_GPU
  Device ID:   4098
  Board name:AMD Radeon HD 6700M Series

Also, can you point me to /testfile/blueangles.m4v so I can reproduce
correct and not correct outputs?

about the input file, just a 1080p video, I think you can use anther video
which size is 1080p. You can compile a master branch and run the command in
the mail above.

Thanks
Best regards


> 2015-01-05 14:50 GMT+08:00 Titov, Alexey :
> Hi Wei,
>
> > This is the first part of the whole patch right? Could you send the
> second
> > part?
>
> Nope, this is the whole patch. git sendmail automatically added 1/2, even
> though this is the only part.
>
> Regards
> Hi
> did you check the result? of YUV, my command is
> ffmpeg -i ./testfile/blueangels.m4v -vf
> unsharp=lx=11:ly=9:cx=5:cy=7:ca=1:la=1:opencl=1  -vframes 1 -y
> ./testfile/out.yuv
>
> and the result of the new patches is not correct. please reference the
> attachment, the wrong one is created by the new patches, the correct one is
> node 202947a0665ea523022afb0a6c50eed96bcd6b69
>
> BTW, I use the 2 patches you submitted before. The size of yuv is
> 1920x1080.
>
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/mxfdec.c: read project_name metadata

2015-01-05 Thread Mark Reid
Hi,
MXF files generated by Media Composer or LibMXF can contain a
project name property in the Preface. Lots of existing samples have them.

http://samples.ffmpeg.org/MXF/issue2160/PW0805A0V01.4C5B5636.EFA330.mxf
project_name: DNX145 PW Test

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3450/WriteAvidMXFgenerated/5502_0010_v1.mxf
project_name: Rombus

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3100/1sec_mxf_test_Video5270C795.mxf
project_name: NVB_DOOD

i can also provide more samples if needed.

---
 libavformat/mxfdec.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 4715169..23d9c73 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -279,6 +279,7 @@ static const uint8_t mxf_encrypted_triplet_key[]   
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_encrypted_essence_container[] = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 
};
 static const uint8_t mxf_random_index_pack_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
 static const uint8_t mxf_sony_mpeg4_extradata[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 
};
+static const uint8_t mxf_avid_project_name[]   = { 
0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf 
};
 
 #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
 
@@ -2087,6 +2088,19 @@ static int mxf_read_identification_metadata(void *arg, 
AVIOContext *pb, int tag,
 return 0;
 }
 
+static int mxf_read_preface_metadata(void *arg, AVIOContext *pb, int tag, int 
size, UID uid, int64_t klv_offset)
+{
+MXFContext *mxf = arg;
+AVFormatContext *s = mxf->fc;
+int ret;
+char *str = NULL;
+
+if (tag >= 0x8000 && (IS_KLV_KEY(uid, mxf_avid_project_name))) {
+SET_STR_METADATA(pb, "project_name", str);
+}
+return 0;
+}
+
 static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x05,0x01,0x00 
}, mxf_read_primer_pack },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x01,0x00 
}, mxf_read_partition_pack },
@@ -2099,6 +2113,7 @@ static const MXFMetadataReadTableEntry 
mxf_metadata_read_table[] = {
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x03,0x04,0x00 
}, mxf_read_partition_pack },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x04,0x02,0x00 
}, mxf_read_partition_pack },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x04,0x04,0x00 
}, mxf_read_partition_pack },
+{ { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x2f,0x00 
}, mxf_read_preface_metadata },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x30,0x00 
}, mxf_read_identification_metadata },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 
}, mxf_read_content_storage, 0, AnyType },
 { { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x37,0x00 
}, mxf_read_package, sizeof(MXFPackage), SourcePackage },
-- 
2.2.1

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_idet: Add analyze_interlaced_flag mode

2015-01-05 Thread Michael Niedermayer
On Thu, Jan 01, 2015 at 02:56:41AM +0100, Michael Niedermayer wrote:
> This should allow us to insert idet before scale and let scale have interl=-1 
> as default in that case
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/filters.texi  |7 +++
>  libavfilter/vf_idet.c |   41 +++--
>  libavfilter/vf_idet.h |4 
>  3 files changed, 50 insertions(+), 2 deletions(-)

applied

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 06:20:15PM +0530, Anshul wrote:
> On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> > the table is constant and does not change, theres no need to have
> > a copy of it in each context or to "make it every time decode is
> > called"
> > a simple static uint8_t parity_table[256];
> > or even
> > static const uint8_t parity_table[256] = {...}
> >
> done
>  +int row_cnt;
>  +struct Screen screen[2];
>  +int active_screen;
>  +uint8_t cursor_row;
>  +uint8_t cursor_column;
>  +AVBPrint buffer;
>  +int erase_display_memory;
>  +int rollup;
>  +enum  cc_mode mode;
>  +int64_t start_time;
>  +/* visible screen time */
>  +int64_t startv_time;
>  +int64_t end_time;
>  +char prev_cmd[2];
>  +/* buffer to store pkt data */
>  +AVBufferRef *pktbuf;
> >>> as you memcopy the data each time, theres no need for a AVBufferRef
> >>> a simple uint8_t * would do the same
> >>> but i think not even that is needed,
> >>> all uses of the data go through process_cc608() it would be
> >>> very simply to strip one bit in the arguments there, so no rewriting
> >>> of the table would be needed
> >>>
> >>> [...]
> >> cant do that, for error resistance we need to escape 1st byte
> >> if parity does not match, for escaping I write 0x7f instead of
> >> whatever data is. Some closed caption insert-er don't care much for parity
> >> when they are not using the data.
> >>  
> >> I was using AVBufferRef instead of uint8_t * , so that I don't have to
> >> take care for length,
> >> and length and data are in one context. and there is already lot of
> >> error handling is
> >> done while realloc, means I don't have to copy buffer pointer somewhere,
> >> if realloc fails.
> >> and in future if someone want to make data channel 1  and data channel 2
> >> to be processed
> >> in parallel,  then he may use reference thing too.
> >> still its my opinion, if you think uint8_t will have better performance,
> >> I will change it to that.
> > if you prefer AVBufferRef, feel free to keep using it, i dont think
> > its the optimal choice though.
> >
> > Also isnt there some maximum size for these buffers ?
> > (this would allow using a fixed size buffer and avoid the need for
> >  dealing with allocation failures)
> >
> There is nothing similar inside spec cc608. since its line 21 data,
> there must
> be something in vertical ancillary specification. I have to search for
> that spec.
> if you can find about max limit of vanc packet, then ccaption can not
> exceed
> with that.
>  +static void handle_char(CCaptionSubContext *ctx, char hi, char lo, 
>  int64_t pts)
>  +{
>  +struct Screen *screen = get_writing_screen(ctx);
>  +char *row = screen->characters[ctx->cursor_row] + 
>  ctx->cursor_column;
>  +
>  +SET_FLAG(screen->row_used,ctx->cursor_row);
>  +
>  +*row++ = hi;
>  +ctx->cursor_column++;
>  +if(lo) {
>  +*row++ = lo;
>  +ctx->cursor_column++;
>  +}
>  +*row = 0;
> >>> this code appears to lack validity checks on the column index
> >> Added in todo list, will do it while implementing backspace.
> > out of array accesses are not a "todo for later" they are a
> > critical issue that could allow an attacker to potentially execute
> > arbitrary code, that has to be fixed before the patch can be applied
> done, took you comment wrongly.
> >
> > [...]
> >
> >
> >
> >> +static int decode(AVCodecContext *avctx, void *data, int *got_sub, 
> >> AVPacket *avpkt)
> >> +{
> >> +CCaptionSubContext *ctx = avctx->priv_data;
> >> +AVSubtitle *sub = data;
> >> +uint8_t *bptr = NULL;
> >> +int len = avpkt->size;
> >> +int ret = 0;
> >> +int i;
> >> +
> >> +if ( ctx->pktbuf->size < len) {
> >> +ret = av_buffer_realloc(&ctx->pktbuf, len);
> >> +if(ret)
> >> +len = ctx->pktbuf->size;
> >> +}
> > error checks in ffmpeg  are <0 not != 0
> > also i doubt that it makes sense to continue with a truncated packet
> > and if the code does continue with a data buffer that failed to
> > reallocate that would at least need an error/warning message so the
> > user knows why what she sees is corrupted
> done
> 
> attached new patchs, for column number, I have done lots of changes,
> you might want to reread the patch.

[...]

> +/**
> + * @param ctx closed caption context just to print log
> + */
> +static void write_char (CCaptionSubContext *ctx, char *row, int col, char ch)
> +{
> +if(col < SCREEN_COLUMNS)
> +row[col] = ch;
> +/* We have extra space at end only for null character */
> +else if ( col == SCREEN_COLUMNS && ch == 0)
> +row[col] = ch;
> +else
> +av_log(ctx, AV_LOG_WARNING,"Data Ignored since exciding screen 
> width\n");
> +}

The else implies that cursor_column can be an index outside the array
handle_dele

Re: [FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 03:17:32PM -0500, Vanista Herion wrote:
> Some MPEG 2 video will give bad interlacing information in AVFrame. If the
> parameters are used by a deinterlace filter such as yadif, frames will be
> processed needlessly and impair the quality.
> 
> By reviewing the code in mpegvideo.c which sets the interlaced_frame
> and top_field_first, I noticed that picture_structure is not considered
> whereas it probably supersedes everything else. The H.262 specification is
> not very clear on that but in the case of this sample, the stream is
> definitely progressive, picture_structure is equal to 3 (Frame picture) and
> top_field_first alternates true and false.
> 
> The result is that frames come out reported as tff, bff and progressive,
> cycling at every frame.
> I propose a simple patch to set interlaced_frame to false when
> picture_structure is equal to PICT_FRAME.

fixed differently, that is by detecting telecined content in yadif

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 03:17:32PM -0500, Vanista Herion wrote:
> Some MPEG 2 video will give bad interlacing information in AVFrame. If the
> parameters are used by a deinterlace filter such as yadif, frames will be
> processed needlessly and impair the quality.

yes and i hope this will get resolved with idet or some other solution
also it might be possible to detect telecined content and do something
more sane in that case without the need of idet


> 
> By reviewing the code in mpegvideo.c which sets the interlaced_frame
> and top_field_first, I noticed that picture_structure is not considered
> whereas it probably supersedes everything else. The H.262 specification is
> not very clear on that but in the case of this sample, the stream is
> definitely progressive, picture_structure is equal to 3 (Frame picture) and
> top_field_first alternates true and false.
> 
> The result is that frames come out reported as tff, bff and progressive,
> cycling at every frame.
> I propose a simple patch to set interlaced_frame to false when
> picture_structure is equal to PICT_FRAME.

This is incorrect, and would break detecting actual interlaced frame
based MPEG-2

ISO/IEC 13818-2: 1995 (E)

6.1.1.1
Progressive and interlaced sequences
This specification deals with coding of both progressive and interlaced 
sequences.
The output of the decoding process, for interlaced sequences, consists of a 
series of reconstructed fields
that are separated in time by a field period.


The two fields of a frame may be coded separately (field-pictures).

This is s->picture_structure != PICT_FRAME


Alternatively the two fields may be coded together as a frame 
(frame-pictures). Both frame

This is s->picture_structure == PICT_FRAME

pictures and field pictures may be used in a single video sequence.

In progressive sequences each picture in the sequence shall be a frame 
picture. The sequence, at the
output of the decoding process, consists of a series of reconstructed 
frames that are separated in time by a
frame period.


also see 6.1.1.8
4:2:0 Format

Figure 6-2 – Vertical and temporal positions of samples in an interlaced 
frame with top_field_first = 1.
Figure 6-3 – Vertical and temporal positions of samples in an interlaced 
frame with top_field_first = 0
Figure 6-4 – Vertical and temporal positions of samples in a progressive 
frame.


6.3.9 Picture header
...

progressive_frame -- If progressive_frame is set to 0 it indicates that the 
two fields of the frame are
interlaced fields in which an interval of time of the field period exists 
between (corresponding spatial
samples) of the two fields. In this case the following restriction applies:
•
repeat_first_field shall be zero (two field duration).
If progressive_frame is set to 1 it indicates that the two fields (of the 
frame) are actually from the same
time instant as one another. In this case a number of restrictions to other 
parameters and flags in the
bitstream apply:
• picture_structure shall be “Frame”
• frame_pred_frame_dct shall be 1
progressive_frame is used when the video sequence is used as the lower 
layer of a spatial scalable
sequence. Here it affects the up-sampling process used in forming a 
prediction in the enhancement layer
from the lower layer.



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


Re: [FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

2015-01-05 Thread Hendrik Leppkes
On Mon, Jan 5, 2015 at 9:17 PM, Vanista Herion  wrote:

> Some MPEG 2 video will give bad interlacing information in AVFrame. If the
> parameters are used by a deinterlace filter such as yadif, frames will be
> processed needlessly and impair the quality.
>
> By reviewing the code in mpegvideo.c which sets the interlaced_frame
> and top_field_first, I noticed that picture_structure is not considered
> whereas it probably supersedes everything else. The H.262 specification is
> not very clear on that but in the case of this sample, the stream is
> definitely progressive, picture_structure is equal to 3 (Frame picture) and
> top_field_first alternates true and false.
>
> The result is that frames come out reported as tff, bff and progressive,
> cycling at every frame.
> I propose a simple patch to set interlaced_frame to false when
> picture_structure is equal to PICT_FRAME.
>
> ​
>  interlaced_flag_switch.mpeg
> <
> https://docs.google.com/file/d/0B72Rmfr6KECZVVE1T3R6dWhMb2s/edit?usp=drive_web
> >
>

The behaviour on that file is correct as far as I can see.
The file is not progressive, its telecined. Telecined video is coded
partially interlaced (even when the content is not technically interlaced),
and when you treat it as pure progressive you will get artifacts.

I do not think any changes are required.

Someone like kierank can probably explain it better and confirm or deny my
statement.

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


[FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

2015-01-05 Thread Vanista Herion
Some MPEG 2 video will give bad interlacing information in AVFrame. If the
parameters are used by a deinterlace filter such as yadif, frames will be
processed needlessly and impair the quality.

By reviewing the code in mpegvideo.c which sets the interlaced_frame
and top_field_first, I noticed that picture_structure is not considered
whereas it probably supersedes everything else. The H.262 specification is
not very clear on that but in the case of this sample, the stream is
definitely progressive, picture_structure is equal to 3 (Frame picture) and
top_field_first alternates true and false.

The result is that frames come out reported as tff, bff and progressive,
cycling at every frame.
I propose a simple patch to set interlaced_frame to false when
picture_structure is equal to PICT_FRAME.

​
 interlaced_flag_switch.mpeg

​
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index ce4fa59..2e25e15 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1832,14 +1832,16 @@ int ff_mpv_frame_start(MpegEncContext *s, 
AVCodecContext *avctx)
 s->current_picture_ptr = pic;
 // FIXME use only the vars from current_pic
 s->current_picture_ptr->f->top_field_first = s->top_field_first;
+s->current_picture_ptr->f->interlaced_frame = !s->progressive_frame &&
+ !s->progressive_sequence;
 if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
 s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
 if (s->picture_structure != PICT_FRAME)
 s->current_picture_ptr->f->top_field_first =
 (s->picture_structure == PICT_TOP_FIELD) == s->first_field;
+else
+s->current_picture_ptr->f->interlaced_frame = 0;
 }
-s->current_picture_ptr->f->interlaced_frame = !s->progressive_frame &&
- !s->progressive_sequence;
 s->current_picture_ptr->field_picture  =  s->picture_structure != 
PICT_FRAME;
 
 s->current_picture_ptr->f->pict_type = s->pict_type;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/mxfdec.c: export the full UMID as metadata

2015-01-05 Thread Mark Reid
---
 libavformat/mxfdec.c | 39 ---
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 4715169..5ade23a 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -200,6 +200,7 @@ typedef struct {
 UID uid;
 enum MXFMetadataSetType type;
 UID package_uid;
+UID package_ul;
 UID *tracks_refs;
 int tracks_count;
 MXFDescriptor *descriptor; /* only one */
@@ -840,8 +841,8 @@ static int mxf_read_package(void *arg, AVIOContext *pb, int 
tag, int size, UID u
 avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * 
sizeof(UID));
 break;
 case 0x4401:
-/* UMID, only get last 16 bytes */
-avio_skip(pb, 16);
+/* UMID */
+avio_read(pb, package->package_ul, 16);
 avio_read(pb, package->package_uid, 16);
 break;
 case 0x4701:
@@ -1488,11 +1489,35 @@ static int mxf_uid_to_str(UID uid, char **str)
 return 0;
 }
 
-static int mxf_add_uid_metadata(AVDictionary **pm, const char *key, UID uid)
+static int mxf_umid_to_str(UID ul, UID uid, char **str)
+{
+int i;
+char *p;
+p = *str = av_mallocz(sizeof(UID) * 4 + 3 + 1);
+if (!p)
+return AVERROR(ENOMEM);
+for (i = 0; i < sizeof(UID); i++) {
+snprintf(p, 2 + 1, "%.2x", ul[i]);
+p += 2;
+if (i == 11 || i == 12 || i == 15) {
+snprintf(p, 1 + 1, "-");
+p++;
+}
+}
+for (i = 0; i < sizeof(UID); i++) {
+snprintf(p, 2 + 1, "%.2x", uid[i]);
+p += 2;
+}
+return 0;
+}
+
+static int mxf_add_umid_metadata(AVDictionary **pm, const char *key, 
MXFPackage* package)
 {
 char *str;
 int ret;
-if ((ret = mxf_uid_to_str(uid, &str)) < 0)
+if (!package)
+return 0;
+if ((ret = mxf_umid_to_str(package->package_ul, package->package_uid, 
&str)) < 0)
 return ret;
 av_dict_set(pm, key, str, AV_DICT_DONT_STRDUP_VAL);
 return 0;
@@ -1633,7 +1658,7 @@ static int mxf_parse_physical_source_package(MXFContext 
*mxf, MXFTrack *source_t
 if (!(physical_package = mxf_resolve_source_package(mxf, 
sourceclip->source_package_uid)))
 break;
 
-mxf_add_uid_metadata(&st->metadata, "reel_uid", 
physical_package->package_uid);
+mxf_add_umid_metadata(&st->metadata, "reel_umid", physical_package);
 
 /* the name of physical source package is name of the reel or tape */
 if (physical_package->name && physical_package->name[0])
@@ -1690,7 +1715,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 return AVERROR_INVALIDDATA;
 }
 
-mxf_add_uid_metadata(&mxf->fc->metadata, "material_package_uid", 
material_package->package_uid);
+mxf_add_umid_metadata(&mxf->fc->metadata, "material_package_umid", 
material_package);
 if (material_package->name && material_package->name[0])
 av_dict_set(&mxf->fc->metadata, "material_package_name", 
material_package->name, 0);
 
@@ -1858,7 +1883,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 }
 av_log(mxf->fc, AV_LOG_VERBOSE, "\n");
 
-mxf_add_uid_metadata(&st->metadata, "file_package_uid", 
source_package->package_uid);
+mxf_add_umid_metadata(&st->metadata, "file_package_umid", 
source_package);
 if (source_package->name && source_package->name[0])
 av_dict_set(&st->metadata, "file_package_name", 
source_package->name, 0);
 
-- 
2.2.1

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


[FFmpeg-devel] [PATCH] libavformat/mxfdec.c: export the full UMID as metadata

2015-01-05 Thread Mark Reid
Hi,
This patch exports the full umid of packages as metadata. ffmpeg currently
only exports the material number portion of the umid.

The new format is
   ---
example:
   060a2b340101010101010f00-13-00-53dc416b9a770251060e2b347f7f2a80

Some applications use the umids to link to mxf media instead using file paths.
I've been using ffmpeg for some AAF work and have encountered
MXF files with different ISO labels and having just the material number alone 
is not
enough to link to media for Media Composer.

For more on umids, this paper explains them pretty well
http://www.digitalpreservationeurope.eu/publications/briefs/UMID_Unique%20Material%20Identifier.pdf

umids also have a optional extened 32 bytes, but I've yet to see a file that
has them.

Mark Reid (1):
  libavformat/mxfdec.c: export the full UMID as metadata

 libavformat/mxfdec.c | 39 ---
 1 file changed, 32 insertions(+), 7 deletions(-)

-- 
2.2.1

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: support USLT tags

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 06:56:20PM +0100, wm4 wrote:
> I think this turned out pretty terrible. There's no good way to add new
> custom tags that write to AVFormatContext->metadata.
> ---
>  libavformat/id3v2.c | 50 ++
>  1 file changed, 50 insertions(+)

do you have a sample mp3 with such tag ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/id3v1: strip trailing whitespace

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 06:56:19PM +0100, wm4 wrote:
> ID3v1 fields have a fixed size, and they are padded either with zeros,
> or with spaces. Handle the latter case, instead of putting strings with
> trailing spaces into the AVDictionary.
> ---
>  libavformat/id3v1.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

applied

thanks

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] x86/flacdsp: remove unneeded ifdeffery

2015-01-05 Thread James Almer
On 04/01/15 8:49 PM, Michael Niedermayer wrote:
> On Sat, Jan 03, 2015 at 07:52:17PM -0300, James Almer wrote:
>> On 29/12/14 5:05 PM, James Almer wrote:
>>> x86inc can translate r*m into a register or stack on its own
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavcodec/x86/flacdsp.asm | 18 +++---
>>>  1 file changed, 3 insertions(+), 15 deletions(-)
>>
>> Ping.
> 
> looks nice, also iam definitly in favor of minimizing all the ABI
> special cases

Pushed, thanks.

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


Re: [FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-05 Thread Clément Bœsch
On Mon, Jan 05, 2015 at 04:33:44PM +, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   2 +
>  libavfilter/f_deinterleave.c | 143 
> +++
>  3 files changed, 147 insertions(+)
>  create mode 100644 libavfilter/f_deinterleave.c
> 
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 0ead6c5..17e49ee 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -29,6 +29,7 @@ OBJS = allfilters.o 
> \
>  
>  OBJS-$(CONFIG_AVCODEC)   += avcodec.o
>  
> +OBJS-$(CONFIG_ADEINTERLEAVE_FILTER)  += f_deinterleave.o
>  OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
>  OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
> @@ -108,6 +109,7 @@ OBJS-$(CONFIG_CROPDETECT_FILTER) += 
> vf_cropdetect.o
>  OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
>  OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += vf_dctdnoiz.o
>  OBJS-$(CONFIG_DECIMATE_FILTER)   += vf_decimate.o
> +OBJS-$(CONFIG_DEINTERLEAVE_FILTER)   += f_deinterleave.o
>  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
>  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
>  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 6543629..66982f5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -50,6 +50,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(AEVAL,  aeval,  af);
>  REGISTER_FILTER(AFADE,  afade,  af);
>  REGISTER_FILTER(AFORMAT,aformat,af);
> +REGISTER_FILTER(ADEINTERLEAVE,  adeinterleave,  af);
>  REGISTER_FILTER(AINTERLEAVE,ainterleave,af);
>  REGISTER_FILTER(ALLPASS,allpass,af);
>  REGISTER_FILTER(AMERGE, amerge, af);
> @@ -124,6 +125,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(CURVES, curves, vf);
>  REGISTER_FILTER(DCTDNOIZ,   dctdnoiz,   vf);
>  REGISTER_FILTER(DECIMATE,   decimate,   vf);
> +REGISTER_FILTER(DEINTERLEAVE,   deinterleave,   vf);
>  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
>  REGISTER_FILTER(DELOGO, delogo, vf);
>  REGISTER_FILTER(DESHAKE,deshake,vf);
> diff --git a/libavfilter/f_deinterleave.c b/libavfilter/f_deinterleave.c
> new file mode 100644
> index 000..2209390
> --- /dev/null
> +++ b/libavfilter/f_deinterleave.c
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright (c) 2015 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * audio and video de-interleaver
> + */
> +
> +#include "libavutil/opt.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "audio.h"
> +#include "video.h"
> +
> +typedef struct {
> +const AVClass *class;
> +int nb_outputs;
> +int index;
> +} DeinterleaveContext;
> +
> +#define OFFSET(x) offsetof(DeinterleaveContext, x)
> +
> +#define DEFINE_OPTIONS(filt_name, flags_)   \
> +static const AVOption filt_name##_options[] = { \
> +   { "nb_outputs", "set number of outputs", OFFSET(nb_outputs), 
> AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
> +   { NULL } \
> +}
> +
> +static av_cold int deinterleave_init(AVFilterContext *ctx)
> +{
> +DeinterleaveContext *s = ctx->priv;
> +int i;
> +
> +for (i = 0; i < s->nb_outputs; i++) {
> +char name[32];
> +AVFilterPad pad = { 0 };
> +
> +snprintf(name, sizeof(name), "output%d", i);
> +pad.type = ctx->filter->inputs[0].type;
> +pad.name = av_strdup(name);

if (!pad.name)
return AVERROR(ENOMEM);

> +
> +ff_insert_outpad(ctx, i, &pad);
> +}
> +
> +return 0;
> +}
> +
> +static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> +{
> +AVFilterCo

Re: [FFmpeg-devel] [PATCH] libavformat/mxfdec.c: support demuxing opatom audio without index

2015-01-05 Thread Mark Reid
On Sat, Dec 27, 2014 at 7:35 AM, Tomas Härdin 
wrote:

> On Sun, 2014-12-21 at 17:46 -0800, Mark Reid wrote:
> > hi,
> >
> > Media Composer generates audio OPAtom mxf files that don't have index
> segments.
> > All the uncompressed pcm audio essence data contained in a single KLV
> packet.
> >
> > This is my initial attempt to get demuxing working, I'm not too familiar
> with demuxing
> > audio or generating packets. I'm sure I'm not setting pts and dts
> correctly.
> > Using the mxf_read_packet_old function also works too but it reads the
> entire
> > essence KLV packet in to memory and these mxf files can be gigs.
> >
> > I haven't seen any raw video data encoded the same way yet, so this
> patch only
> > enables demuxing uncompressed pcm audio mxf files without indexs.
> >
> > I uploaded a sample mxf encoded to ftp://upload.ffmpeg.org/incoming
> >
> > opatom_missing_index.mxf
> >
> > I can also provide more samples if need.
>
> Have you looked at what mxf_handle_small_eubc() does? I feel this should
> work similarly.
>

I'll take a look at a eubc sample and see if its a similar thing. The real
problem I'm having is this OPAtom file doesn't have a index table,
mxf_read_packet and mxf_handle_small_eubc need one. I'm thinking maybe I
could generate a proper index table so that everything can continue as
usual and not implement a new read packet function? I'll play around a bit
more and see if I can come up with something better, I'm still trying to
wrap my head around edit_unit_absolute_offset. Thanks for taking the time
to review.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 04:33:44PM +, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   2 +
>  libavfilter/f_deinterleave.c | 143 
> +++
>  3 files changed, 147 insertions(+)
>  create mode 100644 libavfilter/f_deinterleave.c
> 
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 0ead6c5..17e49ee 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -29,6 +29,7 @@ OBJS = allfilters.o 
> \
>  
>  OBJS-$(CONFIG_AVCODEC)   += avcodec.o
>  
> +OBJS-$(CONFIG_ADEINTERLEAVE_FILTER)  += f_deinterleave.o
>  OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
>  OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
> @@ -108,6 +109,7 @@ OBJS-$(CONFIG_CROPDETECT_FILTER) += 
> vf_cropdetect.o
>  OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
>  OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += vf_dctdnoiz.o
>  OBJS-$(CONFIG_DECIMATE_FILTER)   += vf_decimate.o
> +OBJS-$(CONFIG_DEINTERLEAVE_FILTER)   += f_deinterleave.o
>  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
>  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
>  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 6543629..66982f5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -50,6 +50,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(AEVAL,  aeval,  af);
>  REGISTER_FILTER(AFADE,  afade,  af);
>  REGISTER_FILTER(AFORMAT,aformat,af);
> +REGISTER_FILTER(ADEINTERLEAVE,  adeinterleave,  af);
>  REGISTER_FILTER(AINTERLEAVE,ainterleave,af);
>  REGISTER_FILTER(ALLPASS,allpass,af);
>  REGISTER_FILTER(AMERGE, amerge, af);
> @@ -124,6 +125,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(CURVES, curves, vf);
>  REGISTER_FILTER(DCTDNOIZ,   dctdnoiz,   vf);
>  REGISTER_FILTER(DECIMATE,   decimate,   vf);
> +REGISTER_FILTER(DEINTERLEAVE,   deinterleave,   vf);
>  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
>  REGISTER_FILTER(DELOGO, delogo, vf);
>  REGISTER_FILTER(DESHAKE,deshake,vf);
> diff --git a/libavfilter/f_deinterleave.c b/libavfilter/f_deinterleave.c
> new file mode 100644
> index 000..2209390
> --- /dev/null
> +++ b/libavfilter/f_deinterleave.c
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright (c) 2015 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * audio and video de-interleaver
> + */
> +
> +#include "libavutil/opt.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "audio.h"
> +#include "video.h"
> +
> +typedef struct {
> +const AVClass *class;
> +int nb_outputs;
> +int index;
> +} DeinterleaveContext;
> +
> +#define OFFSET(x) offsetof(DeinterleaveContext, x)
> +
> +#define DEFINE_OPTIONS(filt_name, flags_)   \
> +static const AVOption filt_name##_options[] = { \
> +   { "nb_outputs", "set number of outputs", OFFSET(nb_outputs), 
> AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
> +   { NULL } \
> +}
> +
> +static av_cold int deinterleave_init(AVFilterContext *ctx)
> +{
> +DeinterleaveContext *s = ctx->priv;
> +int i;
> +
> +for (i = 0; i < s->nb_outputs; i++) {
> +char name[32];
> +AVFilterPad pad = { 0 };
> +
> +snprintf(name, sizeof(name), "output%d", i);
> +pad.type = ctx->filter->inputs[0].type;
> +pad.name = av_strdup(name);
> +
> +ff_insert_outpad(ctx, i, &pad);
> +}
> +
> +return 0;
> +}
> +
> +static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> +{
> +AVFilterContext *ctx = inlink->dst;
> +Deinterleave

[FFmpeg-devel] [PATCH 2/2] avformat/id3v2: support USLT tags

2015-01-05 Thread wm4
I think this turned out pretty terrible. There's no good way to add new
custom tags that write to AVFormatContext->metadata.
---
 libavformat/id3v2.c | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 847d4af..02955ff 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -55,6 +55,7 @@ const AVMetadataConv ff_id3v2_34_metadata_conv[] = {
 { "TPUB", "publisher"},
 { "TRCK", "track"},
 { "TSSE", "encoder"  },
+{ "USLT", "lyrics"   },
 { 0 }
 };
 
@@ -353,6 +354,52 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, 
int taglen,
 av_dict_set(metadata, key, dst, dict_flags);
 }
 
+static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
+  AVDictionary **metadata)
+{
+uint8_t lang[4];
+uint8_t *descriptor = NULL; // 'Content descriptor'
+uint8_t *text = NULL;
+char *key = NULL;
+int encoding;
+unsigned genre;
+int ok = 0;
+
+if (taglen < 1)
+goto error;
+
+encoding = avio_r8(pb);
+taglen--;
+
+if (avio_read(pb, lang, 3) < 3)
+goto error;
+lang[3] = '\0';
+taglen -= 3;
+
+if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
+goto error;
+
+if (decode_str(s, pb, encoding, &text, &taglen) < 0)
+goto error;
+
+// FFmpeg does not support hierarchical metadata, so concatenate the keys.
+key = av_asprintf("lyrics-%s%s%s", descriptor[0] ? (char *)descriptor : "",
+   descriptor[0] ? "-" : "",
+   lang);
+if (!key)
+goto error;
+
+av_dict_set(metadata, key, text, 0);
+
+ok = 1;
+error:
+if (!ok)
+av_log(s, AV_LOG_ERROR, "Error reading lyrics, skipped\n");
+av_free(descriptor);
+av_free(text);
+av_free(key);
+}
+
 /**
  * Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
  */
@@ -845,6 +892,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary 
**metadata,
 avio_skip(pb, tlen);
 /* check for text tag or supported special meta tag */
 } else if (tag[0] == 'T' ||
+   !memcmp(tag, "USLT", 4) ||
(extra_meta &&
 (extra_func = get_extra_meta_func(tag, isv34 {
 pbx = pb;
@@ -910,6 +958,8 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary 
**metadata,
 if (tag[0] == 'T')
 /* parse text tag */
 read_ttag(s, pbx, tlen, metadata, tag);
+else if (!memcmp(tag, "USLT", 4))
+read_uslt(s, pbx, tlen, metadata);
 else
 /* parse special meta tag */
 extra_func->read(s, pbx, tlen, tag, extra_meta, isv34);
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/2] avformat/id3v1: strip trailing whitespace

2015-01-05 Thread wm4
ID3v1 fields have a fixed size, and they are padded either with zeros,
or with spaces. Handle the latter case, instead of putting strings with
trailing spaces into the AVDictionary.
---
 libavformat/id3v1.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
index 0617a9c..218ed73 100644
--- a/libavformat/id3v1.c
+++ b/libavformat/id3v1.c
@@ -179,7 +179,7 @@ static void get_string(AVFormatContext *s, const char *key,
const uint8_t *buf, int buf_size)
 {
 int i, c;
-char *q, str[512];
+char *q, str[512], *first_free_space = NULL;
 
 q = str;
 for(i = 0; i < buf_size; i++) {
@@ -188,10 +188,19 @@ static void get_string(AVFormatContext *s, const char 
*key,
 break;
 if ((q - str) >= sizeof(str) - 1)
 break;
+if (c == ' ') {
+if (!first_free_space)
+first_free_space = q;
+} else {
+first_free_space = NULL;
+}
 *q++ = c;
 }
 *q = '\0';
 
+if (first_free_space)
+*first_free_space = '\0';
+
 if (*str)
 av_dict_set(&s->metadata, key, str, 0);
 }
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_idet: Add analyze_interlaced_flag mode

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 01:00:41PM +, tim nicholson wrote:
> On 01/01/15 01:56, Michael Niedermayer wrote:
> > This should allow us to insert idet before scale and let scale have 
> > interl=-1 as default in that case
> 
> Good thinking.
> 
> How would interl=-1 then get set as default for auto inserted filters.
> Or did I miss something?

it maybe could be set when the filter togeter with idet is inserted
i havnt implemented that yet though, idet doesnt support every format
that scale supports so it cant be done unconditionally

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/unsharp opencl optimization

2015-01-05 Thread Titov, Alexey
Hi Wei,
I will double check using yuv.
What opencl platform/device you are running it on?
Also, can you point me to /testfile/blueangles.m4v so I can reproduce correct 
and not correct outputs?

Thanks!

2015-01-05 14:50 GMT+08:00 Titov, Alexey :
Hi Wei,

> This is the first part of the whole patch right? Could you send the second
> part?

Nope, this is the whole patch. git sendmail automatically added 1/2, even 
though this is the only part.

Regards
Hi
did you check the result? of YUV, my command is 
ffmpeg -i ./testfile/blueangels.m4v -vf 
unsharp=lx=11:ly=9:cx=5:cy=7:ca=1:la=1:opencl=1  -vframes 1 -y 
./testfile/out.yuv

and the result of the new patches is not correct. please reference the 
attachment, the wrong one is created by the new patches, the correct one is 
node 202947a0665ea523022afb0a6c50eed96bcd6b69

BTW, I use the 2 patches you submitted before. The size of yuv is 1920x1080.

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

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


[FFmpeg-devel] [PATCH] lavfi: add deinterleave filters

2015-01-05 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   2 +
 libavfilter/f_deinterleave.c | 143 +++
 3 files changed, 147 insertions(+)
 create mode 100644 libavfilter/f_deinterleave.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ead6c5..17e49ee 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -29,6 +29,7 @@ OBJS = allfilters.o   
  \
 
 OBJS-$(CONFIG_AVCODEC)   += avcodec.o
 
+OBJS-$(CONFIG_ADEINTERLEAVE_FILTER)  += f_deinterleave.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
 OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
 OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
@@ -108,6 +109,7 @@ OBJS-$(CONFIG_CROPDETECT_FILTER) += 
vf_cropdetect.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
 OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += vf_dctdnoiz.o
 OBJS-$(CONFIG_DECIMATE_FILTER)   += vf_decimate.o
+OBJS-$(CONFIG_DEINTERLEAVE_FILTER)   += f_deinterleave.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 6543629..66982f5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -50,6 +50,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(AEVAL,  aeval,  af);
 REGISTER_FILTER(AFADE,  afade,  af);
 REGISTER_FILTER(AFORMAT,aformat,af);
+REGISTER_FILTER(ADEINTERLEAVE,  adeinterleave,  af);
 REGISTER_FILTER(AINTERLEAVE,ainterleave,af);
 REGISTER_FILTER(ALLPASS,allpass,af);
 REGISTER_FILTER(AMERGE, amerge, af);
@@ -124,6 +125,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(CURVES, curves, vf);
 REGISTER_FILTER(DCTDNOIZ,   dctdnoiz,   vf);
 REGISTER_FILTER(DECIMATE,   decimate,   vf);
+REGISTER_FILTER(DEINTERLEAVE,   deinterleave,   vf);
 REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
 REGISTER_FILTER(DELOGO, delogo, vf);
 REGISTER_FILTER(DESHAKE,deshake,vf);
diff --git a/libavfilter/f_deinterleave.c b/libavfilter/f_deinterleave.c
new file mode 100644
index 000..2209390
--- /dev/null
+++ b/libavfilter/f_deinterleave.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * audio and video de-interleaver
+ */
+
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "audio.h"
+#include "video.h"
+
+typedef struct {
+const AVClass *class;
+int nb_outputs;
+int index;
+} DeinterleaveContext;
+
+#define OFFSET(x) offsetof(DeinterleaveContext, x)
+
+#define DEFINE_OPTIONS(filt_name, flags_)   \
+static const AVOption filt_name##_options[] = { \
+   { "nb_outputs", "set number of outputs", OFFSET(nb_outputs), 
AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
+   { NULL } \
+}
+
+static av_cold int deinterleave_init(AVFilterContext *ctx)
+{
+DeinterleaveContext *s = ctx->priv;
+int i;
+
+for (i = 0; i < s->nb_outputs; i++) {
+char name[32];
+AVFilterPad pad = { 0 };
+
+snprintf(name, sizeof(name), "output%d", i);
+pad.type = ctx->filter->inputs[0].type;
+pad.name = av_strdup(name);
+
+ff_insert_outpad(ctx, i, &pad);
+}
+
+return 0;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
+{
+AVFilterContext *ctx = inlink->dst;
+DeinterleaveContext *s = ctx->priv;
+int ret;
+
+ret = ff_filter_frame(ctx->outputs[s->index], frame);
+
+s->index++;
+if (s->index >= s->nb_outputs)
+s->index = 0;
+
+return ret;
+}
+
+static av_cold void deinterleave_uninit(AVFilterContext *ctx)
+{
+int i;
+
+for (i = 0; i < ctx->nb_outputs; i

Re: [FFmpeg-devel] Main git server issues

2015-01-05 Thread Michael Niedermayer
On Mon, Jan 05, 2015 at 02:04:47AM +0100, Michael Niedermayer wrote:
> Hi all
> 
> as you probably already noticed videolans git server is not working
> since yesterday and as they generously provide also our main git,
> ffmpeg git is neither.
> I do hope the server will be alive again soon/?tomorrow? but until
> then we can simply use the github mirror, ive enabled irc and mail
> notifications for it
> Its a nice opertunity to test switching between git servers ...
> if theres anything you want pushed, simply push it to your git
> repo and ask me to pull
> 
> Thanks
> 
> PS: if someone knows a better hook available on github for email
> notification, please reply but if not, once the main git is online
> again the commits should get reposted with the old hook so no diffs
> would be missing

main git and videolan is up, alive and online again

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] lavfi: Port mp=pp7 to libavfilter

2015-01-05 Thread Stefano Sabatini
On date Monday 2014-12-29 10:20:26 +0100, Stefano Sabatini encoded:
> On date Sunday 2014-12-28 19:45:18 +0530, arwa arif encoded:
> [...]
> > From ebf5f36d9e9fc80264bb605dfee5c09cbf1f10ef Mon Sep 17 00:00:00 2001
> > From: Arwa Arif 
> > Date: Thu, 25 Dec 2014 09:50:24 +0530
> > Subject: [PATCH] lavfi: port mp=pp7 to avfilter
> > 
> 
> > Added use_bframe_qp in the list of options.
> 

> Also, add use_bframe_qp option.

Please remove this and add it on top of the pp7 port patch.
 
> I'd also suggest to implement this on top of the port.
> 
> > TODO: modify version.h, Add ff_norm_qscale in internal.h
> > ---
> >  LICENSE.md   |1 +
> >  configure|1 +
> >  doc/filters.texi |   31 
> >  libavfilter/Makefile |1 +
> >  libavfilter/allfilters.c |1 +
> >  libavfilter/vf_pp7.c |  460 
> > ++
> >  libavfilter/vf_pp7.h |   49 +
> >  libavfilter/x86/Makefile |1 +
> >  libavfilter/x86/vf_pp7.c |   68 +++
> >  9 files changed, 613 insertions(+)
> >  create mode 100644 libavfilter/vf_pp7.c
> >  create mode 100644 libavfilter/vf_pp7.h
> >  create mode 100644 libavfilter/x86/vf_pp7.c
> 
> [...]
> 
> It is not bitexact here.
> 
> ffmpeg -i matrixbench_mpeg2-lq.mpg -vf mp=pp7=30 -t 2 -f md5 -
> [...]
> MD5=b281d6e4c077f4bf992dae262bc1cd3e
> 
> ffmpeg -i matrixbench_mpeg2-lq.mpg -vf pp7=30 -t 2 -f md5 -
> [...]
> MD5=0fbf1414f026ad10e76acfc03175b37a

Keep in mind that the difference may be due to the QP information
missing in mp=pp7. So you should focus on that (try to reset/disable
qp processing in pp7 and see if it works the same as mp=pp7).
-- 
FFmpeg = Foolish and Frenzy Mystic Puritan Elitist Geisha
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_idet: Add analyze_interlaced_flag mode

2015-01-05 Thread tim nicholson
On 01/01/15 01:56, Michael Niedermayer wrote:
> This should allow us to insert idet before scale and let scale have interl=-1 
> as default in that case

Good thinking.

How would interl=-1 then get set as default for auto inserted filters.
Or did I miss something?

> 
> Signed-off-by: Michael Niedermayer 
> [..]


-- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-05 Thread Anshul
On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> the table is constant and does not change, theres no need to have
> a copy of it in each context or to "make it every time decode is
> called"
> a simple static uint8_t parity_table[256];
> or even
> static const uint8_t parity_table[256] = {...}
>
done
 +int row_cnt;
 +struct Screen screen[2];
 +int active_screen;
 +uint8_t cursor_row;
 +uint8_t cursor_column;
 +AVBPrint buffer;
 +int erase_display_memory;
 +int rollup;
 +enum  cc_mode mode;
 +int64_t start_time;
 +/* visible screen time */
 +int64_t startv_time;
 +int64_t end_time;
 +char prev_cmd[2];
 +/* buffer to store pkt data */
 +AVBufferRef *pktbuf;
>>> as you memcopy the data each time, theres no need for a AVBufferRef
>>> a simple uint8_t * would do the same
>>> but i think not even that is needed,
>>> all uses of the data go through process_cc608() it would be
>>> very simply to strip one bit in the arguments there, so no rewriting
>>> of the table would be needed
>>>
>>> [...]
>> cant do that, for error resistance we need to escape 1st byte
>> if parity does not match, for escaping I write 0x7f instead of
>> whatever data is. Some closed caption insert-er don't care much for parity
>> when they are not using the data.
>>  
>> I was using AVBufferRef instead of uint8_t * , so that I don't have to
>> take care for length,
>> and length and data are in one context. and there is already lot of
>> error handling is
>> done while realloc, means I don't have to copy buffer pointer somewhere,
>> if realloc fails.
>> and in future if someone want to make data channel 1  and data channel 2
>> to be processed
>> in parallel,  then he may use reference thing too.
>> still its my opinion, if you think uint8_t will have better performance,
>> I will change it to that.
> if you prefer AVBufferRef, feel free to keep using it, i dont think
> its the optimal choice though.
>
> Also isnt there some maximum size for these buffers ?
> (this would allow using a fixed size buffer and avoid the need for
>  dealing with allocation failures)
>
There is nothing similar inside spec cc608. since its line 21 data,
there must
be something in vertical ancillary specification. I have to search for
that spec.
if you can find about max limit of vanc packet, then ccaption can not
exceed
with that.
 +static void handle_char(CCaptionSubContext *ctx, char hi, char lo, 
 int64_t pts)
 +{
 +struct Screen *screen = get_writing_screen(ctx);
 +char *row = screen->characters[ctx->cursor_row] + ctx->cursor_column;
 +
 +SET_FLAG(screen->row_used,ctx->cursor_row);
 +
 +*row++ = hi;
 +ctx->cursor_column++;
 +if(lo) {
 +*row++ = lo;
 +ctx->cursor_column++;
 +}
 +*row = 0;
>>> this code appears to lack validity checks on the column index
>> Added in todo list, will do it while implementing backspace.
> out of array accesses are not a "todo for later" they are a
> critical issue that could allow an attacker to potentially execute
> arbitrary code, that has to be fixed before the patch can be applied
done, took you comment wrongly.
>
> [...]
>
>
>
>> +static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket 
>> *avpkt)
>> +{
>> +CCaptionSubContext *ctx = avctx->priv_data;
>> +AVSubtitle *sub = data;
>> +uint8_t *bptr = NULL;
>> +int len = avpkt->size;
>> +int ret = 0;
>> +int i;
>> +
>> +if ( ctx->pktbuf->size < len) {
>> +ret = av_buffer_realloc(&ctx->pktbuf, len);
>> +if(ret)
>> +len = ctx->pktbuf->size;
>> +}
> error checks in ffmpeg  are <0 not != 0
> also i doubt that it makes sense to continue with a truncated packet
> and if the code does continue with a data buffer that failed to
> reallocate that would at least need an error/warning message so the
> user knows why what she sees is corrupted
done

attached new patchs, for column number, I have done lots of changes,
you might want to reread the patch.

-Anshul
>From d6e99d2829162a9f8f84964317fd3dc37ea2d5cd Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 5 Jan 2015 18:02:09 +0530
Subject: [PATCH 1/2] Adding Closed caption Support

Signed-off-by: Anshul Maheshwari 

To test Closed caption use following command
ffmpeg -f lavfi -i "movie=/home/a141982112/test_videos/Starship_Troopers.vob[out0+subcc]" -map s some.srt
---
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/ccaption_dec.c | 518 ++
 3 files changed, 520 insertions(+)
 create mode 100644 libavcodec/ccaption_dec.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 107661b..33051c4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
 OBJS-$(CONF

Re: [FFmpeg-devel] [PATCH] doc/ffmpeg mention both ffpreset/avpreset in documentation, remove superfluous example

2015-01-05 Thread Stefano Sabatini
On date Friday 2015-01-02 11:13:29 +0100, Werner Robitza encoded:
[...]
> (By the way, should I use in-reply-to or do you want separate threads
> for new patches? The developer doc doesn't say.)

I tend to prefer to have a single thread, so I can follow the
evolution and discussion related to a patch more easily.
-- 
FFmpeg = Funny Free Mortal Portable Elitarian Gem
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavfilter/vf_blend: do not unconditionally compile both filters

2015-01-05 Thread Stefano Sabatini
On date Sunday 2015-01-04 12:31:30 +, Paul B Mahol encoded:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/vf_blend.c | 32 
>  1 file changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
> index 538774b..a29cabc 100644
> --- a/libavfilter/vf_blend.c
> +++ b/libavfilter/vf_blend.c
> @@ -373,6 +373,20 @@ static int query_formats(AVFilterContext *ctx)
>  return 0;
>  }
>  
> +static av_cold void uninit(AVFilterContext *ctx)
> +{
> +BlendContext *b = ctx->priv;
> +int i;
> +
> +ff_dualinput_uninit(&b->dinput);
> +av_freep(&b->prev_frame);
> +
> +for (i = 0; i < FF_ARRAY_ELEMS(b->params); i++)
> +av_expr_free(b->params[i].e);
> +}
> +
> +#if CONFIG_BLEND_FILTER
> +
>  static int config_output(AVFilterLink *outlink)
>  {
>  AVFilterContext *ctx = outlink->src;
> @@ -418,18 +432,6 @@ static int config_output(AVFilterLink *outlink)
>  return 0;
>  }
>  
> -static av_cold void uninit(AVFilterContext *ctx)
> -{
> -BlendContext *b = ctx->priv;
> -int i;
> -
> -ff_dualinput_uninit(&b->dinput);
> -av_freep(&b->prev_frame);
> -
> -for (i = 0; i < FF_ARRAY_ELEMS(b->params); i++)
> -av_expr_free(b->params[i].e);
> -}
> -
>  static int request_frame(AVFilterLink *outlink)
>  {
>  BlendContext *b = outlink->src->priv;
> @@ -478,6 +480,10 @@ AVFilter ff_vf_blend = {
>  .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | 
> AVFILTER_FLAG_SLICE_THREADS,
>  };
>  
> +#endif
> +
> +#if CONFIG_TBLEND_FILTER
> +
>  static int tblend_config_output(AVFilterLink *outlink)
>  {
>  AVFilterContext *ctx = outlink->src;
> @@ -545,3 +551,5 @@ AVFilter ff_vf_tblend = {
>  .outputs   = tblend_outputs,
>  .flags = AVFILTER_FLAG_SLICE_THREADS,
>  };
> +
> +#endif

LGTM.
-- 
FFmpeg = Fiendish and Fierce Mere Purposeless Ecstatic Gnome
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel