[FFmpeg-cvslog] avcodec: Add an SVT-AV1 encoder wrapper

2020-07-29 Thread Daryl Seah
ffmpeg | branch: master | Daryl Seah  | Fri Jan 18 
02:11:38 2019 +| [0e20dee5c21a40f23ecfe7af2c360493a169c0f0] | committer: 
James Almer

avcodec: Add an SVT-AV1 encoder wrapper

Signed-off-by: Daryl Seah 
Signed-off-by: Jing SUN 
Signed-off-by: ZhiZhen Tang 
Signed-off-by: Zhong Li 
Signed-off-by: Xu Guangxin 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e20dee5c21a40f23ecfe7af2c360493a169c0f0
---

 Changelog   |   1 +
 configure   |   4 +
 doc/encoders.texi   |  38 
 doc/general.texi|  10 +-
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/libsvt_av1.c | 582 
 libavcodec/version.h|   4 +-
 8 files changed, 638 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index c37ffa82e1..6f648bff2b 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - VDPAU accelerated HEVC 10/12bit decoding
 - ADPCM IMA Ubisoft APM encoder
 - Rayman 2 APM muxer
+- AV1 encoding support SVT-AV1
 
 
 version 4.3:
diff --git a/configure b/configure
index 574f6abf22..169f23e17f 100755
--- a/configure
+++ b/configure
@@ -269,6 +269,7 @@ External library support:
   --enable-libspeexenable Speex de/encoding via libspeex [no]
   --enable-libsrt  enable Haivision SRT protocol via libsrt [no]
   --enable-libssh  enable SFTP protocol via libssh [no]
+  --enable-libsvtav1   enable AV1 encoding via SVT [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
for DNN based filters like sr [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
@@ -1805,6 +1806,7 @@ EXTERNAL_LIBRARY_LIST="
 libspeex
 libsrt
 libssh
+libsvtav1
 libtensorflow
 libtesseract
 libtheora
@@ -3243,6 +3245,7 @@ libshine_encoder_select="audio_frame_queue"
 libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
+libsvt_av1_encoder_deps="libsvtav1"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
@@ -6398,6 +6401,7 @@ enabled libsoxr   && require libsoxr soxr.h 
soxr_create -lsoxr
 enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h 
sftp_init
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h 
speex_decoder_init
 enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" 
srt/srt.h srt_socket
+enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" 
EbSvtAv1Enc.h svt_av1_enc_init_handle
 enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
TF_Version -ltensorflow
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
diff --git a/doc/encoders.texi b/doc/encoders.texi
index ed8ef63784..af7d2ba983 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1687,6 +1687,44 @@ Enable smooth interintra mode. Default is true.
 
 @end table
 
+@section libsvt-av1
+
+SVT-AV1 encoder wrapper.
+
+Requires the presence of the SVT-AV1 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-libsvtav1}.
+
+@subsection Options
+
+@table @option
+@item qmax
+Sets the maximum quantizer to use when using bitrate mode.
+
+@item qmin
+Sets the minimum quantizer to use when using bitrate mode.
+
+@item qp
+Uses quantizer mode to encode at the given quantizer (0-63).
+
+@item hielevel
+Enable scene change detection.
+
+@item la_depth
+Set number of frames to look ahead (0-120).
+
+@item preset
+Set encoding preset.
+
+@item tier
+
+@item tile-rows
+Selects how many rows of tiles to encode with (0-6).
+
+@item tile-columns
+Selects how many columns of tiles to encode with (0-4).
+
+@end table
+
 @section libkvazaar
 
 Kvazaar H.265/HEVC encoder.
diff --git a/doc/general.texi b/doc/general.texi
index 68d386b655..dfcfd394e6 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -263,6 +263,14 @@ Go to @url{https://github.com/xiph/rav1e/} and follow the 
instructions to build
 the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e}
 to @file{./configure}.
 
+@section SVT-AV1
+
+FFmpeg can make use of the Scalable Video Technology for AV1 library for AV1 
encoding.
+
+Go to @url{https://github.com/OpenVisualCloud/SVT-AV1/} and follow the 
instructions
+for installing the library. Then pass @code{--enable-libsvtav1} to configure to
+enable it.
+
 @section TwoLAME
 
 FFmpeg can make use of the TwoLAME library for MP2 encoding.
@@ -822,7 +830,7 @@ following image formats are supported:
 @item Autodesk RLE   @tab @tab  X
 @tab fourcc: AASC
 @item AV1@tab  E  @tab  E
-@tab Supp

[FFmpeg-cvslog] avcodec/libsvt_av1: remove forced-idr option

2020-07-29 Thread Lynne
ffmpeg | branch: master | Lynne  | Wed Jul 29 22:38:44 2020 
+0200| [6ceaeecaf562020f25beab0614157fb2dae32391] | committer: James Almer

avcodec/libsvt_av1: remove forced-idr option

This option is directly copy-pasted from the SVT1-HEVC wrapper and has
no place in the options for an AV1 encoder.

AV1 has no H.264/5 IDR frames nor anything like them.
All this option does is change all real keyframes to an intra-only
AV1 frame, which is not seekable. Hence, any streams encoded with
this option enabled will not be seekable.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ceaeecaf562020f25beab0614157fb2dae32391
---

 libavcodec/libsvt_av1.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/libsvt_av1.c b/libavcodec/libsvt_av1.c
index b30211d15b..c7ae5f9691 100644
--- a/libavcodec/libsvt_av1.c
+++ b/libavcodec/libsvt_av1.c
@@ -67,8 +67,6 @@ typedef struct SvtContext {
 int scd;
 int qp;
 
-int forced_idr;
-
 int tier;
 
 int tile_columns;
@@ -212,7 +210,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration 
*param,
 param->min_qp_allowed   = avctx->qmin;
 }
 
-param->intra_refresh_type   = svt_enc->forced_idr + 1;
+param->intra_refresh_type   = 2; /* Real keyframes only */
 
 if (svt_enc->la_depth >= 0)
 param->look_ahead_distance  = svt_enc->la_depth;
@@ -538,9 +536,6 @@ static const AVOption options[] = {
 { "sc_detection", "Scene change detection", OFFSET(scd),
   AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
 
-{ "forced-idr", "If forcing keyframes, force them as IDR frames", 
OFFSET(forced_idr),
-  AV_OPT_TYPE_BOOL,   { .i64 = 1 }, 0, 1, VE },
-
 { "tile-columns", "Log2 of number of tile columns to use", 
OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE},
 { "tile-rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE},
 

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

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

[FFmpeg-cvslog] avformat/hlsenc: increase initial program date time precision

2020-07-29 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sat Jul 18 23:57:42 
2020 +0200| [b2318c1e537f15c4c23f302a5193d6218dffdde8] | committer: Marton 
Balint

avformat/hlsenc: increase initial program date time precision

Also query time only once, not for every variant stream, otherwise variant
streams might get a slightly different initial program date time. And we can
set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
elsewhere.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2318c1e537f15c4c23f302a5193d6218dffdde8
---

 libavformat/hlsenc.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index df84e6487d..39ff1fa1e7 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
 char *p = NULL;
 int http_base_proto = ff_is_http_proto(s->url);
 int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
+double initial_program_date_time = av_gettime() / 100.0;
 
 if (hls->use_localtime) {
 pattern = get_default_pattern_localtime_fmt(s);
@@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
 vs->start_pts = AV_NOPTS_VALUE;
 vs->end_pts   = AV_NOPTS_VALUE;
 vs->current_segment_final_filename_fmt[0] = '\0';
-
-if (hls->flags & HLS_PROGRAM_DATE_TIME) {
-time_t now0;
-time(&now0);
-vs->initial_prog_date_time = now0;
-}
+vs->initial_prog_date_time = initial_program_date_time;
 
 for (j = 0; j < vs->nb_streams; j++) {
 vs->has_video += vs->streams[j]->codecpar->codec_type == 
AVMEDIA_TYPE_VIDEO;

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

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

[FFmpeg-cvslog] fftools/ffmpeg: make specifying thread_queue_size turn on threaded input

2020-07-29 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sat Jul  4 23:43:12 
2020 +0200| [53a4620fbae20b640d7fd75a64a6d3ff6dcc8b43] | committer: Marton 
Balint

fftools/ffmpeg: make specifying thread_queue_size turn on threaded input

Threaded input can increase smoothness of e.g. x11grab significantly. Before
this patch, in order to activate threaded input the user had to specify a
"dummy" additional input, with this change it is no longer required.

Signed-off-by: Marton Balint 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53a4620fbae20b640d7fd75a64a6d3ff6dcc8b43
---

 doc/ffmpeg.texi  | 5 +++--
 fftools/ffmpeg.c | 6 --
 fftools/ffmpeg_opt.c | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 70b8965d7f..267ddfe8b5 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1689,8 +1689,9 @@ not start from timestamp 0, such as transport streams.
 @item -thread_queue_size @var{size} (@emph{input})
 This option sets the maximum number of queued packets when reading from the
 file or device. With low latency / high rate live streams, packets may be
-discarded if they are not read in a timely manner; raising this value can
-avoid it.
+discarded if they are not read in a timely manner; setting this value can
+force ffmpeg to use a separate input thread and read packets as soon as they
+arrive. By default ffmpeg only do this if multiple inputs are specified.
 
 @item -sdp_file @var{file} (@emph{global})
 Print sdp information for an output stream to @var{file}.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2e9448ea2b..173ac3c9a0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4051,7 +4051,9 @@ static int init_input_thread(int i)
 int ret;
 InputFile *f = input_files[i];
 
-if (nb_input_files == 1)
+if (f->thread_queue_size < 0)
+f->thread_queue_size = (nb_input_files > 1 ? 8 : 0);
+if (!f->thread_queue_size)
 return 0;
 
 if (f->ctx->pb ? !f->ctx->pb->seekable :
@@ -4105,7 +4107,7 @@ static int get_input_packet(InputFile *f, AVPacket *pkt)
 }
 
 #if HAVE_THREADS
-if (nb_input_files > 1)
+if (f->thread_queue_size)
 return get_input_packet_mt(f, pkt);
 #endif
 return av_read_frame(f->ctx, pkt);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 9d1489ce01..853550a142 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -228,6 +228,7 @@ static void init_options(OptionsContext *o)
 o->limit_filesize = UINT64_MAX;
 o->chapters_input_file = INT_MAX;
 o->accurate_seek  = 1;
+o->thread_queue_size = -1;
 }
 
 static int show_hwaccels(void *optctx, const char *opt, const char *arg)
@@ -1270,7 +1271,7 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 f->duration = 0;
 f->time_base = (AVRational){ 1, 1 };
 #if HAVE_THREADS
-f->thread_queue_size = o->thread_queue_size > 0 ? o->thread_queue_size : 8;
+f->thread_queue_size = o->thread_queue_size;
 #endif
 
 /* check if all codec options have been used */

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

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

[FFmpeg-cvslog] avcodec/mips/cabac: Fix a bug in get_cabac_inline_mips.

2020-07-29 Thread Shiyou Yin
ffmpeg | branch: master | Shiyou Yin  | Wed Jul 29 
18:11:00 2020 +0800| [1563b4b4c615e2264c2d302b97b1d507e153255c] | committer: 
Michael Niedermayer

avcodec/mips/cabac: Fix a bug in get_cabac_inline_mips.

Failed fate case: fate-h264-conformance-caba2_sony_e
Clang is more strict in the use of register constraint.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1563b4b4c615e2264c2d302b97b1d507e153255c
---

 libavcodec/mips/cabac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mips/cabac.h b/libavcodec/mips/cabac.h
index c595915eda..3d09e93523 100644
--- a/libavcodec/mips/cabac.h
+++ b/libavcodec/mips/cabac.h
@@ -109,7 +109,7 @@ static av_always_inline int 
get_cabac_inline_mips(CABACContext *c,
   [lps_off]"i"(H264_LPS_RANGE_OFFSET),
   [mlps_off]"i"(H264_MLPS_STATE_OFFSET + 128),
   [norm_off]"i"(H264_NORM_SHIFT_OFFSET),
-  [cabac_mask]"i"(CABAC_MASK)
+  [cabac_mask]"r"(CABAC_MASK)
 : "memory"
 );
 

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

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

[FFmpeg-cvslog] avcodec/mips: Fix segfault in imdct36_mips_float.

2020-07-29 Thread Shiyou Yin
ffmpeg | branch: master | Shiyou Yin  | Wed Jul 29 
18:11:01 2020 +0800| [bd4f37f2ebf5870083c2343cbed6846aee63e6a5] | committer: 
Michael Niedermayer

avcodec/mips: Fix segfault in imdct36_mips_float.

'li.s' is a synthesized instruction, it does not work properly
when compiled with clang on mips, and A segfault occurred.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd4f37f2ebf5870083c2343cbed6846aee63e6a5
---

 libavcodec/mips/aacpsdsp_mips.c   |  13 +-
 libavcodec/mips/aacpsy_mips.h |  14 +-
 libavcodec/mips/fft_mips.c|  12 +-
 libavcodec/mips/mpegaudiodsp_mips_float.c | 492 +++---
 4 files changed, 264 insertions(+), 267 deletions(-)

diff --git a/libavcodec/mips/aacpsdsp_mips.c b/libavcodec/mips/aacpsdsp_mips.c
index ef47e31a9e..f63541330d 100644
--- a/libavcodec/mips/aacpsdsp_mips.c
+++ b/libavcodec/mips/aacpsdsp_mips.c
@@ -293,16 +293,17 @@ static void ps_decorrelate_mips(float (*out)[2], float 
(*delay)[2],
 float phi_fract0 = phi_fract[0];
 float phi_fract1 = phi_fract[1];
 float temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9;
+float f1, f2, f3;
 
 float *p_delay_end = (p_delay + (len << 1));
 
 /* merged 2 loops */
+f1 = 0.65143905753106;
+f2 = 0.56471812200776;
+f3 = 0.48954165955695;
 __asm__ volatile(
 ".setpush\n\t"
 ".setnoreorder   \n\t"
-"li.s%[ag0],0.65143905753106 \n\t"
-"li.s%[ag1],0.56471812200776 \n\t"
-"li.s%[ag2],0.48954165955695 \n\t"
 "mul.s   %[ag0],%[ag0],%[g_decay_slope]  \n\t"
 "mul.s   %[ag1],%[ag1],%[g_decay_slope]  \n\t"
 "mul.s   %[ag2],%[ag2],%[g_decay_slope]  \n\t"
@@ -378,10 +379,10 @@ static void ps_decorrelate_mips(float (*out)[2], float 
(*delay)[2],
   [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
   [temp6]"=&f"(temp6), [temp7]"=&f"(temp7), [temp8]"=&f"(temp8),
   [temp9]"=&f"(temp9), [p_delay]"+r"(p_delay), 
[p_ap_delay]"+r"(p_ap_delay),
-  [p_Q_fract]"+r"(p_Q_fract), [p_t_gain]"+r"(p_t_gain), 
[p_out]"+r"(p_out),
-  [ag0]"=&f"(ag0), [ag1]"=&f"(ag1), [ag2]"=&f"(ag2)
+  [p_Q_fract]"+r"(p_Q_fract), [p_t_gain]"+r"(p_t_gain), 
[p_out]"+r"(p_out)
 : [phi_fract0]"f"(phi_fract0), [phi_fract1]"f"(phi_fract1),
-  [p_delay_end]"r"(p_delay_end), [g_decay_slope]"f"(g_decay_slope)
+  [p_delay_end]"r"(p_delay_end), [g_decay_slope]"f"(g_decay_slope),
+  [ag0]"f"(f1), [ag1]"f"(f2), [ag2]"f"(f3)
 : "memory"
 );
 }
diff --git a/libavcodec/mips/aacpsy_mips.h b/libavcodec/mips/aacpsy_mips.h
index a1fe5ccea9..7d27d32f18 100644
--- a/libavcodec/mips/aacpsy_mips.h
+++ b/libavcodec/mips/aacpsy_mips.h
@@ -135,11 +135,11 @@ static void psy_hp_filter_mips(const float *firbuf, float 
*hpfsmpl, const float
 float coeff3 = psy_fir_coeffs[7];
 float coeff4 = psy_fir_coeffs[9];
 
+float f1 = 32768.0;
 __asm__ volatile (
 ".set push  \n\t"
 ".set noreorder \n\t"
 
-"li.s   $f12,   32768   \n\t"
 "1: \n\t"
 "lwc1   $f0,40(%[fb])   \n\t"
 "lwc1   $f1,4(%[fb])\n\t"
@@ -203,14 +203,14 @@ static void psy_hp_filter_mips(const float *firbuf, float 
*hpfsmpl, const float
 "madd.s %[sum2],%[sum2],$f9,%[coeff4]   \n\t"
 "madd.s %[sum4],%[sum4],$f6,%[coeff4]   \n\t"
 "madd.s %[sum3],%[sum3],$f3,%[coeff4]   \n\t"
-"mul.s  %[sum1],%[sum1],$f12\n\t"
-"mul.s  %[sum2],%[sum2],$f12\n\t"
+"mul.s  %[sum1],%[sum1],%[f1]   \n\t"
+"mul.s  %[sum2],%[sum2],%[f1]   \n\t"
 "madd.s %[sum4],%[sum4],$f11,   %[coeff4]   \n\t"
 "madd.s %[sum3],%[sum3],$f8,%[coeff4]   \n\t"
 "swc1   %[sum1],0(%[hp])\n\t"
 "swc1   %[sum2],4(%[hp])\n\t"
-"mul.s  %[sum4],%[sum4],$f12\n\t"
-"mul.s  %[sum3],%[sum3],$f12\n\t"
+"mul.s  %[sum4],%[sum4],%[f1]   \n\t"
+"mul.s  %[sum3],%[sum3],%[f1]   \n\t"
 "swc1   %[sum4],12(%[hp])   \n\t"
 "swc1   %[sum3],8(%[hp])\n\t"
 "bne%[fb],

[FFmpeg-cvslog] libavcodec/pgxdec Fix pix format selection error

2020-07-29 Thread Gautam Ramakrishnan
ffmpeg | branch: master | Gautam Ramakrishnan  | Wed Jul 
29 21:37:11 2020 +0530| [8821df6fcfc0a3b75c7079617f5917c031d0a63c] | committer: 
Michael Niedermayer

libavcodec/pgxdec Fix pix format selection error

This patch makes the pgx decoder select the correct
byte order instead of selecting big endian format for
16 bit images.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8821df6fcfc0a3b75c7079617f5917c031d0a63c
---

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

diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c
index 93b9f4e7a0..a72d6fe6fe 100644
--- a/libavcodec/pgxdec.c
+++ b/libavcodec/pgxdec.c
@@ -137,7 +137,7 @@ static int pgx_decode_frame(AVCodecContext *avctx, void 
*data,
 avctx->pix_fmt = AV_PIX_FMT_GRAY8;
 bpp = 8;
 } else if (depth <= 16) {
-avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
+avctx->pix_fmt = AV_PIX_FMT_GRAY16;
 bpp = 16;
 } else {
 av_log(avctx, AV_LOG_ERROR, "Maximum depth of 16 bits supported.\n");

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

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

[FFmpeg-cvslog] libavcodec/j2kenc: Encoding up to 16 bits

2020-07-29 Thread Gautam Ramakrishnan
ffmpeg | branch: master | Gautam Ramakrishnan  | Wed Jul 
29 21:37:10 2020 +0530| [9d302efdf2bc1b48896e34574f5a675c6e441a81] | committer: 
Michael Niedermayer

libavcodec/j2kenc: Encoding up to 16 bits

This patch allows the JPEG2000 encoder to
encode images to up to 16 bits.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d302efdf2bc1b48896e34574f5a675c6e441a81
---

 libavcodec/j2kenc.c | 99 ++---
 1 file changed, 57 insertions(+), 42 deletions(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 38643c9a28..5ebc1f3a99 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -298,7 +298,7 @@ static int put_siz(Jpeg2000EncoderContext *s)
 bytestream_put_be16(&s->buf, s->ncomponents); // CSiz
 
 for (i = 0; i < s->ncomponents; i++){ // Ssiz_i XRsiz_i, YRsiz_i
-bytestream_put_byte(&s->buf, 7);
+bytestream_put_byte(&s->buf, s->cbps[i] - 1);
 bytestream_put_byte(&s->buf, i?1buf, i?1numXtiles * s->numYtiles; tileno++){
-Jpeg2000Tile *tile = s->tile + tileno;
-if (s->planar){
-for (compno = 0; compno < s->ncomponents; compno++){
-Jpeg2000Component *comp = tile->comp + compno;
-int *dst = comp->i_data;
-line = s->picture->data[compno]
-   + comp->coord[1][0] * s->picture->linesize[compno]
-   + comp->coord[0][0];
-for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){
-uint8_t *ptr = line;
-for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++)
-*dst++ = *ptr++ - (1 << 7);
-line += s->picture->linesize[compno];
-}
-}
-} else{
-line = s->picture->data[0] + tile->comp[0].coord[1][0] * 
s->picture->linesize[0]
-   + tile->comp[0].coord[0][0] * s->ncomponents;
-
-i = 0;
-for (y = tile->comp[0].coord[1][0]; y < tile->comp[0].coord[1][1]; 
y++){
-uint8_t *ptr = line;
-for (x = tile->comp[0].coord[0][0]; x < 
tile->comp[0].coord[0][1]; x++, i++){
-for (compno = 0; compno < s->ncomponents; compno++){
-tile->comp[compno].i_data[i] = *ptr++  - (1 << 7);
-}
-}
-line += s->picture->linesize[0];
-}
-}
+#define COPY_FRAME(D, PIXEL)   
 \
+static void copy_frame_ ##D(Jpeg2000EncoderContext *s) 
 \
+{  
 \
+int tileno, compno, i, y, x;   
 \
+PIXEL *line;   
 \
+for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){  
 \
+Jpeg2000Tile *tile = s->tile + tileno; 
 \
+if (s->planar){
 \
+for (compno = 0; compno < s->ncomponents; compno++){   
 \
+Jpeg2000Component *comp = tile->comp + compno; 
 \
+int *dst = comp->i_data;   
 \
+int cbps = s->cbps[compno];
 \
+line = (PIXEL*)s->picture->data[compno]
 \
+   + comp->coord[1][0] * (s->picture->linesize[compno] 
/ sizeof(PIXEL)) \
+   + comp->coord[0][0];
 \
+for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){   
 \
+PIXEL *ptr = line; 
 

[FFmpeg-cvslog] avutil/mips/generic_macros_msa: Fix prob that 'ulw' and 'uld' unsupported by clang.

2020-07-29 Thread Shiyou Yin
ffmpeg | branch: master | Shiyou Yin  | Wed Jul 29 
18:10:59 2020 +0800| [0e0a9ca04822f7d3ce0792f5cec3be7b2c738f9a] | committer: 
Michael Niedermayer

avutil/mips/generic_macros_msa: Fix prob that 'ulw' and 'uld' unsupported by 
clang.

GCC support these two synthesized instruction, but clang does not yet.
Use machine instruction instead to adapt clang compiler.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e0a9ca04822f7d3ce0792f5cec3be7b2c738f9a
---

 libavutil/mips/generic_macros_msa.h | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavutil/mips/generic_macros_msa.h 
b/libavutil/mips/generic_macros_msa.h
index 267d4e6ca5..bb25e9fd74 100644
--- a/libavutil/mips/generic_macros_msa.h
+++ b/libavutil/mips/generic_macros_msa.h
@@ -111,10 +111,11 @@
 uint32_t val_lw_m;   \
  \
 __asm__ volatile (   \
-"ulw  %[val_lw_m],  %[psrc_lw_m]  \n\t"  \
+"lwr %[val_lw_m], 0(%[psrc_lw_m]) \n\t"  \
+"lwl %[val_lw_m], 3(%[psrc_lw_m]) \n\t"  \
  \
-: [val_lw_m] "=r" (val_lw_m) \
-: [psrc_lw_m] "m" (*psrc_lw_m)   \
+: [val_lw_m] "=&r"(val_lw_m) \
+: [psrc_lw_m] "r"(psrc_lw_m) \
 );   \
  \
 val_lw_m;\
@@ -127,10 +128,11 @@
 uint64_t val_ld_m = 0;   \
  \
 __asm__ volatile (   \
-"uld  %[val_ld_m],  %[psrc_ld_m]  \n\t"  \
+"ldr %[val_ld_m], 0(%[psrc_ld_m]) \n\t"  \
+"ldl %[val_ld_m], 7(%[psrc_ld_m]) \n\t"  \
  \
-: [val_ld_m] "=r" (val_ld_m) \
-: [psrc_ld_m] "m" (*psrc_ld_m)   \
+: [val_ld_m] "=&r" (val_ld_m)\
+: [psrc_ld_m] "r" (psrc_ld_m)\
 );   \
  \
 val_ld_m;\

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

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

[FFmpeg-cvslog] avcodec/mips: Fix register constraint error reported by clang.

2020-07-29 Thread Shiyou Yin
ffmpeg | branch: master | Shiyou Yin  | Wed Jul 29 
18:10:58 2020 +0800| [44699db6db32e7077d6fc5a1cf0c81463ee5d791] | committer: 
Michael Niedermayer

avcodec/mips: Fix register constraint error reported by clang.

Clang report following error in aacsbr_mips.c,ac3dsp_mips.c and aacdec_mips.c:
"couldn't allocate output register for constraint 'r'"

Use 'f' constraint for float variable.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44699db6db32e7077d6fc5a1cf0c81463ee5d791
---

 libavcodec/mips/aacdec_mips.c |  2 +-
 libavcodec/mips/aacsbr_mips.c |  2 +-
 libavcodec/mips/sbrdsp_mips.c | 19 ++-
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index 8e30652935..7f2478957f 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -340,7 +340,7 @@ static void update_ltp_mips(AACContext *ac, 
SingleChannelElement *sce)
 float *saved_ltp = sce->coeffs;
 const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : 
ff_sine_1024;
 const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : 
ff_sine_128;
-float temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
+uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
 
 if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
 float *p_saved_ltp = saved_ltp + 576;
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 2e0cd723d7..5ef5e68371 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -333,7 +333,7 @@ static void sbr_hf_assemble_mips(float Y1[38][64][2],
 int indexnoise = ch_data->f_indexnoise;
 int indexsine  = ch_data->f_indexsine;
 float *g_temp1, *q_temp1, *pok, *pok1;
-float temp1, temp2, temp3, temp4;
+uint32_t temp1, temp2, temp3, temp4;
 int size = m_max;
 
 if (sbr->reset) {
diff --git a/libavcodec/mips/sbrdsp_mips.c b/libavcodec/mips/sbrdsp_mips.c
index 83039fd802..1c87c99251 100644
--- a/libavcodec/mips/sbrdsp_mips.c
+++ b/libavcodec/mips/sbrdsp_mips.c
@@ -796,9 +796,9 @@ static void sbr_hf_apply_noise_2_mips(float (*Y)[2], const 
float *s_m,
  const float *q_filt, int noise,
  int kx, int m_max)
 {
-int m;
+int m, temp0, temp1;
 float *ff_table;
-float y0,y1, temp0, temp1, temp2, temp3, temp4, temp5;
+float y0, y1, temp2, temp3, temp4, temp5;
 
 for (m = 0; m < m_max; m++) {
 
@@ -808,14 +808,14 @@ static void sbr_hf_apply_noise_2_mips(float (*Y)[2], 
const float *s_m,
 
 __asm__ volatile(
 "lwc1   %[y0],   0(%[Y1])  
\n\t"
-"lwc1   %[temp1],0(%[s_m1])
\n\t"
+"lwc1   %[temp3],0(%[s_m1])
\n\t"
 "addiu  %[noise],%[noise],  1  
\n\t"
 "andi   %[noise],%[noise],  0x1ff  
\n\t"
 "sll%[temp0],%[noise],  3  
\n\t"
 PTR_ADDU "%[ff_table],%[ff_sbr_noise_table],%[temp0]   
\n\t"
-"sub.s  %[y0],   %[y0], %[temp1]   
\n\t"
-"mfc1   %[temp3],%[temp1]  
\n\t"
-"bne%[temp3],$0,1f 
\n\t"
+"sub.s  %[y0],   %[y0], %[temp3]   
\n\t"
+"mfc1   %[temp1],%[temp3]  
\n\t"
+"bne%[temp1],$0,1f 
\n\t"
 "lwc1   %[y1],   4(%[Y1])  
\n\t"
 "lwc1   %[temp2],0(%[q_filt1]) 
\n\t"
 "lwc1   %[temp4],0(%[ff_table])
\n\t"
@@ -826,9 +826,10 @@ static void sbr_hf_apply_noise_2_mips(float (*Y)[2], const 
float *s_m,
 "1:
\n\t"
 "swc1   %[y0],   0(%[Y1])  
\n\t"
 
-: [temp0]"=&r"(temp0), [ff_table]"=&r"(ff_table), [y0]"=&f"(y0),
-  [y1]"=&f"(y1), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
-  [temp3]"=&r"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5)
+: [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [y0]"=&f"(y0),
+  [y1]"=&f"(y1), [ff_table]"=&r"(ff_table),
+  [temp2]"=&f"(temp2), [temp3]"=&f"(temp3),
+  [temp4]"=&f"(temp4), [temp5]"=&f"(temp5)
 : [ff_sbr_noise_table]"r"(ff_sbr_noise_table), [noise]"r"(noise),
   [Y1]"r"(Y1), [s_m1]"r"(s_m1), [q_filt1]"r"(q_filt1)
 : "memory"

___
ffmpeg-cvslog mailin

[FFmpeg-cvslog] avcodec/options_table: make AVCodecContext->level search for child constants

2020-07-29 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Jul 29 19:08:17 
2020 -0300| [8a3f561c341fb2c2b7667c38a6801e2633257577] | committer: James Almer

avcodec/options_table: make AVCodecContext->level search for child constants

This change makes it possible for child encoders to define custom level
option names which can be used for setting the AVCodecContext->level.

Based on 337fe4bcc2

Reviewed-by: jkqxz
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a3f561c341fb2c2b7667c38a6801e2633257577
---

 libavcodec/options_table.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 8ba137f51e..1d0db1b5a4 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -264,8 +264,8 @@ static const AVOption avcodec_options[] = {
 {"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN 
}, INT_MIN, INT_MAX, V|A|E|CC, "avctx.profile"},
 {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, 
INT_MAX, V|A|E, "avctx.profile"},
 {"main10",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, 
INT_MIN, INT_MAX, V|E, "avctx.profile"},
-{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, 
INT_MIN, INT_MAX, V|A|E, "level"},
-{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, 
INT_MAX, V|A|E, "level"},
+{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, 
INT_MIN, INT_MAX, V|A|E|CC, "avctx.level"},
+{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, 
INT_MAX, V|A|E, "avctx.level"},
 {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D},
 #if FF_API_PRIVATE_OPT
 {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), 
AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},

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

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

[FFmpeg-cvslog] avformat/apm: fix APM_FILE_HEADER_SIZE value

2020-07-29 Thread Zane van Iperen
ffmpeg | branch: master | Zane van Iperen  | Wed Jul 29 
22:06:50 2020 +1000| [be3c10d5517824318254a99007c7b1c07559c264] | committer: 
Zane van Iperen

avformat/apm: fix APM_FILE_HEADER_SIZE value

Value was incorrectly changed in 3bf1be210150b435c51c7c8eb8fd05a1fca08814.

Signed-off-by: Zane van Iperen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be3c10d5517824318254a99007c7b1c07559c264
---

 libavformat/apm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/apm.c b/libavformat/apm.c
index 4c5844c83e..38a0f6382a 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -26,7 +26,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 
-#define APM_FILE_HEADER_SIZE18
+#define APM_FILE_HEADER_SIZE20
 #define APM_FILE_EXTRADATA_SIZE 80
 #define APM_EXTRADATA_SIZE  28
 
@@ -287,7 +287,7 @@ static int apm_write_trailer(AVFormatContext *s)
 int64_t file_size, data_size;
 
 file_size = avio_tell(s->pb);
-data_size = file_size - (APM_FILE_HEADER_SIZE + 2 + 
APM_FILE_EXTRADATA_SIZE);
+data_size = file_size - (APM_FILE_HEADER_SIZE + APM_FILE_EXTRADATA_SIZE);
 
 if (file_size >= UINT32_MAX) {
 av_log(s, AV_LOG_ERROR,

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

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