Re: [FFmpeg-devel] [PATCH 3/3] avfilter/showwaves: add split_channels option.

2014-08-20 Thread Paul B Mahol
On 8/19/14, Clement Boesch u...@pkh.me wrote:
 From: Clement Boesch clem...@stupeflix.com

 ---
  doc/filters.texi|  3 +++
  libavfilter/avf_showwaves.c | 14 ++
  2 files changed, 13 insertions(+), 4 deletions(-)


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


Re: [FFmpeg-devel] [PATCH 3/3] avfilter/showwaves: add split_channels option.

2014-08-20 Thread Stefano Sabatini
On date Tuesday 2014-08-19 14:47:04 +0200, Clément Bœsch encoded:
 From: Clément Bœsch clem...@stupeflix.com
 
 ---
  doc/filters.texi|  3 +++
  libavfilter/avf_showwaves.c | 14 ++
  2 files changed, 13 insertions(+), 4 deletions(-)

LGTM, thanks.

(Please bump micro when pushing).
-- 
FFmpeg = Fostering  Foolish Multipurpose Pitiless Evil Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] avfilter/showwaves: add split_channels option.

2014-08-20 Thread Clément Bœsch
On Wed, Aug 20, 2014 at 11:27:23AM +0200, Paul B Mahol wrote:
 On 8/19/14, Clement Boesch u...@pkh.me wrote:
  From: Clement Boesch clem...@stupeflix.com
 
  ---
   doc/filters.texi|  3 +++
   libavfilter/avf_showwaves.c | 14 ++
   2 files changed, 13 insertions(+), 4 deletions(-)
 
 
 lgtm

Applied with micro bump requested by Stefano.

Thanks

-- 
Clément B.


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


[FFmpeg-devel] [PATCH 3/3] avfilter/showwaves: add split_channels option.

2014-08-19 Thread Clément Bœsch
From: Clément Bœsch clem...@stupeflix.com

---
 doc/filters.texi|  3 +++
 libavfilter/avf_showwaves.c | 14 ++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 828f2b4..7939018 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10830,6 +10830,9 @@ is not explicitly specified.
 Set the (approximate) output frame rate. This is done by setting the
 option @var{n}. Default value is 25.
 
+@item split_channels
+Set if channels should be drawn separately or overlap. Default value is 0.
+
 @end table
 
 @subsection Examples
diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 1389e64..7b6f57b 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -51,6 +51,7 @@ typedef struct {
 int n;
 int sample_count_mod;
 enum ShowWavesMode mode;
+int split_channels;
 void (*draw_sample)(uint8_t *buf, int height, int linesize,
 int16_t sample, int16_t *prev_y, int intensity);
 } ShowWavesContext;
@@ -69,6 +70,7 @@ static const AVOption showwaves_options[] = {
 { n,set how many samples to show in the same point, OFFSET(n), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
 { rate, set video rate, OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = 
25}, 0, 0, FLAGS },
 { r,set video rate, OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = 
25}, 0, 0, FLAGS },
+{ split_channels, draw channels separately, OFFSET(split_channels), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -241,7 +243,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 int nb_channels = inlink-channels;
 int i, j, ret = 0;
 const int n = showwaves-n;
-const int x = 255 / (nb_channels * n); /* multiplication factor, 
pre-computed to avoid in-loop divisions */
+const int x = 255 / ((showwaves-split_channels ? 1 : nb_channels) * n); 
/* multiplication factor, pre-computed to avoid in-loop divisions */
+const int ch_height = showwaves-split_channels ? outlink-h / nb_channels 
: outlink-h;
 
 /* draw data in the buffer */
 for (i = 0; i  nb_samples; i++) {
@@ -260,10 +263,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 for (j = 0; j  outlink-h; j++)
 memset(outpicref-data[0] + j * linesize, 0, outlink-w);
 }
-for (j = 0; j  nb_channels; j++)
-showwaves-draw_sample(outpicref-data[0] + showwaves-buf_idx,
-   outlink-h, linesize, *p++,
+for (j = 0; j  nb_channels; j++) {
+uint8_t *buf = outpicref-data[0] + showwaves-buf_idx;
+if (showwaves-split_channels)
+buf += j*ch_height*linesize;
+showwaves-draw_sample(buf, ch_height, linesize, *p++,
showwaves-buf_idy[j], x);
+}
 
 showwaves-sample_count_mod++;
 if (showwaves-sample_count_mod == n) {
-- 
2.0.4

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