Re: [FFmpeg-devel] [PATCH 2/2] avutil/mips: [loongson] simplify macro TRANSPOSE_4H and TRANSPOSE_8B

2018-09-06 Thread Shiyou Yin
>-Original Message-
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Shiyou Yin
>Sent: Thursday, September 6, 2018 4:11 PM
>To: ffmpeg-devel@ffmpeg.org
>Subject: [FFmpeg-devel] [PATCH 2/2] avutil/mips: [loongson] simplify macro 
>TRANSPOSE_4H and
>TRANSPOSE_8B
>
>Simplify macro TRANSPOSE_4H in mmiutils.h and add TRANSPOSE_8B as a common 
>macro.
>---
> libavcodec/mips/vc1dsp_mmi.c | 12 +++
> libavcodec/mips/vp8dsp_mmi.c | 72 +
> libavutil/mips/mmiutils.h| 84 
> 3 files changed, 65 insertions(+), 103 deletions(-)
>
>diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
>index a439b40..80778a5 100644
>--- a/libavcodec/mips/vc1dsp_mmi.c
>+++ b/libavcodec/mips/vc1dsp_mmi.c
>@@ -248,8 +248,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
>0xfff70004, 0xffff, %[ff_pw_4])
>
> TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
>- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
>- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
>+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
>
> MMI_SDC1(%[ftmp15], %[dst], 0x00)
> MMI_SDC1(%[ftmp16], %[dst], 0x10)
>@@ -257,8 +256,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> MMI_SDC1(%[ftmp18], %[dst], 0x30)
>
> TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
>- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
>- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
>+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
>
> MMI_SDC1(%[ftmp19], %[dst], 0x08)
> MMI_SDC1(%[ftmp20], %[dst], 0x18)
>@@ -301,8 +299,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
>0xfff70004, 0xffff, %[ff_pw_4])
>
> TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
>- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
>- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
>+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
>
> MMI_SDC1(%[ftmp15], %[dst], 0x40)
> MMI_SDC1(%[ftmp16], %[dst], 0x50)
>@@ -310,8 +307,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> MMI_SDC1(%[ftmp18], %[dst], 0x70)
>
> TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
>- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
>- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
>+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
>
> MMI_SDC1(%[ftmp19], %[dst], 0x48)
> MMI_SDC1(%[ftmp20], %[dst], 0x58)
>diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
>index b24a87a..bd80aa1 100644
>--- a/libavcodec/mips/vp8dsp_mmi.c
>+++ b/libavcodec/mips/vp8dsp_mmi.c
>@@ -44,58 +44,6 @@
> "punpcklbh  "#dst_r",   "#src", %[db_2] \n\t"   \
> "punpckhbh  "#dst_l",   "#src", %[db_2] \n\t"
>
>-#define MMI_TRANSPOSE8x8_UB_UB(src_0, src_1, src_2, src_3,  \
>-   src_4, src_5, src_6, src_7,  \
>-   dst_0, dst_1, dst_2, dst_3,  \
>-   dst_4, dst_5, dst_6, dst_7)  \
>-"li %[it_1],0xe4\n\t"   \
>-"dmtc1  %[it_1],%[db_1] \n\t"   \
>-"pshufh %[db_2],"#src_0",   %[db_1] \n\t"   \
>-"punpcklbh  "#dst_0",   "#src_0",   "#src_1"\n\t"   \
>-"punpckhbh  "#dst_1",   %[db_2],"#src_1"\n\t"   \
>-"pshufh %[db_2],"#src_2",   %[db_1] \n\t"   \
>-"punpcklbh  "#dst_2",   "#src_2",   "#src_3"\n\t"   \
>-"punpckhbh  "#dst_3",   %[db_2],"#src_3"\n\t"   \
>-"pshufh %[db_2],"#src_4",   %[db_1] \n\t"   \
>-"punpcklbh  "#dst_4",   "#src_4",   "#src_5"\n\t"   \
>-"punpckhbh  "#dst_5",   %[db_2],"#src_5"\n\t"   \
>-"pshufh %[db_2],"#src_6",   %[db_1] \n\t"   \
>-"punpcklbh  "#dst_6",   "#src_6",   "#src_7"\n\t"   \
>-"punpckhbh  "#dst_7",   %[db_2],"#src_7"\n\t"   \
>-\
>-"pshufh %[db_2],"#dst_0",   %[db_1] \n\t"   \
>-"punpcklhw  "#dst_0",   "#dst_0",   "#dst_2"\n\t"   \
>-"punpckhhw  "#dst_2",   %[db_2],"#dst_2"\n\t"   \
>-"pshufh %[db_2],"#dst_1",   %[db_1] \n\t"   \
>-"punpcklhw  "#dst_1",   "#dst_1",   "#dst_3"

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] fix improper use of register constraints.

2018-09-06 Thread Shiyou Yin
>-Original Message-
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Shiyou Yin
>Sent: Thursday, September 6, 2018 4:11 PM
>To: ffmpeg-devel@ffmpeg.org
>Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] fix improper use 
>of register constraints.
>
>Constraint "g" means compiler can store variable in memory or register.
>When we use constraint "g" for a variable and this variable was operated by
>instruction which only support register operands may lead "invalid operands" 
>error.
>---
> libavcodec/mips/vc1dsp_mmi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
>index d78e0c3..a439b40 100644
>--- a/libavcodec/mips/vc1dsp_mmi.c
>+++ b/libavcodec/mips/vc1dsp_mmi.c
>@@ -1857,8 +1857,8 @@ static void OPNAME ## vc1_shift2_mmi(uint8_t *dst, const 
>uint8_t *src,
>\
> : RESTRICT_ASM_LOW32RESTRICT_ASM_ADDRT  \
>   [src]"+r"(src),   [dst]"+r"(dst)  \
> : [offset]"r"(offset),  [offset_x2n]"r"(-2*offset), \
>-  [stride]"g"(stride),  [rnd]"m"(rnd),  \
>-  [stride1]"g"(stride-offset),  \
>+  [stride]"r"(stride),  [rnd]"m"(rnd),  \
>+  [stride1]"r"(stride-offset),  \
>   [ff_pw_9]"m"(ff_pw_9) \
> : "$8", "$9", "$10", "$f0", "$f2", "$f4", "$f6", "$f8", "$f10", \
>   "$f12", "$f14", "$f16", "memory"  \
>@@ -2082,7 +2082,7 @@ OPNAME ## vc1_## NAME ## _mmi(uint8_t *dst, const 
>uint8_t *src,
>\
>   [h]"+r"(h),   \
>   [src]"+r"(src),   [dst]"+r"(dst)  \
> : [offset_x1]"r"(offset),   [offset_x2]"r"(2*offset),   \
>-  [offset_x3]"r"(3*offset), [stride]"g"(stride),\
>+  [offset_x3]"r"(3*offset), [stride]"r"(stride),\
>   [rnd]"m"(rnd),\
>   [ff_pw_53]"m"(ff_pw_53),  [ff_pw_18]"m"(ff_pw_18),\
>   [ff_pw_3]"f"(ff_pw_3) \
>--
>2.1.0

Hi Michael, could you please help to review this patch.


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/mips: [loongson] optimize vp8 decoding in vp8dsp.

2018-09-06 Thread Shiyou Yin
>-Original Message-
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Shiyou Yin
>Sent: Wednesday, September 5, 2018 6:31 PM
>To: ffmpeg-devel@ffmpeg.org
>Cc: gxw
>Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/mips: [loongson] optimize vp8 
>decoding in vp8dsp.
>
>From: gxw 
>
>Optimize vp8 loop filter with mmi, four functions optimized:
>1. ff_vp8_h_loop_filter8uv_mmi.
>2. ff_vp8_v_loop_filter8uv_mmi.
>3. ff_vp8_h_loop_filter16_mmi.
>4. ff_vp8_v_loop_filter16_mmi.
>
>Vp8 decoding speed improved about 50%(from 73fps to 110fps, Tested on loongson 
>3A3000).
>
>Signed-off-by: Shiyou Yin 
>---
> libavcodec/mips/vp8dsp_mmi.c | 402 +++
> libavutil/mips/mmiutils.h|  28 +++
> 2 files changed, 394 insertions(+), 36 deletions(-)
>
>diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
>index f972628..b24a87a 100644
>--- a/libavcodec/mips/vp8dsp_mmi.c
>+++ b/libavcodec/mips/vp8dsp_mmi.c
>@@ -25,6 +25,221 @@
> #include "constants.h"
> #include "libavutil/mips/mmiutils.h"
>
>+#define DECLARE_DOUBLE_1double db_1
>+#define DECLARE_DOUBLE_2double db_2
>+#define DECLARE_UINT32_Tuint32_t  it_1
>+#define RESTRICT_ASM_DOUBLE_1   [db_1]"="(db_1)
>+#define RESTRICT_ASM_DOUBLE_2   [db_2]"="(db_2)
>+#define RESTRICT_ASM_UINT32_T   [it_1]"="(it_1)
>+
>+#define MMI_PCMPGTUB(dst, src1, src2)   \
>+"pcmpeqb%[db_1],"#src1","#src2" \n\t"   \
>+"pmaxub %[db_2],"#src1","#src2" \n\t"   \
>+"pcmpeqb%[db_2],%[db_2],"#src1" \n\t"   \
>+"xor"#dst", %[db_2],%[db_1] \n\t"
>+
>+#define MMI_BTOH(dst_l, dst_r, src) \
>+"xor%[db_1],%[db_1],%[db_1] \n\t"   \
>+"pcmpgtb%[db_2],%[db_1],"#src"  \n\t"   \
>+"punpcklbh  "#dst_r",   "#src", %[db_2] \n\t"   \
>+"punpckhbh  "#dst_l",   "#src", %[db_2] \n\t"
>+
>+#define MMI_TRANSPOSE8x8_UB_UB(src_0, src_1, src_2, src_3,  \
>+   src_4, src_5, src_6, src_7,  \
>+   dst_0, dst_1, dst_2, dst_3,  \
>+   dst_4, dst_5, dst_6, dst_7)  \
>+"li %[it_1],0xe4\n\t"   \
>+"dmtc1  %[it_1],%[db_1] \n\t"   \
>+"pshufh %[db_2],"#src_0",   %[db_1] \n\t"   \
>+"punpcklbh  "#dst_0",   "#src_0",   "#src_1"\n\t"   \
>+"punpckhbh  "#dst_1",   %[db_2],"#src_1"\n\t"   \
>+"pshufh %[db_2],"#src_2",   %[db_1] \n\t"   \
>+"punpcklbh  "#dst_2",   "#src_2",   "#src_3"\n\t"   \
>+"punpckhbh  "#dst_3",   %[db_2],"#src_3"\n\t"   \
>+"pshufh %[db_2],"#src_4",   %[db_1] \n\t"   \
>+"punpcklbh  "#dst_4",   "#src_4",   "#src_5"\n\t"   \
>+"punpckhbh  "#dst_5",   %[db_2],"#src_5"\n\t"   \
>+"pshufh %[db_2],"#src_6",   %[db_1] \n\t"   \
>+"punpcklbh  "#dst_6",   "#src_6",   "#src_7"\n\t"   \
>+"punpckhbh  "#dst_7",   %[db_2],"#src_7"\n\t"   \
>+\
>+"pshufh %[db_2],"#dst_0",   %[db_1] \n\t"   \
>+"punpcklhw  "#dst_0",   "#dst_0",   "#dst_2"\n\t"   \
>+"punpckhhw  "#dst_2",   %[db_2],"#dst_2"\n\t"   \
>+"pshufh %[db_2],"#dst_1",   %[db_1] \n\t"   \
>+"punpcklhw  "#dst_1",   "#dst_1",   "#dst_3"\n\t"   \
>+"punpckhhw  "#dst_3",   %[db_2],"#dst_3"\n\t"   \
>+"pshufh %[db_2],"#dst_4",   %[db_1] \n\t"   \
>+"punpcklhw  "#dst_4",   "#dst_4",   "#dst_6"\n\t"   \
>+"punpckhhw  "#dst_6",   %[db_2],"#dst_6"\n\t"   \
>+"pshufh %[db_2],"#dst_5",   %[db_1] \n\t"   \
>+"punpcklhw  "#dst_5",   "#dst_5",   "#dst_7"\n\t"   \
>+"punpckhhw  "#dst_7",   %[db_2],"#dst_7"\n\t"   \
>+\
>+"pshufh %[db_2],"#dst_0",   %[db_1] \n\t"   \
>+"punpcklwd  "#dst_0",   "#dst_0",   "#dst_4"\n\t"   \
>+"punpckhwd  "#dst_4",   %[db_2],"#dst_4"

Re: [FFmpeg-devel] [PATCH] avcodec: add RemotelyAnywhere Screen Capture decoder

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 10:05:50PM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  configure   |   1 +
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/rasc.c   | 789 
>  libavformat/riff.c  |   1 +
>  7 files changed, 801 insertions(+)
>  create mode 100644 libavcodec/rasc.c
[...]
> +static int decode_dlta(AVCodecContext *avctx,
> +   AVPacket *avpkt, unsigned size)
> +{
> +RASCContext *s = avctx->priv_data;
> +GetByteContext *gb = >gb;
> +GetByteContext dc;
> +unsigned uncompressed_size, pos;
> +unsigned x, y, w, h;
> +int ret, cx, cy, compression;
> +uint8_t *b1, *b2;
> +
> +pos = bytestream2_tell(gb);
> +bytestream2_skip(gb, 12);
> +uncompressed_size = bytestream2_get_le32(gb);
> +x = bytestream2_get_le32(gb);
> +y = bytestream2_get_le32(gb);
> +w = bytestream2_get_le32(gb);
> +h = bytestream2_get_le32(gb);
> +
> +if (x >= avctx->width || y >= avctx->height ||
> +w > avctx->width || h > avctx->height)
> +return AVERROR_INVALIDDATA;
> +
> +if (x + w > avctx->width || y + h > avctx->height)
> +return AVERROR_INVALIDDATA;
> +
> +bytestream2_skip(gb, 4);
> +compression = bytestream2_get_le32(gb);
> +
> +if (compression == 1) {
> +ret = decode_zlib(avctx, avpkt, size, uncompressed_size);
> +if (ret < 0)
> +return ret;
> +bytestream2_init(, s->delta, uncompressed_size);
> +} else if (compression == 0) {
> +if (bytestream2_get_bytes_left(gb) < uncompressed_size)
> +return AVERROR_INVALIDDATA;
> +bytestream2_init(, avpkt->data + bytestream2_tell(gb),
> + uncompressed_size);
> +} else if (compression == 2) {
> +avpriv_request_sample(avctx, "compression %d", compression);
> +return AVERROR_PATCHWELCOME;
> +} else {
> +return AVERROR_INVALIDDATA;
> +}
> +
> +if (!s->frame2->data[0] || !s->frame1->data[0])
> +return AVERROR_INVALIDDATA;
> +
> +b1  = s->frame1->data[0] + s->frame1->linesize[0] * (y + h - 1) + x * 
> s->bpp;
> +b2  = s->frame2->data[0] + s->frame2->linesize[0] * (y + h - 1) + x * 
> s->bpp;
> +cx = 0, cy = h;
> +while (bytestream2_get_bytes_left() > 0) {
> +int type = bytestream2_get_byte();
> +int len = bytestream2_get_byte();
> +unsigned fill;
> +
> +switch (type) {
> +case 1:
> +while (len > 0 && cy > 0) {
> +cx++;
> +NEXT_LINE
> +}
> +break;
> +case 2:
> +while (len > 0 && cy > 0) {
> +int v0 = b1[cx];
> +int v1 = b2[cx];
> +
> +b2[cx] = v0;
> +b1[cx] = v1;
> +cx++;
> +NEXT_LINE
> +}
> +break;
> +case 3:
> +while (len > 0 && cy > 0) {
> +fill = bytestream2_get_byte();
> +b1[cx] = b2[cx];
> +b2[cx] = fill;
> +cx++;
> +NEXT_LINE
> +}
> +break;
> +case 4:
> +fill = bytestream2_get_byte();
> +while (len > 0 && cy > 0) {
> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
> +AV_WL32(b2 + cx, fill);
> +cx++;
> +NEXT_LINE
> +}
> +break;
> +case 7:
> +fill = bytestream2_get_le32();
> +while (len > 0 && cy > 0) {
> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
> +AV_WL32(b2 + cx, fill);
> +cx += 4;
> +NEXT_LINE
> +}
> +break;
> +case 10:
> +while (len > 0 && cy > 0) {
> +cx += 4;
> +NEXT_LINE
> +}
> +break;
> +case 12:
> +while (len > 0 && cy > 0) {
> +unsigned v0, v1;
> +
> +v0 = AV_RL32(b2 + cx);
> +v1 = AV_RL32(b1 + cx);
> +AV_WL32(b2 + cx, v1);
> +AV_WL32(b1 + cx, v0);
> +cx += 4;
> +NEXT_LINE
> +}
> +break;
> +case 13:
> +while (len > 0 && cy > 0) {
> +fill = bytestream2_get_le32();
> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
> +AV_WL32(b2 + cx, fill);
> +cx += 4;
> +NEXT_LINE
> +}
> +break;
> +default:

> +printf("%d %d\n", type, bytestream2_tell());
> +bytestream2_seek(, 0, SEEK_SET);
> +for (int i = 0; bytestream2_get_bytes_left() > 0; i++)
> +printf("%02X ", 

Re: [FFmpeg-devel] [PATCH 1/2] avutil/file: do not request PROT_WRITE in av_file_map

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 08:58:36PM +0200, Marton Balint wrote:
> The documentation states that av_file_map can only be used for reading and for
> WIN32 we are already requesting a read only mapping.

libavutil/tests/file.c disagrees and its unhappy with this patch

thx

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


Re: [FFmpeg-devel] [PATCH] frame: Simplify the video allocation

2018-09-06 Thread James Almer
On 9/6/2018 7:26 PM, Michael Niedermayer wrote:
> On Thu, Sep 06, 2018 at 01:10:31PM -0300, James Almer wrote:
>> On 9/4/2018 5:09 PM, Michael Niedermayer wrote:
>>> On Mon, Sep 03, 2018 at 10:29:13AM -0300, James Almer wrote:
 On 9/3/2018 5:17 AM, Michael Niedermayer wrote:
> On Sun, Sep 02, 2018 at 09:34:23PM -0300, James Almer wrote:
>> From: Luca Barbato 
>>
>> Merged-by: James Almer 
>> ---
>> This is the next merge in the queue. It's a critical part of the AVFrame 
>> API,
>> so even if FATE passes I'd rather have others look at it and test in case
>> something breaks.
>>
>> The only difference compared to the libav commit is the "32 - 1" padding 
>> per
>> plane when allocating the buffer, which was only in our tree.
>
> why is the STRIDE_ALIGN (which is a thing in units of bytes along the
> horizontal axis) added to padded_height which is vertical axis ?
> This is not done prior to the change

 The only way to keep this padding we currently have in the tree applied
 to the buffer allocation for each plane like it was before the change
 (Except it'll now be one continuous buffer instead of one per plane) is
 by passing it alongside the height parameter to
 av_image_fill_pointers(). The result is essentially the same.

 Do you want me to change the name of the variable, or remove it and pass
 32 - 1 to both av_image_fill_pointers() calls directly? Removing the
 padding will probably just make whatever overreads prompted its addition
 to resurface.
 Alternatively, i can just no-op this merge and move on.
>>>
>>> allocating one plane instead of 3 is better obviously so i dont think this
>>> should be no-oped unless someone implements this differently
>>>
>>> i dont think the padding can be removed saftely but i might be missing 
>>> something
>>> also i do not remember this 100%
>>>
>>> what i see and i may have misunderstood your reply but the code before 
>>> places
>>> a few bytes between planes, the new code places a few lines, that is alot 
>>> more
>>> space. Its not even the best that can be done with the current API. For 
>>> example
>>> the number of extra lines would generally be 1 to provide sufficient padding
>>> at most reaslistic resolutions.
>>>
>>> also there is the independant question on the API, do we want/need to make 
>>> adding padding between planes easier?>
>>> actually i think that if we change from 31 bytes to X lines padding then 
>>> this
>>> should be a commit seperate of the 3->1 change. This would make bisect much
>>> more meaningfull and its rather trivial to split this.
>>
>> Do you have a suggestion on how to choose how many lines of padding to
>> add? 
> 
> something like (with rounding up)
> bytes * horizontal_chroma_subsampling / width * vertical_chroma_subsampling

Isn't a calculation like this already being done?

> 
> 
>> And how would it be done? Just passing (h + padding_lines) to
>> av_buffer_alloc() pre merge, and to av_image_fill_pointers() post merge?
> 
> possible
> 
> 
>>
>> It would also be faster if you could commit that change instead.
> 
> thinking of this, its maybe simpler to adjust data[*] by these to get
> exactly teh same effect as before

Is this before or after the merge? Because after the merge it's
av_image_fill_pointers() who does all the work, and get_video_buffer()
has no control over the pointers.

Nothing about this is obvious to me, so i ask again if you could
implement this instead. Otherwise I'll just no-op the merge and add it
to the list of skipped changes in case someone else wants to give it a
try at some other time.

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

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


Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format

2018-09-06 Thread James Almer
On 8/27/2018 6:07 PM, John Stebbins wrote:
> On 08/27/2018 02:03 PM, James Almer wrote:
>> On 8/27/2018 5:48 PM, John Stebbins wrote:
>>> On 08/27/2018 01:29 PM, James Almer wrote:
 On 8/27/2018 4:57 PM, John Stebbins wrote:
> Fixes ticket #6897
> ---
>  libavformat/movenc.c | 40 +---
>  1 file changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 8a3b651514..dd6281d210 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = 
> {
>  { AV_CODEC_ID_NONE, 0 },
>  };
>  
> +static int validate_codec_tag(const AVCodecTag *const *tags,
> +  unsigned int tag, int codec_id)
> +{
> +int i;
> +
> +/**
> + * Check that tag + id is in the table
> + */
> +for (i = 0; tags && tags[i]; i++) {
> +const AVCodecTag *codec_tags = tags[i];
> +while (codec_tags->id != AV_CODEC_ID_NONE) {
> +if (codec_tags->tag == tag && codec_tags->id == codec_id) {
 Make both tag checks case insensitive using avpriv_toupper4(), then
 return codec_tags->tag instead of 1 if the check succeeds.
>>> I've never seen mismatched case in these tags, but sure, why not... there's 
>>> plenty I haven't seen.
>> AV1 in IVF is AV01, wheres in mp4 it's av01. That's the case i had in
>> mind when requesting this.
> 
> Hmm, I should probably return codec_tags->tag in this case rather than tag 
> since it is the expected capitalization for
> the container.  I'll have to fix that (again).

What's the status of this? With that change i think it should be good to
go in.

> 
>>
> +return 1;
> +}
> +codec_tags++;
> +}
> +}
> +return 0;
> +}
> +
>  static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
>  {
>  int tag;
 Take the opportunity to change this, the ones in mov_get_codec_tag() and
 in validate_codec_tag() to unsigned int, including the return types.
 Codec tags in AVCodecTag are unsigned after all.

> @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, 
> MOVTrack *track)
>  if (is_cover_image(track->st))
>  return ff_codec_get_tag(codec_cover_image_tags, 
> track->par->codec_id);
>  
> -if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
> -tag = track->par->codec_tag;
> -else if (track->mode == MODE_ISM)
> -tag = track->par->codec_tag;
> -else if (track->mode == MODE_IPOD) {
> +if (track->mode == MODE_IPOD)
>  if (!av_match_ext(s->url, "m4a") &&
>  !av_match_ext(s->url, "m4v") &&
>  !av_match_ext(s->url, "m4b"))
>  av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a 
> nor .m4v "
> "Quicktime/Ipod might not play the file\n");
> -tag = track->par->codec_tag;
> -} else if (track->mode & MODE_3GP)
> -tag = track->par->codec_tag;
> -else if (track->mode == MODE_F4V)
> -tag = track->par->codec_tag;
> -else
> +
> +if (track->mode == MODE_MOV)
>  tag = mov_get_codec_tag(s, track);
> +else
> +if (!validate_codec_tag(s->oformat->codec_tag, 
> track->par->codec_tag,
> +track->par->codec_id))
> +tag = 0;
> +else
> +tag = track->par->codec_tag;
 And of course make this simply

 tag = validate_codec_tag(...);

 Thanks.

>  
>  return tag;
>  }
>
>>>
>>> All good suggestions, thanks.
>>>
>>>
>>>
>>> ___
>>> 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 mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

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


Re: [FFmpeg-devel] [PATCH] frame: Simplify the video allocation

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 01:10:31PM -0300, James Almer wrote:
> On 9/4/2018 5:09 PM, Michael Niedermayer wrote:
> > On Mon, Sep 03, 2018 at 10:29:13AM -0300, James Almer wrote:
> >> On 9/3/2018 5:17 AM, Michael Niedermayer wrote:
> >>> On Sun, Sep 02, 2018 at 09:34:23PM -0300, James Almer wrote:
>  From: Luca Barbato 
> 
>  Merged-by: James Almer 
>  ---
>  This is the next merge in the queue. It's a critical part of the AVFrame 
>  API,
>  so even if FATE passes I'd rather have others look at it and test in case
>  something breaks.
> 
>  The only difference compared to the libav commit is the "32 - 1" padding 
>  per
>  plane when allocating the buffer, which was only in our tree.
> >>>
> >>> why is the STRIDE_ALIGN (which is a thing in units of bytes along the
> >>> horizontal axis) added to padded_height which is vertical axis ?
> >>> This is not done prior to the change
> >>
> >> The only way to keep this padding we currently have in the tree applied
> >> to the buffer allocation for each plane like it was before the change
> >> (Except it'll now be one continuous buffer instead of one per plane) is
> >> by passing it alongside the height parameter to
> >> av_image_fill_pointers(). The result is essentially the same.
> >>
> >> Do you want me to change the name of the variable, or remove it and pass
> >> 32 - 1 to both av_image_fill_pointers() calls directly? Removing the
> >> padding will probably just make whatever overreads prompted its addition
> >> to resurface.
> >> Alternatively, i can just no-op this merge and move on.
> > 
> > allocating one plane instead of 3 is better obviously so i dont think this
> > should be no-oped unless someone implements this differently
> > 
> > i dont think the padding can be removed saftely but i might be missing 
> > something
> > also i do not remember this 100%
> > 
> > what i see and i may have misunderstood your reply but the code before 
> > places
> > a few bytes between planes, the new code places a few lines, that is alot 
> > more
> > space. Its not even the best that can be done with the current API. For 
> > example
> > the number of extra lines would generally be 1 to provide sufficient padding
> > at most reaslistic resolutions.
> > 
> > also there is the independant question on the API, do we want/need to make 
> > adding padding between planes easier?>
> > actually i think that if we change from 31 bytes to X lines padding then 
> > this
> > should be a commit seperate of the 3->1 change. This would make bisect much
> > more meaningfull and its rather trivial to split this.
> 
> Do you have a suggestion on how to choose how many lines of padding to
> add? 

something like (with rounding up)
bytes * horizontal_chroma_subsampling / width * vertical_chroma_subsampling


> And how would it be done? Just passing (h + padding_lines) to
> av_buffer_alloc() pre merge, and to av_image_fill_pointers() post merge?

possible


> 
> It would also be faster if you could commit that change instead.

thinking of this, its maybe simpler to adjust data[*] by these to get
exactly teh same effect as before


thx

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

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


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


Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-09-06 Thread Marton Balint



On Thu, 6 Sep 2018, Bodecs Bela wrote:


Hi Balint,


2018.09.06. 22:20 keltezéssel, Marton Balint írta:


On Sat, 1 Sep 2018, Bodecs Bela wrote:


Hi Balint,


2018.08.25. 20:35 keltezéssel, Marton Balint írta:

To delay filtering until a given wallclock timestamp.

Signed-off-by: Marton Balint 
---
  doc/filters.texi |  36 ++
  libavfilter/Makefile |   2 +
  libavfilter/allfilters.c |   2 +
  libavfilter/f_cue.c  | 182 
+++

  libavfilter/version.h    |   2 +-
  5 files changed, 223 insertions(+), 1 deletion(-)
  create mode 100644 libavfilter/f_cue.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..79eec0c808 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -551,6 +551,11 @@ Set LFO range.
  Set LFO rate.
  @end table

+@section acue
+
+Delay audio filtering until a given wallclock timestamp. See the 
@ref{cue}

+filter.
+
  @section adeclick
  Remove impulsive noise from input audio.

@@ -6987,6 +6992,37 @@ indicates 'never reset', and returns the 
largest area encountered during

  playback.
  @end table

+@anchor{cue}
+@section cue
+
+Delay video filtering until a given wallclock timestamp. The filter 
first

+passes on @option{preroll} amount of frames, then it buffers at most
+@option{buffer} amount of frames and waits for the cue. After 
reaching the cue
+it forwards the buffered frames and also any subsequent frames 
coming in its

+input.
+
+The filter can be used synchronize the output of multiple ffmpeg 
processes for
+realtime output devices like decklink. By putting the delay in the 
filtering
+chain and pre-buffering frames the process can pass on data to 
output almost

+immediately after the target wallclock timestamp is reached.
+
+Perfect frame accuracy cannot be guaranteed, but the result is good 
enough for

+some use cases.


just for my curiousity, will you please give an example/use_case how 
to use these filters?


Here is a shell script:

#!/bin/bash
UNIX_TIMESTAMP=`date +%s`
TS=$((UNIX_TIMESTAMP*100 + 250))
ffmpeg -nostdin -nostats -stream_loop -1 -i input1.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (1)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input2.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (2)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input3.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (3)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input4.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (4)" &


Thank you.

what about to create a new parameter for the filters: relcue/arelcue ?

relcue would be a relative value to current timestamp. This way the 
shell variable will be unneeded.


The shell variable is needed to be able to provide a common start 
timestamp to all the processes. If relative timestamp is used, that kind 
of defeats the purpose of synchronization, because different processes 
will have different delays in opening their inputs, which means variable 
delay in initalizing their filters, so the start time for passing data 
will not be common among processes.




usage of cue and relcue would be mutally esclusive parameters.


Obviously it is possible, can be added later if somebody finds a valid use 
case for it :)


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


Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: Parse encryption init info from streams.

2018-09-06 Thread Jacob Trimble
On Tue, Aug 28, 2018 at 12:56 PM Jacob Trimble  wrote:
>
> On Mon, Aug 20, 2018 at 11:39 AM Jacob Trimble  wrote:
> >
> > On Thu, Aug 9, 2018 at 9:14 AM Jacob Trimble  wrote:
> > >
> > > On Wed, Aug 1, 2018 at 1:46 PM Jacob Trimble  wrote:
> > > >
> > > > On Mon, Jul 23, 2018 at 2:01 PM Jacob Trimble  
> > > > wrote:
> > > > >
> > > > > On Thu, Jul 12, 2018 at 5:05 PM Jacob Trimble  
> > > > > wrote:
> > > > > >
> > > > > > Signed-off-by: Jacob Trimble 
> > > > > > ---
> > > > > >  libavformat/matroskadec.c | 43 
> > > > > > +--
> > > > > >  1 file changed, 32 insertions(+), 11 deletions(-)
> > > > > >
> > > > > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > > > > > index 1ded431b80..bfef329e59 100644
> > > > > > --- a/libavformat/matroskadec.c
> > > > > > +++ b/libavformat/matroskadec.c
> > > > > > @@ -2080,7 +2080,8 @@ static int 
> > > > > > matroska_parse_tracks(AVFormatContext *s)
> > > > > >  int extradata_offset = 0;
> > > > > >  uint32_t fourcc = 0;
> > > > > >  AVIOContext b;
> > > > > > -char* key_id_base64 = NULL;
> > > > > > +char* key_id = NULL;
> > > > > > +int key_id_size = 0;
> > > > > >  int bit_depth = -1;
> > > > > >
> > > > > >  /* Apply some sanity checks. */
> > > > > > @@ -2133,14 +2134,8 @@ static int 
> > > > > > matroska_parse_tracks(AVFormatContext *s)
> > > > > >  if (encodings[0].encryption.key_id.size > 0) {
> > > > > >  /* Save the encryption key id to be stored 
> > > > > > later as a
> > > > > > metadata tag. */
> > > > > > -const int b64_size = 
> > > > > > AV_BASE64_SIZE(encodings[0].encryption.key_id.size);
> > > > > > -key_id_base64 = av_malloc(b64_size);
> > > > > > -if (key_id_base64 == NULL)
> > > > > > -return AVERROR(ENOMEM);
> > > > > > -
> > > > > > -av_base64_encode(key_id_base64, b64_size,
> > > > > > - 
> > > > > > encodings[0].encryption.key_id.data,
> > > > > > - 
> > > > > > encodings[0].encryption.key_id.size);
> > > > > > +key_id = encodings[0].encryption.key_id.data;
> > > > > > +key_id_size = 
> > > > > > encodings[0].encryption.key_id.size;
> > > > > >  } else {
> > > > > >  encodings[0].scope = 0;
> > > > > >  av_log(matroska->ctx, AV_LOG_ERROR,
> > > > > > @@ -2198,14 +2193,40 @@ static int 
> > > > > > matroska_parse_tracks(AVFormatContext *s)
> > > > > >
> > > > > >  st = track->stream = avformat_new_stream(s, NULL);
> > > > > >  if (!st) {
> > > > > > -av_free(key_id_base64);
> > > > > >  return AVERROR(ENOMEM);
> > > > > >  }
> > > > > >
> > > > > > -if (key_id_base64) {
> > > > > > +if (key_id) {
> > > > > > +AVEncryptionInitInfo *init_info;
> > > > > > +uint8_t *side_data;
> > > > > > +size_t side_data_size;
> > > > > > +const int b64_size = AV_BASE64_SIZE(key_id_size);
> > > > > > +char *key_id_base64 = av_malloc(b64_size);
> > > > > > +if (!key_id_base64)
> > > > > > +return AVERROR(ENOMEM);
> > > > > > +av_base64_encode(key_id_base64, b64_size, key_id, 
> > > > > > key_id_size);
> > > > > > +
> > > > > >  /* export encryption key id as base64 metadata tag */
> > > > > >  av_dict_set(>metadata, "enc_key_id", 
> > > > > > key_id_base64, 0);
> > > > > >  av_freep(_id_base64);
> > > > > > +
> > > > > > +
> > > > > > +/* Convert the key ID to a generic encryption init 
> > > > > > info */
> > > > > > +init_info = av_encryption_init_info_alloc(/* 
> > > > > > system_id_size */ 0, /* num_key_ids */ 1,
> > > > > > +  /* 
> > > > > > key_id_size */ key_id_size, /* data_size */ 0);
> > > > > > +if (!init_info)
> > > > > > +return AVERROR(ENOMEM);
> > > > > > +memcpy(init_info->key_ids[0], key_id, key_id_size);
> > > > > > +side_data = 
> > > > > > av_encryption_init_info_add_side_data(init_info, _data_size);
> > > > > > +av_encryption_init_info_free(init_info);
> > > > > > +if (!side_data)
> > > > > > +return AVERROR(ENOMEM);
> > > > > > +ret = av_stream_add_side_data(st, 
> > > > > > AV_PKT_DATA_ENCRYPTION_INIT_INFO,
> > > > > > +  side_data, 
> > > > > > side_data_size);
> > > > > > +if (ret < 0) {
> > > > > > +av_free(side_data);
> > > > > > +return ret;
> > > > > > +}
> > > > > >  }
> > > > > >
> > > > > >  if 

Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-09-06 Thread Bodecs Bela

Hi Balint,


2018.09.06. 22:20 keltezéssel, Marton Balint írta:


On Sat, 1 Sep 2018, Bodecs Bela wrote:


Hi Balint,


2018.08.25. 20:35 keltezéssel, Marton Balint írta:

To delay filtering until a given wallclock timestamp.

Signed-off-by: Marton Balint 
---
  doc/filters.texi |  36 ++
  libavfilter/Makefile |   2 +
  libavfilter/allfilters.c |   2 +
  libavfilter/f_cue.c  | 182 
+++

  libavfilter/version.h    |   2 +-
  5 files changed, 223 insertions(+), 1 deletion(-)
  create mode 100644 libavfilter/f_cue.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..79eec0c808 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -551,6 +551,11 @@ Set LFO range.
  Set LFO rate.
  @end table

+@section acue
+
+Delay audio filtering until a given wallclock timestamp. See the 
@ref{cue}

+filter.
+
  @section adeclick
  Remove impulsive noise from input audio.

@@ -6987,6 +6992,37 @@ indicates 'never reset', and returns the 
largest area encountered during

  playback.
  @end table

+@anchor{cue}
+@section cue
+
+Delay video filtering until a given wallclock timestamp. The filter 
first

+passes on @option{preroll} amount of frames, then it buffers at most
+@option{buffer} amount of frames and waits for the cue. After 
reaching the cue
+it forwards the buffered frames and also any subsequent frames 
coming in its

+input.
+
+The filter can be used synchronize the output of multiple ffmpeg 
processes for
+realtime output devices like decklink. By putting the delay in the 
filtering
+chain and pre-buffering frames the process can pass on data to 
output almost

+immediately after the target wallclock timestamp is reached.
+
+Perfect frame accuracy cannot be guaranteed, but the result is good 
enough for

+some use cases.


just for my curiousity, will you please give an example/use_case how 
to use these filters?


Here is a shell script:

#!/bin/bash
UNIX_TIMESTAMP=`date +%s`
TS=$((UNIX_TIMESTAMP*100 + 250))
ffmpeg -nostdin -nostats -stream_loop -1 -i input1.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (1)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input2.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (2)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input3.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (3)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input4.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (4)" &


Thank you.

what about to create a new parameter for the filters: relcue/arelcue ?

relcue would be a relative value to current timestamp. This way the 
shell variable will be unneeded.


usage of cue and relcue would be mutally esclusive parameters.

We are doing something similar to drive 16 TVs in a studio set 
simultaneously.


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


bb

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


[FFmpeg-devel] [PATCH] avdevice/decklink_enc: add support for setting duplex mode

2018-09-06 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/outdevs.texi | 4 
 libavdevice/decklink_enc.cpp | 1 +
 libavdevice/decklink_enc_c.c | 4 
 libavdevice/version.h| 2 +-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index 30d376d793..34c508a970 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -150,6 +150,10 @@ Defaults to @option{false}.
 Amount of time to preroll video in seconds.
 Defaults to @option{0.5}.
 
+@item duplex_mode
+Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
@samp{full}.
+Defaults to @samp{unset}.
+
 @end table
 
 @subsection Examples
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index ee4c962add..de562bd22d 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -395,6 +395,7 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx)
 ctx->list_devices = cctx->list_devices;
 ctx->list_formats = cctx->list_formats;
 ctx->preroll  = cctx->preroll;
+ctx->duplex_mode  = cctx->duplex_mode;
 cctx->ctx = ctx;
 
 /* List available devices and exit. */
diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
index 360535cfda..6169078159 100644
--- a/libavdevice/decklink_enc_c.c
+++ b/libavdevice/decklink_enc_c.c
@@ -31,6 +31,10 @@ static const AVOption options[] = {
 { "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, ENC },
 { "list_formats", "list supported formats"  , OFFSET(list_formats), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, ENC },
 { "preroll" , "video preroll in seconds", OFFSET(preroll ), 
AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC },
+{ "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 2, ENC, "duplex_mode"},
+{ "unset"   ,  NULL , 0   , 
AV_OPT_TYPE_CONST , { .i64 = 0   }, 0, 0, ENC, "duplex_mode"},
+{ "half",  NULL , 0   , 
AV_OPT_TYPE_CONST , { .i64 = 1   }, 0, 0, ENC, "duplex_mode"},
+{ "full",  NULL , 0   , 
AV_OPT_TYPE_CONST , { .i64 = 2   }, 0, 0, ENC, "duplex_mode"},
 { NULL },
 };
 
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 9904149288..c10081461d 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVDEVICE_VERSION_MAJOR  58
 #define LIBAVDEVICE_VERSION_MINOR   4
-#define LIBAVDEVICE_VERSION_MICRO 101
+#define LIBAVDEVICE_VERSION_MICRO 102
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
-- 
2.16.4

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


Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters

2018-09-06 Thread Marton Balint


On Sat, 1 Sep 2018, Bodecs Bela wrote:


Hi Balint,


2018.08.25. 20:35 keltezéssel, Marton Balint írta:

To delay filtering until a given wallclock timestamp.

Signed-off-by: Marton Balint 
---
  doc/filters.texi |  36 ++
  libavfilter/Makefile |   2 +
  libavfilter/allfilters.c |   2 +
  libavfilter/f_cue.c  | 182 +++
  libavfilter/version.h|   2 +-
  5 files changed, 223 insertions(+), 1 deletion(-)
  create mode 100644 libavfilter/f_cue.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..79eec0c808 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -551,6 +551,11 @@ Set LFO range.
  Set LFO rate.
  @end table

+@section acue
+
+Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
+filter.
+
  @section adeclick
  Remove impulsive noise from input audio.

@@ -6987,6 +6992,37 @@ indicates 'never reset', and returns the largest area 
encountered during
  playback.
  @end table

+@anchor{cue}
+@section cue
+
+Delay video filtering until a given wallclock timestamp. The filter first
+passes on @option{preroll} amount of frames, then it buffers at most
+@option{buffer} amount of frames and waits for the cue. After reaching the cue
+it forwards the buffered frames and also any subsequent frames coming in its
+input.
+
+The filter can be used synchronize the output of multiple ffmpeg processes for
+realtime output devices like decklink. By putting the delay in the filtering
+chain and pre-buffering frames the process can pass on data to output almost
+immediately after the target wallclock timestamp is reached.
+
+Perfect frame accuracy cannot be guaranteed, but the result is good enough for
+some use cases.


just for my curiousity, will you please give an example/use_case how to 
use these filters?


Here is a shell script:

#!/bin/bash
UNIX_TIMESTAMP=`date +%s`
TS=$((UNIX_TIMESTAMP*100 + 250))
ffmpeg -nostdin -nostats -stream_loop -1 -i input1.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (1)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input2.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (2)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input3.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (3)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input4.mp4 \
 -vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
 -af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (4)" &

We are doing something similar to drive 16 TVs in a studio set 
simultaneously.


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


[FFmpeg-devel] [PATCH] avcodec: add RemotelyAnywhere Screen Capture decoder

2018-09-06 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/rasc.c   | 789 
 libavformat/riff.c  |   1 +
 7 files changed, 801 insertions(+)
 create mode 100644 libavcodec/rasc.c

diff --git a/configure b/configure
index 0d6ee0abfc..595be65f2c 100755
--- a/configure
+++ b/configure
@@ -2719,6 +2719,7 @@ qdm2_decoder_select="mdct rdft mpegaudiodsp"
 ra_144_decoder_select="audiodsp"
 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
 ralf_decoder_select="golomb"
+rasc_decoder_deps="zlib"
 rawvideo_decoder_select="bswapdsp"
 rscc_decoder_deps="zlib"
 rtjpeg_decoder_select="me_cmp"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f8673f0121..ceec1df972 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -536,6 +536,7 @@ OBJS-$(CONFIG_RA_144_DECODER)  += ra144dec.o 
ra144.o celp_filters.o
 OBJS-$(CONFIG_RA_144_ENCODER)  += ra144enc.o ra144.o celp_filters.o
 OBJS-$(CONFIG_RA_288_DECODER)  += ra288.o celp_filters.o
 OBJS-$(CONFIG_RALF_DECODER)+= ralf.o
+OBJS-$(CONFIG_RASC_DECODER)+= rasc.o
 OBJS-$(CONFIG_RAWVIDEO_DECODER)+= rawdec.o
 OBJS-$(CONFIG_RAWVIDEO_ENCODER)+= rawenc.o
 OBJS-$(CONFIG_REALTEXT_DECODER)+= realtextdec.o ass.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index a461131c78..8fc1aeab79 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -248,6 +248,7 @@ extern AVCodec ff_r10k_encoder;
 extern AVCodec ff_r10k_decoder;
 extern AVCodec ff_r210_encoder;
 extern AVCodec ff_r210_decoder;
+extern AVCodec ff_rasc_decoder;
 extern AVCodec ff_rawvideo_encoder;
 extern AVCodec ff_rawvideo_decoder;
 extern AVCodec ff_rl2_decoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b6688b7af3..719c181a08 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -451,6 +451,7 @@ enum AVCodecID {
 AV_CODEC_ID_PROSUMER,
 AV_CODEC_ID_MWSC,
 AV_CODEC_ID_WCMV,
+AV_CODEC_ID_RASC,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 46dfe3f5e5..67a30542d1 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1682,6 +1682,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("WinCAM Motion Video"),
 .props = AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_RASC,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "rasc",
+.long_name = NULL_IF_CONFIG_SMALL("RemotelyAnywhere Screen Capture"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
new file mode 100644
index 00..1b420c4131
--- /dev/null
+++ b/libavcodec/rasc.c
@@ -0,0 +1,789 @@
+/*
+ * RemotelyAnywhere Screen Capture decoder
+ *
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+#include 
+
+#define KBND MKTAG('K', 'B', 'N', 'D')
+#define FINT MKTAG('F', 'I', 'N', 'T')
+#define INIT MKTAG('I', 'N', 'I', 'T')
+#define BNDL MKTAG('B', 'N', 'D', 'L')
+#define KFRM MKTAG('K', 'F', 'R', 'M')
+#define DLTA MKTAG('D', 'L', 'T', 'A')
+#define MOUS MKTAG('M', 'O', 'U', 'S')
+#define MPOS MKTAG('M', 'P', 'O', 'S')
+#define MOVE MKTAG('M', 'O', 'V', 'E')
+#define EMPT MKTAG('E', 'M', 'P', 'T')
+
+typedef struct RASCContext {
+AVClass*class;
+int skip_cursor;
+GetByteContext  gb;
+uint8_t*delta;
+int delta_size;
+uint8_t*cursor;
+int cursor_size;
+unsignedcursor_w;
+unsignedcursor_h;
+unsignedcursor_x;
+unsignedcursor_y;
+int stride;
+int

Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: add reserve free space option

2018-09-06 Thread James Almer
On 9/6/2018 4:18 PM, James Darnley wrote:
> On 2018-09-06 19:39, Sigríður Regína Sigurþórsdóttir wrote:
>> +if (s->metadata_header_padding) {
>> +if (s->metadata_header_padding == 1)
>> +s->metadata_header_padding++;
>> +put_ebml_void(pb, s->metadata_header_padding);
>> +}
> 
> Unfortunately I was forced to make the default -1 so you want to check
> that the value is greater than 0 rather than just true.
> 
> Furthermore I think you will still want to add to Changelog making a
> note that the matroska muxer will now listen to metadata_header_padding.

No, this kind of change doesn't justify a Changelog entry as mentioned
before.

>  That may also want a micro version bump so that library users can check.

Micro version bump is ok.

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

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


Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: add reserve free space option

2018-09-06 Thread Carl Eugen Hoyos
2018-09-06 21:18 GMT+02:00, James Darnley :
> On 2018-09-06 19:39, Sigríður Regína Sigurþórsdóttir wrote:
>> +if (s->metadata_header_padding) {
>> +if (s->metadata_header_padding == 1)
>> +s->metadata_header_padding++;
>> +put_ebml_void(pb, s->metadata_header_padding);
>> +}
>
> Unfortunately I was forced to make the default -1 so you want to check
> that the value is greater than 0 rather than just true.
>
> Furthermore I think you will still want to add to Changelog making a
> note that the matroska muxer will now listen to metadata_header_padding.

I don't remember a new option that warranted a Changelog entry...

>  That may also want a micro version bump so that library users can check.

Of course!

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


Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: add reserve free space option

2018-09-06 Thread James Darnley
On 2018-09-06 19:39, Sigríður Regína Sigurþórsdóttir wrote:
> +if (s->metadata_header_padding) {
> +if (s->metadata_header_padding == 1)
> +s->metadata_header_padding++;
> +put_ebml_void(pb, s->metadata_header_padding);
> +}

Unfortunately I was forced to make the default -1 so you want to check
that the value is greater than 0 rather than just true.

Furthermore I think you will still want to add to Changelog making a
note that the matroska muxer will now listen to metadata_header_padding.
 That may also want a micro version bump so that library users can check.

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


[FFmpeg-devel] [PATCH 1/2] avutil/file: do not request PROT_WRITE in av_file_map

2018-09-06 Thread Marton Balint
The documentation states that av_file_map can only be used for reading and for
WIN32 we are already requesting a read only mapping.

Signed-off-by: Marton Balint 
---
 libavutil/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index 24a86c3f35..2153e51379 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -86,7 +86,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
 *size = off_size;
 
 #if HAVE_MMAP
-ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+ptr = mmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
 if (ptr == MAP_FAILED) {
 err = AVERROR(errno);
 av_strerror(err, errbuf, sizeof(errbuf));
-- 
2.16.4

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


[FFmpeg-devel] [PATCH 2/2] avutil/file: allow mapping 0 byte files with av_file_map

2018-09-06 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavutil/file.c | 8 
 libavutil/file.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/libavutil/file.c b/libavutil/file.c
index 2153e51379..64f11fed76 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -85,6 +85,11 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
 }
 *size = off_size;
 
+if (!*size) {
+*bufptr = NULL;
+goto out;
+}
+
 #if HAVE_MMAP
 ptr = mmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
 if (ptr == MAP_FAILED) {
@@ -126,12 +131,15 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
 read(fd, *bufptr, *size);
 #endif
 
+out:
 close(fd);
 return 0;
 }
 
 void av_file_unmap(uint8_t *bufptr, size_t size)
 {
+if (!size)
+return;
 #if HAVE_MMAP
 munmap(bufptr, size);
 #elif HAVE_MAPVIEWOFFILE
diff --git a/libavutil/file.h b/libavutil/file.h
index 8666c7b1d5..ea6798b259 100644
--- a/libavutil/file.h
+++ b/libavutil/file.h
@@ -33,6 +33,8 @@
  * allocated buffer or map it with mmap() when available.
  * In case of success set *bufptr to the read or mmapped buffer, and
  * *size to the size in bytes of the buffer in *bufptr.
+ * Unlike mmap this function succeeds with zero sized files, in this
+ * case *bufptr will be be NULL and *size will be set to 0.
  * The returned buffer must be released with av_file_unmap().
  *
  * @param log_offset loglevel offset used for logging
-- 
2.16.4

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: block output == input for files

2018-09-06 Thread Gyan Doshi

On 05-09-2018 06:06 AM, Michael Niedermayer wrote:

On Mon, Sep 03, 2018 at 10:48:45AM +0530, Gyan Doshi wrote:

On 31-08-2018 10:26 AM, Gyan Doshi wrote:

On 31-08-2018 09:57 AM, Gyan Doshi wrote:

On 31-08-2018 04:28 AM, Marton Balint wrote:



Is there any real use case when same source and destination works, so
the option can be used?

If not, then just make ffmpeg fail, like the cp command fails for same
source and destination. I am against adding an option if it has no
known use.


Via the file protocol, not that I know of. Will remove.

Gyan


Revised patch attached.


Ping.


no objections though this solution has limitations, so if someone has a
better idea ...


Looks like no one does. Plan to push tomorrow.

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


Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: add reserve free space option

2018-09-06 Thread Sigríður Regína Sigurþórsdóttir
On Wed, Sep 5, 2018 at 6:29 PM James Darnley  wrote:
>
> On 2018-09-05 22:52, Sigríður Regína Sigurþórsdóttir wrote:
> > +{"reserve_free_space", "Reserve a given amount of space at the
> > beginning og the file for unspecified purpose."
>
> I added the "metadata_header_padding" global option many years ago.  Can
> you not reuse it for this purpose?  Is it not likely to be "metadata"
> that another software might fill this with?

Thank you for the suggestion. Here is an updated version using the
"metadata_header_padding".


---
 libavformat/matroskaenc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 09a62e1..3d8ec3c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2005,6 +2005,11 @@ static int mkv_write_header(AVFormatContext *s)
 ret = AVERROR(ENOMEM);
 goto fail;
 }
+if (s->metadata_header_padding) {
+if (s->metadata_header_padding == 1)
+s->metadata_header_padding++;
+put_ebml_void(pb, s->metadata_header_padding);
+}
 if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && mkv->reserve_cues_space) {
 mkv->cues_pos = avio_tell(pb);
 if (mkv->reserve_cues_space == 1)
-- 
2.6.2


0001-avformat-matroskaenc-add-reserve-free-space-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Use QT format for audio sample descriptors depending on stsd version.

2018-09-06 Thread John Stebbins
On 09/06/2018 09:18 AM, Derek Buitenhuis wrote:
> On 06/09/2018 17:13, Carl Eugen Hoyos wrote:
>> Please mention ticket #7376 (and the Handbrake issue) in the commit
>> message.
> Wasn't aware there were tickets already, woops.
>
> Added locally.
>
>

Looks like this also supersedes my earlier patch to fix the same problem... 
your solution is better, thanks ;)

https://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233733.html

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/dnxhddec: ask for samples with alpha

2018-09-06 Thread Paul B Mahol
On 9/6/18, Carl Eugen Hoyos  wrote:
> 2018-09-06 13:48 GMT+02:00, Paul B Mahol :
>> ffmpeg | branch: master | Paul B Mahol  | Thu Sep  6
>> 13:39:22 2018 +0200| [237bbf6678a0c3fc6962716edf72db1063de860c] |
>> committer:
>> Paul B Mahol
>>
>> avcodec/dnxhddec: ask for samples with alpha
>
> Did you look at the samples that were already provided?
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3707/
> The second sample was supposed to be specifically useful.

Both samples unfortunately use undocumented stuff not mention in codec
specification. They do not follow specification.

They are probably storing alpha raw dump after all other stuff (at least
for one sample I tried).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] PATCH: Rotation override for encoding case in metadata

2018-09-06 Thread Илья Щербак
From 193d415c5b6f29be8f75839d5be4a5ca03bbac10 Mon Sep 17 00:00:00 2001
From: Ilya Shcherbak 
Date: Thu, 6 Sep 2018 18:30:20 +0300
Subject: [PATCH] Added rotation override for encoding case

---
 fftools/ffmpeg.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 934dc71a74..ac1972eb94 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3573,6 +3573,11 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 memcpy(dst, sd->data, sd->size);
 if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
 av_display_rotation_set((uint32_t *)dst, 0);
+
+if (ost->rotate_overridden) {
+if (sd->type == AV_PKT_DATA_DISPLAYMATRIX)
+av_display_rotation_set((uint32_t *)dst, 
-ost->rotate_override_value);
+}
 }
 }
 
-- 

> 6 сент. 2018 г., в 18:42, Ilya Shcherbak  написал(а):
> 
> Currently there is ignoring "rotate" flag in metadata for the case when 
> encoding is needing. The patch is propagating this flag to destination video.
> i.g.:
> ffmpeg -noautorotate -i input.mp4 -metadata:s:v:0 rotate=0 -vcodec libx264 
> output.mp4
> 
> this patch is allow us to do things like this: skip rotation flag and encode 
> video as is and mark it as a normal video without rotation.
> 
> Best,
> Ilya.
> <0001-Added-rotation-override-for-encoding-case.patch>

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/dnxhddec: ask for samples with alpha

2018-09-06 Thread Carl Eugen Hoyos
2018-09-06 13:48 GMT+02:00, Paul B Mahol :
> ffmpeg | branch: master | Paul B Mahol  | Thu Sep  6
> 13:39:22 2018 +0200| [237bbf6678a0c3fc6962716edf72db1063de860c] | committer:
> Paul B Mahol
>
> avcodec/dnxhddec: ask for samples with alpha

Did you look at the samples that were already provided?
http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3707/
The second sample was supposed to be specifically useful.

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


Re: [FFmpeg-devel] [PATCH 1/2] Use QT format for audio sample descriptors depending on stsd version.

2018-09-06 Thread Derek Buitenhuis
On 06/09/2018 17:13, Carl Eugen Hoyos wrote:
> Please mention ticket #7376 (and the Handbrake issue) in the commit
> message.

Wasn't aware there were tickets already, woops.

Added locally.

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


Re: [FFmpeg-devel] [PATCH] frame: Simplify the video allocation

2018-09-06 Thread James Almer
On 9/4/2018 5:09 PM, Michael Niedermayer wrote:
> On Mon, Sep 03, 2018 at 10:29:13AM -0300, James Almer wrote:
>> On 9/3/2018 5:17 AM, Michael Niedermayer wrote:
>>> On Sun, Sep 02, 2018 at 09:34:23PM -0300, James Almer wrote:
 From: Luca Barbato 

 Merged-by: James Almer 
 ---
 This is the next merge in the queue. It's a critical part of the AVFrame 
 API,
 so even if FATE passes I'd rather have others look at it and test in case
 something breaks.

 The only difference compared to the libav commit is the "32 - 1" padding 
 per
 plane when allocating the buffer, which was only in our tree.
>>>
>>> why is the STRIDE_ALIGN (which is a thing in units of bytes along the
>>> horizontal axis) added to padded_height which is vertical axis ?
>>> This is not done prior to the change
>>
>> The only way to keep this padding we currently have in the tree applied
>> to the buffer allocation for each plane like it was before the change
>> (Except it'll now be one continuous buffer instead of one per plane) is
>> by passing it alongside the height parameter to
>> av_image_fill_pointers(). The result is essentially the same.
>>
>> Do you want me to change the name of the variable, or remove it and pass
>> 32 - 1 to both av_image_fill_pointers() calls directly? Removing the
>> padding will probably just make whatever overreads prompted its addition
>> to resurface.
>> Alternatively, i can just no-op this merge and move on.
> 
> allocating one plane instead of 3 is better obviously so i dont think this
> should be no-oped unless someone implements this differently
> 
> i dont think the padding can be removed saftely but i might be missing 
> something
> also i do not remember this 100%
> 
> what i see and i may have misunderstood your reply but the code before places
> a few bytes between planes, the new code places a few lines, that is alot more
> space. Its not even the best that can be done with the current API. For 
> example
> the number of extra lines would generally be 1 to provide sufficient padding
> at most reaslistic resolutions.
> 
> also there is the independant question on the API, do we want/need to make 
> adding padding between planes easier?>
> actually i think that if we change from 31 bytes to X lines padding then this
> should be a commit seperate of the 3->1 change. This would make bisect much
> more meaningfull and its rather trivial to split this.

Do you have a suggestion on how to choose how many lines of padding to
add? And how would it be done? Just passing (h + padding_lines) to
av_buffer_alloc() pre merge, and to av_image_fill_pointers() post merge?

It would also be faster if you could commit that change instead.

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

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


Re: [FFmpeg-devel] [PATCH 1/2] Use QT format for audio sample descriptors depending on stsd version.

2018-09-06 Thread Carl Eugen Hoyos
2018-09-06 17:35 GMT+02:00, Derek Buitenhuis :
> From: Justin Ruggles 
>
> ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so
> assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does
> not define a version 2.
>
> This fixes audio decoding for some MP4 files generated with Apple
> tools. The additional fields present in SoundDescriptionV1/V2 need to
> be read in order to correctly read additional boxes that contain
> information required for decoding the stream.

Please mention ticket #7376 (and the Handbrake issue) in the commit
message.

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


[FFmpeg-devel] PATCH: Rotation override for encoding case in metadata

2018-09-06 Thread Ilya Shcherbak
Currently there is ignoring "rotate" flag in metadata for the case when
encoding is needing. The patch is propagating this flag to destination
video.
i.g.:
ffmpeg -noautorotate -i input.mp4 -metadata:s:v:0 rotate=0 -vcodec libx264
output.mp4

this patch is allow us to do things like this: skip rotation flag and
encode video as is and mark it as a normal video without rotation.

Best,
Ilya.


0001-Added-rotation-override-for-encoding-case.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] Use QT format for audio sample descriptors depending on stsd version.

2018-09-06 Thread Derek Buitenhuis
From: Justin Ruggles 

ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so
assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does
not define a version 2.

This fixes audio decoding for some MP4 files generated with Apple
tools. The additional fields present in SoundDescriptionV1/V2 need to
be read in order to correctly read additional boxes that contain
information required for decoding the stream.

Signed-off-by: Derek Buitenhuis 
---
 libavformat/isom.h | 1 +
 libavformat/mov.c  | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 51abea52de..89659db8ee 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -217,6 +217,7 @@ typedef struct MOVStreamContext {
 int *extradata_size;
 int last_stsd_index;
 int stsd_count;
+int stsd_version;
 
 int32_t *display_matrix;
 AVStereo3D *stereo3d;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d922e0f173..ea99616dc8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2120,8 +2120,8 @@ static void mov_parse_stsd_audio(MOVContext *c, 
AVIOContext *pb,
 // Read QT version 1 fields. In version 0 these do not exist.
 av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom);
 if (!c->isom ||
-(compatible_brands && strstr(compatible_brands->value, "qt  "))) {
-
+(compatible_brands && strstr(compatible_brands->value, "qt  ")) ||
+(sc->stsd_version == 0 && version > 0)) {
 if (version == 1) {
 sc->samples_per_frame = avio_rb32(pb);
 avio_rb32(pb); /* bytes per packet */
@@ -2554,7 +2554,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 st = c->fc->streams[c->fc->nb_streams - 1];
 sc = st->priv_data;
 
-avio_r8(pb); /* version */
+sc->stsd_version = avio_r8(pb);
 avio_rb24(pb); /* flags */
 entries = avio_rb32(pb);
 
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 2/2] Add FATE test for QT format audio descriptors in MP4

2018-09-06 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 tests/fate/mov.mak   | 3 +++
 tests/ref/fate/mov-mp4-with-mov-in24-ver | 3 +++
 2 files changed, 6 insertions(+)
 create mode 100644 tests/ref/fate/mov-mp4-with-mov-in24-ver

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 3d9e4280bb..ecdd7f92b4 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -28,6 +28,7 @@ FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
fate-mov-guess-delay-1 \
fate-mov-guess-delay-2 \
fate-mov-guess-delay-3 \
+   fate-mov-mp4-with-mov-in24-ver \
 
 FATE_MOV_FASTSTART = fate-mov-faststart-4gb-overflow \
 
@@ -121,3 +122,5 @@ fate-mov-guess-delay-3: CMD = run 
ffprobe$(PROGSSUF)$(EXESUF) -show_entries stre
 fate-mov-faststart-4gb-overflow: CMD = run tools/qt-faststart$(EXESUF) 
$(TARGET_SAMPLES)/mov/faststart-4gb-overflow.mov 
faststart-4gb-overflow-output.mov > /dev/null ; md5sum 
faststart-4gb-overflow-output.mov | cut -d " " -f1 ; rm 
faststart-4gb-overflow-output.mov
 fate-mov-faststart-4gb-overflow: CMP = oneline
 fate-mov-faststart-4gb-overflow: REF = bc875921f151871e787c4b4023269b29
+
+fate-mov-mp4-with-mov-in24-ver: CMD = run ffprobe -show_entries 
stream=codec_name -select_streams 1 
$(TARGET_SAMPLES)/mov/mp4-with-mov-in24-ver.mp4
diff --git a/tests/ref/fate/mov-mp4-with-mov-in24-ver 
b/tests/ref/fate/mov-mp4-with-mov-in24-ver
new file mode 100644
index 00..b5522454df
--- /dev/null
+++ b/tests/ref/fate/mov-mp4-with-mov-in24-ver
@@ -0,0 +1,3 @@
+[STREAM]
+codec_name=pcm_s24le
+[/STREAM]
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 0/2] QT Audio Descriptors in MP4

2018-09-06 Thread Derek Buitenhuis
Sample for FATE is here: http://chromashift.org/mp4-with-mov-in24-ver.mp4

Derek Buitenhuis (1):
  Add FATE test for QT format audio descriptors in MP4

Justin Ruggles (1):
  Use QT format for audio sample descriptors depending on stsd version.

 libavformat/isom.h   | 1 +
 libavformat/mov.c| 6 +++---
 tests/fate/mov.mak   | 3 +++
 tests/ref/fate/mov-mp4-with-mov-in24-ver | 3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 tests/ref/fate/mov-mp4-with-mov-in24-ver

-- 
2.18.0

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


Re: [FFmpeg-devel] libavdevice/decklink trivial patch for SDI input/output

2018-09-06 Thread Carl Eugen Hoyos


> Am 06.09.2018 um 16:07 schrieb Baldur Gislason :

> I have prepared a patch that adds two things.

Instead please send two patches each adding one thing.

What is supposed to happen if the user specifies “-sdi_link 3”?
Silently assuming “0” is the worst answer imo.

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


[FFmpeg-devel] libavdevice/decklink trivial patch for SDI input/output

2018-09-06 Thread Baldur Gislason
Sending this again as the mime type was wrong for the patch on the last message.
I have prepared a patch that adds two things.
On the Decklink input side, it adds a parameter called 'passthrough'
which makes it possible to change from the default behaviour on cards
that can handle both inputs and outputs. The default behaviour on such
cards depends on the model but many of them will pass through the
input signal if the application generating the output stops. This is
not always desirable so the Decklink API provides a method of changing
it.

On the output side, it adds a parameter called 'sdi_link' which is
crucial when working with SDI output cards that support 3G SDI or
faster. The default behaviour for 1080p60 for example is to use two
HD-SDI links and the default for 2160p29.97 is to use four HD-SDI
links. This option makes it possible to specify how many SDI links are
to be used to make use of 3G, 6G or 12G SDI capabilities of newer
cards which can output those configurations over a single cable.

Baldur Gislason
From 4620016823015757c647662cf2815b7d9cbb69cb Mon Sep 17 00:00:00 2001
From: Baldur Gislason 
Date: Thu, 6 Sep 2018 13:27:01 +
Subject: [PATCH] Adding options to disable Decklink passthrough on capture as
 well as control the output link configuration.

---
 libavdevice/decklink_common.cpp | 12 
 libavdevice/decklink_common_c.h |  2 ++
 libavdevice/decklink_dec_c.c|  4 
 libavdevice/decklink_enc.cpp| 13 +
 libavdevice/decklink_enc_c.c|  1 +
 5 files changed, 32 insertions(+)

diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index aab9d85b94..35d9aa636b 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -352,6 +352,18 @@ int ff_decklink_list_formats(AVFormatContext *avctx, 
decklink_direction_t direct
 
 if (direction == DIRECTION_IN) {
 int ret;
+switch(cctx->passthrough) {
+case 0:
+ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, 
bmdDeckLinkCapturePassthroughModeDirect);
+break;
+case 1:
+ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, 
bmdDeckLinkCapturePassthroughModeCleanSwitch);
+break;
+case 2:
+ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, 
bmdDeckLinkCapturePassthroughModeDisabled);
+break;
+}
+
 ret = decklink_select_input(avctx, 
bmdDeckLinkConfigAudioInputConnection);
 if (ret < 0)
 return ret;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 32a5d70ee1..0e30ec44b9 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -53,6 +53,8 @@ struct decklink_cctx {
 int tc_format;
 int draw_bars;
 char *format_code;
+int sdi_link;
+int passthrough;
 int raw_format;
 int64_t queue_size;
 int copyts;
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 6ab3819375..e9f202b0ad 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -84,6 +84,10 @@ static const AVOption options[] = {
 { "queue_size","input queue buffer size",   OFFSET(queue_size),   
AV_OPT_TYPE_INT64, { .i64 = (1024 * 1024 * 1024)}, 0, INT64_MAX, DEC },
 { "audio_depth",   "audio bitdepth (16 or 32)", OFFSET(audio_depth),  
AV_OPT_TYPE_INT,   { .i64 = 16}, 16, 32, DEC },
 { "decklink_copyts", "copy timestamps, do not remove the initial offset", 
OFFSET(copyts), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
+{ "passthrough",   "monitoring pass through mode", OFFSET(passthrough),  
AV_OPT_TYPE_INT,{ .i64 = 0}, 0, 2, DEC, "passthrough" },
+{ "direct",NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "passthrough" },
+{ "cleanswitch",   NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "passthrough" },
+{ "disabled",  NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "passthrough" },
 { NULL },
 };
 
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index ee4c962add..d98d72e847 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -150,6 +150,19 @@ static int decklink_setup_video(AVFormatContext *avctx, 
AVStream *st)
 return -1;
 }
 
+switch(cctx->sdi_link) {
+case 1:
+ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, 
bmdLinkConfigurationSingleLink);
+break;
+case 2:
+ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, 
bmdLinkConfigurationDualLink);
+break;
+case 4:
+ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, 
bmdLinkConfigurationQuadLink);
+break;
+}
+
+
 if (c->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
 if 

[FFmpeg-devel] [PATCH v7 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-09-06 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  41 +++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 303 +
 libavcodec/version.h   |   4 +-
 8 files changed, 367 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/libxavs2.c

diff --git a/Changelog b/Changelog
index 0975fee..8377956 100644
--- a/Changelog
+++ b/Changelog
@@ -21,6 +21,7 @@ version :
 - Brooktree ProSumer video decoder
 - MatchWare Screen Capture Codec decoder
 - WinCam Motion Video decoder
+- AVS2 video encoder via libxavs2
 
 
 version 4.0:
diff --git a/configure b/configure
index 0d6ee0a..c8dc1a8 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,7 @@ External library support:
   --enable-libx264 enable H.264 encoding via x264 [no]
   --enable-libx265 enable HEVC encoding via x265 [no]
   --enable-libxavs enable AVS encoding via xavs [no]
+  --enable-libxavs2enable AVS2 encoding via xavs2 [no]
   --enable-libxcb  enable X11 grabbing using XCB [autodetect]
   --enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
@@ -1666,6 +1667,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3131,6 +3133,7 @@ libx264rgb_encoder_deps="libx264 x264_csp_bgr"
 libx264rgb_encoder_select="libx264_encoder"
 libx265_encoder_deps="libx265"
 libxavs_encoder_deps="libxavs"
+libxavs2_encoder_deps="libxavs2"
 libxvid_encoder_deps="libxvid"
 libzvbi_teletext_decoder_deps="libzvbi"
 vapoursynth_demuxer_deps="vapoursynth"
@@ -6165,6 +6168,7 @@ enabled libx264   && { check_pkg_config libx264 
x264 "stdint.h x264.h" x
 enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 68"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
+enabled libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.2.77" 
"stdint.h xavs2.h" xavs2_api_get
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled libzimg   && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h 
zimg_get_api_version
 enabled libzmq&& require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7b09575..2547acd 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,47 @@ Reduces detail but attempts to preserve color at 
extremely low bitrates.
 
 @end table
 
+@section libxavs2
+
+xavs2 AVS2-P2/IEEE1857.4 encoder wrapper.
+
+This encoder requires the presence of the libxavs2 headers and library
+during configuration. You need to explicitly configure the build with
+@option{--enable-libxavs2}.
+
+@subsection Options
+
+@table @option
+@item lcu_row_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
+used to set the initial qp for the first frame.
+
+@item max_qp
+Set the max qp for rate control from 1 to 63 (default 55).
+
+@item min_qp
+Set the min qp for rate control from 1 to 63 (default 20).
+
+@item speed_level
+Set the Speed level from 0 to 9 (default 0). Higer is better but slower.
+
+@item hierarchical_ref
+Set the hierarchical reference or not (default true).
+
+@item xavs2-params
+Set xavs2 options using a list of @var{key}=@var{value} couples separated
+by ":".
+
+For example to specify libxavs2 encoding options with @option{-xavs2-params}:
+
+@example
+ffmpeg -i input -c:v libxavs2 -xavs2-params speed_level=5 output.avs2
+@end example
+@end table
+
 @c man end VIDEO ENCODERS
 
 @chapter Subtitles Encoders
diff --git a/doc/general.texi b/doc/general.texi
index 06f7a78..05f7bcd9 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,20 @@ for more formats. None of them are used by default, their 
use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
+@section libxavs2
+
+FFmpeg can make use of the xavs2 library for AVS2-P2/IEEE1857.4 video encoding.
+
+Go to @url{https://github.com/pkuvcl/xavs2} and follow the instructions for
+installing the library. Then pass @code{--enable-libxavs2} to configure to
+enable it.
+
+@float NOTE
+libxavs2 is under the GNU Public License Version 2 or later
+(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
+details), you must upgrade FFmpeg's license to GPL in order to use it.
+@end float
+
 @section libdavs2
 
 FFmpeg can make use of the davs2 library for AVS2-P2/IEEE1857.4 video decoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f8673f0..bf17bf7 100644

[FFmpeg-devel] [PATCH v7 2/2] lavf: add raw avs2 muxer

2018-09-06 Thread hwren
Signed-off-by: hwren 
---
 libavformat/allformats.c |  1 +
 libavformat/rawenc.c | 13 +
 2 files changed, 14 insertions(+)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index adcc8d9..c17cdc2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -76,6 +76,7 @@ extern AVInputFormat  ff_avisynth_demuxer;
 extern AVOutputFormat ff_avm2_muxer;
 extern AVInputFormat  ff_avr_demuxer;
 extern AVInputFormat  ff_avs_demuxer;
+extern AVOutputFormat ff_avs2_muxer;
 extern AVInputFormat  ff_bethsoftvid_demuxer;
 extern AVInputFormat  ff_bfi_demuxer;
 extern AVInputFormat  ff_bintext_demuxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 809ca23..993d232 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -117,6 +117,19 @@ AVOutputFormat ff_aptx_hd_muxer = {
 };
 #endif
 
+#if CONFIG_AVS2_MUXER
+AVOutputFormat ff_avs2_muxer = {
+.name  = "avs2",
+.long_name = NULL_IF_CONFIG_SMALL("raw AVS2-P2/IEEE1857.4 video"),
+.extensions= "avs,avs2",
+.audio_codec   = AV_CODEC_ID_NONE,
+.video_codec   = AV_CODEC_ID_AVS2,
+.write_header  = force_one_stream,
+.write_packet  = ff_raw_write_packet,
+.flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_CAVSVIDEO_MUXER
 AVOutputFormat ff_cavsvideo_muxer = {
 .name  = "cavsvideo",
-- 
2.7.4

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


[FFmpeg-devel] Patch that adds options to Decklink input and output modules.

2018-09-06 Thread Baldur Gislason
I have prepared a patch that adds two things.
On the Decklink input side, it adds a parameter called 'passthrough'
which makes it possible to change from the default behaviour on cards
that can handle both inputs and outputs. The default behaviour on such
cards depends on the model but many of them will pass through the
input signal if the application generating the output stops. This is
not always desirable so the Decklink API provides a method of changing
it.

On the output side, it adds a parameter called 'sdi_link' which is
crucial when working with SDI output cards that support 3G SDI or
faster. The default behaviour for 1080p60 for example is to use two
HD-SDI links and the default for 2160p29.97 is to use four HD-SDI
links. This option makes it possible to specify how many SDI links are
to be used to make use of 3G, 6G or 12G SDI capabilities of newer
cards which can output those configurations over a single cable.

Baldur Gislason


0001-Adding-options-to-disable-Decklink-passthrough-on-ca.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v6 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-09-06 Thread Huiwen Ren









At 2018-09-06 08:43:05, "Mark Thompson"  wrote:
>On 05/09/18 14:38, hwren wrote:
>> Signed-off-by: hwren 
[...]
>> +if (cae->xavs2_opts) {
>> +AVDictionary *dict= NULL;
>> +AVDictionaryEntry *en = NULL;
>> +
>> +if (!av_dict_parse_string(, cae->xavs2_opts, "=", ":", 0)) {
>> +while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) 
>> {
>> +xavs2_opt_set2(en->key, "%s", en->value);
>
>Should you check the result of this one?  The user might pass soemthing 
>completely invalid, which probably wants a warning at least.

Added into the macro function :)

[...]
>> +{ "i_initial_qp",   "Quantization parameter" ,  
>> OFFSET(i_initial_qp), AV_OPT_TYPE_INT, {.i64 = 34 }, 1,  63,  VE },
>
>If I understand what you said previously correctly, this is only used in 
>constant-QP mode, and there it is used as the QP for every frame (not just the 
>initial one)?
>
>If that's the case then it should probably not say "initial" - I would read 
>"initial_qp" as meaning the QP used for the first frame only, so probably in 
>modes with a bitrate target.  Maybe change it to just be "qp"?  That name is 
>used by several other encoders, including libx264 and libxavs.

If "RateControl" is opened, the "initial_qp" will be used for the first frame 
and kept for all the other frames (constant-QP) and if there is no rate 
control, the initial_qp will only work for the first frame (xavs2 will always 
initial the qp for the first frame). So...maybe better with "initial"?

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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 11:34:57AM +0530, Gagandeep Singh wrote:
> On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer 
> wrote:
> 
> > On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
> > [...]
> > >
> > > > [...]
> > > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx,
> > void
> > > > *data, int *got_frame,
> > > > >  }
> > > > >  }
> > > > >  }
> > > > > -
> > > > > -if (!s->a_width || !s->a_height || s->a_format ==
> > AV_PIX_FMT_NONE ||
> > > > > -s->coded_width || s->coded_height || s->coded_format !=
> > > > AV_PIX_FMT_NONE) {
> > > >
> > > > > +//disabled to run mountain sample file
> > > > > +#if 0
> > > > > +if ((!s->a_width || !s->a_height || s->a_format ==
> > AV_PIX_FMT_NONE
> > > > ||
> > > > > +s->coded_width || s->coded_height || s->coded_format !=
> > > > AV_PIX_FMT_NONE) && s->sample_type != 1) {
> > > > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> > > > >  ret = AVERROR(EINVAL);
> > > > >  goto end;
> > > > >  }
> > > > > -
> > > > > +#endif
> > > >
> > > > please elaborate why this needs to be disabled
> > > > i presume this code was needed for something
> > > >
> > > I didn't need to disable this for any sample except one, where the image
> > > height and width data wasn't transfered in accordance to how it was in
> > the
> > > rest of the sample so the flow of code was just causing the decoder to
> > > crash. I can produce a more robust fix, though again will need to repost
> > > other patches as well, please comment.
> > >
> > > > also this decoder with the patches should be tested with a fuzzer to
> > > > reduce
> > > > the chance of bugs
> > > >
> > > > I don't know how to use 'fuzzer', sorry, though i can look into that.
> >
> > had missed this reply as its not quoted correctly
> > yes, please look into testing this with a fuzzer, we should make reasonable
> > sure we dont add anomalies
> >
> > thx
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > Dictatorship naturally arises out of democracy, and the most aggravated
> > form of tyranny and slavery out of the most extreme liberty. -- Plato
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> 
> Hi,
> patch updated to add back the check.

>  cfhd.c |  504 
> +
>  cfhd.h |   13 +
>  2 files changed, 450 insertions(+), 67 deletions(-)
> 67182ed6c7222c3a544f07d3501c072da16682ae  3d_transform_add.patch
> From f99726110a9e9e127fc2c7b4bbc3945764ecbfdd Mon Sep 17 00:00:00 2001
> From: Gagandeep Singh 
> Date: Thu, 6 Sep 2018 11:08:57 +0530
> Subject: [GSOC][PATCH 1/3] lavc/cfhd: 3d transform decoding added for both
>  progressive and interlaced samples
> 
> ---
>  libavcodec/cfhd.c | 504 --
>  libavcodec/cfhd.h |  13 +-
>  2 files changed, 450 insertions(+), 67 deletions(-)
> 
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index 846d334b9b..3929b54f31 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -41,12 +41,15 @@
>  #define ALPHA_COMPAND_GAIN 9400
>  
>  enum CFHDParam {
> +TransformType=  10,
>  ChannelCount =  12,
>  SubbandCount =  14,
> +Pframe   =  19,
>  ImageWidth   =  20,
>  ImageHeight  =  21,
>  LowpassPrecision =  35,
>  SubbandNumber=  48,
> +EncodingMethod   =  52,
>  Quantization =  53,
>  ChannelNumber=  62,
>  SampleFlags  =  68,
> @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx)
>  
>  avctx->bits_per_raw_sample = 10;
>  s->avctx   = avctx;
> +s->progressive = 0;
>  
>  return ff_cfhd_init_vlcs(s);
>  }
> @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s)
>  
>  static void init_frame_defaults(CFHDContext *s)
>  {
> +s->sample_type   = 0;
> +s->transform_type= 0;
> +s->pframe= 0;
> +s->first_wavelet = 0;
>  s->coded_width   = 0;
>  s->coded_height  = 0;
>  s->cropped_height= 0;
> @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s)
>  s->pshift= 1;
>  s->codebook  = 0;
>  s->difference_coding = 0;
> -s->progressive   = 0;
>  init_plane_defaults(s);
>  init_peak_table_defaults(s);
>  }
>  
>  /* TODO: merge with VLC tables or use LUT */
> -static inline int dequant_and_decompand(int level, int quantisation, int 
> codebook)
> +static inline int dequant_and_decompand(int level, int quantisation, int 
> codebook, int lossless)
>  {
> +if (lossless)
> +return level;
>  if (codebook == 0 || codebook == 1) {
>  int64_t abslevel = abs(level);
>  if (level < 264)
> @@ 

Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 11:50:12AM +0530, Gagandeep Singh wrote:
> On Thu, Sep 6, 2018 at 11:34 AM Gagandeep Singh 
> wrote:
> 
> >
> >
> > On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer 
> > wrote:
> >
> >> On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
> >> [...]
> >> >
> >> > > [...]
> >> > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx,
> >> void
> >> > > *data, int *got_frame,
> >> > > >  }
> >> > > >  }
> >> > > >  }
> >> > > > -
> >> > > > -if (!s->a_width || !s->a_height || s->a_format ==
> >> AV_PIX_FMT_NONE ||
> >> > > > -s->coded_width || s->coded_height || s->coded_format !=
> >> > > AV_PIX_FMT_NONE) {
> >> > >
> >> > > > +//disabled to run mountain sample file
> >> > > > +#if 0
> >> > > > +if ((!s->a_width || !s->a_height || s->a_format ==
> >> AV_PIX_FMT_NONE
> >> > > ||
> >> > > > +s->coded_width || s->coded_height || s->coded_format !=
> >> > > AV_PIX_FMT_NONE) && s->sample_type != 1) {
> >> > > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> >> > > >  ret = AVERROR(EINVAL);
> >> > > >  goto end;
> >> > > >  }
> >> > > > -
> >> > > > +#endif
> >> > >
> >> > > please elaborate why this needs to be disabled
> >> > > i presume this code was needed for something
> >> > >
> >> > I didn't need to disable this for any sample except one, where the image
> >> > height and width data wasn't transfered in accordance to how it was in
> >> the
> >> > rest of the sample so the flow of code was just causing the decoder to
> >> > crash. I can produce a more robust fix, though again will need to repost
> >> > other patches as well, please comment.
> >> >
> >> > > also this decoder with the patches should be tested with a fuzzer to
> >> > > reduce
> >> > > the chance of bugs
> >> > >
> >> > > I don't know how to use 'fuzzer', sorry, though i can look into that.
> >>
> >> had missed this reply as its not quoted correctly
> >> yes, please look into testing this with a fuzzer, we should make
> >> reasonable
> >> sure we dont add anomalies
> >>
> >> thx
> >>
> >> [...]
> >> --
> >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >>
> >> Dictatorship naturally arises out of democracy, and the most aggravated
> >> form of tyranny and slavery out of the most extreme liberty. -- Plato
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> > Hi,
> > patch updated to add back the check.
> >
> 
> The work around for the check is just to not to check for the coded_width
> == 0 and coded_height == 0 as these are used to set a_width and a_height
> during buffer allocation (which are also being checked for non zero values.
> coded_width and coded_height  were later set to 0 for a loop exit (which
> has been taken care of in other way), and  since i needed to update
> coded_width and coded_height with some other data in case they were not
> available in the sample(we have a sample for the same), thus it
> necessitates that the unneeded check be removed.

tested with zzuf
it crashes:
make -j12 && zzuf -M -1 -r 0.1 -s 0:1000 ./ffmpeg -i 
fate-suite/cfhd/cfhd_odd.mov -f null -

zzuf[s=297,r=1e-05]: signal 11 (SIGSEGV)



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH] avcodec/scpr: add version 3 support

2018-09-06 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/scpr.c  |  368 +++---
 libavcodec/scpr.h  |  349 +
 libavcodec/scpr3.c | 1189 
 libavcodec/scpr3.h |   82 +++
 4 files changed, 1680 insertions(+), 308 deletions(-)
 create mode 100644 libavcodec/scpr.h
 create mode 100644 libavcodec/scpr3.c
 create mode 100644 libavcodec/scpr3.h

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index ee6bf21b71..d1e07b875c 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -24,47 +24,18 @@
 #include 
 #include 
 
+#include "libavutil/qsort.h"
+
 #include "avcodec.h"
 #include "bytestream.h"
 #include "internal.h"
+#include "scpr.h"
+#include "scpr3.h"
 
 #define TOP  0x0100
 #define BOT0x01
 
-typedef struct RangeCoder {
-unsigned   code;
-unsigned   range;
-unsigned   code1;
-} RangeCoder;
-
-typedef struct PixelModel {
-unsignedfreq[256];
-unsignedlookup[16];
-unsignedtotal_freq;
-} PixelModel;
-
-typedef struct SCPRContext {
-AVFrame*last_frame;
-AVFrame*current_frame;
-GetByteContext  gb;
-RangeCoder  rc;
-PixelModel  pixel_model[3][4096];
-unsignedop_model[6][7];
-unsignedrun_model[6][257];
-unsignedrange_model[257];
-unsignedcount_model[257];
-unsignedfill_model[6];
-unsignedsxy_model[4][17];
-unsignedmv_model[2][513];
-unsignednbx, nby;
-unsignednbcount;
-unsigned   *blocks;
-unsignedcbits;
-int cxshift;
-
-int   (*get_freq)(RangeCoder *rc, unsigned total_freq, unsigned 
*freq);
-int   (*decode)(GetByteContext *gb, RangeCoder *rc, unsigned 
cumFreq, unsigned freq, unsigned total_freq);
-} SCPRContext;
+#include "scpr3.c"
 
 static void init_rangecoder(RangeCoder *rc, GetByteContext *gb)
 {
@@ -90,14 +61,14 @@ static void reinit_tables(SCPRContext *s)
 }
 
 for (j = 0; j < 6; j++) {
-unsigned *p = s->run_model[j];
+uint32_t *p = s->run_model[j];
 for (i = 0; i < 256; i++)
 p[i] = 1;
 p[256] = 256;
 }
 
 for (j = 0; j < 6; j++) {
-unsigned *op = s->op_model[j];
+uint32_t *op = s->op_model[j];
 for (i = 0; i < 6; i++)
 op[i] = 1;
 op[6] = 6;
@@ -130,13 +101,13 @@ static void reinit_tables(SCPRContext *s)
 s->mv_model[1][512] = 512;
 }
 
-static int decode(GetByteContext *gb, RangeCoder *rc, unsigned cumFreq, 
unsigned freq, unsigned total_freq)
+static int decode(GetByteContext *gb, RangeCoder *rc, uint32_t cumFreq, 
uint32_t freq, uint32_t total_freq)
 {
 rc->code -= cumFreq * rc->range;
 rc->range *= freq;
 
 while (rc->range < TOP && bytestream2_get_bytes_left(gb) > 0) {
-unsigned byte = bytestream2_get_byte(gb);
+uint32_t byte = bytestream2_get_byte(gb);
 rc->code = (rc->code << 8) | byte;
 rc->range <<= 8;
 }
@@ -144,7 +115,7 @@ static int decode(GetByteContext *gb, RangeCoder *rc, 
unsigned cumFreq, unsigned
 return 0;
 }
 
-static int get_freq(RangeCoder *rc, unsigned total_freq, unsigned *freq)
+static int get_freq(RangeCoder *rc, uint32_t total_freq, uint32_t *freq)
 {
 if (total_freq == 0)
 return AVERROR_INVALIDDATA;
@@ -159,9 +130,9 @@ static int get_freq(RangeCoder *rc, unsigned total_freq, 
unsigned *freq)
 return 0;
 }
 
-static int decode0(GetByteContext *gb, RangeCoder *rc, unsigned cumFreq, 
unsigned freq, unsigned total_freq)
+static int decode0(GetByteContext *gb, RangeCoder *rc, uint32_t cumFreq, 
uint32_t freq, uint32_t total_freq)
 {
-unsigned t;
+uint32_t t;
 
 if (total_freq == 0)
 return AVERROR_INVALIDDATA;
@@ -172,7 +143,7 @@ static int decode0(GetByteContext *gb, RangeCoder *rc, 
unsigned cumFreq, unsigne
 rc->range = rc->range * (uint64_t)(freq + cumFreq) / total_freq - (t + 1);
 
 while (rc->range < TOP && bytestream2_get_bytes_left(gb) > 0) {
-unsigned byte = bytestream2_get_byte(gb);
+uint32_t byte = bytestream2_get_byte(gb);
 rc->code = (rc->code << 8) | byte;
 rc->code1 <<= 8;
 rc->range <<= 8;
@@ -181,7 +152,7 @@ static int decode0(GetByteContext *gb, RangeCoder *rc, 
unsigned cumFreq, unsigne
 return 0;
 }
 
-static int get_freq0(RangeCoder *rc, unsigned total_freq, unsigned *freq)
+static int get_freq0(RangeCoder *rc, uint32_t total_freq, uint32_t *freq)
 {
 if (rc->range == 0)
 return AVERROR_INVALIDDATA;
@@ -191,13 +162,13 @@ static int get_freq0(RangeCoder *rc, unsigned total_freq, 
unsigned *freq)
 return 0;
 }
 
-static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned 
step, unsigned *rval)
+static int decode_value(SCPRContext *s, uint32_t *cnt, uint32_t maxc, uint32_t 
step, uint32_t *rval)
 {
 GetByteContext *gb = >gb;
 RangeCoder *rc = >rc;
-unsigned totfr = 

[FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Add support for AV_PIX_FMT_BGRA.

2018-09-06 Thread Zhong Li
RGB32(AV_PIX_FMT_BGRA on intel platforms) format may be used as overlay with 
alpha blending.
So add AV_PIX_FMT_BGRA format support.

Rename RGB32 to be BGRA to make it clearer as Mark Thompson's suggestion.

V2: Add P010 format support else will introduce HEVC 10bit encoding regression.
Thanks for LinJie's discovery.

Signed-off-by: Zhong Li 
Verified-by: Fu, Linjie 
---
 libavfilter/qsvvpp.c  |  2 +-
 libavutil/hwcontext_qsv.c | 44 ++--
 2 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 7ee1e56..06efdf5 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -142,7 +142,7 @@ static int pix_fmt_to_mfx_fourcc(int format)
 return MFX_FOURCC_NV12;
 case AV_PIX_FMT_YUYV422:
 return MFX_FOURCC_YUY2;
-case AV_PIX_FMT_RGB32:
+case AV_PIX_FMT_BGRA:
 return MFX_FOURCC_RGB4;
 }
 
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 250091c..fa7459c 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -90,6 +90,7 @@ static const struct {
 uint32_t   fourcc;
 } supported_pixel_formats[] = {
 { AV_PIX_FMT_NV12, MFX_FOURCC_NV12 },
+{ AV_PIX_FMT_BGRA, MFX_FOURCC_RGB4 },
 { AV_PIX_FMT_P010, MFX_FOURCC_P010 },
 { AV_PIX_FMT_PAL8, MFX_FOURCC_P8   },
 };
@@ -731,6 +732,37 @@ static int qsv_transfer_data_child(AVHWFramesContext *ctx, 
AVFrame *dst,
 return ret;
 }
 
+static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 
*surface)
+{
+switch (frame->format) {
+case AV_PIX_FMT_NV12:
+case AV_PIX_FMT_P010:
+surface->Data.Y  = frame->data[0];
+surface->Data.UV = frame->data[1];
+break;
+
+case AV_PIX_FMT_YUV420P:
+surface->Data.Y = frame->data[0];
+surface->Data.U = frame->data[1];
+surface->Data.V = frame->data[2];
+break;
+
+case AV_PIX_FMT_BGRA:
+surface->Data.B = frame->data[0];
+surface->Data.G = frame->data[0] + 1;
+surface->Data.R = frame->data[0] + 2;
+surface->Data.A = frame->data[0] + 3;
+break;
+
+default:
+return MFX_ERR_UNSUPPORTED;
+}
+surface->Data.Pitch = frame->linesize[0];
+surface->Data.TimeStamp = frame->pts;
+
+return 0;
+}
+
 static int qsv_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
   const AVFrame *src)
 {
@@ -750,11 +782,7 @@ static int qsv_transfer_data_from(AVHWFramesContext *ctx, 
AVFrame *dst,
 }
 
 out.Info = in->Info;
-out.Data.PitchLow = dst->linesize[0];
-out.Data.Y= dst->data[0];
-out.Data.U= dst->data[1];
-out.Data.V= dst->data[2];
-out.Data.A= dst->data[3];
+map_frame_to_surface(dst, );
 
 do {
 err = MFXVideoVPP_RunFrameVPPAsync(s->session_download, in, , 
NULL, );
@@ -797,11 +825,7 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, 
AVFrame *dst,
 }
 
 in.Info = out->Info;
-in.Data.PitchLow = src->linesize[0];
-in.Data.Y= src->data[0];
-in.Data.U= src->data[1];
-in.Data.V= src->data[2];
-in.Data.A= src->data[3];
+map_frame_to_surface(src, );
 
 do {
 err = MFXVideoVPP_RunFrameVPPAsync(s->session_upload, , out, NULL, 
);
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264dec: remove unnecessary checks in h264_decode_frame

2018-09-06 Thread Zhao Zhili



On 2018年09月06日 17:01, Zhao Zhili wrote:

These conditions are checked again in is_extra(). This patch makes no
functional changes.


I made a mistake. The patch makes no functional changes only after
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-September/233991.html


---
  libavcodec/h264dec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b2447e9..bffce52 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1000,7 +1000,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
   >ps, >is_avc, >nal_length_size,
   avctx->err_recognition, avctx);
  }
-if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && 
(buf[5]&0x1F) && buf[8]==0x67){
+if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC) {
  if (is_extra(buf, buf_size))
  return ff_h264_decode_extradata(buf, buf_size,
  >ps, >is_avc, 
>nal_length_size,


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


[FFmpeg-devel] [PATCH] avcodec/h264dec: check number of SPS in is_extra

2018-09-06 Thread Zhao Zhili
---
 libavcodec/h264dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index bffce52..6f7530d 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -871,6 +871,8 @@ static int is_extra(const uint8_t *buf, int buf_size)
 {
 int cnt= buf[5]&0x1f;
 const uint8_t *p= buf+6;
+if (!cnt)
+return 0;
 while(cnt--){
 int nalsize= AV_RB16(p) + 2;
 if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)
-- 
2.9.5



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


[FFmpeg-devel] [PATCH] avcodec/h264dec: remove unnecessary checks in h264_decode_frame

2018-09-06 Thread Zhao Zhili
These conditions are checked again in is_extra(). This patch makes no
functional changes.
---
 libavcodec/h264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b2447e9..bffce52 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1000,7 +1000,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
  >ps, >is_avc, >nal_length_size,
  avctx->err_recognition, avctx);
 }
-if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
+if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC) {
 if (is_extra(buf, buf_size))
 return ff_h264_decode_extradata(buf, buf_size,
 >ps, >is_avc, 
>nal_length_size,
-- 
2.9.5



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


Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 11:36:22AM +0530, Gagandeep Singh wrote:
> On Fri, Aug 17, 2018 at 11:34 AM Gagandeep Singh 
> wrote:
> 
> >
> >
> > On Thu, Aug 16, 2018 at 2:37 AM Kieran Kunhya  wrote:
> >
> >> On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh 
> >> wrote:
> >>
> >> > Second patch for fixing decompanding in table 9.
> >> >
> >> > Gagandeep Singh
> >> >
> >>
> >> Seems ok
> >>
> >> Kieran
> >>
> >
> > Thanks!!
> >
> > Gagandeep Singh
> >
> 
> Hi,
> This patch is to be applied along with the other updated patches.
> 
> Thanks
> Gagandeep Singh
> 
> > ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >

>  cfhd.c |   25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 44fe9de4bb44ecd39071a9e543b7f8a718a41915  decompanding_fix.patch
> From 4f0c812aaf50738e579bde0bb12b9f2391eb15e5 Mon Sep 17 00:00:00 2001
> From: Gagandeep Singh 
> Date: Thu, 6 Sep 2018 11:12:16 +0530
> Subject: [GSOC][PATCH 2/3] lavc/cfhd: correct decompanding for old codebook 
> (table 9)
> 
> ---
>  libavcodec/cfhd.c | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index 3929b54f31..e78fa81655 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int 
> quantisation, int codeboo
>  {
>  if (lossless)
>  return level;
> -if (codebook == 0 || codebook == 1) {
> +if (codebook == 0) {
> +if (level >= 40 && level < 264) {
> +if (level >= 54) {

> +level  -= 54;
> +level <<= 2;
> +level  += 54;

this can be simplified:
level = (level<<2) - 3*54;

thx


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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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


Re: [FFmpeg-devel] [PATCH] avcodec/h264dec: remove unnecessary checks in h264_decode_frame

2018-09-06 Thread Michael Niedermayer
On Thu, Sep 06, 2018 at 03:38:28PM +0800, Zhao Zhili wrote:
> ---
>  libavcodec/h264dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

why do you think the checks are unneeded ?

the commit message is not sufficient to understand the reasons for this change
does this fix a bug or ticket ? if so how can the bug be reproduced where is
the ticket?

thx

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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


[FFmpeg-devel] [PATCH 2/2] avutil/mips: [loongson] simplify macro TRANSPOSE_4H and TRANSPOSE_8B

2018-09-06 Thread Shiyou Yin
Simplify macro TRANSPOSE_4H in mmiutils.h and add TRANSPOSE_8B as a common 
macro.
---
 libavcodec/mips/vc1dsp_mmi.c | 12 +++
 libavcodec/mips/vp8dsp_mmi.c | 72 +
 libavutil/mips/mmiutils.h| 84 
 3 files changed, 65 insertions(+), 103 deletions(-)

diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index a439b40..80778a5 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -248,8 +248,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
0xfff70004, 0xffff, %[ff_pw_4])
 
 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
 
 MMI_SDC1(%[ftmp15], %[dst], 0x00)
 MMI_SDC1(%[ftmp16], %[dst], 0x10)
@@ -257,8 +256,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
 MMI_SDC1(%[ftmp18], %[dst], 0x30)
 
 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
 
 MMI_SDC1(%[ftmp19], %[dst], 0x08)
 MMI_SDC1(%[ftmp20], %[dst], 0x18)
@@ -301,8 +299,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
0xfff70004, 0xffff, %[ff_pw_4])
 
 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
 
 MMI_SDC1(%[ftmp15], %[dst], 0x40)
 MMI_SDC1(%[ftmp16], %[dst], 0x50)
@@ -310,8 +307,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
 MMI_SDC1(%[ftmp18], %[dst], 0x70)
 
 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
 
 MMI_SDC1(%[ftmp19], %[dst], 0x48)
 MMI_SDC1(%[ftmp20], %[dst], 0x58)
diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
index b24a87a..bd80aa1 100644
--- a/libavcodec/mips/vp8dsp_mmi.c
+++ b/libavcodec/mips/vp8dsp_mmi.c
@@ -44,58 +44,6 @@
 "punpcklbh  "#dst_r",   "#src", %[db_2] \n\t"   \
 "punpckhbh  "#dst_l",   "#src", %[db_2] \n\t"
 
-#define MMI_TRANSPOSE8x8_UB_UB(src_0, src_1, src_2, src_3,  \
-   src_4, src_5, src_6, src_7,  \
-   dst_0, dst_1, dst_2, dst_3,  \
-   dst_4, dst_5, dst_6, dst_7)  \
-"li %[it_1],0xe4\n\t"   \
-"dmtc1  %[it_1],%[db_1] \n\t"   \
-"pshufh %[db_2],"#src_0",   %[db_1] \n\t"   \
-"punpcklbh  "#dst_0",   "#src_0",   "#src_1"\n\t"   \
-"punpckhbh  "#dst_1",   %[db_2],"#src_1"\n\t"   \
-"pshufh %[db_2],"#src_2",   %[db_1] \n\t"   \
-"punpcklbh  "#dst_2",   "#src_2",   "#src_3"\n\t"   \
-"punpckhbh  "#dst_3",   %[db_2],"#src_3"\n\t"   \
-"pshufh %[db_2],"#src_4",   %[db_1] \n\t"   \
-"punpcklbh  "#dst_4",   "#src_4",   "#src_5"\n\t"   \
-"punpckhbh  "#dst_5",   %[db_2],"#src_5"\n\t"   \
-"pshufh %[db_2],"#src_6",   %[db_1] \n\t"   \
-"punpcklbh  "#dst_6",   "#src_6",   "#src_7"\n\t"   \
-"punpckhbh  "#dst_7",   %[db_2],"#src_7"\n\t"   \
-\
-"pshufh %[db_2],"#dst_0",   %[db_1] \n\t"   \
-"punpcklhw  "#dst_0",   "#dst_0",   "#dst_2"\n\t"   \
-"punpckhhw  "#dst_2",   %[db_2],"#dst_2"\n\t"   \
-"pshufh %[db_2],"#dst_1",   %[db_1] \n\t"   \
-"punpcklhw  "#dst_1",   "#dst_1",   "#dst_3"\n\t"   \
-"punpckhhw  "#dst_3",   %[db_2],"#dst_3"\n\t"   \
-"pshufh %[db_2],"#dst_4",   %[db_1] \n\t"   \
-"punpcklhw  "#dst_4",   "#dst_4",   "#dst_6"\n\t"   \
-"punpckhhw  "#dst_6",   %[db_2],"#dst_6"\n\t"   \
-"pshufh %[db_2],"#dst_5",   %[db_1]   

[FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] fix improper use of register constraints.

2018-09-06 Thread Shiyou Yin
Constraint "g" means compiler can store variable in memory or register.
When we use constraint "g" for a variable and this variable was operated by
instruction which only support register operands may lead "invalid operands" 
error.
---
 libavcodec/mips/vc1dsp_mmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index d78e0c3..a439b40 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -1857,8 +1857,8 @@ static void OPNAME ## vc1_shift2_mmi(uint8_t *dst, const 
uint8_t *src,  \
 : RESTRICT_ASM_LOW32RESTRICT_ASM_ADDRT  \
   [src]"+r"(src),   [dst]"+r"(dst)  \
 : [offset]"r"(offset),  [offset_x2n]"r"(-2*offset), \
-  [stride]"g"(stride),  [rnd]"m"(rnd),  \
-  [stride1]"g"(stride-offset),  \
+  [stride]"r"(stride),  [rnd]"m"(rnd),  \
+  [stride1]"r"(stride-offset),  \
   [ff_pw_9]"m"(ff_pw_9) \
 : "$8", "$9", "$10", "$f0", "$f2", "$f4", "$f6", "$f8", "$f10", \
   "$f12", "$f14", "$f16", "memory"  \
@@ -2082,7 +2082,7 @@ OPNAME ## vc1_## NAME ## _mmi(uint8_t *dst, const uint8_t 
*src, \
   [h]"+r"(h),   \
   [src]"+r"(src),   [dst]"+r"(dst)  \
 : [offset_x1]"r"(offset),   [offset_x2]"r"(2*offset),   \
-  [offset_x3]"r"(3*offset), [stride]"g"(stride),\
+  [offset_x3]"r"(3*offset), [stride]"r"(stride),\
   [rnd]"m"(rnd),\
   [ff_pw_53]"m"(ff_pw_53),  [ff_pw_18]"m"(ff_pw_18),\
   [ff_pw_3]"f"(ff_pw_3) \
-- 
2.1.0


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


[FFmpeg-devel] [PATCH] avcodec/h264dec: remove unnecessary checks in h264_decode_frame

2018-09-06 Thread Zhao Zhili
---
 libavcodec/h264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b2447e9..bffce52 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1000,7 +1000,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
  >ps, >is_avc, >nal_length_size,
  avctx->err_recognition, avctx);
 }
-if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
+if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && 
(buf[4]&0xFC)==0xFC) {
 if (is_extra(buf, buf_size))
 return ff_h264_decode_extradata(buf, buf_size,
 >ps, >is_avc, 
>nal_length_size,
-- 
2.9.5



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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-09-06 Thread Gagandeep Singh
On Thu, Sep 6, 2018 at 11:34 AM Gagandeep Singh 
wrote:

>
>
> On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer 
> wrote:
>
>> On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
>> [...]
>> >
>> > > [...]
>> > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx,
>> void
>> > > *data, int *got_frame,
>> > > >  }
>> > > >  }
>> > > >  }
>> > > > -
>> > > > -if (!s->a_width || !s->a_height || s->a_format ==
>> AV_PIX_FMT_NONE ||
>> > > > -s->coded_width || s->coded_height || s->coded_format !=
>> > > AV_PIX_FMT_NONE) {
>> > >
>> > > > +//disabled to run mountain sample file
>> > > > +#if 0
>> > > > +if ((!s->a_width || !s->a_height || s->a_format ==
>> AV_PIX_FMT_NONE
>> > > ||
>> > > > +s->coded_width || s->coded_height || s->coded_format !=
>> > > AV_PIX_FMT_NONE) && s->sample_type != 1) {
>> > > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
>> > > >  ret = AVERROR(EINVAL);
>> > > >  goto end;
>> > > >  }
>> > > > -
>> > > > +#endif
>> > >
>> > > please elaborate why this needs to be disabled
>> > > i presume this code was needed for something
>> > >
>> > I didn't need to disable this for any sample except one, where the image
>> > height and width data wasn't transfered in accordance to how it was in
>> the
>> > rest of the sample so the flow of code was just causing the decoder to
>> > crash. I can produce a more robust fix, though again will need to repost
>> > other patches as well, please comment.
>> >
>> > > also this decoder with the patches should be tested with a fuzzer to
>> > > reduce
>> > > the chance of bugs
>> > >
>> > > I don't know how to use 'fuzzer', sorry, though i can look into that.
>>
>> had missed this reply as its not quoted correctly
>> yes, please look into testing this with a fuzzer, we should make
>> reasonable
>> sure we dont add anomalies
>>
>> thx
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Dictatorship naturally arises out of democracy, and the most aggravated
>> form of tyranny and slavery out of the most extreme liberty. -- Plato
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
> Hi,
> patch updated to add back the check.
>

The work around for the check is just to not to check for the coded_width
== 0 and coded_height == 0 as these are used to set a_width and a_height
during buffer allocation (which are also being checked for non zero values.
coded_width and coded_height  were later set to 0 for a loop exit (which
has been taken care of in other way), and  since i needed to update
coded_width and coded_height with some other data in case they were not
available in the sample(we have a sample for the same), thus it
necessitates that the unneeded check be removed.

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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-09-06 Thread Gagandeep Singh
On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer 
wrote:

> On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
> [...]
> >
> > > [...]
> > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx,
> void
> > > *data, int *got_frame,
> > > >  }
> > > >  }
> > > >  }
> > > > -
> > > > -if (!s->a_width || !s->a_height || s->a_format ==
> AV_PIX_FMT_NONE ||
> > > > -s->coded_width || s->coded_height || s->coded_format !=
> > > AV_PIX_FMT_NONE) {
> > >
> > > > +//disabled to run mountain sample file
> > > > +#if 0
> > > > +if ((!s->a_width || !s->a_height || s->a_format ==
> AV_PIX_FMT_NONE
> > > ||
> > > > +s->coded_width || s->coded_height || s->coded_format !=
> > > AV_PIX_FMT_NONE) && s->sample_type != 1) {
> > > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> > > >  ret = AVERROR(EINVAL);
> > > >  goto end;
> > > >  }
> > > > -
> > > > +#endif
> > >
> > > please elaborate why this needs to be disabled
> > > i presume this code was needed for something
> > >
> > I didn't need to disable this for any sample except one, where the image
> > height and width data wasn't transfered in accordance to how it was in
> the
> > rest of the sample so the flow of code was just causing the decoder to
> > crash. I can produce a more robust fix, though again will need to repost
> > other patches as well, please comment.
> >
> > > also this decoder with the patches should be tested with a fuzzer to
> > > reduce
> > > the chance of bugs
> > >
> > > I don't know how to use 'fuzzer', sorry, though i can look into that.
>
> had missed this reply as its not quoted correctly
> yes, please look into testing this with a fuzzer, we should make reasonable
> sure we dont add anomalies
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Dictatorship naturally arises out of democracy, and the most aggravated
> form of tyranny and slavery out of the most extreme liberty. -- Plato
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Hi,
patch updated to add back the check.
From f99726110a9e9e127fc2c7b4bbc3945764ecbfdd Mon Sep 17 00:00:00 2001
From: Gagandeep Singh 
Date: Thu, 6 Sep 2018 11:08:57 +0530
Subject: [GSOC][PATCH 1/3] lavc/cfhd: 3d transform decoding added for both
 progressive and interlaced samples

---
 libavcodec/cfhd.c | 504 --
 libavcodec/cfhd.h |  13 +-
 2 files changed, 450 insertions(+), 67 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 846d334b9b..3929b54f31 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -41,12 +41,15 @@
 #define ALPHA_COMPAND_GAIN 9400
 
 enum CFHDParam {
+TransformType=  10,
 ChannelCount =  12,
 SubbandCount =  14,
+Pframe   =  19,
 ImageWidth   =  20,
 ImageHeight  =  21,
 LowpassPrecision =  35,
 SubbandNumber=  48,
+EncodingMethod   =  52,
 Quantization =  53,
 ChannelNumber=  62,
 SampleFlags  =  68,
@@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx)
 
 avctx->bits_per_raw_sample = 10;
 s->avctx   = avctx;
+s->progressive = 0;
 
 return ff_cfhd_init_vlcs(s);
 }
@@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s)
 
 static void init_frame_defaults(CFHDContext *s)
 {
+s->sample_type   = 0;
+s->transform_type= 0;
+s->pframe= 0;
+s->first_wavelet = 0;
 s->coded_width   = 0;
 s->coded_height  = 0;
 s->cropped_height= 0;
@@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s)
 s->pshift= 1;
 s->codebook  = 0;
 s->difference_coding = 0;
-s->progressive   = 0;
 init_plane_defaults(s);
 init_peak_table_defaults(s);
 }
 
 /* TODO: merge with VLC tables or use LUT */
-static inline int dequant_and_decompand(int level, int quantisation, int codebook)
+static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless)
 {
+if (lossless)
+return level;
 if (codebook == 0 || codebook == 1) {
 int64_t abslevel = abs(level);
 if (level < 264)
@@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride,
 }
 }
 
-static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high,
- int width, int linesize, int plane)
+static inline void inverse_temporal_filter(int16_t *output, int16_t *low, int16_t *high,
+ int width, int linesize, int temporal_for_highpass)
 {
 int i;
 int16_t even, odd;
 for (i = 0; i < width; i++) {
 even = (low[i] - high[i])/2;
 odd  = (low[i] + high[i])/2;
-

Re: [FFmpeg-devel] [GSOC][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples

2018-09-06 Thread Gagandeep Singh
Hi,
The new patch is to applied on top of the new patches sent.

Thanks
Gagandeep Singh

On Tue, Aug 14, 2018 at 1:14 PM Gagandeep Singh 
wrote:

> Last patch adding frame thread support for ip samples in both progressive
> and interlaced versions.
>
> Gagandeep Singh
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd

2018-09-06 Thread Gagandeep Singh
On Fri, Aug 17, 2018 at 11:34 AM Gagandeep Singh 
wrote:

>
>
> On Thu, Aug 16, 2018 at 2:37 AM Kieran Kunhya  wrote:
>
>> On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh 
>> wrote:
>>
>> > Second patch for fixing decompanding in table 9.
>> >
>> > Gagandeep Singh
>> >
>>
>> Seems ok
>>
>> Kieran
>>
>
> Thanks!!
>
> Gagandeep Singh
>

Hi,
This patch is to be applied along with the other updated patches.

Thanks
Gagandeep Singh

> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 4f0c812aaf50738e579bde0bb12b9f2391eb15e5 Mon Sep 17 00:00:00 2001
From: Gagandeep Singh 
Date: Thu, 6 Sep 2018 11:12:16 +0530
Subject: [GSOC][PATCH 2/3] lavc/cfhd: correct decompanding for old codebook (table 9)

---
 libavcodec/cfhd.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 3929b54f31..e78fa81655 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo
 {
 if (lossless)
 return level;
-if (codebook == 0 || codebook == 1) {
+if (codebook == 0) {
+if (level >= 40 && level < 264) {
+if (level >= 54) {
+level  -= 54;
+level <<= 2;
+level  += 54;
+}
+level  -= 40;
+level <<= 2;
+level  += 40;
+} else if (level <= -40) {
+level = -level;
+if (level >= 54) {
+level  -= 54;
+level <<= 2;
+level  += 54;
+}
+level  -= 40;
+level <<= 2;
+level  += 40;
+level   = -level;
+}
+return level * quantisation;
+} else if (codebook == 1) {
 int64_t abslevel = abs(level);
 if (level < 264)
 return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) *
-- 
2.17.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel