Re: [FFmpeg-devel] [PATCH] vf_thumbnail: support alpha

2019-05-11 Thread Michael Niedermayer
On Sat, May 11, 2019 at 12:19:22PM +0200, Robert Nagy wrote:
> ---
>  libavfilter/vf_thumbnail.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
> index 0effdc91e9..30bb0dfdb8 100644
> --- a/libavfilter/vf_thumbnail.c
> +++ b/libavfilter/vf_thumbnail.c
> @@ -136,6 +136,7 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *frame)
>  AVFilterLink *outlink = ctx->outputs[0];
>  int *hist = s->frames[s->n].histogram;
>  const uint8_t *p = frame->data[0];
> +int stride = frame->format == AV_PIX_FMT_BGRA || frame->format ==
> AV_PIX_FMT_RGBA ? 4 : 3;

Applying: vf_thumbnail: support alpha
error: corrupt patch at line 10
error: could not build fake ancestor
Patch failed at 0001 vf_thumbnail: support alpha
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


signature.asc
Description: PGP signature
___
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] vf_thumbnail: support alpha

2019-05-11 Thread Robert Nagy
---
 libavfilter/vf_thumbnail.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
index 0effdc91e9..30bb0dfdb8 100644
--- a/libavfilter/vf_thumbnail.c
+++ b/libavfilter/vf_thumbnail.c
@@ -136,6 +136,7 @@ static int filter_frame(AVFilterLink *inlink,
AVFrame *frame)
 AVFilterLink *outlink = ctx->outputs[0];
 int *hist = s->frames[s->n].histogram;
 const uint8_t *p = frame->data[0];
+int stride = frame->format == AV_PIX_FMT_BGRA || frame->format ==
AV_PIX_FMT_RGBA ? 4 : 3;

 // keep a reference of each frame
 s->frames[s->n].buf = frame;
@@ -143,9 +144,9 @@ static int filter_frame(AVFilterLink *inlink,
AVFrame *frame)
 // update current frame RGB histogram
 for (j = 0; j < inlink->h; j++) {
 for (i = 0; i < inlink->w; i++) {
-hist[0*256 + p[i*3]]++;
-hist[1*256 + p[i*3 + 1]]++;
-hist[2*256 + p[i*3 + 2]]++;
+hist[0*256 + p[i*stride]]++;
+hist[1*256 + p[i*stride + 1]]++;
+hist[2*256 + p[i*stride + 2]]++;
 }
 p += frame->linesize[0];
 }
@@ -197,6 +198,7 @@ static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat pix_fmts[] = {
 AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
 AV_PIX_FMT_NONE
 };
 AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
-- 
2.19.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".