[FFmpeg-cvslog] avcodec/adpcm: refactor init/flush code

2021-04-10 Thread Zane van Iperen
ffmpeg | branch: master | Zane van Iperen  | Wed Mar 31 
17:23:34 2021 +1000| [c012f9b265e172de9c240c9dfab8665936fa3e83] | committer: 
Zane van Iperen

avcodec/adpcm: refactor init/flush code

Most of the codecs just need everything zeroed. Those that don't
are either handled inline during decode, or pull state from
extradata.

Move state reset/init functionality into adpcm_flush(), and
invoke it from adpcm_decode_init().

Signed-off-by: Zane van Iperen 

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

 libavcodec/adpcm.c | 71 ++
 1 file changed, 29 insertions(+), 42 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 8aab07e334..be14607eac 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -103,6 +103,8 @@ typedef struct ADPCMDecodeContext {
 int has_status; /**< Status flag. Reset to 0 after a 
flush. */
 } ADPCMDecodeContext;
 
+static void adpcm_flush(AVCodecContext *avctx);
+
 static av_cold int adpcm_decode_init(AVCodecContext * avctx)
 {
 ADPCMDecodeContext *c = avctx->priv_data;
@@ -150,38 +152,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * 
avctx)
 }
 
 switch(avctx->codec->id) {
-case AV_CODEC_ID_ADPCM_CT:
-c->status[0].step = c->status[1].step = 511;
-break;
 case AV_CODEC_ID_ADPCM_IMA_WAV:
 if (avctx->bits_per_coded_sample < 2 || avctx->bits_per_coded_sample > 
5)
 return AVERROR_INVALIDDATA;
 break;
-case AV_CODEC_ID_ADPCM_IMA_APC:
-if (avctx->extradata && avctx->extradata_size >= 8) {
-c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata
), 18);
-c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 
4), 18);
-}
-break;
-case AV_CODEC_ID_ADPCM_IMA_APM:
-if (avctx->extradata) {
-if (avctx->extradata_size >= 28) {
-c->status[0].predictor  = 
av_clip_intp2(AV_RL32(avctx->extradata + 16), 18);
-c->status[0].step_index = av_clip(AV_RL32(avctx->extradata + 
20), 0, 88);
-c->status[1].predictor  = 
av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
-c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 
8), 0, 88);
-} else if (avctx->extradata_size >= 16) {
-c->status[0].predictor  = 
av_clip_intp2(AV_RL32(avctx->extradata +  0), 18);
-c->status[0].step_index = av_clip(AV_RL32(avctx->extradata +  
4), 0, 88);
-c->status[1].predictor  = 
av_clip_intp2(AV_RL32(avctx->extradata +  8), 18);
-c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 
12), 0, 88);
-}
-}
-break;
-case AV_CODEC_ID_ADPCM_IMA_WS:
-if (avctx->extradata && avctx->extradata_size >= 2)
-c->vqa_version = AV_RL16(avctx->extradata);
-break;
 case AV_CODEC_ID_ADPCM_ARGO:
 if (avctx->bits_per_coded_sample != 4 || avctx->block_align != 17 * 
avctx->channels)
 return AVERROR_INVALIDDATA;
@@ -228,6 +202,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
 }
 
+adpcm_flush(avctx);
 return 0;
 }
 
@@ -2110,29 +2085,41 @@ static void adpcm_flush(AVCodecContext *avctx)
 {
 ADPCMDecodeContext *c = avctx->priv_data;
 
+/* Just nuke the entire state and re-init. */
+memset(c, 0, sizeof(ADPCMDecodeContext));
+
 switch(avctx->codec_id) {
-case AV_CODEC_ID_ADPCM_AICA:
-for (int channel = 0; channel < avctx->channels; channel++)
-c->status[channel].step = 0;
+case AV_CODEC_ID_ADPCM_CT:
+c->status[0].step = c->status[1].step = 511;
 break;
 
-case AV_CODEC_ID_ADPCM_ARGO:
-for (int channel = 0; channel < avctx->channels; channel++) {
-c->status[channel].sample1 = 0;
-c->status[channel].sample2 = 0;
+case AV_CODEC_ID_ADPCM_IMA_APC:
+if (avctx->extradata && avctx->extradata_size >= 8) {
+c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata
), 18);
+c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 
4), 18);
 }
 break;
 
-case AV_CODEC_ID_ADPCM_IMA_ALP:
-case AV_CODEC_ID_ADPCM_IMA_CUNNING:
-case AV_CODEC_ID_ADPCM_IMA_SSI:
-case AV_CODEC_ID_ADPCM_ZORK:
-for (int channel = 0; channel < avctx->channels; channel++) {
-c->status[channel].predictor  = 0;
-c->status[channel].step_index = 0;
+case AV_CODEC_ID_ADPCM_IMA_APM:
+if (avctx->extradata) {
+if (avctx->extradata_size >= 28) {
+c->status[0].predictor  = 
av_clip_intp2(AV_RL32(avctx->extradata + 16), 18);
+c->status[0].step_index = av_clip(AV_RL32(avctx->extradata + 
20), 0, 88);
+

[FFmpeg-cvslog] avcodec/adpcm_swf: remove memory allocation during trellis encoding

2021-04-10 Thread Zane van Iperen
ffmpeg | branch: master | Zane van Iperen  | Thu Apr  1 
10:29:19 2021 +1000| [9e89a23eac1d5ab6f20c5c281d224e9218312a0b] | committer: 
Zane van Iperen

avcodec/adpcm_swf: remove memory allocation during trellis encoding

The block size is hardcoded, so the buffer size is always known.
Statically allocate the buffer on the stack.

Signed-off-by: Zane van Iperen 

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

 libavcodec/adpcmenc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 58308dae47..9dc77d519a 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -722,6 +722,9 @@ static int adpcm_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 n = frame->nb_samples - 1;
 
+/* NB: This is safe as we don't have AV_CODEC_CAP_SMALL_LAST_FRAME. */
+av_assert0(n == 4095);
+
 // store AdpcmCodeSize
 put_bits(&pb, 2, 2);// set 4-bit flash adpcm format
 
@@ -735,8 +738,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 }
 
 if (avctx->trellis > 0) {
-if (!(buf = av_malloc(2 * n)))
-return AVERROR(ENOMEM);
+uint8_t buf[8190 /* = 2 * n */];
 adpcm_compress_trellis(avctx, samples + avctx->channels, buf,
&c->status[0], n, avctx->channels);
 if (avctx->channels == 2)
@@ -748,7 +750,6 @@ static int adpcm_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 if (avctx->channels == 2)
 put_bits(&pb, 4, buf[n + i]);
 }
-av_free(buf);
 } else {
 for (i = 1; i < frame->nb_samples; i++) {
 put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0],

___
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] doc/protocols: update rtsp options

2021-04-10 Thread Andriy Gelman
ffmpeg | branch: master | Andriy Gelman  | Sat Apr 10 
16:11:11 2021 -0400| [282682a9fd6c0bcff5f0240bd6b86a2f45ee11b9] | committer: 
Andriy Gelman

doc/protocols: update rtsp options

Define listen_timeout and user_agent. Set timeout and user-agent to deprecated.

Signed-off-by: Andriy Gelman 

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

 doc/protocols.texi | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index d3f6cbefcf..a6e46b99ad 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1165,11 +1165,16 @@ Set minimum local UDP port. Default value is 5000.
 Set maximum local UDP port. Default value is 65000.
 
 @item timeout
-Set maximum timeout (in seconds) to wait for incoming connections.
+This option is deprecated. Use @option{listen_timeout} instead. Set maximum 
timeout (in seconds) to wait for incoming connections.
 
 A value of -1 means infinite (default). This option implies the
 @option{rtsp_flags} set to @samp{listen}.
 
+@item listen_timeout
+Set maximum timeout (in seconds) to establish an initial connection. Setting
+@option{listen_timeout} > 0 sets @option{rtsp_flags} to @samp{listen}. Default 
is -1
+which means an infinite timeout when @samp{listen} mode is set.
+
 @item reorder_queue_size
 Set number of packets to buffer for handling of reordered packets.
 
@@ -1177,6 +1182,10 @@ Set number of packets to buffer for handling of 
reordered packets.
 Set socket TCP I/O timeout in microseconds.
 
 @item user-agent
+This option is deprecated. Use @option{user_agent} instead. Override 
User-Agent header. If not specified, it defaults to the
+libavformat identifier string.
+
+@item user_agent
 Override User-Agent header. If not specified, it defaults to the
 libavformat identifier string.
 @end table

___
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] avfilter/vf_v360: allow user to control fov for equirectagular format

2021-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 11 00:56:44 
2021 +0200| [1050f94c229d4b157467f94de367f87499706c0d] | committer: Paul B Mahol

avfilter/vf_v360: allow user to control fov for equirectagular format

It may be useful to use different values from typical 360/180 deg.

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

 libavfilter/vf_v360.c | 114 +-
 1 file changed, 103 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 94473cd5b3..87105dbe92 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -148,8 +148,8 @@ static const AVOption v360_options[] = {
 { "pitch", "pitch rotation", OFFSET(pitch), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f,TFLAGS, 
"pitch"},
 {  "roll", "roll rotation",   OFFSET(roll), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f,TFLAGS, 
"roll"},
 {"rorder", "rotation order",OFFSET(rorder), 
AV_OPT_TYPE_STRING, {.str="ypr"},   0,   0,TFLAGS, 
"rorder"},
-{ "h_fov", "output horizontal field of view",OFFSET(h_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=90.f}, 0.1f,   360.f,TFLAGS, 
"h_fov"},
-{ "v_fov", "output vertical field of view",  OFFSET(v_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=45.f}, 0.1f,   360.f,TFLAGS, 
"v_fov"},
+{ "h_fov", "output horizontal field of view",OFFSET(h_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"h_fov"},
+{ "v_fov", "output vertical field of view",  OFFSET(v_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"v_fov"},
 { "d_fov", "output diagonal field of view",  OFFSET(d_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"d_fov"},
 {"h_flip", "flip out video horizontally",   OFFSET(h_flip), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1,TFLAGS, 
"h_flip"},
 {"v_flip", "flip out video vertically", OFFSET(v_flip), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1,TFLAGS, 
"v_flip"},
@@ -158,8 +158,8 @@ static const AVOption v360_options[] = {
 {   "iv_flip", "flip in video vertically", OFFSET(iv_flip), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1,TFLAGS, 
"iv_flip"},
 {  "in_trans", "transpose video input",   OFFSET(in_transpose), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1, FLAGS, 
"in_transpose"},
 { "out_trans", "transpose video output", OFFSET(out_transpose), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1, FLAGS, 
"out_transpose"},
-{"ih_fov", "input horizontal field of view",OFFSET(ih_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=90.f}, 0.1f,   360.f,TFLAGS, 
"ih_fov"},
-{"iv_fov", "input vertical field of view",  OFFSET(iv_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=45.f}, 0.1f,   360.f,TFLAGS, 
"iv_fov"},
+{"ih_fov", "input horizontal field of view",OFFSET(ih_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"ih_fov"},
+{"iv_fov", "input vertical field of view",  OFFSET(iv_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"iv_fov"},
 {"id_fov", "input diagonal field of view",  OFFSET(id_fov), 
AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f,   360.f,TFLAGS, 
"id_fov"},
 {"alpha_mask", "build mask in alpha plane",  OFFSET(alpha), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,   1, FLAGS, 
"alpha"},
 { NULL }
@@ -1728,6 +1728,23 @@ static int xyz_to_cube6x1(const V360Context *s,
 return 1;
 }
 
+/**
+ * Prepare data for processing equirectangular output format.
+ *
+ * @param ctx filter context
+ *
+ * @return error code
+ */
+static int prepare_equirect_out(AVFilterContext *ctx)
+{
+V360Context *s = ctx->priv;
+
+s->flat_range[0] = s->h_fov * M_PI / 360.f;
+s->flat_range[1] = s->v_fov * M_PI / 360.f;
+
+return 0;
+}
+
 /**
  * Calculate 3D coordinates on sphere for corresponding frame position in 
equirectangular format.
  *
@@ -1742,8 +1759,8 @@ static int equirect_to_xyz(const V360Context *s,
int i, int j, int width, int height,
float *vec)
 {
-const float phi   = ((2.f * i + 0.5f) / width  - 1.f) * M_PI;
-const float theta = ((2.f * j + 0.5f) / height - 1.f) * M_PI_2;
+const float phi   = ((2.f * i + 0.5f) / width  - 1.f) * s->flat_range[0];
+const float theta = ((2.f * j + 0.5f) / height - 1.f) * s->flat_range[1];
 
 const float sin_phi   = sinf(phi);
 const float cos_phi   = cosf(phi);
@@ -2103,6 +2120,23 @@ static int xyz_to_orthographic(const V360Context *s,
 return visible;
 }

[FFmpeg-cvslog] doc/muxers: add entries for raw muxers

2021-04-10 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Sat Apr 10 16:35:53 
2021 +0530| [47b8871ca6f9da4c0467466a43d204dec7fcbd4a] | committer: Gyan Doshi

doc/muxers: add entries for raw muxers

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

 doc/muxers.texi | 172 
 1 file changed, 172 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 5826d7e986..9c5f0a93a9 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1969,6 +1969,178 @@ ogg files can be safely chained.
 
 @end table
 
+@anchor{raw muxers}
+@section raw muxers
+
+Raw muxers accept a single stream matching the designated codec. They do not 
store timestamps or metadata.
+The recognized extension is the same as the muxer name unless indicated 
otherwise.
+
+@subsection ac3
+
+Dolby Digital, also known as AC-3, audio.
+
+@subsection adx
+
+CRI Middleware ADX audio.
+
+This muxer will write out the total sample count near the start of the first 
packet
+when the output is seekable and the count can be stored in 32 bits.
+
+@subsection aptx
+
+aptX (Audio Processing Technology for Bluetooth) audio.
+
+@subsection aptx_hd
+
+aptX HD (Audio Processing Technology for Bluetooth) audio.
+
+Extensions: aptxhd
+
+@subsection avs2
+
+AVS2-P2/IEEE1857.4 video.
+
+Extensions: avs, avs2
+
+@subsection cavsvideo
+
+Chinese AVS (Audio Video Standard) video.
+
+Extensions: cavs
+
+@subsection codec2raw
+
+Codec 2 audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f codec2raw}.
+
+@subsection data
+
+Data muxer accepts a single stream with any codec of any type.
+The input stream has to be selected using the @code {-map} option with the 
ffmpeg CLI tool.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f data}.
+
+@subsection dirac
+
+BBC Dirac video. The Dirac Pro codec is a subset and is standardized as SMPTE 
VC-2.
+
+Extensions: drc, vc2
+
+@subsection dnxhd
+
+Avid DNxHD video. It is standardized as SMPTE VC-3. Accepts DNxHR streams.
+
+Extensions: dnxhd, dnxhr
+
+@subsection dts
+
+DTS Coherent Acoustics (DCA) audio.
+
+@subsection eac3
+
+Dolby Digital Plus, also known as Enhanced AC-3, audio.
+
+@subsection g722
+
+ITU-T G.722 audio.
+
+@subsection g723_1
+
+ITU-T G.723.1 audio.
+
+Extensions: tco, rco
+
+@subsection g726
+
+ITU-T G.726 big-endian ("left-justified") audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f g726}.
+
+@subsection g726le
+
+ITU-T G.726 little-endian ("right-justified") audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f g726le}.
+
+@subsection gsm
+
+Global System for Mobile Communications audio.
+
+@subsection h261
+
+ITU-T H.261 video.
+
+@subsection h263
+
+ITU-T H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2 video.
+
+@subsection h264
+
+ITU-T H.264 / MPEG-4 Part 10 AVC video. Bitstream shall be converted to Annex 
B syntax if it's in length-prefixed mode.
+
+Extensions: h264, 264
+
+@subsection hevc
+
+ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted to Annex 
B syntax if it's in length-prefixed mode.
+
+Extensions: hevc, h265, 265
+
+@subsection m4v
+
+MPEG-4 Part 2 video.
+
+@subsection mjpeg
+
+Motion JPEG video.
+
+Extensions: mjpg, mjpeg
+
+@subsection mlp
+
+Meridian Lossless Packing, also known as Packed PCM, audio.
+
+@subsection mp2
+
+MPEG-1 Audio Layer II audio.
+
+Extensions: mp2, m2a, mpa
+
+@subsection mpeg1video
+
+MPEG-1 Part 2 video.
+
+Extensions: mpg, mpeg, m1v
+
+@subsection mpeg2video
+
+ITU-T H.262 / MPEG-2 Part 2 video.
+
+Extensions: m2v
+
+@subsection rawvideo
+
+Raw uncompressed video.
+
+Extensions: yuv, rgb
+
+@subsection sbc
+
+Bluetooth SIG low-complexity subband codec audio.
+
+Extensions: sbc, msbc
+
+@subsection truehd
+
+Dolby TrueHD audio.
+
+Extensions: thd
+
+@subsection vc1
+
+SMPTE 421M / VC-1 video.
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 

___
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".