Re: [FFmpeg-devel] [PATCH v3 3/5] avcodec/avs2_parser: parse more info

2022-06-21 Thread hwren



















在 2022-06-21 16:28:37,"\"zhilizhao(赵志立)\""  写道:
>
>
>> On Jun 21, 2022, at 4:25 PM, zhilizhao(赵志立)  wrote:
>> 
>>> On Jun 21, 2022, at 10:45 AM, hwren  wrote:
>>> 
>>> At 2022-06-13 11:36:34, "Zhao Zhili"  wrote:
>>>> Including video resolution, framerate and picture type, etc.
>>>> 
>>>> Signed-off-by: Zhao Zhili 
>>>> ---
>>>> libavcodec/Makefile  |   2 +-
>>>> libavcodec/avs2.c|  42 
>>>> libavcodec/avs2.h|  10 
>>>> libavcodec/avs2_parser.c | 105 +++
>>>> 4 files changed, 158 insertions(+), 1 deletion(-)
>>>> create mode 100644 libavcodec/avs2.c
>>>> 
>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>> index 3b8f7b5e01..6cc6f8437c 100644
>>>> --- a/libavcodec/Makefile
>>>> +++ b/libavcodec/Makefile
>>>> @@ -1114,7 +1114,7 @@ OBJS-$(CONFIG_AC3_PARSER)  += 
>>>> aac_ac3_parser.o ac3tab.o \
>>>> OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
>>>> OBJS-$(CONFIG_AMR_PARSER)  += amr_parser.o
>>>> OBJS-$(CONFIG_AV1_PARSER)  += av1_parser.o
>>>> -OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
>>>> +OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o
>>>> OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
>>>> OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
>>>> OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
>>>> diff --git a/libavcodec/avs2.c b/libavcodec/avs2.c
>>>> new file mode 100644
>>>> index 00..ead8687d0a
>>>> --- /dev/null
>>>> +++ b/libavcodec/avs2.c
>>>> @@ -0,0 +1,42 @@
>>>> +/*
>>>> + * AVS2 related definitions
>>>> + *
>>>> + * Copyright (C) 2022 Zhao Zhili, 
>>>> + *
>>>> + * 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 "avs2.h"
>>>> +
>>>> +const AVRational ff_avs2_frame_rate_tab[16] = {
>>>> +{ 0, 0   }, // forbid
>>>> +{ 24000, 1001},
>>>> +{ 24   , 1   },
>>>> +{ 25   , 1   },
>>>> +{ 3, 1001},
>>>> +{ 30   , 1   },
>>>> +{ 50   , 1   },
>>>> +{ 6, 1001},
>>>> +{ 60   , 1   },
>>>> +{ 100  , 1   },
>>>> +{ 120  , 1   },
>>>> +{ 200  , 1   },
>>>> +{ 240  , 1   },
>>>> +{ 300  , 1   },
>>>> +{ 0, 0   }, // reserved
>>>> +{ 0, 0   }  // reserved
>>>> +};
>>> 
>>> That table seems to appear only in avs2 decoder. If so, they are supposed 
>>> to be declared in libdavs2.c.
>>> If not, please point out the usage of this separate source file.
>> 
>> It’s used in this patch, parse_avs2_seq_header().

LGTM if it is used in multiple files and need to be optimized to reduce binary 
size.

>> 
>>> 
>>> Persionally, the frame_rate table can be used in both encoder and decoder. 
>>> So it is what should be
>>> defined in the avs2.h (with related enc/dec changes).
>> 
>> It’s declared in avs2.h, so it can be used by enc/dec.
>> It’s defined in .c to reduce binary size.
>> 
>>> 
>>>> diff --git a/libavcodec/avs2.h b/libavcodec/avs2.h
>>>> index f342ba52a0..544cf502d7 100644
>>>&g

Re: [FFmpeg-devel] [PATCH v3 3/5] avcodec/avs2_parser: parse more info

2022-06-20 Thread hwren




















At 2022-06-13 11:36:34, "Zhao Zhili"  wrote:
>Including video resolution, framerate and picture type, etc.
>
>Signed-off-by: Zhao Zhili 
>---
> libavcodec/Makefile  |   2 +-
> libavcodec/avs2.c|  42 
> libavcodec/avs2.h|  10 
> libavcodec/avs2_parser.c | 105 +++
> 4 files changed, 158 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/avs2.c
>
>diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>index 3b8f7b5e01..6cc6f8437c 100644
>--- a/libavcodec/Makefile
>+++ b/libavcodec/Makefile
>@@ -1114,7 +1114,7 @@ OBJS-$(CONFIG_AC3_PARSER)  += 
>aac_ac3_parser.o ac3tab.o \
> OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
> OBJS-$(CONFIG_AMR_PARSER)  += amr_parser.o
> OBJS-$(CONFIG_AV1_PARSER)  += av1_parser.o
>-OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
>+OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o
> OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
> OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
> OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
>diff --git a/libavcodec/avs2.c b/libavcodec/avs2.c
>new file mode 100644
>index 00..ead8687d0a
>--- /dev/null
>+++ b/libavcodec/avs2.c
>@@ -0,0 +1,42 @@
>+/*
>+ * AVS2 related definitions
>+ *
>+ * Copyright (C) 2022 Zhao Zhili, 
>+ *
>+ * 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 "avs2.h"
>+
>+const AVRational ff_avs2_frame_rate_tab[16] = {
>+{ 0, 0   }, // forbid
>+{ 24000, 1001},
>+{ 24   , 1   },
>+{ 25   , 1   },
>+{ 3, 1001},
>+{ 30   , 1   },
>+{ 50   , 1   },
>+{ 6, 1001},
>+{ 60   , 1   },
>+{ 100  , 1   },
>+{ 120  , 1   },
>+{ 200  , 1   },
>+{ 240  , 1   },
>+{ 300  , 1   },
>+{ 0, 0   }, // reserved
>+{ 0, 0   }  // reserved
>+};

That table seems to appear only in avs2 decoder. If so, they are supposed to be 
declared in libdavs2.c.
If not, please point out the usage of this separate source file.

Persionally, the frame_rate table can be used in both encoder and decoder. So 
it is what should be
defined in the avs2.h (with related enc/dec changes).

>diff --git a/libavcodec/avs2.h b/libavcodec/avs2.h
>index f342ba52a0..544cf502d7 100644
>--- a/libavcodec/avs2.h
>+++ b/libavcodec/avs2.h
>@@ -23,6 +23,8 @@
> #ifndef AVCODEC_AVS2_H
> #define AVCODEC_AVS2_H
> 
>+#include "libavutil/rational.h"
>+
> #define AVS2_SLICE_MAX_START_CODE0x01AF
> 
> enum {
>@@ -38,4 +40,12 @@ enum {
> #define AVS2_ISPIC(x)  ((x) == AVS2_INTRA_PIC_START_CODE || (x) == 
> AVS2_INTER_PIC_START_CODE)
> #define AVS2_ISUNIT(x) ((x) == AVS2_SEQ_START_CODE || AVS2_ISPIC(x))
> 

Same as above. Mentioned definitions now are only used in avs2_parser.c. If so, 
they are supposed to be
kept in avs2_parser.c.


>+enum AVS2Profile {
>+AVS2_PROFILE_MAIN_PIC   = 0x12,
>+AVS2_PROFILE_MAIN   = 0x20,
>+AVS2_PROFILE_MAIN10 = 0x22,
>+};

Not mentioned elsewhere. If they are to work in the encoder/decoder, please 
package them with related changes.

>+
>+extern const AVRational ff_avs2_frame_rate_tab[16];
>+
> #endif
>diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
>index 71cf442903..0350517493 100644
>--- a/libavcodec/avs2_parser.c
>+++ b/libavcodec/avs2_parser.c
>@@ -19,7 +19,9 @@
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>  */
> 
>+#include "libavutil/avutil.h"
> #include "avs2.h"
>+#include "get_bits.h"
> #include "parser.h"
> 
> static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
> buf_size)
>@@ -58,6 +60,107 @@ static int avs2_find_frame_end(ParseContext *pc, const 
>uint8_t *buf, int buf_siz
> return END_NOT_FOUND;
> }
> 
>+static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf,
>+ int buf_size, AVCodecContext *avctx)
>+{
>+GetBitContext gb;
>+int profile, level;
>+int width, height;
>+int chroma, sample_precision, encoding_precision = 1;
>+// sample_precision and encoding_precision is 3 bits
>+static const uint8_t precision[8] = { 0, 8, 10 };
>+unsigned 

Re: [FFmpeg-devel] [PATCH] doc/general_contents.texi: add uavs3d section

2020-10-20 Thread hwren
Will apply if no more suggestions.


Thanks,
Huiwen Ren

At 2020-10-06 15:08:21, hwr...@126.com wrote:
>From: hwren 
>
>Signed-off-by: hwren 
>---
> doc/general_contents.texi | 10 ++
> 1 file changed, 10 insertions(+)
>
>diff --git a/doc/general_contents.texi b/doc/general_contents.texi
>index 598e0e74da..f441a75ee9 100644
>--- a/doc/general_contents.texi
>+++ b/doc/general_contents.texi
>@@ -119,6 +119,14 @@ libdavs2 is under the GNU Public License Version 2 or 
>later
> details), you must upgrade FFmpeg's license to GPL in order to use it.
> @end float
> 
>+@section uavs3d
>+
>+FFmpeg can make use of the uavs3d library for AVS3-P2/IEEE1857.10 video 
>decoding.
>+
>+Go to @url{https://github.com/uavs3/uavs3d} and follow the instructions for
>+installing the library. Then pass @code{--enable-libuavs3d} to configure to
>+enable it.
>+
> @section Game Music Emu
> 
> FFmpeg can make use of the Game Music Emu library to read audio from 
> supported video game
>@@ -816,6 +824,8 @@ following image formats are supported:
> @tab Video encoding used by the Creature Shock game.
> @item AVS2-P2/IEEE1857.4 @tab  E  @tab  E
> @tab Supported through external libraries libxavs2 and libdavs2
>+@item AVS3-P2/IEEE1857.10@tab @tab  E
>+@tab Supported through external library libuavs3d
> @item AYUV   @tab  X  @tab  X
> @tab Microsoft uncompressed packed 4:4:4:4
> @item Beam Software VB   @tab @tab  X
>-- 
>2.23.0.windows.1
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 3/5] lavc/avs3_parser: add avs3 parser

2020-08-26 Thread hwren



















At 2020-08-26 19:51:20, "Moritz Barsnick"  wrote:
>On Thu, Aug 20, 2020 at 13:31:12 +0800, hwren wrote:
>> At 2020-08-19 22:14:04, "Moritz Barsnick"  wrote:
>> >ffmpeg prefers the "cur++" style (twice in this block, and elsewhere).
>>
>> Will be corrected. Thanks.
>
>> >Is "low_delay" part of the skipped bits? The rest already adds up to
>> >32.
>>
>> No it's not...The low_delay is added by mistake. I will remove it in the 
>> next version.
>
>> >Incorrect indentation.
>>
>> Will be corrected. Thanks.
>
>None of these changed in v7.

Looks like I used a wrong base. I will check them again. Thanks for your 
mention.

Regards,
Huiwen Ren

>
>Moritz
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/3] lavf/davs2.c: Rename as avs2dec.c for better understanding

2020-08-20 Thread hwren



Incomplete submission. Please refer to the new version patches.














At 2020-08-20 15:05:14, hwr...@126.com wrote:
>From: hwren 
>
>Signed-off-by: hwren 
>---
> libavformat/{davs2.c => avs2dec.c} | 0
> 1 file changed, 0 insertions(+), 0 deletions(-)
> rename libavformat/{davs2.c => avs2dec.c} (100%)
>
>diff --git a/libavformat/davs2.c b/libavformat/avs2dec.c
>similarity index 100%
>rename from libavformat/davs2.c
>rename to libavformat/avs2dec.c
>-- 
>2.23.0.windows.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 2/5] lavc/avs3: add AVS3 related definitions

2020-08-20 Thread hwren



















At 2020-08-19 21:15:32, "Andreas Rheinhardt"  
wrote:
>hwr...@126.com:
>> From: hwren 
>> 
>> Signed-off-by: hwren 
>> ---
>>  libavcodec/Makefile |  2 +
>>  libavcodec/avs3.c   | 95 +
>>  libavcodec/avs3.h   | 52 +
>>  3 files changed, 149 insertions(+)
>>  create mode 100644 libavcodec/avs3.c
>>  create mode 100644 libavcodec/avs3.h
>> 
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index 3431ba2dca..e1e0c4629d 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -6,6 +6,7 @@ HEADERS = ac3_parser.h   
>>\
>>avcodec.h \
>>avdct.h   \
>>avfft.h   \
>> +  avs3.h\
>>bsf.h \
>>codec.h   \
>>codec_desc.h  \
>> @@ -32,6 +33,7 @@ OBJS = ac3_parser.o
>>  \
>> avdct.o  \
>> avpacket.o   \
>> avpicture.o  \
>> +   avs3.o   \
>> bitstream.o  \
>> bitstream_filter.o   \
>> bitstream_filters.o  \
>> diff --git a/libavcodec/avs3.c b/libavcodec/avs3.c
>> new file mode 100644
>> index 00..8587e36def
>> --- /dev/null
>> +++ b/libavcodec/avs3.c
>> @@ -0,0 +1,95 @@
>> +/*
>> + * AVS3 related definition
>> + *
>> + * Copyright (C) 2020 Huiwen Ren, 
>> + *
>> + * 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 "avs3.h"
>> +
>> +const AVRational ff_avs3_frame_rate_tab[16] = {
>> +{ 0, 0   }, // forbid
>> +{ 24000, 1001},
>> +{ 24   , 1   },
>> +{ 25   , 1   },
>> +{ 3, 1001},
>> +{ 30   , 1   },
>> +{ 50   , 1   },
>> +{ 6, 1001},
>> +{ 60   , 1   },
>> +{ 100  , 1   },
>> +{ 120  , 1   },
>> +{ 200  , 1   },
>> +{ 240  , 1   },
>> +{ 300  , 1   },
>> +{ 0, 0   }, // reserved
>> +{ 0, 0   }  // reserved
>> +};
>> +
>> +const int ff_avs3_color_primaries_tab[10] = {
>> +AVCOL_PRI_RESERVED0   ,// 0
>> +AVCOL_PRI_BT709   ,// 1
>> +AVCOL_PRI_UNSPECIFIED ,// 2
>> +AVCOL_PRI_RESERVED,// 3
>> +AVCOL_PRI_BT470M  ,// 4
>> +AVCOL_PRI_BT470BG ,// 5
>> +AVCOL_PRI_SMPTE170M   ,// 6
>> +AVCOL_PRI_SMPTE240M   ,// 7
>> +AVCOL_PRI_FILM,// 8
>> +AVCOL_PRI_BT2020   // 9
>> +};
>> +
>> +const enum AVPictureType ff_avs3_image_type[4] = {
>> +AV_PICTURE_TYPE_NONE,
>> +AV_PICTURE_TYPE_I,
>> +AV_PICTURE_TYPE_P,
>> +AV_PICTURE_TYPE_B
>> +};
>
>These two coincide with the values of the constants, so they could be
>removed.

Indeed. But I prefer to keep these mappings in case any side changes their 
related tables,
and ensure the completeness of the group of definit

Re: [FFmpeg-devel] [PATCH v5 3/5] lavc/avs3_parser: add avs3 parser

2020-08-19 Thread hwren



















At 2020-08-19 22:14:04, "Moritz Barsnick"  wrote:
>On Wed, Aug 19, 2020 at 14:25:54 +0800, hwr...@126.com wrote:
>> +for (; cur < buf_size; ++cur) {
>> +state = (state << 8) | buf[cur];
>> +if (ISPIC(buf[cur])){
>> +++cur;
>
>ffmpeg prefers the "cur++" style (twice in this block, and elsewhere).

Will be corrected. Thanks.

>
>> +// Skip bits: resv(1)
>> +//bitrate_low(18)
>> +//resv(1)
>> +//bitrate_high(12)
>> +//low_delay
>> +skip_bits(, 32);
>
>Is "low_delay" part of the skipped bits? The rest already adds up to
>32.

No it's not...The low_delay is added by mistake. I will remove it in the next 
version.

>
>> +av_log(avctx, AV_LOG_DEBUG,
>> +   "avs3 parse seq hdr: profile %d; coded wxh: %dx%d; "
>> +   "frame_rate_code %d\n", profile, avctx->width, 
>> avctx->height, ratecode);
>
>Incorrect indentation.

Will be corrected. Thanks.

Cheers,
Huiwen Ren

>
>Cheers,
>Moritz
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 2/5] lavc/avs3: add AVS3 related definitions

2020-08-19 Thread hwren



















At 2020-08-19 22:18:52, "Moritz Barsnick"  wrote:
>On Wed, Aug 19, 2020 at 14:25:53 +0800, hwr...@126.com wrote:
>> + * AVS3 related definition
>
>definitions?
>> +};
>> \ No newline at end of file
>
>Please amend a carriage return to the last line.
>
>> + *  AVS3 related definition
>
>definitions?
>
>Moritz

Will be corrected. Thanks for pointing out.

Regards,
Huiwen Ren

>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 2/5] lavc/avs3: add AVS3 related definitions

2020-08-19 Thread hwren



















At 2020-08-19 20:56:27, "Nicolas George"  wrote:
>hwr...@126.com (12020-08-19):
>> From: hwren 
>> 
>> Signed-off-by: hwren 
>> ---
>>  libavcodec/Makefile |  2 +
>>  libavcodec/avs3.c   | 95 +
>>  libavcodec/avs3.h   | 52 +
>>  3 files changed, 149 insertions(+)
>>  create mode 100644 libavcodec/avs3.c
>>  create mode 100644 libavcodec/avs3.h
>
>Except ff_avs3_frame_rate_tab, all these tables are only used in the
>decoder. Is there a reason you want them in a separate header?

Considering that the other tables are also declared in AVS3, and they may get
reused by other coming encoders or decoders, so I put them together with the
ff_avs3_frame_rate_tab in avs3.h.

Thanks.
Huiwen Ren

>
>Regards,
>
>-- 
>  Nicolas George


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 5/5] lavc, doc: add libuavs3d video decoder wrapper

2020-08-19 Thread hwren



















At 2020-08-19 22:23:07, "Moritz Barsnick"  wrote:
>On Wed, Aug 19, 2020 at 14:25:56 +0800, hwr...@126.com wrote:
>>  - AV1 Low overhead bitstream format demuxer
>> +- AVS3 video decoder via libuavs3d
>
>I wonder whether the raw demuxer should have been mentioned in its
>respective patch.

Yes, I missed it. The demuxer will be mentioned in Changlog in the next version.

Thanks.
Huiwen Ren

>
>Moritz
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4 2/4] lavc/avs3_parser: add avs3 parser

2020-08-19 Thread hwren



















At 2020-08-19 01:00:57, "Andreas Rheinhardt"  
wrote:
>hwr...@126.com:
>> From: hwren 
>> 
>> Signed-off-by: hbj 
>> Signed-off-by: hwren 
>> ---
>> diff --git a/libavcodec/avs3_parser.h b/libavcodec/avs3_parser.h
>> new file mode 100644
>> index 00..afc6d235b9
>> --- /dev/null
>> +++ b/libavcodec/avs3_parser.h
>> @@ -0,0 +1,64 @@
>> +/*
>> + * AVS3-P2/IEEE1857.10 video parser.
>> + * Copyright (c) 2020 Zhenyu Wang 
>> + *Bingjie Han 
>> + *Huiwen Ren  
>> + *
>> + * 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
>> + */
>> +
>> +#ifndef AVCODEC_AVS3PARSER_H
>> +#define AVCODEC_AVS3PARSER_H
>> +
>> +#include "parser.h"
>> +
>> +#define AVS3_NAL_START_CODE  0x01
>> +#define AVS3_SEQ_START_CODE  0xB0
>> +#define AVS3_SEQ_END_CODE0xB1
>> +#define AVS3_USER_DATA_START_CODE0xB2
>> +#define AVS3_INTRA_PIC_START_CODE0xB3
>> +#define AVS3_UNDEF_START_CODE0xB4
>> +#define AVS3_EXTENSION_START_CODE0xB5
>> +#define AVS3_INTER_PIC_START_CODE0xB6
>> +#define AVS3_VIDEO_EDIT_CODE 0xB7
>> +#define AVS3_FIRST_SLICE_START_CODE  0x00
>> +#define AVS3_PROFILE_BASELINE_MAIN   0x20
>> +#define AVS3_PROFILE_BASELINE_MAIN10 0x22
>> +
>> +#define ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) == 
>> AVS3_INTER_PIC_START_CODE)
>> +#define ISUNIT(x) ((x) == AVS3_SEQ_START_CODE || ISPIC(x))
>> +
>> +static const AVRational avs3_frame_rate_tab[16] = {
>> +{ 0, 0   }, // forbid
>> +{ 24000, 1001},
>> +{ 24   , 1   },
>> +{ 25   , 1   },
>> +{ 3, 1001},
>> +{ 30   , 1   },
>> +{ 50   , 1   },
>> +{ 6, 1001},
>> +{ 60   , 1   },
>> +{ 100  , 1   },
>> +{ 120  , 1   },
>> +{ 200  , 1   },
>> +{ 240  , 1   },
>> +{ 300  , 1   },
>> +{ 0, 0   }, // reserved
>> +{ 0, 0   }  // reserved
>> +};
>> +
>> +#endif /* AVCODEC_AVS3PARSER_H */
>
>None of the stuff in this header file (except the '#include "parser.h"')
>is parser-specific. It should be part of a generic avs3 header file. And
>the frame rate table should not be defined in said header file, as this
>will lead to duplications of the table. If it is used in more than one
>place, it should be declared via extern in this header file; if not, it
>should just be declared inside the file that uses it (right now, only
>the parser uses it).
>(If it is used in more than one library, then it needs to exist in these
>libraries separately (or it needs to be avpriv).)

Indeed. There would be a new file as avs3.h including all those common
definitions. avs3_parser.h will be removed.

Thanks.

>
>- Andreas
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4 4/4] lavc, doc: add libuavs3d video decoder wrapper

2020-08-19 Thread hwren



















At 2020-08-19 00:49:12, "Paul B Mahol"  wrote:
>On 8/18/20, hwr...@126.com  wrote:
>> From: hwren 
>>
>> Signed-off-by: hbj 
>> Signed-off-by: hwren 
>> ---
>>  Changelog  |   1 +
>>  configure  |   4 +
>>  doc/decoders.texi  |  21 +++
>>  doc/general.texi   |   8 ++
>>  libavcodec/Makefile|   1 +
>>  libavcodec/allcodecs.c |   1 +
>>  libavcodec/libuavs3d.c | 294 +
>>  7 files changed, 330 insertions(+)
>>  create mode 100644 libavcodec/libuavs3d.c
>>
>> diff --git a/Changelog b/Changelog
>> index 1efc768387..91794629e5 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -14,6 +14,7 @@ version :
>>  - ADPCM Argonaut Games encoder
>>  - Argonaut Games ASF muxer
>>  - AV1 Low overhead bitstream format demuxer
>> +- AVS3 video decoder via libuavs3d
>>
>>
>>  version 4.3:
>> diff --git a/configure b/configure
>> index 6faff9bc7b..0fde821742 100755
>> --- a/configure
>> +++ b/configure
>> @@ -277,6 +277,7 @@ External library support:
>>--enable-libtls  enable LibreSSL (via libtls), needed for https
>> support
>> if openssl, gnutls or mbedtls is not used [no]
>>--enable-libtwolame  enable MP2 encoding via libtwolame [no]
>> +  --enable-libuavs3d   enable AVS3 decoding via libuavs3d [no]
>>--enable-libv4l2 enable libv4l2/v4l-utils [no]
>>--enable-libvidstab  enable video stabilization using vid.stab [no]
>>--enable-libvmaf enable vmaf filter via libvmaf [no]
>> @@ -1811,6 +1812,7 @@ EXTERNAL_LIBRARY_LIST="
>>  libtesseract
>>  libtheora
>>  libtwolame
>> +libuavs3d
>>  libv4l2
>>  libvmaf
>>  libvorbis
>> @@ -3253,6 +3255,7 @@ libspeex_encoder_select="audio_frame_queue"
>>  libsvtav1_encoder_deps="libsvtav1"
>>  libtheora_encoder_deps="libtheora"
>>  libtwolame_encoder_deps="libtwolame"
>> +libuavs3d_decoder_deps="libuavs3d"
>>  libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
>>  libvorbis_decoder_deps="libvorbis"
>>  libvorbis_encoder_deps="libvorbis libvorbisenc"
>> @@ -6416,6 +6419,7 @@ enabled libtls&& require_pkg_config libtls
>> libtls tls.h tls_configur
>>  enabled libtwolame&& require libtwolame twolame.h twolame_init
>> -ltwolame &&
>>   { check_lib libtwolame twolame.h
>> twolame_encode_buffer_float32_interleaved -ltwolame ||
>> die "ERROR: libtwolame must be installed and
>> version must be >= 0.3.10"; }
>> +enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >=
>> 1.1.41" uavs3d.h uavs3d_decode
>>  enabled libv4l2   && require_pkg_config libv4l2 libv4l2 libv4l2.h
>> v4l2_ioctl
>>  enabled libvidstab&& require_pkg_config libvidstab "vidstab >=
>> 0.98" vid.stab/libvidstab.h vsMotionDetectInit
>>  enabled libvmaf   && require_pkg_config libvmaf "libvmaf >= 1.5.2"
>> libvmaf.h compute_vmaf
>> diff --git a/doc/decoders.texi b/doc/decoders.texi
>> index 9005714e3c..42b46fe153 100644
>> --- a/doc/decoders.texi
>> +++ b/doc/decoders.texi
>> @@ -88,6 +88,27 @@ This decoder allows libavcodec to decode AVS2 streams
>> with davs2 library.
>>
>>  @c man end VIDEO DECODERS
>>
>> +@section libuavs3d
>> +
>> +AVS3-P2/IEEE1857.10 video decoder.
>> +
>> +libuavs3d allows libavcodec to decode AVS3 streams.
>> +Requires the presence of the libuavs3d headers and library during
>> configuration.
>> +You need to explicitly configure the build with @code{--enable-libuavs3d}.
>> +
>> +@subsection Options
>> +
>> +The following option is supported by the libuavs3d wrapper.
>> +
>> +@table @option
>> +
>> +@item frame_threads
>> +Set amount of frame threads to use during decoding. The default value is 0
>> (autodetect).
>> +
>> +@end table
>> +
>> +@c man end VIDEO DECODERS
>> +
>>  @chapter Audio Decoders
>>  @c man begin AUDIO DECODERS
>>
>> diff --git a/doc/general.texi b/doc/general.texi
>> index fac5377504..233f69d349 100644
>> --- a/doc/general.texi
>> +++ b/doc/general.texi
>> @@ -125,6 +125,14 @@ Go to @url{https://github.c

Re: [FFmpeg-devel] [PATCH v3 4/4] lavc, doc: add libuavs3d video decoder wrapper

2020-08-17 Thread hwren
Fix the mail format of reply message from  and reset it to 
the correct thread.
Same content.















At 2020-08-12 06:18:46, "Mark Thompson"  wrote:
>On 05/08/2020 17:18, hwr...@126.com wrote:
>> From: hwren 
>> 
>> Signed-off-by: hbj 
>> Signed-off-by: hwren 
>> ---
>>   Changelog  |   1 +
>>   configure  |   4 +
>>   doc/decoders.texi  |  21 +++
>>   doc/general.texi   |   8 ++
>>   libavcodec/Makefile|   1 +
>>   libavcodec/allcodecs.c |   1 +
>>   libavcodec/libuavs3d.c | 283 +
>>   7 files changed, 319 insertions(+)
>>   create mode 100644 libavcodec/libuavs3d.c
>> 
>> ...
>> diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
>> new file mode 100644
>> index 00..c0d89cd1ce
>> --- /dev/null
>> +++ b/libavcodec/libuavs3d.c
>> @@ -0,0 +1,283 @@
>> +/*
>> + * RAW AVS3-P2/IEEE1857.10 video demuxer
>> + * Copyright (c) 2020 Zhenyu Wang 
>> + *Bingjie Han 
>> + *Huiwen Ren  
>> + *
>> + * 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 "libavutil/avassert.h"
>> +#include "libavutil/avutil.h"
>> +#include "libavutil/common.h"
>> +#include "libavutil/imgutils.h"
>> +#include "libavutil/opt.h"
>> +#include "avcodec.h"
>> +#include "internal.h"
>> +#include "uavs3d.h"
>> +
>> +#define UAVS3D_MAX_FRAME_THREADS 48
>
>This restriction seems weird.  Is it reflecting some intrinsic property of the 
>codec, or might it change in future?

The restriction will be removed in the next version.

>
>> +
>> +static const int color_primaries_tab[10] = {
>> +AVCOL_PRI_RESERVED0   ,// 0
>> +AVCOL_PRI_BT709   ,// 1
>> +AVCOL_PRI_UNSPECIFIED ,// 2
>> +AVCOL_PRI_RESERVED,// 3
>> +AVCOL_PRI_BT470M  ,// 4
>> +AVCOL_PRI_BT470BG  ,// 5
>> +AVCOL_PRI_SMPTE170M   ,// 6
>> +AVCOL_PRI_SMPTE240M   ,// 7
>> +AVCOL_PRI_FILM,// 8
>> +AVCOL_PRI_BT2020   // 9
>> +};
>> +
>> +static const int color_transfer_tab[15] = {
>> +AVCOL_TRC_RESERVED0, // 0
>> +AVCOL_TRC_BT709, // 1
>> +AVCOL_TRC_UNSPECIFIED  , // 2
>> +AVCOL_TRC_RESERVED , // 3
>> +AVCOL_TRC_GAMMA22  , // 4
>> +AVCOL_TRC_GAMMA28  , // 5
>> +AVCOL_TRC_SMPTE170M, // 6
>> +AVCOL_TRC_SMPTE240M, // 7
>> +AVCOL_TRC_LINEAR   , // 8
>> +AVCOL_TRC_LOG  , // 9
>> +AVCOL_TRC_LOG_SQRT , // 10
>> +AVCOL_TRC_BT2020_12, // 11
>> +AVCOL_TRC_SMPTE2084, // 12
>> +AVCOL_TRC_UNSPECIFIED  , // 13
>> +AVCOL_TRC_ARIB_STD_B67   // 14
>> +};
>> +
>> +static const int color_matrix_tab[12] = {
>> +AVCOL_SPC_RESERVED , // 0
>> +AVCOL_SPC_BT709, // 1
>> +AVCOL_SPC_UNSPECIFIED  , // 2
>> +AVCOL_SPC_RESERVED , // 3
>> +AVCOL_SPC_FCC  , // 4
>> +AVCOL_SPC_BT470BG  , // 5
>> +AVCOL_SPC_SMPTE170M, // 6
>> +AVCOL_SPC_SMPTE240M, // 7
>> +AVCOL_SPC_BT2020_NCL   , // 8
>> +AVCOL_SPC_BT2020_CL, // 9
>> +AVCOL_SPC_UNSPECIFIED  , // 10
>> +AVCOL_SPC_UNSPECIFIED// 11
>> +};
>
>These tables aren't used anywhere.

These informations are located in the sequence extension header, and the tables 
are ID maps between FFMPEG ID ans AVS3 ID.
We will add decoding these informations in the next version.

>
>> +
>> +static const enum AVPictureType IMGTYPE[8] = {
>
>This na

Re: [FFmpeg-devel] [PATCH v3 2/4] lavc/avs3_paeser: add avs3 parser

2020-08-17 Thread hwren
Fix the mail format of reply message from  and reset it to 
the correct thread.

same content.

















At 2020-08-12 05:43:24, "Mark Thompson"  wrote:
>
>Typo "paeser" in the title.
>
>On 05/08/2020 17:18, hwr...@126.com wrote:
>> From: hwren 
>> 
>> Signed-off-by: hbj 
>> Signed-off-by: hwren 
>> ---
>>   libavcodec/Makefile  |   1 +
>>   libavcodec/avs3_parser.c | 184 +++
>>   libavcodec/parsers.c |   1 +
>>   3 files changed, 186 insertions(+)
>>   create mode 100644 libavcodec/avs3_parser.c
>> 
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index 5a6ea59715..f1512779be 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -1053,6 +1053,7 @@ OBJS-$(CONFIG_AC3_PARSER)  += ac3tab.o 
>> aac_ac3_parser.o
>>   OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
>>   OBJS-$(CONFIG_AV1_PARSER)  += av1_parser.o av1_parse.o
>>   OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
>> +OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
>>   OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
>>   OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
>>   OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
>> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
>> new file mode 100644
>> index 00..7a7f826c59
>> --- /dev/null
>> +++ b/libavcodec/avs3_parser.c
>> @@ -0,0 +1,184 @@
>> +/*
>> + * AVS3-P2/IEEE1857.10 video parser.
>> + * Copyright (c) 2020 Zhenyu Wang 
>> + *Bingjie Han 
>> + *Huiwen Ren  
>> + *
>> + * 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 "parser.h"
>> +
>> +#define SLICE_MAX_START_CODE0x01af
>> +
>> +#define ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
>> +#define ISUNIT(x) ((x) == 0xB0 || ISPIC(x))
>
>Perhaps give the magic numbers here symbolic constants?  (Sequence header, 
>etc.)

Thanks, we will define the constants as bellow:
#define AVS3_VIDEO_SEQ_START_CODE 0xB0
#define AVS3_INTRA_PIC_START_CODE 0xB3
#define AVS3_INTER_PIC_START_CODE 0xB6

>
>> +
>> +static av_cold int avs3_find_frame_end(ParseContext *pc, const uint8_t 
>> *buf, int buf_size)
>
>This function doesn't look cold.

Sorry, the av_cold will be removed.

>
>> +{
>> +int pic_found  = pc->frame_start_found;
>> +uint32_t state = pc->state;
>> +int cur = 0;
>> +
>> +if (!pic_found) {
>> +for (; cur < buf_size; ++cur) {
>> +state = (state<<8) | buf[cur];
>> +if (ISPIC(buf[cur])){
>> +++cur;
>> +pic_found = 1;
>> +break;
>> +}
>> +}
>> +}
>> +
>> +if (pic_found) {
>> +if (!buf_size)
>> +return END_NOT_FOUND;
>> +for (; cur < buf_size; ++cur) {
>> +state = (state << 8) | buf[cur];
>> +if ((state & 0xFF00) == 0x100 && ISUNIT(state & 0xFF)) {
>> +pc->frame_start_found = 0;
>> +pc->state = -1;
>> +return cur - 3;
>> +}
>> +}
>> +}
>> +
>> +pc->frame_start_found = pic_found;
>> +pc->state = state;
>> +
>> +return END_NOT_FOUND;
>> +}
>> +
>> +static unsigned int read_bits(const char** ppbuf, int *pidx, int bits)
>> +{
>> +const char* p = *ppbuf;
>> +int idx = *pidx;
>> +unsigned int val = 0;
>> +
>> +while (bits) {
>> +bits--;
>&g

Re: [FFmpeg-devel] [PATCH v3 4/4] lavc, doc: add libuavs3d video decoder wrapper

2020-08-08 Thread hwren



















At 2020-08-06 05:21:43, "James Almer"  wrote:
>On 8/5/2020 1:18 PM, hwr...@126.com wrote:
>> From: hwren 
>> 
>> Signed-off-by: hbj 
>> Signed-off-by: hwren 
>> ---
>>  Changelog  |   1 +
>>  configure  |   4 +
>>  doc/decoders.texi  |  21 +++
>>  doc/general.texi   |   8 ++
>>  libavcodec/Makefile|   1 +
>>  libavcodec/allcodecs.c |   1 +
>>  libavcodec/libuavs3d.c | 283 +
>>  7 files changed, 319 insertions(+)
>>  create mode 100644 libavcodec/libuavs3d.c
>> 
>> diff --git a/Changelog b/Changelog
>> index a60e7d2eb8..dfd56b3fc6 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
>>  version :
>>  - AudioToolbox output device
>>  - MacCaption demuxer
>> +- AVS3 video decoder via libuavs3d
>>  
>>  
>>  version 4.3:
>> diff --git a/configure b/configure
>> index 7495f35faa..7340bc4a35 100755
>> --- a/configure
>> +++ b/configure
>> @@ -274,6 +274,7 @@ External library support:
>>--enable-libtls  enable LibreSSL (via libtls), needed for https 
>> support
>> if openssl, gnutls or mbedtls is not used [no]
>>--enable-libtwolame  enable MP2 encoding via libtwolame [no]
>> +  --enable-libuavs3d   enable AVS3 decoding via libuavs3d [no]
>>--enable-libv4l2 enable libv4l2/v4l-utils [no]
>>--enable-libvidstab  enable video stabilization using vid.stab [no]
>>--enable-libvmaf enable vmaf filter via libvmaf [no]
>> @@ -1807,6 +1808,7 @@ EXTERNAL_LIBRARY_LIST="
>>  libtesseract
>>  libtheora
>>  libtwolame
>> +libuavs3d
>>  libv4l2
>>  libvorbis
>>  libvpx
>> @@ -3242,6 +3244,7 @@ libspeex_encoder_deps="libspeex"
>>  libspeex_encoder_select="audio_frame_queue"
>>  libtheora_encoder_deps="libtheora"
>>  libtwolame_encoder_deps="libtwolame"
>> +libuavs3d_decoder_deps="libuavs3d"
>>  libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
>>  libvorbis_decoder_deps="libvorbis"
>>  libvorbis_encoder_deps="libvorbis libvorbisenc"
>> @@ -6379,6 +6382,7 @@ enabled libtls&& require_pkg_config libtls 
>> libtls tls.h tls_configur
>>  enabled libtwolame&& require libtwolame twolame.h twolame_init 
>> -ltwolame &&
>>   { check_lib libtwolame twolame.h 
>> twolame_encode_buffer_float32_interleaved -ltwolame ||
>> die "ERROR: libtwolame must be installed and 
>> version must be >= 0.3.10"; }
>> +enabled libuavs3d && require_pkg_config libuavs3d uavs3d uavs3d.h 
>> uavs3d_decode
>>  enabled libv4l2   && require_pkg_config libv4l2 libv4l2 libv4l2.h 
>> v4l2_ioctl
>>  enabled libvidstab&& require_pkg_config libvidstab "vidstab >= 
>> 0.98" vid.stab/libvidstab.h vsMotionDetectInit
>>  enabled libvmaf   && require_pkg_config libvmaf "libvmaf >= 1.3.9" 
>> libvmaf.h compute_vmaf
>> diff --git a/doc/decoders.texi b/doc/decoders.texi
>> index 9005714e3c..f1a0b3c36e 100644
>> --- a/doc/decoders.texi
>> +++ b/doc/decoders.texi
>> @@ -86,6 +86,27 @@ AVS2-P2/IEEE1857.4 video decoder wrapper.
>>  
>>  This decoder allows libavcodec to decode AVS2 streams with davs2 library.
>>  
>> +@c man end VIDEO DECODERS
>> + 
>> +@section libuavs3d
>> +
>> +AVS3-P2/IEEE1857.10 video decoder.
>> +
>> +libuavs3d allows libavcodec to decode AVS3 streams.
>> +Requires the presence of the libuavs3d headers and library during 
>> configuration.
>> +You need to explicitly configure the build with @code{--enable-libuavs3d}.
>> +
>> +@subsection Options
>> +
>> +The following option is supported by the libuavs3d wrapper.
>> +
>> +@table @option
>> +
>> +@item frame_threads
>> +Set amount of frame threads to use during decoding. The default value is 0 
>> (autodetect).
>> +
>> +@end table
>> +
>>  @c man end VIDEO DECODERS
>>  
>>  @chapter Audio Decoders
>> diff --git a/doc/general.texi b/doc/general.texi
>> index 9b0ee96752..6d673b74e1 100644
>> --- a/doc/general.texi
>> +++ b/doc/general.texi
>> @@ -125,6 +125,14 @@ Go to @url{https://githu

Re: [FFmpeg-devel] [PATCH] lavc/libxavs2.c: mark key-frame packets

2020-07-27 Thread hwren



















在 2020-07-27 15:26:24,"Steven Liu"  写道:
> 于2020年7月27日周一 下午2:22写道:
>>
>> From: hwren 
>>
>> Signed-off-by: hwren 
>> ---
>>  libavcodec/libxavs2.c | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
>> index 76b57e731e..8519f6925a 100644
>> --- a/libavcodec/libxavs2.c
>> +++ b/libavcodec/libxavs2.c
>> @@ -223,6 +223,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
>> AVPacket *pkt,
>>  pkt->pts = cae->packet.pts;
>>  pkt->dts = cae->packet.dts;
>>
>> +if (cae->packet.type == XAVS2_TYPE_IDR ||
>> +cae->packet.type == XAVS2_TYPE_I ||
>Don't support OpenGOP?

There is no obvious difference between IDR/I frame in AVS2. Actually we will 
use TYPE_I in most cases.
So I think, when a jump occurs, ffmpeg just needs to find the closest I frame. 
Then the decoder will
determine the validity and discard the illegal frames. This method may trigger 
some error reports,
but they should be harmless.

>> +cae->packet.type == XAVS2_TYPE_KEYFRAME) {
>> +pkt->flags |= AV_PKT_FLAG_KEY;
>> +}
>> +
>>  memcpy(pkt->data, cae->packet.stream, cae->packet.len);
>>  pkt->size = cae->packet.len;
>>
>> --
>> 2.23.0.windows.1
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 0/4] Supplement AVS3-P2/IEEE1857.10 video decoding via libuavs3d

2020-07-05 Thread hwren
Ping. Looking forward to more suggestions :-)

















At 2020-06-22 21:57:48, hwr...@126.com wrote:
>From: hwren 
>
>=== Version1 ===
>These patches are to supplement the third generation of Audio Video Coding 
>Standard,
>part 2: video (AVS3-P2), aka IEEE1857.10, decoding support via libuavs3d 
>wrapper.
>
>The uAVS3d decoder could be found in https://github.com/uavs3/uavs3d
>AVS3 sample streams could be found in https://github.com/uavs3/avs3stream
>
>=== Version 2 ===
>Fix conflict with CAVS streams. Considering that there is no direct version 
>flag in AVS,
>AVS3 demuxer only supports raw streams in format <*.avs3>.
>
>Fix API function conflict.
>
>Thanks.
>
>hwren (4):
>  lavc: add AVS3 codec id and desc
>  lavc/avs3_paeser: add avs3 parser
>  lavf/avs3dec: add raw avs3 demuxer
>  lavc,doc: add libuavs3d video decoder wrapper
>
> Changelog|   1 +
> configure|   4 +
> doc/decoders.texi|  21 +++
> doc/general.texi |   8 ++
> libavcodec/Makefile  |   2 +
> libavcodec/allcodecs.c   |   1 +
> libavcodec/avs3_parser.c | 184 +
> libavcodec/codec_desc.c  |   7 +
> libavcodec/codec_id.h|   1 +
> libavcodec/libuavs3d.c   | 283 +++
> libavcodec/parsers.c |   1 +
> libavformat/Makefile |   1 +
> libavformat/allformats.c |   1 +
> libavformat/avs3dec.c|  75 +++
> 14 files changed, 590 insertions(+)
> create mode 100644 libavcodec/avs3_parser.c
> create mode 100644 libavcodec/libuavs3d.c
> create mode 100644 libavformat/avs3dec.c
>
>-- 
>2.23.0.windows.1


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] MAINTAINERS: add myself as libxavs2 maintainer

2019-12-06 Thread hwren
Ping.


Thanks,
Huiwen Ren

At 2019-10-12 11:15:55, "Steven Liu"  wrote:
>
>
>> 在 2019年10月12日,09:28,hwren  写道:
>> 
>> From: hwrenx 
>> 
>> Signed-off-by: hwrenx 
>> ---
>> MAINTAINERS | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 7f60ef0..928f4ee 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -198,6 +198,7 @@ Codecs:
>>   libvorbis.c   David Conrad
>>   libvpx*   James Zern
>>   libxavs.c Stefan Gehrer
>> +  libxavs2.cHuiwen Ren
>>   libzvbi-teletextdec.c Marton Balint
>>   lzo.h, lzo.c  Reimar Doeffinger
>>   mdec.cMichael Niedermayer
>> -- 
>> 2.7.4
>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe”.
>
>LGTM
>
>Huiwen is come from AVS2 team. 
>
>Thanks
>Steven
>
>
>
>
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 2/5] lavc/libxavs2.c: avoid recomputations of pointers in xavs2_copy_frame* functions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 32 +++-
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 3896f3b..0e525ee 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,28 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int plane, hIdx, wIdx;
+uint16_t *p_plane;
+uint8_t *p_buffer;
+int plane;
+int hIdx;
+int wIdx;
+
 for (plane = 0; plane < 3; plane++) {
-int i_stride = pic->img.i_stride[plane];
+p_plane = (uint16_t *)pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
 for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[plane][hIdx * 
i_stride];
-uint8_t *p_buffer = frame->data[plane] + frame->linesize[plane] * 
hIdx;
-memset(p_plane, 0, i_stride);
+memset(p_plane, 0, pic->img.i_stride[plane]);
 for (wIdx = 0; wIdx < pic->img.i_width[plane]; wIdx++) {
 p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int plane, hIdx;
+uint8_t *p_plane;
+uint8_t *p_buffer;
+int plane;
+int hIdx;
+int stride;
+
 for (plane = 0; plane < 3; plane++) {
+p_plane = pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+stride = pic->img.i_width[plane] * pic->img.in_sample_size;
 for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
-memcpy( pic->img.img_planes[plane] + pic->img.i_stride[plane] * 
hIdx,
-frame->data[plane]+frame->linesize[plane] * hIdx,
-pic->img.i_width[plane] * pic->img.in_sample_size);
+memcpy(p_plane, p_buffer, stride);
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 5/5] lavc/libxavs2.c: optimize error descriptions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 3dfe755..6ee2280 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -72,13 +72,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 /* get API handler */
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
-av_log(avctx, AV_LOG_ERROR, "api get failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to get xavs2 api context\n");
 return AVERROR_EXTERNAL;
 }
 
 cae->param = cae->api->opt_alloc();
 if (!cae->param) {
-av_log(avctx, AV_LOG_ERROR, "param alloc failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to alloc xavs2 parameters\n");
 return AVERROR(ENOMEM);
 }
 
@@ -124,7 +124,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to create xavs2 encoder 
instance.\n");
 return AVERROR(EINVAL);
 }
 
@@ -183,7 +183,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 /* create the XAVS2 video encoder */
 /* read frame data and send to the XAVS2 video encoder */
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to get xavs2 frame buffer\n");
 return AVERROR_EXTERNAL;
 }
 if (frame) {
@@ -214,7 +214,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 ret = cae->api->encoder_encode(cae->encoder, , >packet);
 
 if (ret) {
-av_log(avctx, AV_LOG_ERROR, "encode failed\n");
+av_log(avctx, AV_LOG_ERROR, "Encoding error occured.\n");
 return AVERROR_EXTERNAL;
 }
 
@@ -224,7 +224,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 
 if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)) {
 if (av_new_packet(pkt, cae->packet.len) < 0) {
-av_log(avctx, AV_LOG_ERROR, "packet alloc failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to alloc xavs2 packet.\n");
 cae->api->encoder_packet_unref(cae->encoder, >packet);
 return AVERROR(ENOMEM);
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 3/5] lavc/libxavs2.c: fix code style - spaces

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0e525ee..0aa4d31 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -59,7 +59,7 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
+XAVS2EContext *cae = avctx->priv_data;
 int bit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
@@ -115,15 +115,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-
 ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-
 xavs2_opt_set2("FrameRate",   "%d", code);
 
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
 return AVERROR(EINVAL);
 }
 
@@ -182,7 +180,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 /* create the XAVS2 video encoder */
 /* read frame data and send to the XAVS2 video encoder */
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx,AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
 return AVERROR_EXTERNAL;
 }
 if (frame) {
@@ -221,9 +219,8 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 cae->api->encoder_encode(cae->encoder, NULL, >packet);
 }
 
-if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)){
-
-if (av_new_packet(pkt, cae->packet.len) < 0){
+if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)) {
+if (av_new_packet(pkt, cae->packet.len) < 0) {
 av_log(avctx, AV_LOG_ERROR, "packet alloc failed\n");
 cae->api->encoder_packet_unref(cae->encoder, >packet);
 return AVERROR(ENOMEM);
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 1/5] lavc/libxavs2.c: use more descriptive variable names in xavs2_copy_frame* functions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..3896f3b 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,16 +132,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-int i_stride = pic->img.i_stride[k];
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
i_stride];
-int i;
-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
+int plane, hIdx, wIdx;
+for (plane = 0; plane < 3; plane++) {
+int i_stride = pic->img.i_stride[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+uint16_t *p_plane = (uint16_t *)>img.img_planes[plane][hIdx * 
i_stride];
+uint8_t *p_buffer = frame->data[plane] + frame->linesize[plane] * 
hIdx;
 memset(p_plane, 0, i_stride);
-for (i = 0; i < pic->img.i_width[k]; i++) {
-p_plane[i] = p_buffer[i] << shift_in;
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; wIdx++) {
+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
 }
 }
@@ -149,12 +148,12 @@ static void xavs2_copy_frame_with_shift(xavs2_picture_t 
*pic, const AVFrame *fra
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-frame->data[k]+frame->linesize[k] * j,
-pic->img.i_width[k] * pic->img.in_sample_size);
+int plane, hIdx;
+for (plane = 0; plane < 3; plane++) {
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+memcpy( pic->img.img_planes[plane] + pic->img.i_stride[plane] * 
hIdx,
+frame->data[plane]+frame->linesize[plane] * hIdx,
+pic->img.i_width[plane] * pic->img.in_sample_size);
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 4/5] lavc/libxavs2.c: replace deprecated parameter 'FrameRate' with new parameter 'fps'

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0aa4d31..3dfe755 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -60,10 +60,15 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
 XAVS2EContext *cae = avctx->priv_data;
-int bit_depth, code;
+int bit_depth;
+double framerate = 30.0;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+framerate = av_q2d(avctx->framerate);
+}
+
 /* get API handler */
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
@@ -83,6 +88,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("BitDepth",  "%d", bit_depth);
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
+xavs2_opt_set2("fps",   "%.3lf", framerate);
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
@@ -115,9 +121,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-xavs2_opt_set2("FrameRate",   "%d", code);
-
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 4/5] lavc/libxavs2.c: replace deprecated parameter 'FrameRate' with new parameter 'fps'

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index cf448be..41b7a29 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -60,10 +60,15 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
 XAVS2EContext *cae = avctx->priv_data;
-int bit_depth, code;
+int bit_depth;
+double framerate = 30.0;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+framerate = av_q2d(avctx->framerate);
+}
+
 /* get API handler */
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
@@ -83,6 +88,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("BitDepth",  "%d", bit_depth);
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
+xavs2_opt_set2("fps",   "%.3lf", framerate);
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
@@ -115,9 +121,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-xavs2_opt_set2("FrameRate",   "%d", code);
-
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 5/5] lavc/libxavs2.c: optimize error descriptions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 41b7a29..e3ba808 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -72,13 +72,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 /* get API handler */
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
-av_log(avctx, AV_LOG_ERROR, "api get failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to get xavs2 api context\n");
 return AVERROR_EXTERNAL;
 }
 
 cae->param = cae->api->opt_alloc();
 if (!cae->param) {
-av_log(avctx, AV_LOG_ERROR, "param alloc failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to alloc xavs2 parameters\n");
 return AVERROR(ENOMEM);
 }
 
@@ -124,7 +124,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to create xavs2 encoder 
instance.\n");
 return AVERROR(EINVAL);
 }
 
@@ -183,7 +183,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 /* create the XAVS2 video encoder */
 /* read frame data and send to the XAVS2 video encoder */
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to get xavs2 frame buffer\n");
 return AVERROR_EXTERNAL;
 }
 if (frame) {
@@ -214,7 +214,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 ret = cae->api->encoder_encode(cae->encoder, , >packet);
 
 if (ret) {
-av_log(avctx, AV_LOG_ERROR, "encode failed\n");
+av_log(avctx, AV_LOG_ERROR, "Encoder error occured.\n");
 return AVERROR_EXTERNAL;
 }
 
@@ -224,7 +224,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 
 if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)) {
 if (av_new_packet(pkt, cae->packet.len) < 0) {
-av_log(avctx, AV_LOG_ERROR, "packet alloc failed\n");
+av_log(avctx, AV_LOG_ERROR, "Failed to alloc xavs2 packet.\n");
 cae->api->encoder_packet_unref(cae->encoder, >packet);
 return AVERROR(ENOMEM);
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/5] lavc/libxavs2.c: avoid recomputations of pointers in xavs2_copy_frame* functions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 42 --
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 3896f3b..6ec6349 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,28 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int plane, hIdx, wIdx;
-for (plane = 0; plane < 3; plane++) {
-int i_stride = pic->img.i_stride[plane];
-for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[plane][hIdx * 
i_stride];
-uint8_t *p_buffer = frame->data[plane] + frame->linesize[plane] * 
hIdx;
-memset(p_plane, 0, i_stride);
-for (wIdx = 0; wIdx < pic->img.i_width[plane]; wIdx++) {
+uint16_t *p_plane;
+uint8_t *p_buffer;
+int plane;
+int hIdx;
+int wIdx;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane = (uint16_t *)pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memset(p_plane, 0, pic->img.i_stride[plane]);
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) {
 p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int plane, hIdx;
-for (plane = 0; plane < 3; plane++) {
-for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
-memcpy( pic->img.img_planes[plane] + pic->img.i_stride[plane] * 
hIdx,
-frame->data[plane]+frame->linesize[plane] * hIdx,
-pic->img.i_width[plane] * pic->img.in_sample_size);
+uint8_t *p_plane;
+uint8_t *p_buffer;
+int plane;
+int hIdx;
+int stride;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane = pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+stride = pic->img.i_width[plane] * pic->img.in_sample_size;
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memcpy(p_plane, p_buffer, stride);
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/5] lavc/libxavs2.c: use more descriptive variable names in xavs2_copy_frame* functions

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..3896f3b 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,16 +132,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-int i_stride = pic->img.i_stride[k];
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
i_stride];
-int i;
-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
+int plane, hIdx, wIdx;
+for (plane = 0; plane < 3; plane++) {
+int i_stride = pic->img.i_stride[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+uint16_t *p_plane = (uint16_t *)>img.img_planes[plane][hIdx * 
i_stride];
+uint8_t *p_buffer = frame->data[plane] + frame->linesize[plane] * 
hIdx;
 memset(p_plane, 0, i_stride);
-for (i = 0; i < pic->img.i_width[k]; i++) {
-p_plane[i] = p_buffer[i] << shift_in;
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; wIdx++) {
+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
 }
 }
@@ -149,12 +148,12 @@ static void xavs2_copy_frame_with_shift(xavs2_picture_t 
*pic, const AVFrame *fra
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-frame->data[k]+frame->linesize[k] * j,
-pic->img.i_width[k] * pic->img.in_sample_size);
+int plane, hIdx;
+for (plane = 0; plane < 3; plane++) {
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+memcpy( pic->img.img_planes[plane] + pic->img.i_stride[plane] * 
hIdx,
+frame->data[plane]+frame->linesize[plane] * hIdx,
+pic->img.i_width[plane] * pic->img.in_sample_size);
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/5] lavc/libxavs2.c: fix code style - spaces

2019-12-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 6ec6349..cf448be 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -59,7 +59,7 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
+XAVS2EContext *cae = avctx->priv_data;
 int bit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
@@ -115,15 +115,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-
 ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-
 xavs2_opt_set2("FrameRate",   "%d", code);
 
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
 return AVERROR(EINVAL);
 }
 
@@ -182,7 +180,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 /* create the XAVS2 video encoder */
 /* read frame data and send to the XAVS2 video encoder */
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx,AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
 return AVERROR_EXTERNAL;
 }
 if (frame) {
@@ -221,9 +219,8 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 cae->api->encoder_encode(cae->encoder, NULL, >packet);
 }
 
-if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)){
-
-if (av_new_packet(pkt, cae->packet.len) < 0){
+if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)) {
+if (av_new_packet(pkt, cae->packet.len) < 0) {
 av_log(avctx, AV_LOG_ERROR, "packet alloc failed\n");
 cae->api->encoder_packet_unref(cae->encoder, >packet);
 return AVERROR(ENOMEM);
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 2/4] lavc/libxavs2: optimize data access

2019-11-29 Thread hwren









At 2019-11-30 02:39:07, "Michael Niedermayer"  wrote:
>On Mon, Oct 14, 2019 at 09:22:43PM +0800, hwren wrote:
>> Optimize data access from multiplication to iteration.
>> 
>> Signed-off-by: hwren 
>> ---
>>  libavcodec/libxavs2.c | 45 +
>>  1 file changed, 29 insertions(+), 16 deletions(-)
>
>I think the change is ok but the commit message is hard to understand
>

>thx


I'm not sure which way is better to describe this commit. What I did was use 
iterative addressing instead of multiplicative addressing. So, maybe it's 
better to use message like Optimize data addressingor like Use iterative 
addressing instead of multiplicative addressing? I would be appreciate if you 
could give me some suggestions.


Thanks,
Huiwen Ren


>
>[...]
>-- 
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>Whats the most studid thing your enemy could do ? Blow himself up
>Whats the most studid thing you could do ? Give up your rights and
>freedom because your enemy blew himself up.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v5 2/4] lavc/libxavs2: optimize data access

2019-11-28 Thread hwren
ping the remaining three patches.


Thanks,
Huiwen Ren






At 2019-10-14 21:22:43, "hwren"  wrote:
>Optimize data access from multiplication to iteration.
>
>Signed-off-by: hwren 
>---
> libavcodec/libxavs2.c | 45 +
> 1 file changed, 29 insertions(+), 16 deletions(-)
>
>diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
>index 0179a1e..b5c07ec 100644
>--- a/libavcodec/libxavs2.c
>+++ b/libavcodec/libxavs2.c
>@@ -132,29 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
> 
> static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
> *frame, const int shift_in)
> {
>-int j, k;
>-for (k = 0; k < 3; k++) {
>-int i_stride = pic->img.i_stride[k];
>-for (j = 0; j < pic->img.i_lines[k]; j++) {
>-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
>i_stride];
>-int i;
>-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
>-memset(p_plane, 0, i_stride);
>-for (i = 0; i < pic->img.i_width[k]; i++) {
>-p_plane[i] = p_buffer[i] << shift_in;
>+uint16_t *p_plane;
>+uint8_t *p_buffer;
>+int wIdx;
>+int hIdx;
>+int plane;
>+
>+for (plane = 0; plane < 3; ++plane) {
>+p_plane  = (uint16_t *)pic->img.img_planes[plane];
>+p_buffer = frame->data[plane];
>+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
>+memset(p_plane, 0, pic->img.i_stride[plane]);
>+for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) {
>+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
> }
>+p_plane += pic->img.i_stride[plane];
>+p_buffer += frame->linesize[plane];
> }
> }
> }
> 
> static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
> {
>-int j, k;
>-for (k = 0; k < 3; k++) {
>-for (j = 0; j < pic->img.i_lines[k]; j++) {
>-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
>-frame->data[k]+frame->linesize[k] * j,
>-pic->img.i_width[k] * pic->img.in_sample_size);
>+uint8_t *p_plane;
>+uint8_t *p_buffer;
>+int hIdx;
>+int plane;
>+int stride;
>+
>+for (plane = 0; plane < 3; ++plane) {
>+p_plane  = pic->img.img_planes[plane];
>+p_buffer = frame->data[plane];
>+stride = pic->img.i_width[plane] * pic->img.in_sample_size;
>+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
>+memcpy(p_plane, p_buffer, stride);
>+p_plane += pic->img.i_stride[plane];
>+p_buffer += frame->linesize[plane];
> }
> }
> }
>-- 
>2.7.4
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 3/4] lavc/libxavs2: optimize using of spaces and indents

2019-10-14 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 51 +++
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index b5c07ec..8077607 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -26,15 +26,16 @@
 #include "mpeg12.h"
 #include "libavutil/avstring.h"
 
-#define xavs2_opt_set2(name, format, ...) do{ \
-char opt_str[16] = {0}; \
-int err; \
-av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
-err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err < 0) {\
-av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
-}\
-} while(0);
+#define xavs2_opt_set2(name, format, ...)  
 \
+do {   
 \
+char opt_str[16] = {0};
 \
+int  err;  
 \
+av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__);
 \
+err = cae->api->opt_set2(cae->param, name, opt_str);   
 \
+if (err < 0) { 
 \
+av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str); \
+}  
 \
+} while (0);
 
 typedef struct XAVS2EContext {
 AVClass *class;
@@ -59,12 +60,12 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
+XAVS2EContext *cae = avctx->priv_data;
 int bit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
-/* get API handler */
+// get API handler
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
 av_log(avctx, AV_LOG_ERROR, "api get failed\n");
@@ -83,17 +84,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("BitDepth",  "%d", bit_depth);
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
+xavs2_opt_set2("OpenGOP",   "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
-
 xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
 xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
 
-xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
-
 if (cae->xavs2_opts) {
-AVDictionary *dict= NULL;
+AVDictionary *dict = NULL;
 AVDictionaryEntry *en = NULL;
 
 if (!av_dict_parse_string(, cae->xavs2_opts, "=", ":", 0)) {
@@ -104,7 +103,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 }
 }
 
-/* Rate control */
+// Rate control
 if (avctx->bit_rate > 0) {
 xavs2_opt_set2("RateControl",   "%d", 1);
 xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate);
@@ -115,15 +114,14 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-
 ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
 
-xavs2_opt_set2("FrameRate",   "%d", code);
+xavs2_opt_set2("FrameRate", "%d", code);
 
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
 return AVERROR(EINVAL);
 }
 
@@ -179,10 +177,10 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 xavs2_picture_t pic;
 int ret;
 
-/* create the XAVS2 video encoder */
-/* read frame data and send to the XAVS2 video encoder */
+// create the XAVS2 video encoder
+// read frame data and send to the XAVS2 video encoder
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx,AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
 ret

[FFmpeg-devel] [PATCH v5 2/4] lavc/libxavs2: optimize data access

2019-10-14 Thread hwren
Optimize data access from multiplication to iteration.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 45 +
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..b5c07ec 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,29 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-int i_stride = pic->img.i_stride[k];
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
i_stride];
-int i;
-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
-memset(p_plane, 0, i_stride);
-for (i = 0; i < pic->img.i_width[k]; i++) {
-p_plane[i] = p_buffer[i] << shift_in;
+uint16_t *p_plane;
+uint8_t *p_buffer;
+int wIdx;
+int hIdx;
+int plane;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = (uint16_t *)pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memset(p_plane, 0, pic->img.i_stride[plane]);
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) {
+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-frame->data[k]+frame->linesize[k] * j,
-pic->img.i_width[k] * pic->img.in_sample_size);
+uint8_t *p_plane;
+uint8_t *p_buffer;
+int hIdx;
+int plane;
+int stride;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+stride = pic->img.i_width[plane] * pic->img.in_sample_size;
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memcpy(p_plane, p_buffer, stride);
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 1/4] lavc/libxavs2: fix parameter setting result determination

2019-10-14 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index d5c4557..0179a1e 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -31,7 +31,7 @@
 int err; \
 av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
 err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err) {\
+if (err < 0) {\
 av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
 }\
 } while(0);
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-14 Thread hwren
Remove deprecated parameter FrameRate (frame rate code) and use fps (frame 
rate) instead.
Avoid encoder warnings.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 8077607..0ee3f4d 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -61,7 +61,8 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
 XAVS2EContext *cae = avctx->priv_data;
-int bit_depth, code;
+int bit_depth;
+double framerate;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
@@ -78,6 +79,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+framerate = av_q2d(avctx->framerate);
+}
+
 xavs2_opt_set2("Width", "%d", avctx->width);
 xavs2_opt_set2("Height","%d", avctx->height);
 xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
@@ -85,6 +90,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
 xavs2_opt_set2("OpenGOP",   "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
+xavs2_opt_set2("fps",   "%.3lf", framerate);
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
@@ -114,10 +120,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-
-xavs2_opt_set2("FrameRate", "%d", code);
-
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-14 Thread hwren
Sorry, these patches were sent by accident, the changes will be in the new 
version.


Huiwen Ren









At 2019-10-14 21:15:33, "hwren"  wrote:
>Remove deprecated parameter FrameRate (frame rate code) and use fps (frame 
>rate) instead.
>Avoid encoder warnings.
>
>Signed-off-by: hwren 
>---
> libavcodec/libxavs2.c | 12 +++-
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
>diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
>index 8077607..382f745 100644
>--- a/libavcodec/libxavs2.c
>+++ b/libavcodec/libxavs2.c
>@@ -61,7 +61,8 @@ typedef struct XAVS2EContext {
> static av_cold int xavs2_init(AVCodecContext *avctx)
> {
> XAVS2EContext *cae = avctx->priv_data;
>-int bit_depth, code;
>+int bit_depth;
>+float framerate;
> 
> bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
> 
>@@ -78,6 +79,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
> return AVERROR(ENOMEM);
> }
> 
>+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
>+framerate = (float)avctx->framerate.num / (float)avctx->framerate.den;
>+}
>+
> xavs2_opt_set2("Width", "%d", avctx->width);
> xavs2_opt_set2("Height","%d", avctx->height);
> xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
>@@ -85,6 +90,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
> xavs2_opt_set2("Log",   "%d", cae->log_level);
> xavs2_opt_set2("Preset","%d", cae->preset_level);
> xavs2_opt_set2("OpenGOP",   "%d", !(avctx->flags & 
> AV_CODEC_FLAG_CLOSED_GOP));
>+xavs2_opt_set2("fps",   "%.3f", framerate);
> 
> xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
> xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
>@@ -114,10 +120,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
> xavs2_opt_set2("InitialQP", "%d", cae->qp);
> }
> 
>-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
>-
>-xavs2_opt_set2("FrameRate", "%d", code);
>-
> cae->encoder = cae->api->encoder_create(cae->param);
> 
> if (!cae->encoder) {
>-- 
>2.7.4
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v4 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-14 Thread hwren
Remove deprecated parameter FrameRate (frame rate code) and use fps (frame 
rate) instead.
Avoid encoder warnings.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 8077607..382f745 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -61,7 +61,8 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
 XAVS2EContext *cae = avctx->priv_data;
-int bit_depth, code;
+int bit_depth;
+float framerate;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
@@ -78,6 +79,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+framerate = (float)avctx->framerate.num / (float)avctx->framerate.den;
+}
+
 xavs2_opt_set2("Width", "%d", avctx->width);
 xavs2_opt_set2("Height","%d", avctx->height);
 xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
@@ -85,6 +90,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
 xavs2_opt_set2("OpenGOP",   "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
+xavs2_opt_set2("fps",   "%.3f", framerate);
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
@@ -114,10 +120,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-
-xavs2_opt_set2("FrameRate", "%d", code);
-
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v4 3/4] lavc/libxavs2: optimize using of spaces and indents

2019-10-14 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 51 +++
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index b5c07ec..8077607 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -26,15 +26,16 @@
 #include "mpeg12.h"
 #include "libavutil/avstring.h"
 
-#define xavs2_opt_set2(name, format, ...) do{ \
-char opt_str[16] = {0}; \
-int err; \
-av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
-err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err < 0) {\
-av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
-}\
-} while(0);
+#define xavs2_opt_set2(name, format, ...)  
 \
+do {   
 \
+char opt_str[16] = {0};
 \
+int  err;  
 \
+av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__);
 \
+err = cae->api->opt_set2(cae->param, name, opt_str);   
 \
+if (err < 0) { 
 \
+av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str); \
+}  
 \
+} while (0);
 
 typedef struct XAVS2EContext {
 AVClass *class;
@@ -59,12 +60,12 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
+XAVS2EContext *cae = avctx->priv_data;
 int bit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
-/* get API handler */
+// get API handler
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
 av_log(avctx, AV_LOG_ERROR, "api get failed\n");
@@ -83,17 +84,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("BitDepth",  "%d", bit_depth);
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
+xavs2_opt_set2("OpenGOP",   "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
-
 xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
 xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
 
-xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
-
 if (cae->xavs2_opts) {
-AVDictionary *dict= NULL;
+AVDictionary *dict = NULL;
 AVDictionaryEntry *en = NULL;
 
 if (!av_dict_parse_string(, cae->xavs2_opts, "=", ":", 0)) {
@@ -104,7 +103,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 }
 }
 
-/* Rate control */
+// Rate control
 if (avctx->bit_rate > 0) {
 xavs2_opt_set2("RateControl",   "%d", 1);
 xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate);
@@ -115,15 +114,14 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-
 ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
 
-xavs2_opt_set2("FrameRate",   "%d", code);
+xavs2_opt_set2("FrameRate", "%d", code);
 
 cae->encoder = cae->api->encoder_create(cae->param);
 
 if (!cae->encoder) {
-av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
+av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
 return AVERROR(EINVAL);
 }
 
@@ -179,10 +177,10 @@ static int xavs2_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 xavs2_picture_t pic;
 int ret;
 
-/* create the XAVS2 video encoder */
-/* read frame data and send to the XAVS2 video encoder */
+// create the XAVS2 video encoder
+// read frame data and send to the XAVS2 video encoder
 if (cae->api->encoder_get_buffer(cae->encoder, ) < 0) {
-av_log(avctx,AV_LOG_ERROR, "failed to get frame buffer\n");
+av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n");
 ret

[FFmpeg-devel] [PATCH v4 2/4] lavc/libxavs2: optimize data access

2019-10-14 Thread hwren
Optimize data access from multiplication to iteration.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 45 +
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..b5c07ec 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,29 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-int i_stride = pic->img.i_stride[k];
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
i_stride];
-int i;
-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
-memset(p_plane, 0, i_stride);
-for (i = 0; i < pic->img.i_width[k]; i++) {
-p_plane[i] = p_buffer[i] << shift_in;
+uint16_t *p_plane;
+uint8_t *p_buffer;
+int wIdx;
+int hIdx;
+int plane;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = (uint16_t *)pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memset(p_plane, 0, pic->img.i_stride[plane]);
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) {
+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-frame->data[k]+frame->linesize[k] * j,
-pic->img.i_width[k] * pic->img.in_sample_size);
+uint8_t *p_plane;
+uint8_t *p_buffer;
+int hIdx;
+int plane;
+int stride;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+stride = pic->img.i_width[plane] * pic->img.in_sample_size;
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memcpy(p_plane, p_buffer, stride);
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-14 Thread hwren









At 2019-10-14 19:22:38, "Moritz Barsnick"  wrote:
>On Mon, Oct 14, 2019 at 14:52:44 +0800, hwr...@126.com wrote:
>> From: hwren 
>> +float framerate;
>[...]
>> +if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
>> +framerate = (float)avctx->framerate.num / 
>> (float)avctx->framerate.den;
>> +}
>
>It should suffice to cast only .den. See av_q2d(). Actually, since it's
>only used in _init() anyway, you could use av_q2d() at the cost of
>double versus float.
>

Indeed, thanks for review.

>BTW, what value does framerate have if this if-clause isn't met?
>Zero-initialized, right?
>

Encoder will use its default frame rate value (25 for xavs2).

Thanks,
Huiwen Ren

>Cheers,
>Moritz
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-13 Thread hwren
Remove deprecated parameter FrameRate (frame rate code) and use fps (frame 
rate) instead.
Avoid encoder warnings.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index e52f0c4..4e4e1b2 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -61,7 +61,8 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
 XAVS2EContext *cae = avctx->priv_data;
-intbit_depth, code;
+intbit_depth;
+float  framerate;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
@@ -78,8 +79,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
+if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+framerate = (float)avctx->framerate.num / (float)avctx->framerate.den;
+}
+
 xavs2_opt_set2("Width", "%d", avctx->width);
 xavs2_opt_set2("Height", "%d", avctx->height);
+xavs2_opt_set2("fps", "%.3f", framerate);
 xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames);
 xavs2_opt_set2("BitDepth", "%d", bit_depth);
 xavs2_opt_set2("Log", "%d", cae->log_level);
@@ -113,9 +119,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-xavs2_opt_set2("FrameRate", "%d", code);
-
 cae->encoder = cae->api->encoder_create(cae->param);
 if (!cae->encoder) {
 av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer 
returned\n");
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 1/4] lavc/libxavs2: fix parameter setting result determination

2019-10-13 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index d5c4557..0179a1e 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -31,7 +31,7 @@
 int err; \
 av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
 err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err) {\
+if (err < 0) {\
 av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
 }\
 } while(0);
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 3/4] lavc/libxavs2: optimize using of spaces and indents

2019-10-13 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 98 ---
 1 file changed, 46 insertions(+), 52 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 7a41ca2..e52f0c4 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -26,15 +26,16 @@
 #include "mpeg12.h"
 #include "libavutil/avstring.h"
 
-#define xavs2_opt_set2(name, format, ...) do{ \
-char opt_str[16] = {0}; \
-int err; \
-av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
-err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err < 0) {\
-av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
-}\
-} while(0);
+#define xavs2_opt_set2(name, format, ...)  
 \
+do {   
 \
+char opt_str[16] = {0};
 \
+int  err;  
 \
+av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__);
 \
+err = cae->api->opt_set2(cae->param, name, opt_str);   
 \
+if (err < 0) { 
 \
+av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str); \
+}  
 \
+} while (0);
 
 typedef struct XAVS2EContext {
 AVClass *class;
@@ -51,7 +52,7 @@ typedef struct XAVS2EContext {
 char *xavs2_opts;
 
 xavs2_outpacket_t packet;
-xavs2_param_t *param;
+xavs2_param_t *   param;
 
 const xavs2_api_t *api;
 
@@ -59,12 +60,12 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
-int bit_depth, code;
+XAVS2EContext *cae = avctx->priv_data;
+intbit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
-/* get API handler */
+// get API handler
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
 av_log(avctx, AV_LOG_ERROR, "api get failed\n");
@@ -77,24 +78,21 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-xavs2_opt_set2("Width", "%d", avctx->width);
-xavs2_opt_set2("Height","%d", avctx->height);
-xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
-xavs2_opt_set2("BitDepth",  "%d", bit_depth);
-xavs2_opt_set2("Log",   "%d", cae->log_level);
-xavs2_opt_set2("Preset","%d", cae->preset_level);
-
-xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
-xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
-
-xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
-xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
-
-xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
+xavs2_opt_set2("Width", "%d", avctx->width);
+xavs2_opt_set2("Height", "%d", avctx->height);
+xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames);
+xavs2_opt_set2("BitDepth", "%d", bit_depth);
+xavs2_opt_set2("Log", "%d", cae->log_level);
+xavs2_opt_set2("Preset", "%d", cae->preset_level);
+xavs2_opt_set2("IntraPeriodMax", "%d", avctx->gop_size);
+xavs2_opt_set2("IntraPeriodMin", "%d", avctx->gop_size);
+xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count);
+xavs2_opt_set2("ThreadRows", "%d", cae->lcu_row_threads);
+xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 if (cae->xavs2_opts) {
-AVDictionary *dict= NULL;
-AVDictionaryEntry *en = NULL;
+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))) {
@@ -104,26 +102,23 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 }
 }
 
-/* Rate control */
+// Rate control
 if (avctx->bit_rate > 0) {
-xavs2_opt_set2("RateControl",   &qu

[FFmpeg-devel] [PATCH v2 2/4] lavc/libxavs2: optimize data access

2019-10-13 Thread hwren
Optimize data access from multiplication to iteration.

Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 41 +
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..7a41ca2 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,29 +132,38 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame 
*frame, const int shift_in)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-int i_stride = pic->img.i_stride[k];
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-uint16_t *p_plane = (uint16_t *)>img.img_planes[k][j * 
i_stride];
-int i;
-uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
-memset(p_plane, 0, i_stride);
-for (i = 0; i < pic->img.i_width[k]; i++) {
-p_plane[i] = p_buffer[i] << shift_in;
+uint16_t *p_plane;
+uint8_t * p_buffer;
+int   wIdx, hIdx, plane;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = (uint16_t *)pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memset(p_plane, 0, pic->img.i_stride[plane]);
+for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) {
+p_plane[wIdx] = p_buffer[wIdx] << shift_in;
 }
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-int j, k;
-for (k = 0; k < 3; k++) {
-for (j = 0; j < pic->img.i_lines[k]; j++) {
-memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-frame->data[k]+frame->linesize[k] * j,
-pic->img.i_width[k] * pic->img.in_sample_size);
+uint8_t *p_plane;
+uint8_t *p_buffer;
+int  hIdx, plane, stride;
+
+for (plane = 0; plane < 3; ++plane) {
+p_plane  = pic->img.img_planes[plane];
+p_buffer = frame->data[plane];
+stride   = pic->img.i_width[plane] * pic->img.in_sample_size;
+for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) {
+memcpy(p_plane, p_buffer, stride);
+p_plane += pic->img.i_stride[plane];
+p_buffer += frame->linesize[plane];
 }
 }
 }
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: add stream type AVS2

2019-10-13 Thread hwren









At 2019-10-12 19:40:15, "myp...@gmail.com"  wrote:
>On Sat, Oct 12, 2019 at 10:00 AM hwren  wrote:
>>
>> From: hwrenx 
>>
>> Signed-off-by: hwrenx 
>> ---
>>  libavformat/mpegts.h| 1 +
>>  libavformat/mpegtsenc.c | 3 +++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
>> index ecc3d33..78abe72 100644
>> --- a/libavformat/mpegts.h
>> +++ b/libavformat/mpegts.h
>> @@ -119,6 +119,7 @@
>>  #define STREAM_TYPE_VIDEO_CAVS  0x42
>>  #define STREAM_TYPE_VIDEO_VC1   0xea
>>  #define STREAM_TYPE_VIDEO_DIRAC 0xd1
>> +#define STREAM_TYPE_VIDEO_AVS2  0xd2
>Can you supply the spec for this new stream type? Thx

Sure, the definition of stream type 0xd2 refers to the Chinese national 
standard GB/T 17975.1.
i.e. Information technology - Generic coding of moving pictures and associated 
audio information Part 1: Systems.

>
>>
>>  #define STREAM_TYPE_AUDIO_AC3   0x81
>>  #define STREAM_TYPE_AUDIO_DTS   0x82
>> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
>> index 0678657..b80ab25 100644
>> --- a/libavformat/mpegtsenc.c
>> +++ b/libavformat/mpegtsenc.c
>> @@ -336,6 +336,9 @@ static int mpegts_write_pmt(AVFormatContext *s, 
>> MpegTSService *service)
>>  case AV_CODEC_ID_CAVS:
>>  stream_type = STREAM_TYPE_VIDEO_CAVS;
>>  break;
>> +case AV_CODEC_ID_AVS2:
>> +stream_type = STREAM_TYPE_VIDEO_AVS2;
>> +break;
>>  case AV_CODEC_ID_DIRAC:
>>  stream_type = STREAM_TYPE_VIDEO_DIRAC;
>>  break;
>> --
>> 2.7.4

Thanks
Huiwen Ren

>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavf/mpegtsenc: add stream type AVS2

2019-10-11 Thread hwren
From: hwrenx 

Signed-off-by: hwrenx 
---
 libavformat/mpegts.h| 1 +
 libavformat/mpegtsenc.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index ecc3d33..78abe72 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -119,6 +119,7 @@
 #define STREAM_TYPE_VIDEO_CAVS  0x42
 #define STREAM_TYPE_VIDEO_VC1   0xea
 #define STREAM_TYPE_VIDEO_DIRAC 0xd1
+#define STREAM_TYPE_VIDEO_AVS2  0xd2
 
 #define STREAM_TYPE_AUDIO_AC3   0x81
 #define STREAM_TYPE_AUDIO_DTS   0x82
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 0678657..b80ab25 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -336,6 +336,9 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 case AV_CODEC_ID_CAVS:
 stream_type = STREAM_TYPE_VIDEO_CAVS;
 break;
+case AV_CODEC_ID_AVS2:
+stream_type = STREAM_TYPE_VIDEO_AVS2;
+break;
 case AV_CODEC_ID_DIRAC:
 stream_type = STREAM_TYPE_VIDEO_DIRAC;
 break;
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] MAINTAINERS: add myself as libxavs2 maintainer

2019-10-11 Thread hwren
From: hwrenx 

Signed-off-by: hwrenx 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7f60ef0..928f4ee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -198,6 +198,7 @@ Codecs:
   libvorbis.c   David Conrad
   libvpx*   James Zern
   libxavs.c Stefan Gehrer
+  libxavs2.cHuiwen Ren
   libzvbi-teletextdec.c Marton Balint
   lzo.h, lzo.c  Reimar Doeffinger
   mdec.cMichael Niedermayer
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] lavc/libxavs2: fix parameter setting result determination

2019-10-11 Thread hwren
From: hwrenx 

Signed-off-by: hwrenx 
---
 libavcodec/libxavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index d5c4557..0179a1e 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -31,7 +31,7 @@
 int err; \
 av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
 err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err) {\
+if (err < 0) {\
 av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
 }\
 } while(0);
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] lavc/libxvas2: optimize code style and data acces

2019-10-11 Thread hwren
From: hwrenx 

Optimize using of spaces and indents, change data access from multiplication to 
iteration.

Signed-off-by: hwrenx 
---
 libavcodec/libxavs2.c | 139 ++
 1 file changed, 71 insertions(+), 68 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1e..47ba74d 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -26,15 +26,16 @@
 #include "mpeg12.h"
 #include "libavutil/avstring.h"
 
-#define xavs2_opt_set2(name, format, ...) do{ \
-char opt_str[16] = {0}; \
-int err; \
-av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
-err = cae->api->opt_set2(cae->param, name, opt_str); \
-if (err < 0) {\
-av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str);\
-}\
-} while(0);
+#define xavs2_opt_set2(name, format, ...)  
 \
+do {   
 \
+char opt_str[16] = {0};
 \
+int  err;  
 \
+av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__);
 \
+err = cae->api->opt_set2(cae->param, name, opt_str);   
 \
+if (err < 0) { 
 \
+av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, 
opt_str); \
+}  
 \
+} while (0);
 
 typedef struct XAVS2EContext {
 AVClass *class;
@@ -51,7 +52,7 @@ typedef struct XAVS2EContext {
 char *xavs2_opts;
 
 xavs2_outpacket_t packet;
-xavs2_param_t *param;
+xavs2_param_t *   param;
 
 const xavs2_api_t *api;
 
@@ -59,12 +60,12 @@ typedef struct XAVS2EContext {
 
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
-XAVS2EContext *cae= avctx->priv_data;
-int bit_depth, code;
+XAVS2EContext *cae = avctx->priv_data;
+intbit_depth, code;
 
 bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
-/* get API handler */
+// get API handler
 cae->api = xavs2_api_get(bit_depth);
 if (!cae->api) {
 av_log(avctx, AV_LOG_ERROR, "api get failed\n");
@@ -77,24 +78,21 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-xavs2_opt_set2("Width", "%d", avctx->width);
-xavs2_opt_set2("Height","%d", avctx->height);
-xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
-xavs2_opt_set2("BitDepth",  "%d", bit_depth);
-xavs2_opt_set2("Log",   "%d", cae->log_level);
-xavs2_opt_set2("Preset","%d", cae->preset_level);
-
-xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
-xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
-
-xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
-xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
-
-xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
+xavs2_opt_set2("Width", "%d", avctx->width);
+xavs2_opt_set2("Height", "%d", avctx->height);
+xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames);
+xavs2_opt_set2("BitDepth", "%d", bit_depth);
+xavs2_opt_set2("Log", "%d", cae->log_level);
+xavs2_opt_set2("Preset", "%d", cae->preset_level);
+xavs2_opt_set2("IntraPeriodMax", "%d", avctx->gop_size);
+xavs2_opt_set2("IntraPeriodMin", "%d", avctx->gop_size);
+xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count);
+xavs2_opt_set2("ThreadRows", "%d", cae->lcu_row_threads);
+xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 if (cae->xavs2_opts) {
-AVDictionary *dict= NULL;
-AVDictionaryEntry *en = NULL;
+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))) {
@@ -104,26 +102,23 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 }
 }
 
-/* Rate control */
+// Rate control
 if (avctx->bit_rate > 0) {
-xavs2_opt_set2("RateControl",   "%d", 1);
-xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate);
-xavs2_opt_set2("InitialQP", "%d", cae->initial_qp);
-xavs2_opt_set2("MaxQP", "%d", avctx->qmax >= 0 ? avctx->qmax : 
cae->max_qp);
-xavs2_opt_set2("MinQP", "%d", avctx->qmin >= 0 ? avctx->qmin : 
cae->min_qp);
+xavs2_opt_set2("RateControl", "%d", 1);
+xavs2_opt_set2("TargetBitRate", "%" PRId64 "", avctx->bit_rate);
+xavs2_opt_set2("InitialQP", "%d", cae->initial_qp);
+

[FFmpeg-devel] [PATCH 3/3] lavc/libxavs2: replace 'FrameRate' with 'fps'

2019-10-11 Thread hwren
From: hwrenx 

Remove deprecated paramete FrameRate (frame rate code) and use fps (frame rate).
Avoid encoder warning.

Signed-off-by: hwrenx 
---
 libavcodec/libxavs2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 47ba74d..04f4ecb 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -113,8 +113,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
-ff_mpeg12_find_best_frame_rate(avctx->framerate, , NULL, NULL, 0);
-xavs2_opt_set2("FrameRate", "%d", code);
+xavs2_opt_set2("fps", "%d", avctx->framerate);
 
 cae->encoder = cae->api->encoder_create(cae->param);
 if (!cae->encoder) {
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 3/3] lavc/libdavs2.c: use decoder data directly instead of memcpy

2019-08-08 Thread hwren
I'm sorry I almost missed this email. Thanks for your review.

At 2019-07-23 03:42:20, "Marton Balint"  wrote:
>
>
>On Sat, 13 Jul 2019, hwren wrote:
>
>>
>> At 2019-07-13 01:38:55, "Marton Balint"  wrote:
>>>
>>>
>>> On Fri, 12 Jul 2019, hwrenx wrote:
>>>
>>>> Can effectivly improved decoding speed when memcpy becomes a limitation
>>>> for proccessing high resolution source.
>>>> Tested under i7-8700k with `ffmpeg -i 7680x4320.avs2 -vsync 0 -f null -`
>>>> got performance 23fps => 42fps
>>>>
>>>> Signed-off-by: hwrenx 
>>>> ---
>>>> libavcodec/libdavs2.c | 54 
>>>> +--
>>>> 1 file changed, 31 insertions(+), 23 deletions(-)
>>>>
>>>> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
>>>> index 1b274a3..af0778f 100644
>>>> --- a/libavcodec/libdavs2.c
>>>> +++ b/libavcodec/libdavs2.c
>>>> @@ -60,13 +60,24 @@ static av_cold int davs2_init(AVCodecContext *avctx)
>>>> return 0;
>>>> }
>>>> 
>>>> +static void davs2_frame_unref(void *opaque, uint8_t *data) {
>>>> +DAVS2Context*cad = (DAVS2Context *)opaque;
>>>> +davs2_picture_t  pic;
>>>> +
>>>> +pic.magic = (davs2_picture_t *)data;
>>>> +
>>>> +if (cad->decoder) {
>>>> +davs2_decoder_frame_unref(cad->decoder, );
>>>> +} else {
>>>> +av_log(NULL, AV_LOG_WARNING, "Decoder not found, frame 
>>>> unreference failed.\n");
>>>
>>> Whoa, this should not happen, and you have to be prepared that the user 
>>> might close the decoder before freeing the last frame.
>>
>> I hope so, actually it's harmless if we failed to unref some frames outside 
>> davs2 when decoder
>> was closed through davs2_decoder_close(). The decoder will free the memory 
>> which contains
>> all recycle data itself.
>
>And that is the problem, because the data should survive closing the 
>(avcodec) decoder.

Do you mean after decoder closing, there may still some data left which should 
be unref by decoder ...
The davs2_decoder_frame_unref() can only notice the decoder that it could reuse 
this part of memory,
but the decoder won't free or realloc any memory. All these memory will be free 
together when decoder
was closing. So the "survived data" in ffmpeg should just be some unuseful 
pointers.

Or you mean even decoder is closed, there are still some data needed by ffmpeg?

>
>>
>>>
>>> Maybe you should use some refcounting and create references to the 
>>> decoder, others may have a better idea.
>>>
>>> Regards,
>>> Marton
>>
>> Of course, anyway, it would be better if there are any ways to make sure we 
>> correctly freed all
>> frames even decoder was not found or exited without a davs2_decoder_close(). 
>>  But force to
>> free the memory immediately in the call back function can cause troubles to 
>> decoder and I'm
>> not very clearly understand how to use reference to deal with this problem 
>> inside a codec.
>>
>>
>> Maybe that means I could reference the buffer and waiting ffmpeg to free 
>> them once they were
>> not handled by davs2?
>
>I am not sure I understand your concern here.
>
>Here is what I propose in more detail, I think it works for all cases:
>
>In davs_init allocate a small struct which contains the decoder and a 
>reference counter for the decoder itself:
>DAVS2Reference {
>   atomic_int refcount;
>   void *decoder;
>}
>set the refs to 1.
>
>In davs2_dump_frames you should pass the allocated DAVS2Reference to 
>av_buffer_create instead of the DAVS2Context. After each successful 
>av_buffer_create you should increase refcount.
>
>In davs2_frame_unref after freeing the frame you should decrease the 
>reference counter and if you reach 0 then you can destroy the davs2 
>decoder (and free DAVS2Reference struct as well)
>
>You can do the same in davs2_end: decrease the refcount and if you reach 0 
>then you can close the davs2 decoder and free the DAVS2Reference struct.
>

In my understanding, once closing decoder, ffmpeg should finish or stop 
outputing (not so sure,
if not please correct me). So I think normally the refcount should always be 
zero when using
decoder_close(), if not zero, maybe decoder can do nothing but wait (and never 
stop).

If after closing decoder there are still some data needed by ffmpeg, a 
refcounter is necessary indeed.

Regards,
Huiwen REN

>Regards,
>Marton
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2.c: change decoder info level

2019-07-13 Thread hwren









At 2019-07-13 21:34:30, "Li, Zhong"  wrote:
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>> Of hwrenx
>> Sent: Friday, July 12, 2019 11:22 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2.c: change decoder info
>> level
>> 
>> Signed-off-by: hwrenx 
>> ---
>>  libavcodec/libdavs2.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index
>> 218f3ec..1b274a3 100644
>> --- a/libavcodec/libdavs2.c
>> +++ b/libavcodec/libdavs2.c
>> @@ -44,7 +44,9 @@ static av_cold int davs2_init(AVCodecContext *avctx)
>> 
>>  /* init the decoder */
>>  cad->param.threads  = avctx->thread_count;
>> -cad->param.info_level   = 0;
>> +cad->param.info_level   = av_log_get_level() > AV_LOG_INFO
>> + ?
>> DAVS2_LOG_DEBUG
>> + :
>> DAVS2_LOG_WARNING;
>
>How about exactly map AV_LOG_XXX to DAVS2_LOG_XXX?

Exactly, a map would be better. Two levels are enough now, and I will update if 
there are new versions of these patches.

Thanks : )
Huiwen REN

>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 3/3] lavc/libdavs2.c: use decoder data directly instead of memcpy

2019-07-12 Thread hwren

At 2019-07-13 01:38:55, "Marton Balint"  wrote:
>
>
>On Fri, 12 Jul 2019, hwrenx wrote:
>
>> Can effectivly improved decoding speed when memcpy becomes a limitation
>> for proccessing high resolution source.
>> Tested under i7-8700k with `ffmpeg -i 7680x4320.avs2 -vsync 0 -f null -`
>> got performance 23fps => 42fps
>>
>> Signed-off-by: hwrenx 
>> ---
>> libavcodec/libdavs2.c | 54 
>> +--
>> 1 file changed, 31 insertions(+), 23 deletions(-)
>>
>> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
>> index 1b274a3..af0778f 100644
>> --- a/libavcodec/libdavs2.c
>> +++ b/libavcodec/libdavs2.c
>> @@ -60,13 +60,24 @@ static av_cold int davs2_init(AVCodecContext *avctx)
>> return 0;
>> }
>> 
>> +static void davs2_frame_unref(void *opaque, uint8_t *data) {
>> +DAVS2Context*cad = (DAVS2Context *)opaque;
>> +davs2_picture_t  pic;
>> +
>> +pic.magic = (davs2_picture_t *)data;
>> +
>> +if (cad->decoder) {
>> +davs2_decoder_frame_unref(cad->decoder, );
>> +} else {
>> +av_log(NULL, AV_LOG_WARNING, "Decoder not found, frame unreference 
>> failed.\n");
>
>Whoa, this should not happen, and you have to be prepared that the user 
>might close the decoder before freeing the last frame.

I hope so, actually it's harmless if we failed to unref some frames outside 
davs2 when decoder
was closed through davs2_decoder_close(). The decoder will free the memory 
which contains
all recycle data itself.

>
>Maybe you should use some refcounting and create references to the 
>decoder, others may have a better idea.
>
>Regards,
>Marton

Of course, anyway, it would be better if there are any ways to make sure we 
correctly freed all
frames even decoder was not found or exited without a davs2_decoder_close().  
But force to
free the memory immediately in the call back function can cause troubles to 
decoder and I'm
not very clearly understand how to use reference to deal with this problem 
inside a codec.


Maybe that means I could reference the buffer and waiting ffmpeg to free them 
once they were
not handled by davs2?

Thanks :-)
Huiwen REN

>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] configure: update api version of libdavs2

2018-11-17 Thread hwren









At 2018-11-18 02:45:23, "Michael Niedermayer"  wrote:
>On Sun, Nov 18, 2018 at 12:54:09AM +0800, hwren wrote:
>> From: hwrenx  
>> 
>> api version update.
>> 
>> detials could be found in davs2-git 
>> https://github.com/pkuvcl/davs2 
>> 
>> Signed-off-by: hwrenx  
>> --- 
>> configure | 2 +- 
>> 1 file changed, 1 insertion(+), 1 deletion(-) 
>> 
>> diff --git a/configure b/configure 
>> index 9bc4cf3..d2159db 100755 
>> --- a/configure 
>> +++ b/configure 
>> @@ -6075,7 +6075,7 @@ enabled libcelt   && require libcelt 
>> celt/celt.h celt_decode -lcelt0 && 
>> enabled libcaca   && require_pkg_config libcaca caca caca.h 
>> caca_create_canvas 
>> enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
>> -lcodec2 
>> enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.0.1" 
>> "dav1d/dav1d.h" dav1d_version 
>> -enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.5.115" 
>> davs2.h davs2_decoder_open 
>> +enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
>> davs2.h davs2_decoder_open 
>> enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
>> dc1394/dc1394.h dc1394_new 
>
>this patch is malformed and cannot be applied automatically

I'm not sure what happened cause my patch-email generated by "git send-email" 
were identified as spams.
But it worked if I just  pasted the message into a new email.
Anyway, the new patches were submitted through another stmp server.

Thanks.

>
>[...]
>-- 
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>When you are offended at any man's fault, turn to yourself and study your
>own failings. Then you will forget your anger. -- Epictetus
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] configure: update api version of libdavs2

2018-11-17 Thread hwren









At 2018-11-18 01:01:36, "Carl Eugen Hoyos"  wrote:
>2018-11-17 17:54 GMT+01:00, hwren :
>> From: hwrenx 
>>
>> api version update.
>>
>> detials could be found in davs2-git
>> https://github.com/pkuvcl/davs2
>>
>> Signed-off-by: hwrenx 
>> ---
>> configure | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 9bc4cf3..d2159db 100755
>> --- a/configure
>> +++ b/configure
>> @@ -6075,7 +6075,7 @@ enabled libcelt   && require libcelt
>> celt/celt.h celt_decode -lcelt0 &&
>> enabled libcaca   && require_pkg_config libcaca caca caca.h
>> caca_create_canvas
>> enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create
>> -lcodec2
>> enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.0.1"
>> "dav1d/dav1d.h" dav1d_version
>> -enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.5.115"
>> davs2.h davs2_decoder_open
>> +enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0"
>> davs2.h davs2_decoder_open
>
>Does this fix a regression in FFmpeg? If yes, please mention it in the
>commit message.
>(If not, what does this patch do?)

I'm sorry for the missing message. New api enable avx option.
New patches would be submitted soon. Thanks.

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


[FFmpeg-devel] [PATCH 2/2] configure: update api version of libxavs2

2018-11-17 Thread hwren
From: hwrenx  

api version update.

more detials could be found in xavs2-git 
https://github.com/pkuvcl/xavs2 

Signed-off-by: hwrenx  
--- 
configure | 2 +- 
1 file changed, 1 insertion(+), 1 deletion(-) 

diff --git a/configure b/configure 
index d2159db..fb70181 100755 
--- a/configure 
+++ b/configure 
@@ -6191,7 +6191,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 libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.3.0" 
"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 
-- 
2.7.4 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] configure: update api version of libdavs2

2018-11-17 Thread hwren
From: hwrenx  

api version update.

detials could be found in davs2-git 
https://github.com/pkuvcl/davs2 

Signed-off-by: hwrenx  
--- 
configure | 2 +- 
1 file changed, 1 insertion(+), 1 deletion(-) 

diff --git a/configure b/configure 
index 9bc4cf3..d2159db 100755 
--- a/configure 
+++ b/configure 
@@ -6075,7 +6075,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 && 
enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas 
enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2 
enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.0.1" 
"dav1d/dav1d.h" dav1d_version 
-enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.5.115" 
davs2.h davs2_decoder_open 
+enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open 
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new 
enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion 
enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen || 
-- 
2.7.4 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5 1/4] lavc/libdavs2: fix sequence incomplete output error

2018-11-14 Thread hwren
Any comments on these patches?








At 2018-11-02 21:30:08, "hwren"  wrote:
>Signed-off-by: hwren 
>---
> libavcodec/libdavs2.c | 12 +++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
>index cadf995..e36bfed 100644
>--- a/libavcodec/libdavs2.c
>+++ b/libavcodec/libdavs2.c
>@@ -129,7 +129,17 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
>*data,
> int   ret  = DAVS2_DEFAULT;
> 
> if (!buf_size) {
>-return 0;
>+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>>out_frame);
>+if (ret == DAVS2_END) {
>+return 0;
>+} else if (ret == DAVS2_GOT_FRAME) {
>+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>>headerset, ret, frame);
>+davs2_decoder_frame_unref(cad->decoder, >out_frame);
>+return ret;
>+} else {
>+av_log(avctx, AV_LOG_ERROR, "Decoder error: dump frames 
>failed\n");
>+return AVERROR_EXTERNAL;
>+}
> }
> 
> cad->packet.data = buf_ptr;
>-- 
>2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v5 4/4] lavc/libdavs2: fix wrong return value

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 3e59d41..6e4bd50 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -147,15 +147,17 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 if (!buf_size) {
 ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
 if (ret == DAVS2_END) {
-return 0;
+ret = 0;
 } else if (ret == DAVS2_GOT_FRAME) {
-*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+ret = davs2_dump_frames(avctx, >out_frame, >headerset, 
ret, frame);
 davs2_decoder_frame_unref(cad->decoder, >out_frame);
-return ret;
+if (ret == 0 || ret == 1) {
+*got_frame = ret;
+}
 } else {
-av_log(avctx, AV_LOG_ERROR, "Decoder error: dump frames failed\n");
-return AVERROR_EXTERNAL;
+av_log(avctx, AV_LOG_ERROR, "Decoder error: flush frames 
failed\n");
 }
+return ret;
 }
 
 cad->packet.data = buf_ptr;
@@ -174,8 +176,14 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 ret = davs2_decoder_recv_frame(cad->decoder, >headerset, 
>out_frame);
 
 if (ret != DAVS2_DEFAULT) {
-*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+ret = davs2_dump_frames(avctx, >out_frame, >headerset, ret, 
frame);
 davs2_decoder_frame_unref(cad->decoder, >out_frame);
+if (ret == 0 || ret == 1) {
+*got_frame = ret;
+} else {
+av_log(avctx, AV_LOG_ERROR, "Decoder error: dump frames failed\n");
+return ret;
+}
 }
 
 return buf_size;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v5 1/4] lavc/libdavs2: fix sequence incomplete output error

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..e36bfed 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -129,7 +129,17 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 int   ret  = DAVS2_DEFAULT;
 
 if (!buf_size) {
-return 0;
+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
+if (ret == DAVS2_END) {
+return 0;
+} else if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, >out_frame);
+return ret;
+} else {
+av_log(avctx, AV_LOG_ERROR, "Decoder error: dump frames failed\n");
+return AVERROR_EXTERNAL;
+}
 }
 
 cad->packet.data = buf_ptr;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v5 3/4] lavc/libdavs2: correct frame type setting

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 6dc1173..3e59d41 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -76,6 +76,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 return 0;
 }
 
+switch (pic->type) {
+case DAVS2_PIC_I:
+case DAVS2_PIC_G:
+frame->pict_type = AV_PICTURE_TYPE_I;
+break;
+case DAVS2_PIC_P:
+case DAVS2_PIC_S:
+frame->pict_type = AV_PICTURE_TYPE_P;
+break;
+case DAVS2_PIC_B:
+frame->pict_type = AV_PICTURE_TYPE_B;
+break;
+case DAVS2_PIC_F:
+frame->pict_type = AV_PICTURE_TYPE_S;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Decoder error: unknown frame type\n");
+return AVERROR_EXTERNAL;
+}
+
 for (plane = 0; plane < 3; ++plane) {
 int size_line = pic->widths[plane] * bytes_per_sample;
 frame->buf[plane]  = av_buffer_alloc(size_line * pic->lines[plane]);
@@ -97,7 +117,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->width = cad->headerset.width;
 frame->height= cad->headerset.height;
 frame->pts   = cad->out_frame.pts;
-frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
 return 1;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v5 2/4] lavc/libdavs2: remove unused frame counter

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index e36bfed..6dc1173 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -32,8 +32,6 @@ typedef struct DAVS2Context {
 davs2_param_tparam;  // decoding parameters
 davs2_packet_t   packet; // input bitstream
 
-int decoded_frames;
-
 davs2_picture_t  out_frame;  // output data, frame data
 davs2_seq_info_t headerset;  // output data, sequence header
 
@@ -102,7 +100,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
-cad->decoded_frames++;
 return 1;
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 3/4] lavc/libdavs2: correct frame type setting

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index a1815d2..4dbce73 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -76,6 +76,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 return 0;
 }
 
+switch (pic->type) {
+case DAVS2_PIC_I:
+case DAVS2_PIC_G:
+frame->pict_type = AV_PICTURE_TYPE_I;
+break;
+case DAVS2_PIC_P:
+case DAVS2_PIC_S:
+frame->pict_type = AV_PICTURE_TYPE_P;
+break;
+case DAVS2_PIC_B:
+frame->pict_type = AV_PICTURE_TYPE_B;
+break;
+case DAVS2_PIC_F:
+frame->pict_type = AV_PICTURE_TYPE_S;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Decoder error: unknown frame type\n");
+return AVERROR_EXTERNAL;
+}
+
 for (plane = 0; plane < 3; ++plane) {
 int size_line = pic->widths[plane] * bytes_per_sample;
 frame->buf[plane]  = av_buffer_alloc(size_line * pic->lines[plane]);
@@ -97,7 +117,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->width = cad->headerset.width;
 frame->height= cad->headerset.height;
 frame->pts   = cad->out_frame.pts;
-frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
 return 1;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 2/4] lavc/libdavs2: remove unused frame counter

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index e463b2e..a1815d2 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -32,8 +32,6 @@ typedef struct DAVS2Context {
 davs2_param_tparam;  // decoding parameters
 davs2_packet_t   packet; // input bitstream
 
-int decoded_frames;
-
 davs2_picture_t  out_frame;  // output data, frame data
 davs2_seq_info_t headerset;  // output data, sequence header
 
@@ -102,7 +100,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
-cad->decoded_frames++;
 return 1;
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 4/4] lavc/libdavs2: fix wrong return value

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 4dbce73..d912dd8 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -147,14 +147,15 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 if (!buf_size) {
 ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
 if (ret == DAVS2_END) {
-return 0;
+ret = 0;
 } else if (ret == DAVS2_GOT_FRAME) {
-*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+ret = davs2_dump_frames(avctx, >out_frame, >headerset, 
ret, frame);
 davs2_decoder_frame_unref(cad->decoder, >out_frame);
-return ret;
-} else {
-return AVERROR_EXTERNAL;
+if (ret == 0 || ret == 1) {
+*got_frame = ret;
+}
 }
+return ret;
 }
 
 cad->packet.data = buf_ptr;
@@ -173,8 +174,13 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 ret = davs2_decoder_recv_frame(cad->decoder, >headerset, 
>out_frame);
 
 if (ret != DAVS2_DEFAULT) {
-*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+ret = davs2_dump_frames(avctx, >out_frame, >headerset, ret, 
frame);
 davs2_decoder_frame_unref(cad->decoder, >out_frame);
+if (ret == 0 || ret == 1) {
+*got_frame = ret;
+} else {
+return ret;
+}
 }
 
 return buf_size;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 1/4] lavc/libdavs2: fix sequence incomplete output error

2018-11-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..e463b2e 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -129,7 +129,16 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 int   ret  = DAVS2_DEFAULT;
 
 if (!buf_size) {
-return 0;
+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
+if (ret == DAVS2_END) {
+return 0;
+} else if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, >out_frame);
+return ret;
+} else {
+return AVERROR_EXTERNAL;
+}
 }
 
 cad->packet.data = buf_ptr;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] lavc/libdavs2: use assert instead of wrong return value

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 4dbce73..acdfaca 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -93,7 +93,7 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 break;
 default:
 av_log(avctx, AV_LOG_ERROR, "Decoder error: unknown frame type\n");
-return AVERROR_EXTERNAL;
+assert(0);
 }
 
 for (plane = 0; plane < 3; ++plane) {
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 1/3] lavc/libdavs2: fix sequence incomplete output error

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..e463b2e 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -129,7 +129,16 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 int   ret  = DAVS2_DEFAULT;
 
 if (!buf_size) {
-return 0;
+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
+if (ret == DAVS2_END) {
+return 0;
+} else if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, >out_frame);
+return ret;
+} else {
+return AVERROR_EXTERNAL;
+}
 }
 
 cad->packet.data = buf_ptr;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 3/3] lavc/libdavs2: correct frame type setting

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index a1815d2..4dbce73 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -76,6 +76,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 return 0;
 }
 
+switch (pic->type) {
+case DAVS2_PIC_I:
+case DAVS2_PIC_G:
+frame->pict_type = AV_PICTURE_TYPE_I;
+break;
+case DAVS2_PIC_P:
+case DAVS2_PIC_S:
+frame->pict_type = AV_PICTURE_TYPE_P;
+break;
+case DAVS2_PIC_B:
+frame->pict_type = AV_PICTURE_TYPE_B;
+break;
+case DAVS2_PIC_F:
+frame->pict_type = AV_PICTURE_TYPE_S;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Decoder error: unknown frame type\n");
+return AVERROR_EXTERNAL;
+}
+
 for (plane = 0; plane < 3; ++plane) {
 int size_line = pic->widths[plane] * bytes_per_sample;
 frame->buf[plane]  = av_buffer_alloc(size_line * pic->lines[plane]);
@@ -97,7 +117,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->width = cad->headerset.width;
 frame->height= cad->headerset.height;
 frame->pts   = cad->out_frame.pts;
-frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
 return 1;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 2/3] lavc/libdavs2: remove unused frame counter

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index e463b2e..a1815d2 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -32,8 +32,6 @@ typedef struct DAVS2Context {
 davs2_param_tparam;  // decoding parameters
 davs2_packet_t   packet; // input bitstream
 
-int decoded_frames;
-
 davs2_picture_t  out_frame;  // output data, frame data
 davs2_seq_info_t headerset;  // output data, sequence header
 
@@ -102,7 +100,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
-cad->decoded_frames++;
 return 1;
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 3/3] lavc/libdavs2: correct frame type setting

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index a1815d2..d7bcaa3 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -94,11 +94,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
pic->widths[plane] * bytes_per_sample);
 }
 
+switch (pic->type) {
+case DAVS2_PIC_I:
+frame->pict_type = AV_PICTURE_TYPE_I;
+break;
+case DAVS2_PIC_P:
+frame->pict_type = AV_PICTURE_TYPE_P;
+break;
+case DAVS2_PIC_B:
+case DAVS2_PIC_F:
+frame->pict_type = AV_PICTURE_TYPE_B;
+break;
+default:
+frame->pict_type = AV_PICTURE_TYPE_NONE;
+}
+
 frame->width = cad->headerset.width;
 frame->height= cad->headerset.height;
 frame->pts   = cad->out_frame.pts;
-frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
+frame->key_frame = pic->type == DAVS2_PIC_I ? 1 : 0;
 
 return 1;
 }
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 1/3] lavc/libdavs2: fix sequence incomplete output error

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..e463b2e 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -129,7 +129,16 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 int   ret  = DAVS2_DEFAULT;
 
 if (!buf_size) {
-return 0;
+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
+if (ret == DAVS2_END) {
+return 0;
+} else if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, >out_frame);
+return ret;
+} else {
+return AVERROR_EXTERNAL;
+}
 }
 
 cad->packet.data = buf_ptr;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 2/3] lavc/libdavs2: remove unused frame counter

2018-10-31 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index e463b2e..a1815d2 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -32,8 +32,6 @@ typedef struct DAVS2Context {
 davs2_param_tparam;  // decoding parameters
 davs2_packet_t   packet; // input bitstream
 
-int decoded_frames;
-
 davs2_picture_t  out_frame;  // output data, frame data
 davs2_seq_info_t headerset;  // output data, sequence header
 
@@ -102,7 +100,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->pict_type = pic->type;
 frame->format= avctx->pix_fmt;
 
-cad->decoded_frames++;
 return 1;
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 3/3] lavc/libdavs2: remove unused context parameter

2018-10-30 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index b05bdef..ee52043 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -32,8 +32,6 @@ typedef struct DAVS2Context {
 davs2_param_tparam;  // decoding parameters
 davs2_packet_t   packet; // input bitstream
 
-int decoded_frames;
-
 davs2_picture_t  out_frame;  // output data, frame data
 davs2_seq_info_t headerset;  // output data, sequence header
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 1/2] lavc/libdavs2: remove incorrect frame settings

2018-10-30 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..581d568 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -96,13 +96,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
pic->widths[plane] * bytes_per_sample);
 }
 
-frame->width = cad->headerset.width;
-frame->height= cad->headerset.height;
-frame->pts   = cad->out_frame.pts;
-frame->pict_type = pic->type;
-frame->format= avctx->pix_fmt;
-
-cad->decoded_frames++;
 return 1;
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 2/2] lavc/libdavs2: fix sequence incomplete output error

2018-10-30 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 581d568..b05bdef 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -122,7 +122,16 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 int   ret  = DAVS2_DEFAULT;
 
 if (!buf_size) {
-return 0;
+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>out_frame);
+if (ret == DAVS2_END) {
+return 0;
+} else if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, >out_frame);
+return ret;
+} else {
+return AVERROR_EXTERNAL;
+}
 }
 
 cad->packet.data = buf_ptr;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 2/3] lavc/libxavs2: fix intra period meaning conflict

2018-10-18 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 1152c63..f07fc63 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -85,8 +85,8 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("Log",   "%d", cae->log_level);
 xavs2_opt_set2("Preset","%d", cae->preset_level);
 
-/* not the same parameter as the IntraPeriod in xavs2 log */
-xavs2_opt_set2("IntraPeriod",   "%d", avctx->gop_size);
+xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
+xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size);
 
 xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
 xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 3/3] lavc/libxavs2: enable OpenGop

2018-10-18 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index f07fc63..822af3f 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -91,7 +91,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
 xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
 
-xavs2_opt_set2("OpenGOP",  "%d", 1);
+xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 if (cae->xavs2_opts) {
 AVDictionary *dict= NULL;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 1/3] lavc/libxavs2: unified naming style

2018-10-18 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 2b47d0c..1152c63 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -78,18 +78,18 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-xavs2_opt_set2("width", "%d", avctx->width);
-xavs2_opt_set2("height","%d", avctx->height);
-xavs2_opt_set2("bframes",   "%d", avctx->max_b_frames);
-xavs2_opt_set2("bitdepth",  "%d", bit_depth);
-xavs2_opt_set2("log",   "%d", cae->log_level);
-xavs2_opt_set2("preset","%d", cae->preset_level);
+xavs2_opt_set2("Width", "%d", avctx->width);
+xavs2_opt_set2("Height","%d", avctx->height);
+xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
+xavs2_opt_set2("BitDepth",  "%d", bit_depth);
+xavs2_opt_set2("Log",   "%d", cae->log_level);
+xavs2_opt_set2("Preset","%d", cae->preset_level);
 
 /* not the same parameter as the IntraPeriod in xavs2 log */
-xavs2_opt_set2("intraperiod",   "%d", avctx->gop_size);
+xavs2_opt_set2("IntraPeriod",   "%d", avctx->gop_size);
 
-xavs2_opt_set2("thread_frames", "%d", avctx->thread_count);
-xavs2_opt_set2("thread_rows",   "%d", cae->lcu_row_threads);
+xavs2_opt_set2("ThreadFrames",  "%d", avctx->thread_count);
+xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads);
 
 xavs2_opt_set2("OpenGOP",  "%d", 1);
 
@@ -109,11 +109,11 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 if (avctx->bit_rate > 0) {
 xavs2_opt_set2("RateControl",   "%d", 1);
 xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate);
-xavs2_opt_set2("initial_qp","%d", cae->initial_qp);
-xavs2_opt_set2("max_qp","%d", cae->max_qp);
-xavs2_opt_set2("min_qp","%d", cae->min_qp);
+xavs2_opt_set2("InitialQP", "%d", cae->initial_qp);
+xavs2_opt_set2("MaxQP", "%d", cae->max_qp);
+xavs2_opt_set2("MinQP", "%d", cae->min_qp);
 } else {
-xavs2_opt_set2("initial_qp","%d", cae->qp);
+xavs2_opt_set2("InitialQP", "%d", cae->qp);
 }
 
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] LICENSE: add libdavs2 and libxavs2 into compatible libraries section

2018-10-10 Thread hwren
Signed-off-by: hwren 
---
 LICENSE.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/LICENSE.md b/LICENSE.md
index ba65b05..1340ee4 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -83,11 +83,13 @@ affect the licensing of binaries resulting from the 
combination.
 The following libraries are under GPL:
 - frei0r
 - libcdio
+- libdavs2
 - librubberband
 - libvidstab
 - libx264
 - libx265
 - libxavs
+- libxavs2
 - libxvid
 
 When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v1 2/3] lavc/libxavs2: enable open_gop option

2018-10-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index a3cd588..cb01291 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -89,7 +89,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("thread_frames", "%d", avctx->thread_count);
 xavs2_opt_set2("thread_rows",   "%d", cae->lcu_row_threads);
 
-xavs2_opt_set2("OpenGOP",  "%d", 1);
+xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 if (cae->xavs2_opts) {
 AVDictionary *dict= NULL;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v1 3/3] lavc/libxavs2: unified option descriptions format

2018-10-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index cb01291..6267b98 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -249,14 +249,14 @@ static av_cold int xavs2_close(AVCodecContext *avctx)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
 static const AVOption options[] = {
-{ "lcu_row_threads" ,   "number of parallel threads for rows" , 
OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 =  0 },  0, INT_MAX,  VE },
+{ "lcu_row_threads" ,   "Number of parallel threads for rows" , 
OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 =  0 },  0, INT_MAX,  VE },
 { "initial_qp"  ,   "Quantization initial parameter"  , 
OFFSET(initial_qp)  , AV_OPT_TYPE_INT, {.i64 = 34 },  1,  63,  VE },
 { "qp"  ,   "Quantization parameter"  , 
OFFSET(qp)  , AV_OPT_TYPE_INT, {.i64 = 34 },  1,  63,  VE },
-{ "max_qp"  ,   "max qp for rate control" , 
OFFSET(max_qp)  , AV_OPT_TYPE_INT, {.i64 = 55 },  0,  63,  VE },
-{ "min_qp"  ,   "min qp for rate control" , 
OFFSET(min_qp)  , AV_OPT_TYPE_INT, {.i64 = 20 },  0,  63,  VE },
+{ "max_qp"  ,   "Max qp for rate control" , 
OFFSET(max_qp)  , AV_OPT_TYPE_INT, {.i64 = 55 },  0,  63,  VE },
+{ "min_qp"  ,   "Min qp for rate control" , 
OFFSET(min_qp)  , AV_OPT_TYPE_INT, {.i64 = 20 },  0,  63,  VE },
 { "speed_level" ,   "Speed level, higher is better but slower", 
OFFSET(preset_level), AV_OPT_TYPE_INT, {.i64 =  0 },  0,   9,  VE },
-{ "log_level"   ,   "log level: -1: none, 0: error, 1: warning, 2: 
info, 3: debug", OFFSET(log_level), AV_OPT_TYPE_INT, {.i64 =  0 },  -1, 
  3,  VE },
-{ "xavs2-params",   "set the xavs2 configuration using a :-separated 
list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 
0, 0, VE },
+{ "log_level"   ,   "Log level: -1: none, 0: error, 1: warning, 2: 
info, 3: debug", OFFSET(log_level), AV_OPT_TYPE_INT, {.i64 =  0 },  -1, 
  3,  VE },
+{ "xavs2-params",   "Set the xavs2 configuration using a :-separated 
list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 
0, 0, VE },
 { NULL },
 };
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v1 1/3] lavc/libxavs2: keep uniform with xavs2 api

2018-10-02 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libxavs2.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 2b47d0c..a3cd588 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -78,16 +78,14 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-xavs2_opt_set2("width", "%d", avctx->width);
-xavs2_opt_set2("height","%d", avctx->height);
-xavs2_opt_set2("bframes",   "%d", avctx->max_b_frames);
-xavs2_opt_set2("bitdepth",  "%d", bit_depth);
-xavs2_opt_set2("log",   "%d", cae->log_level);
-xavs2_opt_set2("preset","%d", cae->preset_level);
-
-/* not the same parameter as the IntraPeriod in xavs2 log */
-xavs2_opt_set2("intraperiod",   "%d", avctx->gop_size);
-
+xavs2_opt_set2("Width", "%d", avctx->width);
+xavs2_opt_set2("Height","%d", avctx->height);
+xavs2_opt_set2("BFrames",   "%d", avctx->max_b_frames);
+xavs2_opt_set2("BitDepth",  "%d", bit_depth);
+xavs2_opt_set2("Log",   "%d", cae->log_level);
+xavs2_opt_set2("Preset","%d", cae->preset_level);
+
+xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size);
 xavs2_opt_set2("thread_frames", "%d", avctx->thread_count);
 xavs2_opt_set2("thread_rows",   "%d", cae->lcu_row_threads);
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] lavc/libxavs2: remove invalid parameters

2018-09-12 Thread hwren
Signed-off-by: hwren 
---
 doc/encoders.texi | 3 ---
 libavcodec/libxavs2.c | 4 
 2 files changed, 7 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 4623f38..0696a7a 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2761,9 +2761,6 @@ Set the Speed level from 0 to 9 (default 0). Higher is 
better but slower.
 Set the log level from -1 to 3 (default 0). -1: none, 0: error,
 1: warning, 2: info, 3: debug.
 
-@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 ":".
diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index e26c90a..2b47d0c 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -78,8 +78,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-xavs2_opt_set2("rec",   "%d", 0);
-
 xavs2_opt_set2("width", "%d", avctx->width);
 xavs2_opt_set2("height","%d", avctx->height);
 xavs2_opt_set2("bframes",   "%d", avctx->max_b_frames);
@@ -92,7 +90,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 xavs2_opt_set2("thread_frames", "%d", avctx->thread_count);
 xavs2_opt_set2("thread_rows",   "%d", cae->lcu_row_threads);
-xavs2_opt_set2("hierarchical_ref",  "%d", cae->hierarchical_reference);
 
 xavs2_opt_set2("OpenGOP",  "%d", 1);
 
@@ -261,7 +258,6 @@ static const AVOption options[] = {
 { "min_qp"  ,   "min qp for rate control" , 
OFFSET(min_qp)  , AV_OPT_TYPE_INT, {.i64 = 20 },  0,  63,  VE },
 { "speed_level" ,   "Speed level, higher is better but slower", 
OFFSET(preset_level), AV_OPT_TYPE_INT, {.i64 =  0 },  0,   9,  VE },
 { "log_level"   ,   "log level: -1: none, 0: error, 1: warning, 2: 
info, 3: debug", OFFSET(log_level), AV_OPT_TYPE_INT, {.i64 =  0 },  -1, 
  3,  VE },
-{ "hierarchical_ref",   "hierarchical reference" ,  
OFFSET(hierarchical_reference), AV_OPT_TYPE_BOOL,{.i64 =  1 }, 0, 1,  
VE },
 { "xavs2-params",   "set the xavs2 configuration using a :-separated 
list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 
0, 0, VE },
 { NULL },
 };
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 1/2] lavc/libdavs2: remove unused head files

2018-09-12 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 70aae3e..ab9e511 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -22,13 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/avassert.h"
-#include "libavutil/common.h"
-#include "libavutil/avutil.h"
 #include "avcodec.h"
-#include "libavutil/imgutils.h"
-#include "internal.h"
-
 #include "davs2.h"
 
 typedef struct DAVS2Context {
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 2/2] lavc/libdavs2: fix error type

2018-09-12 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/libdavs2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index ab9e511..aa14782 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -50,7 +50,7 @@ static av_cold int davs2_init(AVCodecContext *avctx)
 
 if (!cad->decoder) {
 av_log(avctx, AV_LOG_ERROR, "decoder created error.");
-return AVERROR(EINVAL);
+return AVERROR_EXTERNAL;
 }
 
 av_log(avctx, AV_LOG_VERBOSE, "decoder created. %p\n", cad->decoder);
@@ -84,7 +84,7 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 
 if (!frame->buf[plane]){
 av_log(avctx, AV_LOG_ERROR, "dump error: alloc failed.\n");
-return AVERROR(EINVAL);
+return AVERROR(ENOMEM);
 }
 
 frame->data[plane] = frame->buf[plane]->data;
@@ -142,7 +142,7 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 
 if (ret == DAVS2_ERROR) {
 av_log(avctx, AV_LOG_ERROR, "Decoder error: can't read packet\n");
-return AVERROR(EINVAL);
+return AVERROR_EXTERNAL;
 }
 
 ret = davs2_decoder_recv_frame(cad->decoder, >headerset, 
>out_frame);
-- 
2.7.4

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


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

2018-09-09 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  49 
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 300 +
 libavcodec/version.h   |   4 +-
 8 files changed, 372 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..4623f38 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,55 @@ 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 qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
+used to set the qp value under constant-QP mode.
+
+@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). Higher is better but slower.
+
+@item log_level
+Set the log level from -1 to 3 (default 0). -1: none, 0: error,
+1: warning, 2: info, 3: debug.
+
+@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 preset_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
+installin

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

2018-09-09 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 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 F

[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 v6 2/2] lavf: add raw avs2 muxer

2018-09-05 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 v6 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-09-05 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  34 ++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 290 +
 libavcodec/version.h   |   4 +-
 8 files changed, 347 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..6998493 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,40 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item speed_level
+Set the Speed level from 0 to 9 (default 0).
+
+@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 preset_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 

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

2018-09-05 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  38 +++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 291 +
 libavcodec/version.h   |   2 +-
 8 files changed, 351 insertions(+), 1 deletion(-)
 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 8bbcd53..c439d2a 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]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,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"
@@ -6164,6 +6167,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 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..1604477 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,44 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item speed_level
+Set the Speed level from 0 to 9 (default 0).Higher is better but slower.
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4). This intra_period means
+actul intra period divied by gop_size.
+
+@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 preset_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-devel] [PATCH v5 2/2] lavf: add raw avs2 muxer

2018-09-05 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 v4 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-09-02 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  40 +++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 319 +
 libavcodec/version.h   |   2 +-
 8 files changed, 381 insertions(+), 1 deletion(-)
 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 8bbcd53..c439d2a 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]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,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"
@@ -6164,6 +6167,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 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..0b4dfb3 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,46 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item preset_level
+Set the Speed level from 0 to 9 (default 0).
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4).
+
+@item hierarchical_ref
+Set the hierarchical reference from 0 to 1 (default 1).
+
+@item num_bframes
+Set the number of B frames from 0 to 15 (default 7).
+
+@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 preset_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-devel] [PATCH v4 2/2] lavf: add raw avs2 muxer

2018-09-02 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 v3 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-09-01 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  40 +++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 320 +
 libavcodec/version.h   |   2 +-
 8 files changed, 382 insertions(+), 1 deletion(-)
 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 8bbcd53..c439d2a 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]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,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"
@@ -6164,6 +6167,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 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..0b4dfb3 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,46 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item preset_level
+Set the Speed level from 0 to 9 (default 0).
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4).
+
+@item hierarchical_ref
+Set the hierarchical reference from 0 to 1 (default 1).
+
+@item num_bframes
+Set the number of B frames from 0 to 15 (default 7).
+
+@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 preset_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-devel] [PATCH v3 2/2] lavf: add raw avs2 muxer

2018-09-01 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 v2 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-08-31 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  40 ++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 330 +
 libavcodec/version.h   |   2 +-
 8 files changed, 392 insertions(+), 1 deletion(-)
 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 8bbcd53..c439d2a 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]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,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"
@@ -6164,6 +6167,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 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..b5f9c5e 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,46 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item preset_level
+Set the Speed level from 0 to 9 (default 0).
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4).
+
+@item hierarchical_ref
+Set the hierarchical reference from 0 to 1 (default 1).
+
+@item num_bframes
+Set the number of B frames from 0 to 15 (default 7).
+
+@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 -preset_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-devel] [PATCH v2 2/2] lavf: add raw avs2 muxer

2018-08-31 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 v1 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-08-31 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  40 ++
 doc/general.texi   |  14 ++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 341 +
 libavcodec/version.h   |   2 +-
 8 files changed, 403 insertions(+), 1 deletion(-)
 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 8bbcd53..c439d2a 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]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,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"
@@ -6164,6 +6167,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 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..b5f9c5e 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,46 @@ 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 i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item preset_level
+Set the Speed level from 0 to 9 (default 0).
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4).
+
+@item hierarchical_ref
+Set the hierarchical reference from 0 to 1 (default 1).
+
+@item num_bframes
+Set the number of B frames from 0 to 15 (default 7).
+
+@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 -preset_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
 

  1   2   >