Re: [FFmpeg-devel] [PATCH v7 2/2] fftools/ffmpeg: add exif orientation support per frame's metadata

2019-06-06 Thread Jun Li
On Thu, Jun 6, 2019 at 4:02 AM Michael Niedermayer 
wrote:

> On Tue, Jun 04, 2019 at 06:12:28PM -0700, Jun Li wrote:
> > Fix #6945
> > Rotate or/and flip frame according to frame's metadata orientation
> [..]
>
> > +
> > +return filterst != framest;
> > +}
> > +
> >  static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
> >  {
> >  FilterGraph *fg = ifilter->graph;
> > @@ -2142,7 +2155,8 @@ static int ifilter_send_frame(InputFilter
> *ifilter, AVFrame *frame)
> >  break;
> >  case AVMEDIA_TYPE_VIDEO:
> >  need_reinit |= ifilter->width  != frame->width ||
> > -   ifilter->height != frame->height;
> > +   ifilter->height != frame->height ||
> > +   orientation_need_update(ifilter, frame);
> >  break;
> >  }
> >
> > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> > index 7b6f802082..64278b6ab1 100644
> > --- a/fftools/ffmpeg.h
> > +++ b/fftools/ffmpeg.h
> > @@ -244,7 +244,7 @@ typedef struct InputFilter {
> >  // parameters configured for this input
> >  int format;
> >
> > -int width, height;
> > +int width, height, orientation;
>
> orientation should probably be an enum not an int
>

Agree, thanks for the input. I updated the version
https://patchwork.ffmpeg.org/patch/13446/

Best Regards,
Jun


> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you think the mosad wants you dead since a long time then you are either
> wrong or dead since a long time.
> ___
> 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 v8 2/2] fftools/ffmpeg: add exif orientation support per frame's metadata

2019-06-06 Thread Jun Li
Fix #6945
Rotate or/and flip frame according to frame's metadata orientation
---
 fftools/ffmpeg.c|  5 +++--
 fftools/ffmpeg.h|  8 
 fftools/ffmpeg_filter.c | 36 +++-
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..bc0cece59d 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2141,8 +2141,9 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
ifilter->channel_layout != frame->channel_layout;
 break;
 case AVMEDIA_TYPE_VIDEO:
-need_reinit |= ifilter->width  != frame->width ||
-   ifilter->height != frame->height;
+need_reinit |= ifilter->width   != frame->width ||
+   ifilter->height  != frame->height ||
+   ifilter->orientation != get_frame_orientation(frame);
 break;
 }
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b6f802082..7324813ce3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -232,6 +232,12 @@ typedef struct OptionsContext {
 intnb_enc_time_bases;
 } OptionsContext;
 
+enum OrientationType {
+ORIENTATION_NONE,
+ORIENTATION_AUTO_FLIP,
+ORIENTATION_AUTO_TRANSPOSE
+};
+
 typedef struct InputFilter {
 AVFilterContext*filter;
 struct InputStream *ist;
@@ -245,6 +251,7 @@ typedef struct InputFilter {
 int format;
 
 int width, height;
+enum OrientationType orientation;
 AVRational sample_aspect_ratio;
 
 int sample_rate;
@@ -649,6 +656,7 @@ int init_complex_filtergraph(FilterGraph *fg);
 void sub2video_update(InputStream *ist, AVSubtitle *sub);
 
 int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame);
+enum OrientationType get_frame_orientation(const AVFrame* frame);
 
 int ffmpeg_parse_options(int argc, char **argv);
 
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de1e2..790751f47f 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -743,6 +743,28 @@ static int sub2video_prepare(InputStream *ist, InputFilter 
*ifilter)
 return 0;
 }
 
+enum OrientationType get_frame_orientation(const AVFrame *frame)
+{
+AVDictionaryEntry *entry = NULL;
+int orientation = 0;
+
+// read exif orientation data
+entry = av_dict_get(frame->metadata, "Orientation", NULL, 0);
+if (entry && entry->value)
+orientation = atoi(entry->value);
+
+if (orientation > 8 || orientation < 0) {
+av_log(NULL, AV_LOG_WARNING, "Invalid frame orientation: %i, skip 
it.\n", orientation);
+return ORIENTATION_NONE;
+} else if (orientation <= 1) {
+return ORIENTATION_NONE;
+} else if (orientation <= 4) {
+return ORIENTATION_AUTO_FLIP;
+} else {
+return ORIENTATION_AUTO_TRANSPOSE;
+}
+}
+
 static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
 AVFilterInOut *in)
 {
@@ -809,13 +831,16 @@ static int configure_input_video_filter(FilterGraph *fg, 
InputFilter *ifilter,
 if (ist->autorotate) {
 double theta = get_rotation(ist->st);
 
-if (fabs(theta - 90) < 1.0) {
+if (fabs(theta) < 1.0) { // no rotation info in stream meta
+if (ifilter->orientation == ORIENTATION_AUTO_FLIP) { 
+ret = insert_filter(&last_filter, &pad_idx, "transpose", 
"orientation=auto_flip");
+} else if (ifilter->orientation == ORIENTATION_AUTO_TRANSPOSE) {
+ret = insert_filter(&last_filter, &pad_idx, "transpose", 
"orientation=auto_transpose");
+}
+} else if (fabs(theta - 90) < 1.0) {
 ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock");
 } else if (fabs(theta - 180) < 1.0) {
-ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
-if (ret < 0)
-return ret;
-ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
+ret = insert_filter(&last_filter, &pad_idx, "transpose", 
"orientation=rotate180");
 } else if (fabs(theta - 270) < 1.0) {
 ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock");
 } else if (fabs(theta) > 1.0) {
@@ -1191,6 +1216,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, 
const AVFrame *frame)
 ifilter->width   = frame->width;
 ifilter->height  = frame->height;
 ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
+ifilter->orientation = get_frame_orientation(frame);
 
 ifilter->sample_rate = frame->sample_rate;
 ifilter->channels= frame->channels;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
f

[FFmpeg-devel] [PATCH v8 1/2] lavf/vf_transpose: add exif orientation support

2019-06-06 Thread Jun Li
Add exif orientation support and expose an option.
---
 libavfilter/hflip.h|   2 +
 libavfilter/transpose.h|  14 
 libavfilter/vf_hflip.c |  40 ++---
 libavfilter/vf_transpose.c | 163 -
 4 files changed, 187 insertions(+), 32 deletions(-)

diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h
index 204090dbb4..4e89bae3fc 100644
--- a/libavfilter/hflip.h
+++ b/libavfilter/hflip.h
@@ -35,5 +35,7 @@ typedef struct FlipContext {
 
 int ff_hflip_init(FlipContext *s, int step[4], int nb_planes);
 void ff_hflip_init_x86(FlipContext *s, int step[4], int nb_planes);
+int ff_hflip_config_props(FlipContext* s, AVFilterLink *inlink);
+int ff_hflip_filter_slice(FlipContext *s, AVFrame *in, AVFrame *out, int job, 
int nb_jobs, int vlifp);
 
 #endif /* AVFILTER_HFLIP_H */
diff --git a/libavfilter/transpose.h b/libavfilter/transpose.h
index aa262b9487..5da08bddc0 100644
--- a/libavfilter/transpose.h
+++ b/libavfilter/transpose.h
@@ -34,4 +34,18 @@ enum TransposeDir {
 TRANSPOSE_VFLIP,
 };
 
+enum OrientationType {
+ORIENTATION_AUTO_TRANSPOSE = -2,
+ORIENTATION_AUTO_FLIP = -1,
+ORIENTATION_NONE = 0,
+ORIENTATION_NORMAL,
+ORIENTATION_HFLIP,
+ORIENTATION_ROTATE180,
+ORIENTATION_VFLIP,
+ORIENTATION_HFLIP_ROTATE270CW,
+ORIENTATION_ROTATE90CW,
+ORIENTATION_HFLIP_ROTATE90CW,
+ORIENTATION_ROTATE270CW
+};
+
 #endif
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index b77afc77fc..d24ca5c2e7 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -125,9 +125,8 @@ static void hflip_qword_c(const uint8_t *ssrc, uint8_t 
*ddst, int w)
 dst[j] = src[-j];
 }
 
-static int config_props(AVFilterLink *inlink)
+int ff_hflip_config_props(FlipContext* s, AVFilterLink *inlink)
 {
-FlipContext *s = inlink->dst->priv;
 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
 const int hsub = pix_desc->log2_chroma_w;
 const int vsub = pix_desc->log2_chroma_h;
@@ -144,6 +143,12 @@ static int config_props(AVFilterLink *inlink)
 return ff_hflip_init(s, s->max_step, nb_planes);
 }
 
+static int config_props(AVFilterLink *inlink)
+{
+FlipContext *s = inlink->dst->priv;
+return ff_hflip_config_props(s, inlink);
+}
+
 int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 {
 int i;
@@ -170,14 +175,10 @@ typedef struct ThreadData {
 AVFrame *in, *out;
 } ThreadData;
 
-static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
+int ff_hflip_filter_slice(FlipContext *s, AVFrame *in, AVFrame *out, int job, 
int nb_jobs, int vflip)
 {
-FlipContext *s = ctx->priv;
-ThreadData *td = arg;
-AVFrame *in = td->in;
-AVFrame *out = td->out;
 uint8_t *inrow, *outrow;
-int i, plane, step;
+int i, plane, step, outlinesize;
 
 for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; 
plane++) {
 const int width  = s->planewidth[plane];
@@ -187,19 +188,36 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int job, int nb_jobs)
 
 step = s->max_step[plane];
 
-outrow = out->data[plane] + start * out->linesize[plane];
-inrow  = in ->data[plane] + start * in->linesize[plane] + (width - 1) 
* step;
+if (vflip) {
+outrow = out->data[plane] + (height - start - 1)* 
out->linesize[plane];
+outlinesize = -out->linesize[plane];
+} else {
+outrow = out->data[plane] + start * out->linesize[plane];
+outlinesize = out->linesize[plane];
+}
+
+inrow = in->data[plane] + start * in->linesize[plane] +  (width - 1) * 
step;
+
 for (i = start; i < end; i++) {
 s->flip_line[plane](inrow, outrow, width);
 
 inrow  += in ->linesize[plane];
-outrow += out->linesize[plane];
+outrow += outlinesize;
 }
 }
 
 return 0;
 }
 
+static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
+{
+FlipContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+return ff_hflip_filter_slice(s, in, out, job, nb_jobs, 0);
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx  = inlink->dst;
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index dd54947bd9..d0b5709d1f 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -39,6 +39,7 @@
 #include "internal.h"
 #include "video.h"
 #include "transpose.h"
+#include "hflip.h"
 
 typedef struct TransVtable {
 void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize,
@@ -48,16 +49,22 @@ typedef struct TransVtable {
 int w, int h);
 } TransVtable;
 
-typedef struct TransContext {
-const AVClass *class;
+typedef struct TransContextData {
 int hsub, vsub;
 int planes;
 int pixsteps[4];
+TransVtable vtables[4];
+}

[FFmpeg-devel] [PATCH] cbs_h264: Fix types of abs_diff_pic_num_minus1 and

2019-06-06 Thread Andreas Rheinhardt
difference_of_pic_nums_minus1

They are unsigned values.

Signed-off-by: Andreas Rheinhardt 
---
Sorry for sending the first email prematurely.
 libavcodec/cbs_h264.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
index a31be298ba..b9b9d2d1fd 100644
--- a/libavcodec/cbs_h264.h
+++ b/libavcodec/cbs_h264.h
@@ -379,7 +379,7 @@ typedef struct H264RawSliceHeader {
 uint8_t ref_pic_list_modification_flag_l1;
 struct {
 uint8_t modification_of_pic_nums_idc;
-int32_t abs_diff_pic_num_minus1;
+uint32_t abs_diff_pic_num_minus1;
 uint8_t long_term_pic_num;
 } rplm_l0[H264_MAX_RPLM_COUNT], rplm_l1[H264_MAX_RPLM_COUNT];
 
@@ -406,7 +406,7 @@ typedef struct H264RawSliceHeader {
 uint8_t adaptive_ref_pic_marking_mode_flag;
 struct {
 uint8_t memory_management_control_operation;
-int32_t difference_of_pic_nums_minus1;
+uint32_t difference_of_pic_nums_minus1;
 uint8_t long_term_pic_num;
 uint8_t long_term_frame_idx;
 uint8_t max_long_term_frame_idx_plus1;
-- 
2.21.0

___
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] cbs_h264: Fix type of abs_diff_pic_num_minus1

2019-06-06 Thread Andreas Rheinhardt
It is an unsigned value.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h264.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
index a31be298ba..721379eacc 100644
--- a/libavcodec/cbs_h264.h
+++ b/libavcodec/cbs_h264.h
@@ -379,7 +379,7 @@ typedef struct H264RawSliceHeader {
 uint8_t ref_pic_list_modification_flag_l1;
 struct {
 uint8_t modification_of_pic_nums_idc;
-int32_t abs_diff_pic_num_minus1;
+uint32_t abs_diff_pic_num_minus1;
 uint8_t long_term_pic_num;
 } rplm_l0[H264_MAX_RPLM_COUNT], rplm_l1[H264_MAX_RPLM_COUNT];
 
-- 
2.21.0

___
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] cbs_av1, cbs_jpeg, cbs_mpeg2, cbs_vp9: Fix undef

2019-06-06 Thread Andreas Rheinhardt
READ has already been undefined at this point; it is obviously intended
to undef WRITE.
Furthermore, leb128 (in cbs_av1) was undefined too often and
inconsistently.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_av1.c   | 5 ++---
 libavcodec/cbs_jpeg.c  | 2 +-
 libavcodec/cbs_mpeg2.c | 2 +-
 libavcodec/cbs_vp9.c   | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index eb2d03ef43..eb6b801790 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -648,7 +648,6 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext 
*gbc)
 #undef xf
 #undef xsu
 #undef uvlc
-#undef leb128
 #undef ns
 #undef increment
 #undef subexp
@@ -720,17 +719,17 @@ static size_t 
cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
 
 #include "cbs_av1_syntax_template.c"
 
-#undef READ
+#undef WRITE
 #undef READWRITE
 #undef RWContext
 #undef xf
 #undef xsu
 #undef uvlc
-#undef leb128
 #undef ns
 #undef increment
 #undef subexp
 #undef delta_q
+#undef leb128
 #undef infer
 #undef byte_alignment
 
diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c
index 5a72f0e2e7..83857bbba2 100644
--- a/libavcodec/cbs_jpeg.c
+++ b/libavcodec/cbs_jpeg.c
@@ -75,7 +75,7 @@
 
 #include "cbs_jpeg_syntax_template.c"
 
-#undef READ
+#undef WRITE
 #undef READWRITE
 #undef RWContext
 #undef FUNC
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index ce22e32c15..cb202f835b 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -118,7 +118,7 @@
 
 #include "cbs_mpeg2_syntax_template.c"
 
-#undef READ
+#undef WRITE
 #undef READWRITE
 #undef RWContext
 #undef xui
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
index 0b5f137ed8..5579d9b0af 100644
--- a/libavcodec/cbs_vp9.c
+++ b/libavcodec/cbs_vp9.c
@@ -395,7 +395,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, 
PutBitContext *pbc,
 
 #include "cbs_vp9_syntax_template.c"
 
-#undef READ
+#undef WRITE
 #undef READWRITE
 #undef RWContext
 #undef xf
-- 
2.21.0

___
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] mpeg12enc: Use all Closed Captions side data

2019-06-06 Thread Mathieu Duponchelle
Sorry for pinging again, but at this point I don't know what more I can do to 
get this (necessary)
fix upstream :)

On 5/29/19 3:44 PM, Mathieu Duponchelle wrote:
> As suggested elsewhere, here's the output of git diff -w, I hope that helps :)
>
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
>
> index 2bc5289d63..0162939399 100644
>
> --- a/libavcodec/mpeg12enc.c
>
> +++ b/libavcodec/mpeg12enc.c
>
> @@ -547,8 +547,13 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, 
> int picture_number)
>
>  }
>
>  
>
>  if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->a53_cc) {
>
> -    side_data = av_frame_get_side_data(s->current_picture_ptr->f,
>
> -    AV_FRAME_DATA_A53_CC);
>
> +    int i;
>
> +
>
> +    for (i = 0; i < s->current_picture_ptr->f->nb_side_data; i++) {
>
> +    side_data = s->current_picture_ptr->f->side_data[i];
>
> +    if (side_data->type != AV_FRAME_DATA_A53_CC)
>
> +  continue;
>
> +
>
>  if (side_data) {
>
>  if (side_data->size <= A53_MAX_CC_COUNT * 3 && 
> side_data->size % 3 == 0) {
>
>  int i = 0;
>
> @@ -575,6 +580,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, 
> int picture_number)
>
>  }
>
>  }
>
>  }
>
> +    }
>
>  
>
>  s->mb_y = 0;
>
>  ff_mpeg1_encode_slice_header(s);
>
>
> On 5/13/19 3:39 PM, Carl Eugen Hoyos wrote:
>> Am Mi., 10. Apr. 2019 um 13:26 Uhr schrieb Mathieu Duponchelle
>> :
>>
>>> No problem
>> I don't see an updated patch.
>>
>> Carl Eugen
>> ___
>> 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] libavfilter/vf_find_rect: convert the object image to gray8 format instead of failed directly

2019-06-06 Thread Michael Niedermayer
On Thu, Jun 06, 2019 at 01:54:41PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_find_rect.c | 37 ++---
>  1 file changed, 26 insertions(+), 11 deletions(-)
> 
> diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
> index d7e6579af7..abf7d89d21 100644
> --- a/libavfilter/vf_find_rect.c
> +++ b/libavfilter/vf_find_rect.c
> @@ -28,6 +28,7 @@
>  #include "internal.h"
>  
>  #include "lavfutils.h"
> +#include "lswsutils.h"
>  
>  #define MAX_MIPMAPS 5
>  

> @@ -244,6 +245,7 @@ static av_cold int init(AVFilterContext *ctx)
>  {
>  FOCContext *foc = ctx->priv;
>  int ret, i;

> +AVFrame tmp_frame;

AVFrames size cannot be used outside libavutil as it breaks extensibility


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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

Re: [FFmpeg-devel] [PATCH V3 2/2] checkasm/vf_gblur: add test for horiz_slice simd

2019-06-06 Thread Song, Ruiling
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Michael Niedermayer
> Sent: Thursday, June 6, 2019 6:45 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH V3 2/2] checkasm/vf_gblur: add test for
> horiz_slice simd
> 
> On Wed, Jun 05, 2019 at 10:29:36PM +0800, Ruiling Song wrote:
> > Signed-off-by: Ruiling Song 
> > ---
> >  tests/checkasm/Makefile   |  1 +
> >  tests/checkasm/checkasm.c |  3 ++
> >  tests/checkasm/checkasm.h |  1 +
> >  tests/checkasm/vf_gblur.c | 67
> +++
> >  tests/fate/checkasm.mak   |  1 +
> >  5 files changed, 73 insertions(+)
> >  create mode 100644 tests/checkasm/vf_gblur.c
> 
> this patchset seems to fix the fate failure of the last
Thanks Michael, I will wait a few more days to see if anybody has comment on 
the patch.
Will apply later next week if no objection.

> 
> thanks
> 
> [...]
> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
___
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] mpegts pat and sdt period should respect user options

2019-06-06 Thread Michael Niedermayer
On Wed, Jun 05, 2019 at 11:13:20PM +0200, Tomas Hulata wrote:
> When mux_rate (CBR) is defined, pat/sdt period setting is now respected. In
> case of VBR, leave it as it was.
> 
> ---
>  libavformat/mpegtsenc.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fc0ea225c6..5ad1f813e0 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -999,10 +999,18 @@ static int mpegts_init(AVFormatContext *s)
>  ts->last_sdt_ts = AV_NOPTS_VALUE;

git doesnt like this patch
Applying: mpegts pat and sdt period should respect user options
error: corrupt patch at line 10

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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 1/3] avformat/vpk: Fix integer overflow in samples_per_block computation

2019-06-06 Thread Michael Niedermayer
Fixes: signed integer overflow: 84026453 * 28 cannot be represented in type 
'int'
Fixes: 
15111/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5675630072430592

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/vpk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index 1dfb8fcd70..dcc2db329c 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -56,12 +56,12 @@ static int vpk_read_header(AVFormatContext *s)
 st->codecpar->codec_id= AV_CODEC_ID_ADPCM_PSX;
 st->codecpar->block_align = avio_rl32(s->pb);
 st->codecpar->sample_rate = avio_rl32(s->pb);
-if (st->codecpar->sample_rate <= 0)
+if (st->codecpar->sample_rate <= 0 || st->codecpar->block_align <= 0)
 return AVERROR_INVALIDDATA;
 st->codecpar->channels= avio_rl32(s->pb);
 if (st->codecpar->channels <= 0)
 return AVERROR_INVALIDDATA;
-samples_per_block  = ((st->codecpar->block_align / 
st->codecpar->channels) * 28) / 16;
+samples_per_block  = ((st->codecpar->block_align / 
st->codecpar->channels) * 28LL) / 16;
 if (samples_per_block <= 0)
 return AVERROR_INVALIDDATA;
 vpk->block_count   = (st->duration + (samples_per_block - 1)) / 
samples_per_block;
-- 
2.21.0

___
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/3] avformat/sbgdec: Fixes integer overflow in str_to_time() with hours

2019-06-06 Thread Michael Niedermayer
Fixes: signed integer overflow: 90 * 3600 cannot be represented in type 
'int'
Fixes: 
15113/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5764083346833408

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/sbgdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 67ae39698e..4155395da0 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -197,7 +197,7 @@ static int str_to_time(const char *str, int64_t *rtime)
 if (end > cur + 1)
 cur = end;
 }
-*rtime = (hours * 3600 + minutes * 60 + seconds) * AV_TIME_BASE;
+*rtime = (hours * 3600LL + minutes * 60LL + seconds) * AV_TIME_BASE;
 return cur - str;
 }
 
-- 
2.21.0

___
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] avformat/vpk: Check offset for validity

2019-06-06 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/vpk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index dcc2db329c..255d6030b0 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -66,6 +66,9 @@ static int vpk_read_header(AVFormatContext *s)
 return AVERROR_INVALIDDATA;
 vpk->block_count   = (st->duration + (samples_per_block - 1)) / 
samples_per_block;
 vpk->last_block_size   = (st->duration % samples_per_block) * 16 * 
st->codecpar->channels / 28;
+
+if (offset < avio_tell(s->pb))
+return AVERROR_INVALIDDATA;
 avio_skip(s->pb, offset - avio_tell(s->pb));
 avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 
-- 
2.21.0

___
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] CPIA

2019-06-06 Thread Stephan Hilb
Michael Niedermayer wrote on 27.05.2019 at 00:22:

> [...] maybe just add teh codec id to nut and try to store it in that
> with stream copy if it works it should be possible to playback that
> nit file

I have the file ready, how can I provide it?


pgp12neptaV1q.pgp
Description: OpenPGP digital 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 2/2] fftools/ffmpeg: log skipped initial non-keyframes

2019-06-06 Thread Stephan Hilb
If `AV_PKT_FLAG_KEY` stays unset on `pkt->flags`, the output stream
stays empty with little information about what is going on.
This change makes it easier to debug the situation for the user who
could then choose to use the `-copyinkf` option.
---
 fftools/ffmpeg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..446439e285 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2006,8 +2006,10 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
 }
 
 if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) &&
-!ost->copy_initial_nonkeyframes)
+!ost->copy_initial_nonkeyframes) {
+av_log(NULL, AV_LOG_DEBUG, "skipping initial non-keyframe\n");
 return;
+}
 
 if (!ost->frame_number && !ost->copy_prior_start) {
 int64_t comp_start = start_time;
-- 
2.21.0

___
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/2] avformat/nut: add cpia codec

2019-06-06 Thread Stephan Hilb
---
 libavformat/nut.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/nut.c b/libavformat/nut.c
index 4fbbcb1d26..937f452878 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -43,6 +43,7 @@ const AVCodecTag ff_nut_video_tags[] = {
 { AV_CODEC_ID_XFACE,MKTAG('X', 'F', 'A', 'C') },
 { AV_CODEC_ID_VP9,  MKTAG('V', 'P', '9', '0') },
 { AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
+{ AV_CODEC_ID_CPIA, MKTAG('C', 'P', 'i', 'A') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 16 ) },
-- 
2.21.0

___
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 v7 2/2] fftools/ffmpeg: add exif orientation support per frame's metadata

2019-06-06 Thread Michael Niedermayer
On Tue, Jun 04, 2019 at 06:12:28PM -0700, Jun Li wrote:
> Fix #6945
> Rotate or/and flip frame according to frame's metadata orientation
[..]

> +
> +return filterst != framest;
> +}
> +
>  static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
>  {
>  FilterGraph *fg = ifilter->graph;
> @@ -2142,7 +2155,8 @@ static int ifilter_send_frame(InputFilter *ifilter, 
> AVFrame *frame)
>  break;
>  case AVMEDIA_TYPE_VIDEO:
>  need_reinit |= ifilter->width  != frame->width ||
> -   ifilter->height != frame->height;
> +   ifilter->height != frame->height ||
> +   orientation_need_update(ifilter, frame);
>  break;
>  }
>  
> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> index 7b6f802082..64278b6ab1 100644
> --- a/fftools/ffmpeg.h
> +++ b/fftools/ffmpeg.h
> @@ -244,7 +244,7 @@ typedef struct InputFilter {
>  // parameters configured for this input
>  int format;
>  
> -int width, height;
> +int width, height, orientation;

orientation should probably be an enum not an int

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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

Re: [FFmpeg-devel] [PATCH] avformat/id3v2enc: write CTOC too

2019-06-06 Thread Paul B Mahol
On 6/6/19, Michael Niedermayer  wrote:
> On Thu, Jun 06, 2019 at 09:08:48AM +0200, Paul B Mahol wrote:
>> On 6/5/19, Michael Niedermayer  wrote:
>> > On Tue, Jun 04, 2019 at 04:45:38PM +0200, Paul B Mahol wrote:
>> >> Signed-off-by: Paul B Mahol 
>> >> ---
>> >>  libavformat/id3v2enc.c | 36 
>> >>  1 file changed, 36 insertions(+)
>> >
>> > if this is written in a fate test then it will need an update
>> > (this patch as it is ATM does write it in fate-lavf-fate-mp3)
>> >
>>
>> What are you talking about? No tests need update for fate.
>
> --- ./tests/ref/lavf-fate/mp3 2019-06-04 00:17:28.266942595 +0200
> +++ tests/data/fate/lavf-fate-mp3 2019-06-06 11:01:19.501329747 +0200
> @@ -1,3 +1,3 @@
> -f231c5316357fd747573cbcb02f889c5 *tests/data/lavf-fate/lavf.mp3
> -96016 tests/data/lavf-fate/lavf.mp3
> +4c47e0589cc3a0c415d1def532c7f34d *tests/data/lavf-fate/lavf.mp3
> +96033 tests/data/lavf-fate/lavf.mp3
>  tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe
> Test lavf-fate-mp3 failed. Look at tests/data/fate/lavf-fate-mp3.err for
> details.
> make: *** [fate-lavf-fate-mp3] Error 1
> make: *** Waiting for unfinished jobs
>
>

Thats with this old patch, where ctoc is written even when not needed.

> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> "I am not trying to be anyone's saviour, I'm trying to think about the
>  future and not be sad" - Elon Musk
>
>
___
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/2] checkasm/vf_gblur: add test for horiz_slice simd

2019-06-06 Thread Michael Niedermayer
On Wed, Jun 05, 2019 at 10:29:36PM +0800, Ruiling Song wrote:
> Signed-off-by: Ruiling Song 
> ---
>  tests/checkasm/Makefile   |  1 +
>  tests/checkasm/checkasm.c |  3 ++
>  tests/checkasm/checkasm.h |  1 +
>  tests/checkasm/vf_gblur.c | 67 +++
>  tests/fate/checkasm.mak   |  1 +
>  5 files changed, 73 insertions(+)
>  create mode 100644 tests/checkasm/vf_gblur.c

this patchset seems to fix the fate failure of the last

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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

Re: [FFmpeg-devel] [PATCH] avformat/id3v2enc: write CTOC too

2019-06-06 Thread Michael Niedermayer
On Thu, Jun 06, 2019 at 09:08:48AM +0200, Paul B Mahol wrote:
> On 6/5/19, Michael Niedermayer  wrote:
> > On Tue, Jun 04, 2019 at 04:45:38PM +0200, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol 
> >> ---
> >>  libavformat/id3v2enc.c | 36 
> >>  1 file changed, 36 insertions(+)
> >
> > if this is written in a fate test then it will need an update
> > (this patch as it is ATM does write it in fate-lavf-fate-mp3)
> >
> 
> What are you talking about? No tests need update for fate.

--- ./tests/ref/lavf-fate/mp3   2019-06-04 00:17:28.266942595 +0200
+++ tests/data/fate/lavf-fate-mp3   2019-06-06 11:01:19.501329747 +0200
@@ -1,3 +1,3 @@
-f231c5316357fd747573cbcb02f889c5 *tests/data/lavf-fate/lavf.mp3
-96016 tests/data/lavf-fate/lavf.mp3
+4c47e0589cc3a0c415d1def532c7f34d *tests/data/lavf-fate/lavf.mp3
+96033 tests/data/lavf-fate/lavf.mp3
 tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe
Test lavf-fate-mp3 failed. Look at tests/data/fate/lavf-fate-mp3.err for 
details.
make: *** [fate-lavf-fate-mp3] Error 1
make: *** Waiting for unfinished jobs


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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] libavfilter/vf_cover_rect.c: free the allocated frame

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_cover_rect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index 41cd1a12b9..d63c03215d 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -196,8 +196,10 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
 CoverContext *cover = ctx->priv;
 
-if (cover->cover_frame)
+if (cover->cover_frame) {
 av_freep(&cover->cover_frame->data[0]);
+av_frame_free(&cover->cover_frame);
+}
 }
 
 static av_cold int init(AVFilterContext *ctx)
-- 
2.21.0

___
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 5/6] libavfilter/vf_overlay.c: add the yuv420p10 10bit support

2019-06-06 Thread Lance Wang
On Thu, Jun 6, 2019 at 3:10 PM  wrote:

> From: Limin Wang 
>
> The test ffmpeg command in iMAC system:
> ./ffmpeg -y  -i input.ts -i ./logo.png -filter_complex
> overlay=50:50:format=yuv420p10  -c:v hevc_videotoolbox ./test.ts
> Now I have tested with yuv420p10 overlay and check the result is OK,
> please help to test with your condition.
>
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_overlay.c | 42 +++-
>  libavfilter/vf_overlay.h |  1 +
>  2 files changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
> index 70961befa5..e332a3647e 100644
> --- a/libavfilter/vf_overlay.c
> +++ b/libavfilter/vf_overlay.c
> @@ -153,7 +153,7 @@ static int process_command(AVFilterContext *ctx, const
> char *cmd, const char *ar
>  }
>
>  static const enum AVPixelFormat alpha_pix_fmts[] = {
> -AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
> +AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P,
> AV_PIX_FMT_YUVA444P,
>  AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
>  AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
>  };
> @@ -172,6 +172,14 @@ static int query_formats(AVFilterContext *ctx)
>  AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
>  };
>
> +static const enum AVPixelFormat main_pix_fmts_yuv420p10[] = {
> +AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_YUVA420P10LE,
> +AV_PIX_FMT_NONE
> +};
> +static const enum AVPixelFormat overlay_pix_fmts_yuv420p10[] = {
> +AV_PIX_FMT_YUVA420P10LE, AV_PIX_FMT_NONE
> +};
> +
>  static const enum AVPixelFormat main_pix_fmts_yuv422[] = {
>  AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVA422P,
> AV_PIX_FMT_NONE
>  };
> @@ -217,6 +225,13 @@ static int query_formats(AVFilterContext *ctx)
>  goto fail;
>  }
>  break;
> +case OVERLAY_FORMAT_YUV420P10:
> +if (!(main_formats=
> ff_make_format_list(main_pix_fmts_yuv420p10)) ||
> +!(overlay_formats =
> ff_make_format_list(overlay_pix_fmts_yuv420p10))) {
> +ret = AVERROR(ENOMEM);
> +goto fail;
> +}
> +break;
>  case OVERLAY_FORMAT_YUV422:
>  if (!(main_formats=
> ff_make_format_list(main_pix_fmts_yuv422)) ||
>  !(overlay_formats =
> ff_make_format_list(overlay_pix_fmts_yuv422))) {
> @@ -565,6 +580,7 @@ static av_always_inline void
> blend_plane_##depth##_##nbits##bits(AVFilterContext
>  }
>   \
>  }
>  DEFINE_BLEND_PLANE(8, 8);
> +DEFINE_BLEND_PLANE(16, 10);
>
>  #define DEFINE_ALPHA_COMPOSITE(depth, nbits)
>  \
>  static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame
> *src, const AVFrame *dst, \
> @@ -616,6 +632,7 @@ static inline void
> alpha_composite_##depth##_##nbits##bits(const AVFrame *src, c
>  }
>   \
>  }
>  DEFINE_ALPHA_COMPOSITE(8, 8);
> +DEFINE_ALPHA_COMPOSITE(16, 10);
>
>  #define DEFINE_BLEND_SLICE_YUV(depth, nbits)
>  \
>  static av_always_inline void
> blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx,
>\
> @@ -646,6 +663,7 @@ static av_always_inline void
> blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon
>  alpha_composite_##depth##_##nbits##bits(src, dst, src_w, src_h,
> dst_w, dst_h, x, y, jobnr, nb_jobs);   \
>  }
>  DEFINE_BLEND_SLICE_YUV(8, 8);
> +DEFINE_BLEND_SLICE_YUV(16, 10);
>
>  static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx,
>  AVFrame *dst, const
> AVFrame *src,
> @@ -692,6 +710,21 @@ static int blend_slice_yuva420(AVFilterContext *ctx,
> void *arg, int jobnr, int n
>  return 0;
>  }
>
> +static int blend_slice_yuv420p10(AVFilterContext *ctx, void *arg, int
> jobnr, int nb_jobs)
> +{
> +OverlayContext *s = ctx->priv;
> +ThreadData *td = arg;
> +blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y,
> 1, jobnr, nb_jobs);
> +return 0;
> +}
> +
> +static int blend_slice_yuva420p10(AVFilterContext *ctx, void *arg, int
> jobnr, int nb_jobs)
> +{
> +OverlayContext *s = ctx->priv;
> +ThreadData *td = arg;
> +blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y,
> 1, jobnr, nb_jobs);
> +return 0;
> +}
>  static int blend_slice_yuv422(AVFilterContext *ctx, void *arg, int jobnr,
> int nb_jobs)
>  {
>  OverlayContext *s = ctx->priv;
> @@ -855,6 +888,9 @@ static int config_input_main(AVFilterLink *inlink)
>  case OVERLAY_FORMAT_YUV420:
>  s->blend_slice = s->main_has_alpha ? blend_slice_yuva420 :
> blend_slice_yuv420;
>  break;
> +case OVERLAY_FORMAT_YUV420P10:
> +s->blend_slice = s->main_has_alpha ? blend_slice_yuva420p10 :
> blend_slice_yuv420p10;

Re: [FFmpeg-devel] [PATCH v2] libavcodec/vp8dec: fix the multi-thread HWAccel decode error

2019-06-06 Thread Wang, Shaofei
> -Original Message-
> From: Xiang, Haihao
> Sent: Thursday, June 6, 2019 11:57 AM
> To: ffmpeg-devel@ffmpeg.org; Wang, Shaofei 
> Subject: Re: [FFmpeg-devel] [PATCH v2] libavcodec/vp8dec: fix the
> multi-thread HWAccel decode error
> 
> On Tue, 2019-06-04 at 15:21 +0800, Wang, Shaofei wrote:
> > > -Original Message-
> > > From: Xiang, Haihao
> > > Sent: Tuesday, May 28, 2019 12:23 PM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Cc: Wang, Shaofei 
> > > Subject: Re: [FFmpeg-devel] [PATCH v2] libavcodec/vp8dec: fix the
> > > multi-thread HWAccel decode error
> > >
> > > On Thu, 2019-03-28 at 13:28 -0400, Shaofei Wang wrote:
> > > > Fix the issue: https://github.com/intel/media-driver/issues/317
> > > >
> > > > the root cause is update_dimensions will be called multple times
> > > > when decoder thread number is not only 1, but update_dimensions
> > > > call get_pixel_format in each decode thread will trigger the
> > > > hwaccel_uninit/hwaccel_init more than once. But only one hwaccel
> > > > should be shared with all decode threads.
> > > > in current context,
> > > > there are 3 situations in the update_dimensions():
> > > > 1. First time calling. No matter single thread or multithread,
> > > >get_pixel_format() should be called after dimensions were
> > > >set;
> > > > 2. Dimention changed at the runtime. Dimention need to be
> > > >updated when macroblocks_base is already allocated,
> > > >get_pixel_format() should be called to recreate new frames
> > > >according to updated dimention;
> > >
> > > s/Dimention/dimension ?
> >
> > OK, should be dimension
> >
> > > BTW this version of patch doesn't address the concern provided when
> > > reviewing the first version of patch.
> > >
> > > When (width != s->avctx->width || height != s->avctx->height) is
> > > true,
> > > ff_set_dimensions() is called even if s->macroblocks_base is not
> > > allocated, so why set dim_reset to (s->macroblocks_base != NULL)? I
> > > think dim_reset should be set to 1.
> >
> > If s->macroblocks_base is available, it means macroblocks_base of the
> > context  has been already allocated by one of threads, so it's a reset
> > operation when  (width != s->avctx->width...
> > If s->macroblocks_base is null, it's not allocated yet, and (width !=
> > s->avctx->width..., just dimension need to be updated but it's not a
> > dim reset operation. Since we only call get_pixel_format() in the
> > first thread or  in the reset operation
> 
> Is it reasonable when dimension is updated however the low level frame still
> use stale dimension info?
> 
> Thanks
> Haihao

The low level frame, especially hw frame will just need to be updated once.
For example, the init phase of the first thread will call update_dimension and
init hwaccel by get_pixel_format, but not needed to update low level frame for
the follow-up threads.
___
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 v3 2/6] libavfilter/vf_overlay.c: Add "\" for the following macro style function

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 358 +++
 1 file changed, 179 insertions(+), 179 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index b468cedf2e..ba8147f579 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -441,189 +441,189 @@ static av_always_inline void 
blend_slice_packed_rgb(AVFilterContext *ctx,
 }
 }
 
-static av_always_inline void blend_plane(AVFilterContext *ctx,
- AVFrame *dst, const AVFrame *src,
- int src_w, int src_h,
- int dst_w, int dst_h,
- int i, int hsub, int vsub,
- int x, int y,
- int main_has_alpha,
- int dst_plane,
- int dst_offset,
- int dst_step,
- int straight,
- int yuv,
- int jobnr,
- int nb_jobs)
-{
-OverlayContext *octx = ctx->priv;
-int src_wp = AV_CEIL_RSHIFT(src_w, hsub);
-int src_hp = AV_CEIL_RSHIFT(src_h, vsub);
-int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub);
-int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub);
-int yp = y>>vsub;
-int xp = x>>hsub;
-uint8_t *s, *sp, *d, *dp, *dap, *a, *da, *ap;
-int jmax, j, k, kmax;
-int slice_start, slice_end;
-
-j = FFMAX(-yp, 0);
-jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp);
-
-slice_start = j + (jmax * jobnr) / nb_jobs;
-slice_end = j + (jmax * (jobnr+1)) / nb_jobs;
-
-sp = src->data[i] + (slice_start) * src->linesize[i];
-dp = dst->data[dst_plane]
-  + (yp + slice_start) * dst->linesize[dst_plane]
-  + dst_offset;
-ap = src->data[3] + (slice_start << vsub) * src->linesize[3];
-dap = dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3];
-
-for (j = slice_start; j < slice_end; j++) {
-k = FFMAX(-xp, 0);
-d = dp + (xp+k) * dst_step;
-s = sp + k;
-a = ap + (kblend_row[i](d, da, s, a, kmax - k, 
src->linesize[3]);
-
-s += c;
-d += dst_step * c;
-da += (1 << hsub) * c;
-a += (1 << hsub) * c;
-k += c;
-}
-for (; k < kmax; k++) {
-int alpha_v, alpha_h, alpha;
-
-/* average alpha for color components, improve quality */
-if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) {
-alpha = (a[0] + a[src->linesize[3]] +
- a[1] + a[src->linesize[3]+1]) >> 2;
-} else if (hsub || vsub) {
-alpha_h = hsub && k+1 < src_wp ?
-(a[0] + a[1]) >> 1 : a[0];
-alpha_v = vsub && j+1 < src_hp ?
-(a[0] + a[src->linesize[3]]) >> 1 : a[0];
-alpha = (alpha_v + alpha_h) >> 1;
-} else
-alpha = a[0];
-/* if the main channel has an alpha channel, alpha has to be 
calculated */
-/* to create an un-premultiplied (straight) alpha value */
-if (main_has_alpha && alpha != 0 && alpha != 255) {
-/* average alpha for color components, improve quality */
-uint8_t alpha_d;
-if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) {
-alpha_d = (da[0] + da[dst->linesize[3]] +
-   da[1] + da[dst->linesize[3]+1]) >> 2;
-} else if (hsub || vsub) {
-alpha_h = hsub && k+1 < src_wp ?
-(da[0] + da[1]) >> 1 : da[0];
-alpha_v = vsub && j+1 < src_hp ?
-(da[0] + da[dst->linesize[3]]) >> 1 : da[0];
-alpha_d = (alpha_v + alpha_h) >> 1;
-} else
-alpha_d = da[0];
-alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
-}
-if (straight) {
-*d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);
-} else {
-if (i && yuv)
-*d = av_clip(FAST_DIV255((*d - 128) * (255 - alpha)) + *s 
- 128, -128, 128) + 128;
-else
-*d = FFMIN(FAST_DIV255(*d * (255 - alpha)) + *s, 255);
-}
-s++;
-d += dst_step;
-da += 1 << hsub;
-a += 1 << hsub;
-}
-dp += dst->linesize[dst_plane];
-sp += src->linesize[i];
-ap += (1 << vsub) * src->linesize[3];
-dap += (1 << vsub) * dst->linesize[3];
-}
+static av_al

Re: [FFmpeg-devel] [PATCH] avformat/id3v2enc: write CTOC too

2019-06-06 Thread Paul B Mahol
On 6/5/19, Michael Niedermayer  wrote:
> On Tue, Jun 04, 2019 at 04:45:38PM +0200, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavformat/id3v2enc.c | 36 
>>  1 file changed, 36 insertions(+)
>
> if this is written in a fate test then it will need an update
> (this patch as it is ATM does write it in fate-lavf-fate-mp3)
>

What are you talking about? No tests need update for fate.

> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
>
___
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 v3 6/6] doc/filters.texi: add overlay yuv420p10 format

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/filters.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 5db8e0302f..b0e951c9f9 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13159,6 +13159,9 @@ It accepts the following values:
 @item yuv420
 force YUV420 output
 
+@item yuv420p10
+force YUV420p10 output
+
 @item yuv422
 force YUV422 output
 
-- 
2.21.0

___
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 v3 4/6] libavfilter/vf_overlay.c: using the nbits and depth for 8bits and 10bit support

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 79 
 1 file changed, 47 insertions(+), 32 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index ee51a54659..70961befa5 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -464,22 +464,26 @@ static av_always_inline void 
blend_plane_##depth##_##nbits##bits(AVFilterContext
 int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub);  
\
 int yp = y>>vsub;  
\
 int xp = x>>hsub;  
\
-uint8_t *s, *sp, *d, *dp, *dap, *a, *da, *ap;  
\
+uint##depth##_t *s, *sp, *d, *dp, *dap, *a, *da, *ap;  
\
 int jmax, j, k, kmax;  
\
 int slice_start, slice_end;
\
+const uint##depth##_t max = (1 << nbits) - 1;  
\
+const uint##depth##_t mid = (1 << (nbits -1)) ;
\
+int bytes = depth / 8; 
\

\
+dst_step /= bytes; 
\
 j = FFMAX(-yp, 0); 
\
 jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp);   
\

\
 slice_start = j + (jmax * jobnr) / nb_jobs;
\
 slice_end = j + (jmax * (jobnr+1)) / nb_jobs;  
\

\
-sp = src->data[i] + (slice_start) * src->linesize[i];  
\
-dp = dst->data[dst_plane]  
\
+sp = (uint##depth##_t *)(src->data[i] + (slice_start) * src->linesize[i]); 
\
+dp = (uint##depth##_t *)(dst->data[dst_plane]  
\
   + (yp + slice_start) * dst->linesize[dst_plane]  
\
-  + dst_offset;
\
-ap = src->data[3] + (slice_start << vsub) * src->linesize[3];  
\
-dap = dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3];  
\
+  + dst_offset);   
\
+ap = (uint##depth##_t *)(src->data[3] + (slice_start << vsub) * 
src->linesize[3]); \
+dap = (uint##depth##_t *)(dst->data[3] + ((yp + slice_start) << vsub) * 
dst->linesize[3]); \

\
 for (j = slice_start; j < slice_end; j++) {
\
 k = FFMAX(-xp, 0); 
\
@@ -489,8 +493,8 @@ static av_always_inline void 
blend_plane_##depth##_##nbits##bits(AVFilterContext
 da = dap + ((xp+k) << hsub);   
\
 kmax = FFMIN(-xp + dst_wp, src_wp);
\

\
-if (((vsub && j+1 < src_hp) || !vsub) && octx->blend_row[i]) { 
\
-int c = octx->b

[FFmpeg-devel] [PATCH v3 5/6] libavfilter/vf_overlay.c: add the yuv420p10 10bit support

2019-06-06 Thread lance . lmwang
From: Limin Wang 

The test ffmpeg command in iMAC system:
./ffmpeg -y  -i input.ts -i ./logo.png -filter_complex 
overlay=50:50:format=yuv420p10  -c:v hevc_videotoolbox ./test.ts
Now I have tested with yuv420p10 overlay and check the result is OK, please 
help to test with your condition.

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 42 +++-
 libavfilter/vf_overlay.h |  1 +
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 70961befa5..e332a3647e 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -153,7 +153,7 @@ static int process_command(AVFilterContext *ctx, const char 
*cmd, const char *ar
 }
 
 static const enum AVPixelFormat alpha_pix_fmts[] = {
-AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
+AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P, 
AV_PIX_FMT_YUVA444P,
 AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
 AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
 };
@@ -172,6 +172,14 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
 };
 
+static const enum AVPixelFormat main_pix_fmts_yuv420p10[] = {
+AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_YUVA420P10LE,
+AV_PIX_FMT_NONE
+};
+static const enum AVPixelFormat overlay_pix_fmts_yuv420p10[] = {
+AV_PIX_FMT_YUVA420P10LE, AV_PIX_FMT_NONE
+};
+
 static const enum AVPixelFormat main_pix_fmts_yuv422[] = {
 AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVA422P, 
AV_PIX_FMT_NONE
 };
@@ -217,6 +225,13 @@ static int query_formats(AVFilterContext *ctx)
 goto fail;
 }
 break;
+case OVERLAY_FORMAT_YUV420P10:
+if (!(main_formats= ff_make_format_list(main_pix_fmts_yuv420p10)) 
||
+!(overlay_formats = 
ff_make_format_list(overlay_pix_fmts_yuv420p10))) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+break;
 case OVERLAY_FORMAT_YUV422:
 if (!(main_formats= ff_make_format_list(main_pix_fmts_yuv422)) ||
 !(overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv422))) 
{
@@ -565,6 +580,7 @@ static av_always_inline void 
blend_plane_##depth##_##nbits##bits(AVFilterContext
 }  
\
 }
 DEFINE_BLEND_PLANE(8, 8);
+DEFINE_BLEND_PLANE(16, 10);
 
 #define DEFINE_ALPHA_COMPOSITE(depth, nbits)   
\
 static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, 
const AVFrame *dst, \
@@ -616,6 +632,7 @@ static inline void 
alpha_composite_##depth##_##nbits##bits(const AVFrame *src, c
 }  
\
 }
 DEFINE_ALPHA_COMPOSITE(8, 8);
+DEFINE_ALPHA_COMPOSITE(16, 10);
 
 #define DEFINE_BLEND_SLICE_YUV(depth, nbits)   
\
 static av_always_inline void 
blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx,   
  \
@@ -646,6 +663,7 @@ static av_always_inline void 
blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon
 alpha_composite_##depth##_##nbits##bits(src, dst, src_w, src_h, dst_w, 
dst_h, x, y, jobnr, nb_jobs);   \
 }
 DEFINE_BLEND_SLICE_YUV(8, 8);
+DEFINE_BLEND_SLICE_YUV(16, 10);
 
 static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx,
 AVFrame *dst, const 
AVFrame *src,
@@ -692,6 +710,21 @@ static int blend_slice_yuva420(AVFilterContext *ctx, void 
*arg, int jobnr, int n
 return 0;
 }
 
+static int blend_slice_yuv420p10(AVFilterContext *ctx, void *arg, int jobnr, 
int nb_jobs)
+{
+OverlayContext *s = ctx->priv;
+ThreadData *td = arg;
+blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 1, 
jobnr, nb_jobs);
+return 0;
+}
+
+static int blend_slice_yuva420p10(AVFilterContext *ctx, void *arg, int jobnr, 
int nb_jobs)
+{
+OverlayContext *s = ctx->priv;
+ThreadData *td = arg;
+blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 1, 
jobnr, nb_jobs);
+return 0;
+}
 static int blend_slice_yuv422(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
 {
 OverlayContext *s = ctx->priv;
@@ -855,6 +888,9 @@ static int config_input_main(AVFilterLink *inlink)
 case OVERLAY_FORMAT_YUV420:
 s->blend_slice = s->main_has_alpha ? blend_slice_yuva420 : 
blend_slice_yuv420;
 break;
+case OVERLAY_FORMAT_YUV420P10:
+s->blend_slice = s->main_has_alpha ? blend_slice_yuva420p10 : 
blend_slice_yuv420p10;
+break;
 case OVERLAY_FORMAT_YUV422:
 s->b

[FFmpeg-devel] [PATCH v3 3/6] libavfilter/vf_overlay.c: define the macro-style function to support 8bit and 10bit blend, keep the 8bit function same now

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 52 ++--
 1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index ba8147f579..ee51a54659 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -441,7 +441,8 @@ static av_always_inline void 
blend_slice_packed_rgb(AVFilterContext *ctx,
 }
 }
 
-static av_always_inline void blend_plane(AVFilterContext *ctx, 
\
+#define DEFINE_BLEND_PLANE(depth, nbits)   
\
+static av_always_inline void 
blend_plane_##depth##_##nbits##bits(AVFilterContext *ctx,   
  \
  AVFrame *dst, const AVFrame *src, 
\
  int src_w, int src_h, 
\
  int dst_w, int dst_h, 
\
@@ -549,8 +550,10 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
 dap += (1 << vsub) * dst->linesize[3]; 
\
 }  
\
 }
+DEFINE_BLEND_PLANE(8, 8);
 
-static inline void alpha_composite(const AVFrame *src, const AVFrame *dst, 
\
+#define DEFINE_ALPHA_COMPOSITE(depth, nbits)   
\
+static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, 
const AVFrame *dst, \
int src_w, int src_h,   
\
int dst_w, int dst_h,   
\
int x, int y,   
\
@@ -597,8 +600,10 @@ static inline void alpha_composite(const AVFrame *src, 
const AVFrame *dst,
 sa += src->linesize[3];
\
 }  
\
 }
+DEFINE_ALPHA_COMPOSITE(8, 8);
 
-static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, 
\
+#define DEFINE_BLEND_SLICE_YUV(depth, nbits)   
\
+static av_always_inline void 
blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx,   
  \
  AVFrame *dst, const AVFrame *src, 
\
  int hsub, int vsub,   
\
  int main_has_alpha,   
\
@@ -612,19 +617,20 @@ static av_always_inline void 
blend_slice_yuv(AVFilterContext *ctx,
 const int dst_w = dst->width;  
\
 const int dst_h = dst->height; 
\

\
-blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0,   0, x, 
y, main_has_alpha,\
+blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, 
dst_h, 0, 0,   0, x, y, main_has_alpha,\
 s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, 
s->main_desc->comp[0].step, is_straight, 1, \
 jobnr, nb_jobs);   
\
-blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, 
y, main_has_alpha,\
+blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, 
dst_h, 1, hsub, vsub, x, y, main_has_alpha,\
 s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, 
s->main_desc->comp[1].step, is_straight, 1, \
 jobnr, nb_jobs);   
\
-blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, 
y, main_has_alpha,\
+blend_plane_##depth##_##nb

[FFmpeg-devel] [PATCH v3 1/6] libavfilter/vf_overlay.c: change the comment style for the following macro defined function

2019-06-06 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 0a8f089c0d..b468cedf2e 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -500,7 +500,7 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
 for (; k < kmax; k++) {
 int alpha_v, alpha_h, alpha;
 
-// average alpha for color components, improve quality
+/* average alpha for color components, improve quality */
 if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) {
 alpha = (a[0] + a[src->linesize[3]] +
  a[1] + a[src->linesize[3]+1]) >> 2;
@@ -512,10 +512,10 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
 alpha = (alpha_v + alpha_h) >> 1;
 } else
 alpha = a[0];
-// if the main channel has an alpha channel, alpha has to be 
calculated
-// to create an un-premultiplied (straight) alpha value
+/* if the main channel has an alpha channel, alpha has to be 
calculated */
+/* to create an un-premultiplied (straight) alpha value */
 if (main_has_alpha && alpha != 0 && alpha != 255) {
-// average alpha for color components, improve quality
+/* average alpha for color components, improve quality */
 uint8_t alpha_d;
 if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) {
 alpha_d = (da[0] + da[dst->linesize[3]] +
@@ -556,7 +556,7 @@ static inline void alpha_composite(const AVFrame *src, 
const AVFrame *dst,
int x, int y,
int jobnr, int nb_jobs)
 {
-uint8_t alpha;  ///< the amount of overlay to blend on to main
+uint8_t alpha;  /* the amount of overlay to blend on to main */
 uint8_t *s, *sa, *d, *da;
 int i, imax, j, jmax;
 int slice_start, slice_end;
@@ -587,7 +587,7 @@ static inline void alpha_composite(const AVFrame *src, 
const AVFrame *dst,
 *d = *s;
 break;
 default:
-// apply alpha compositing: main_alpha += (1-main_alpha) * 
overlay_alpha
+/* apply alpha compositing: main_alpha += (1-main_alpha) * 
overlay_alpha */
 *d += FAST_DIV255((255 - *d) * *s);
 }
 d += 1;
-- 
2.21.0

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