Re: [FFmpeg-devel] [PATCH 2/2] avcodec/vc1_block: Fix invalid shifts in vc1_decode_i_blocks()

2019-06-29 Thread Michael Niedermayer
On Thu, Jun 27, 2019 at 12:40:58AM +0200, Michael Niedermayer wrote:
> On Sat, Jun 22, 2019 at 04:55:47PM +0200, Paul B Mahol wrote:
> > On 6/22/19, Michael Niedermayer  wrote:
> > > Fixes: left shift of negative value -9
> > > Fixes:
> > > 15299/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSS2_fuzzer-5660922678345728
> > >
> > > Found-by: continuous fuzzing process
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/vc1_block.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
> > > index 7e41791832..6137252580 100644
> > > --- a/libavcodec/vc1_block.c
> > > +++ b/libavcodec/vc1_block.c
> > > @@ -2600,13 +2600,13 @@ static void vc1_decode_i_blocks(VC1Context *v)
> > >  if (v->rangeredfrm)
> > >  for (k = 0; k < 6; k++)
> > >  for (j = 0; j < 64; j++)
> > > -v->block[v->cur_blk_idx][block_map[k]][j] <<=
> > > 1;
> > > +v->block[v->cur_blk_idx][block_map[k]][j] *= 
> > > 2;
> > >  vc1_put_blocks_clamped(v, 1);
> > >  } else {
> > >  if (v->rangeredfrm)
> > >  for (k = 0; k < 6; k++)
> > >  for (j = 0; j < 64; j++)
> > > -v->block[v->cur_blk_idx][block_map[k]][j] =
> > > (v->block[v->cur_blk_idx][block_map[k]][j] - 64) << 1;
> > > +v->block[v->cur_blk_idx][block_map[k]][j] =
> > > (v->block[v->cur_blk_idx][block_map[k]][j] - 64) * 2;
> > >  vc1_put_blocks_clamped(v, 0);
> > >  }
> > >
> > > --
> > > 2.22.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".
> > 
> > 
> > This is much slower.
> 
> please provide your testcase and benchmarks or disassmbly

Noone ?
people just claim "This is much slower." without having tested it ?

ok heres the disassmbly of the 2 inner loops from the code with the patch 
applied
(that is with the multiplications in the source tested with gcc (4.8.5)
as you can see all multiplications are optimized to shifts or additions
even the old gcc used optmizes it to a shift


.p2align 4,,10
.p2align 3
.L1034:
salw(%rax)
addq$2, %rax
cmpq%rdx, %rax
jne .L1034
...
.p2align 4,,10
.p2align 3
.L1039:
movswl  (%rax), %edx
addq$2, %rax
leal-128(%rdx,%rdx), %edx
movw%dx, -2(%rax)
cmpq%rcx, %rax
jne .L1039


before the patch it looked like this: 

.p2align 4,,10
.p2align 3
.L1034:
salw(%rax)
addq$2, %rax
cmpq%rdx, %rax
jne .L1034  
...
.p2align 4,,10
.p2align 3
.L1039:
movswl  (%rax), %edx
addq$2, %rax
leal-128(%rdx,%rdx), %edx
movw%dx, -2(%rax)
cmpq%rcx, %rax
jne .L1039

I used this patch for testing and finding the parts of the code:
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -2579,16 +2579,20 @@ static void vc1_decode_i_blocks(VC1Context *v)
 
 if (v->overlap && v->pq >= 9) {
 ff_vc1_i_overlap_filter(v);
+__asm volatile ("MARKA\n\t");
 if (v->rangeredfrm)
 for (k = 0; k < 6; k++)
 for (j = 0; j < 64; j++)
-v->block[v->cur_blk_idx][block_map[k]][j] *= 2;
+v->block[v->cur_blk_idx][block_map[k]][j] <<= 1;
+__asm volatile ("MARKB\n\t");
 vc1_put_blocks_clamped(v, 1);
 } else {
+__asm volatile ("MARKC\n\t");
 if (v->rangeredfrm)
 for (k = 0; k < 6; k++)
 for (j = 0; j < 64; j++)
-v->block[v->cur_blk_idx][block_map[k]][j] = 
(v->block[v->cur_blk_idx][block_map[k]][j] - 64) * 2;
+v->block[v->cur_blk_idx][block_map[k]][j] = 
(v->block[v->cur_blk_idx][block_map[k]][j] - 64) << 1;
+__asm volatile ("MARKD\n\t");
 vc1_put_blocks_clamped(v, 0);
 }
 

[...]

-- 
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] [PATCH 2/2] avformat/rpl: Calculate the duration of the video track

2019-06-29 Thread Cameron Cawley
---
 libavformat/rpl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 579ab4f57e..d31c7f09ad 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -280,8 +280,10 @@ static int rpl_read_header(AVFormatContext *s)
 read_line_and_int(pb, );   //   (file index)
 error |= read_line(pb, line, sizeof(line));  // offset to "helpful" sprite
 error |= read_line(pb, line, sizeof(line));  // size of "helpful" sprite
-if (vst)
+if (vst) {
 error |= read_line(pb, line, sizeof(line));  // offset to key frame 
list
+vst->duration = number_of_chunks * rpl->frames_per_chunk;
+}
 
 // Read the index
 avio_seek(pb, chunk_catalog_offset, SEEK_SET);
-- 
2.11.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/rpl: Replace strcpy with av_strlcpy

2019-06-29 Thread Cameron Cawley
---
 libavformat/rpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index b4859320f4..579ab4f57e 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -192,7 +192,7 @@ static int rpl_read_header(AVFormatContext *s)
 // samples, though. This code will ignore additional tracks.
 error |= read_line(pb, line, sizeof(line));
 audio_format = read_int(line, , );  // audio format ID
-strcpy(audio_codec, endptr);
+av_strlcpy(audio_codec, endptr, RPL_LINE_LENGTH);
 if (audio_format) {
 ast = avformat_new_stream(s, NULL);
 if (!ast)
@@ -203,7 +203,7 @@ static int rpl_read_header(AVFormatContext *s)
 ast->codecpar->channels= read_line_and_int(pb, );  // 
number of audio channels
 error |= read_line(pb, line, sizeof(line));
 ast->codecpar->bits_per_coded_sample = read_int(line, , 
);  // audio bits per sample
-strcpy(audio_type, endptr);
+av_strlcpy(audio_type, endptr, RPL_LINE_LENGTH);
 // At least one sample uses 0 for ADPCM, which is really 4 bits
 // per sample.
 if (ast->codecpar->bits_per_coded_sample == 0)
-- 
2.11.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] ffmpeg: Integrate two checks

2019-06-29 Thread Andreas Rheinhardt
For audio packets with dts != AV_NOPTS_VALUE the dts the dts was
converted twice to the muxer's timebase during streamcopy, once as a
normal packet and once specifically as an audio packet. This has been
changed.

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..755bc05bc1 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2044,20 +2044,18 @@ static void do_streamcopy(InputStream *ist, 
OutputStream *ost, const AVPacket *p
 else
 opkt.pts = AV_NOPTS_VALUE;
 
-if (pkt->dts == AV_NOPTS_VALUE)
+if (pkt->dts == AV_NOPTS_VALUE) {
 opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase);
-else
-opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
ost->mux_timebase);
-opkt.dts -= ost_tb_start_time;
-
-if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != 
AV_NOPTS_VALUE) {
+} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 int duration = av_get_audio_frame_duration(ist->dec_ctx, pkt->size);
 if(!duration)
 duration = ist->dec_ctx->frame_size;
 opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts,
-   (AVRational){1, 
ist->dec_ctx->sample_rate}, duration, >filter_in_rescale_delta_last,
-   ost->mux_timebase) - 
ost_tb_start_time;
-}
+   (AVRational){1, 
ist->dec_ctx->sample_rate}, duration,
+   
>filter_in_rescale_delta_last, ost->mux_timebase);
+} else
+opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
ost->mux_timebase);
+opkt.dts -= ost_tb_start_time;
 
 opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, 
ost->mux_timebase);
 
-- 
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] avcodec/hq_hqa: Use ff_set_dimensions()

2019-06-29 Thread Michael Niedermayer
Fixes: 
15530/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5637370344374272
Fixes: signed integer overflow: 65312 * 65312 cannot be represented in type 
'int'

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

diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index 90bafdc72a..eec2e980b3 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -254,10 +254,12 @@ static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, 
size_t data_size)
 width  = bytestream2_get_be16(>gbc);
 height = bytestream2_get_be16(>gbc);
 
+ret = ff_set_dimensions(ctx->avctx, width, height);
+if (ret < 0)
+return ret;
+
 ctx->avctx->coded_width = FFALIGN(width,  16);
 ctx->avctx->coded_height= FFALIGN(height, 16);
-ctx->avctx->width   = width;
-ctx->avctx->height  = height;
 ctx->avctx->bits_per_raw_sample = 8;
 ctx->avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
 
-- 
2.22.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/2] avformat/utils: Check timebase before use in estimate_timings()

2019-06-29 Thread Michael Niedermayer
Fixes: division by 0
Fixes: 
15480/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5746727434321920

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3d764c18d6..28583a55ef 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2953,6 +2953,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t 
old_offset)
 AVStream av_unused *st;
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
+if (st->time_base.den)
 av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %0.3f duration: 
%0.3f\n", i,
(double) st->start_time * av_q2d(st->time_base),
(double) st->duration   * av_q2d(st->time_base));
-- 
2.22.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 v11 2/2] fftools/ffmpeg: add exif orientation support per frame's metadata

2019-06-29 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 | 40 +++-
 3 files changed, 46 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..eebb624116 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -743,6 +743,32 @@ 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);
+
+// exif defines orientation in range [1, 8]
+if (orientation > 8 || orientation < 1) {
+if (entry && entry->value) {
+av_log(NULL, AV_LOG_WARNING,
+"Invalid frame orientation: %s, skip it.\n", entry->value);
+}
+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 +835,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(_filter, _idx, "transpose", 
"orientation=auto_flip");
+} else if (ifilter->orientation == ORIENTATION_AUTO_TRANSPOSE) {
+ret = insert_filter(_filter, _idx, "transpose", 
"orientation=auto_transpose");
+}
+} else if (fabs(theta - 90) < 1.0) {
 ret = insert_filter(_filter, _idx, "transpose", "clock");
 } else if (fabs(theta - 180) < 1.0) {
-ret = insert_filter(_filter, _idx, "hflip", NULL);
-if (ret < 0)
-return ret;
-ret = insert_filter(_filter, _idx, "vflip", NULL);
+ret = insert_filter(_filter, _idx, "transpose", 
"orientation=rotate180");
 } else if (fabs(theta - 270) < 1.0) {
 ret = insert_filter(_filter, _idx, "transpose", "cclock");
 } else if (fabs(theta) > 1.0) {
@@ -1191,6 +1220,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

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

2019-06-29 Thread Jun Li
On Sat, Jun 29, 2019 at 12:07 AM Steven Liu  wrote:

>
>
> > 在 2019年6月26日,19:32,Steven Liu  写道:
> >
> > Jun Li  于2019年6月25日周二 上午9:26写道:
> >>
> >> On Mon, Jun 17, 2019 at 5:31 PM Jun Li  wrote:
> >>
> >>>
> >>>
> >>> On Sat, Jun 15, 2019 at 7:09 PM Jun Li  wrote:
> >>>
> 
> 
>  On Tue, Jun 11, 2019 at 7:05 PM Jun Li  wrote:
> 
> >
> > On Sun, Jun 9, 2019 at 2:28 PM Jun Li  wrote:
> >
> >> 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 | 168
> -
> >> 4 files changed, 192 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 = 

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

2019-06-29 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 | 170 -
 4 files changed, 194 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..cbe6e53155 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];
+} 

Re: [FFmpeg-devel] Changes in cofigure script

2019-06-29 Thread Dmitry A
вс, 30 июн. 2019 г. в 01:03, Dmitry A :

>
>
> сб, 29 июн. 2019 г. в 22:47, Reimar Döffinger :
>
>>
>>
>> On 29.06.2019, at 18:26, Dmitry A  wrote:
>>
>> > сб, 29 июн. 2019 г. в 21:43, Dmitry A :
>> >
>> >>
>> >>
>> >> сб, 29 июн. 2019 г. в 19:11, Dmitry A :
>> >>
>> >>>
>> >>>
>> >>> сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :
>> >>>
>>  Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
>>  dmitry.adj...@gmail.com>:
>> 
>> > What is right way to make changes in the cofigure script?
>> > I hacked it for building ffmpeg for android since clang doesn't
>> > support -mcpu and -march or something else.
>> 
>>  Please elaborate, building for Android works fine here.
>> 
>>  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".
>> >>>
>> >>>
>> >>> I integrated ffmpeg in aosp inside for one micro chip. I created
>> simple
>> >>> library  for implementation
>> >>> fake camera based on video file etc.
>> >>> But I built the latest ffmpeg with latest NDK. Please share the
>> options
>> >>> which you use.
>> >>>
>> >> --
>> >>> Thanks!
>> >>> Dmitry
>> >>>
>> >>
>> >> One more question: did you build it for android with NDK with clang?
>> >> If so please share your configure options.
>> >> Also I remember some errors related with vairable names such as B0.
>> >> I'll share the output later.
>> >> --
>> >> Thanks!
>> >> Dmitry
>> >>
>> >
>> > That's what I told:
>> >
>> > BEGIN /tmp/ffconf.MukWI5j9/test.c
>> >1 int main(void){ return 0; }
>> > END /tmp/ffconf.MukWI5j9/test.c
>> >
>> /d/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-androideabi-gcc
>> >
>> --sysroot=/d/Android/android-sdk/ndk-bundle/platforms/android-29/arch-arm64/
>> > -Os -fpic -mcpu= -c -o /tmp/ffconf.MukWI5j9/test.o
>> > /tmp/ffconf.MukWI5j9/test.c
>> > clang: warning: joined argument expects additional value: '-mcpu='
>> > [-Wunused-command-line-argument]
>>
>> That is the real error.
>> the mcpu argument is empty, which makes no sense.
>> You need to find out why/how that happens.
>> ___
>> 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".
>
>
> Thanks for your help!
> But should be patch generated from script itself or is there any source
> files from which configure script generated?
> --
> Thanks!
> Dmitry
>

OMG. It's pretty simple.
--arch=aarch64 \
--disable-runtime-cpudetect \
--extra-cflags="-Os -fpic $ADDI_CFLAGS --target=aarch64-linux-android29
-fno-addrsig"
Thanks for your help and sorry I distracted you on so stupid thing.

-- 
Thanks!
Dmitry
___
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] Changes in cofigure script

2019-06-29 Thread Dmitry A
сб, 29 июн. 2019 г. в 22:47, Reimar Döffinger :

>
>
> On 29.06.2019, at 18:26, Dmitry A  wrote:
>
> > сб, 29 июн. 2019 г. в 21:43, Dmitry A :
> >
> >>
> >>
> >> сб, 29 июн. 2019 г. в 19:11, Dmitry A :
> >>
> >>>
> >>>
> >>> сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :
> >>>
>  Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
>  dmitry.adj...@gmail.com>:
> 
> > What is right way to make changes in the cofigure script?
> > I hacked it for building ffmpeg for android since clang doesn't
> > support -mcpu and -march or something else.
> 
>  Please elaborate, building for Android works fine here.
> 
>  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".
> >>>
> >>>
> >>> I integrated ffmpeg in aosp inside for one micro chip. I created simple
> >>> library  for implementation
> >>> fake camera based on video file etc.
> >>> But I built the latest ffmpeg with latest NDK. Please share the options
> >>> which you use.
> >>>
> >> --
> >>> Thanks!
> >>> Dmitry
> >>>
> >>
> >> One more question: did you build it for android with NDK with clang?
> >> If so please share your configure options.
> >> Also I remember some errors related with vairable names such as B0.
> >> I'll share the output later.
> >> --
> >> Thanks!
> >> Dmitry
> >>
> >
> > That's what I told:
> >
> > BEGIN /tmp/ffconf.MukWI5j9/test.c
> >1 int main(void){ return 0; }
> > END /tmp/ffconf.MukWI5j9/test.c
> >
> /d/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-androideabi-gcc
> >
> --sysroot=/d/Android/android-sdk/ndk-bundle/platforms/android-29/arch-arm64/
> > -Os -fpic -mcpu= -c -o /tmp/ffconf.MukWI5j9/test.o
> > /tmp/ffconf.MukWI5j9/test.c
> > clang: warning: joined argument expects additional value: '-mcpu='
> > [-Wunused-command-line-argument]
>
> That is the real error.
> the mcpu argument is empty, which makes no sense.
> You need to find out why/how that happens.
> ___
> 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".


Thanks for your help!
But should be patch generated from script itself or is there any source
files from which configure script generated?
-- 
Thanks!
Dmitry
___
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 1/3] avcodec/qdm2: Move fft_order check up

2019-06-29 Thread Michael Niedermayer
On Mon, Jun 17, 2019 at 09:59:39PM +0200, Michael Niedermayer wrote:
> This avoids undefined computations with unchecked values
> 
> Fixes: shift exponent -21 is negative
> Fixes: 
> 15262/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5651261753393152
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/qdm2.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)

will apply patchset

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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 1/3] avformat/vqf: Check header_size

2019-06-29 Thread Michael Niedermayer
On Wed, Jun 19, 2019 at 01:53:01AM +0200, Michael Niedermayer wrote:
> Fixes: 
> 15271/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5735262606327808
> Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 
> 'int'
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/vqf.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply

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

It is what and why we do it that matters, not just one of them.


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 2/5] avcodec/atrac9dec: Check conditions before apply_band_extension() to avoid out of array read in initialization of unused variables

2019-06-29 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 09:11:05PM +0200, Michael Niedermayer wrote:
> On Sun, Jun 16, 2019 at 12:20:35PM +0200, Lynne wrote:
> > Jun 15, 2019, 11:00 PM by mich...@niedermayer.cc:
> > 
> > > Fixes: global-buffer-overflow
> > > Fixes: 
> > > 15247/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5671602181636096
> > >
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/atrac9dec.c | 7 +++
> > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> > > index 805d46f3b8..5401d6e19e 100644
> > > --- a/libavcodec/atrac9dec.c
> > > +++ b/libavcodec/atrac9dec.c
> > > @@ -535,9 +535,6 @@ static inline void apply_band_extension(ATRAC9Context 
> > > *s, ATRAC9BlockData *b,
> > >  at9_q_unit_to_coeff_idx[g_units[3]],
> > >  };
> > >  
> > > -if (!b->has_band_ext || !b->has_band_ext_data)
> > > -return;
> > > -
> > >  for (int ch = 0; ch <= stereo; ch++) {
> > >  ATRAC9ChannelData *c = >channel[ch];
> > >  
> > > @@ -741,7 +738,9 @@ static int atrac9_decode_block(ATRAC9Context *s, 
> > > GetBitContext *gb,
> > >  
> > >  apply_intensity_stereo(s, b, stereo);
> > >  apply_scalefactors(s, b, stereo);
> > > -apply_band_extension  (s, b, stereo);
> > > +
> > > +if (b->has_band_ext && b->has_band_ext_data)
> > > +apply_band_extension  (s, b, stereo); 
> > >
> > 
> > False positive as usual, q_unit_cnt can't be anything out of array since 
> > its looked up from
> > at9_tab_band_q_unit_map.
> > I'd really appreciate it if you stopped fixing complaint messages from 
> > automated tools.
> > Especially from overflows and fuzzing timeouts. The latter are completely 
> > useless and
> > often make the code look worse and weird, and the former are all useless 
> > except when
> > outside of DSP code (e.g. malloc). And most of our code is DSP.
> 
> Calm down please, ill explain how this is reading out of array
> 
> In fact there seem to be more ways than i realized before that this can read
> out of array, so i will post 2 more patches to fix this more completely
> 
> First q_unit_cnt is only set from at9_tab_band_q_unit_map if you are lucky as
> the code is conditional on a bit read from the bitstream.
> 
> Second the values in at9_tab_band_q_unit_map start like this 0, 4, 8, 10, 12
> 
> The code reading out of array is this:
> 
> const int g_units[4] = { /* A, B, C, total units */
> b->q_unit_cnt,
> at9_tab_band_ext_group[b->q_unit_cnt - 13][0],
> at9_tab_band_ext_group[b->q_unit_cnt - 13][1],
> 
> if q_unit_cnt is less than 13 the index is negative and that reads out of the 
> array
> teh value is not used later in the sample but the program could have crashed 
> already
> 
> It is very good that we discuss this here though as the fix from the patch
> does not appear to be enough. There are more pathes that can lead to this.

this patch here is still needed, so i will apply it in the next days unless
someone objects or has a better idea

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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 1/2] avcodec/atrac9dec: Check that the reused block has succeeded initilization

2019-06-29 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 10:47:21PM +0200, Michael Niedermayer wrote:
> Fixes: global-buffer-overflow
> Fixes: 
> 15247/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5671602181636096
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/atrac9dec.c | 8 
>  1 file changed, 8 insertions(+)

will apply patchset

[...]
-- 
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] Changes in cofigure script

2019-06-29 Thread Reimar Döffinger


On 29.06.2019, at 18:26, Dmitry A  wrote:

> сб, 29 июн. 2019 г. в 21:43, Dmitry A :
> 
>> 
>> 
>> сб, 29 июн. 2019 г. в 19:11, Dmitry A :
>> 
>>> 
>>> 
>>> сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :
>>> 
 Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
 dmitry.adj...@gmail.com>:
 
> What is right way to make changes in the cofigure script?
> I hacked it for building ffmpeg for android since clang doesn't
> support -mcpu and -march or something else.
 
 Please elaborate, building for Android works fine here.
 
 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".
>>> 
>>> 
>>> I integrated ffmpeg in aosp inside for one micro chip. I created simple
>>> library  for implementation
>>> fake camera based on video file etc.
>>> But I built the latest ffmpeg with latest NDK. Please share the options
>>> which you use.
>>> 
>> --
>>> Thanks!
>>> Dmitry
>>> 
>> 
>> One more question: did you build it for android with NDK with clang?
>> If so please share your configure options.
>> Also I remember some errors related with vairable names such as B0.
>> I'll share the output later.
>> --
>> Thanks!
>> Dmitry
>> 
> 
> That's what I told:
> 
> BEGIN /tmp/ffconf.MukWI5j9/test.c
>1 int main(void){ return 0; }
> END /tmp/ffconf.MukWI5j9/test.c
> /d/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-androideabi-gcc
> --sysroot=/d/Android/android-sdk/ndk-bundle/platforms/android-29/arch-arm64/
> -Os -fpic -mcpu= -c -o /tmp/ffconf.MukWI5j9/test.o
> /tmp/ffconf.MukWI5j9/test.c
> clang: warning: joined argument expects additional value: '-mcpu='
> [-Wunused-command-line-argument]

That is the real error.
the mcpu argument is empty, which makes no sense.
You need to find out why/how that happens.
___
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] add FF_DECODE_ERROR_DECODE_SLICES flag for AVFrame.decode_error_flags

2019-06-29 Thread Michael Niedermayer
On Fri, Jun 28, 2019 at 02:21:18AM -0700, Amir Pauker wrote:
> avutil: add FF_DECODE_ERROR_DECODE_SLICES for AVFrame.decode_error_flags 
> 
> Signed-off-by: Amir Pauker 
> ---
>  doc/APIchanges  | 3 +++
>  libavutil/frame.h   | 1 +
>  libavutil/version.h | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)

will apply

thanks

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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 2/2] avformat/rpl: Support files containing Replay IMA ADPCM audio

2019-06-29 Thread Michael Niedermayer
On Thu, Jun 27, 2019 at 08:56:02PM +0100, Cameron Cawley wrote:
> ---
>  libavformat/rpl.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/rpl.c b/libavformat/rpl.c
> index dbbcd13b41..b4859320f4 100644
> --- a/libavformat/rpl.c
> +++ b/libavformat/rpl.c
> @@ -121,6 +121,7 @@ static int rpl_read_header(AVFormatContext *s)
>  int error = 0;
>  const char *endptr;
>  char audio_type[RPL_LINE_LENGTH];
> +char audio_codec[RPL_LINE_LENGTH];
>  
>  uint32_t i;
>  
> @@ -189,7 +190,9 @@ static int rpl_read_header(AVFormatContext *s)
>  
>  // ARMovie supports multiple audio tracks; I don't have any
>  // samples, though. This code will ignore additional tracks.
> -audio_format = read_line_and_int(pb, );  // audio format ID
> +error |= read_line(pb, line, sizeof(line));
> +audio_format = read_int(line, , );  // audio format ID

> +strcpy(audio_codec, endptr);

This should be using a function checking the available space

[...]

thx

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


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 V2 3/4] lavf/dump: More disposition flag dump

2019-06-29 Thread Michael Niedermayer
On Fri, Jun 28, 2019 at 03:21:11PM +0800, Jun Zhao wrote:
> From: Jun Zhao 
> 
> More disposition flag dump
> 
> Signed-off-by: Jun Zhao 
> ---
>  libavformat/dump.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)

I think this is a good idea

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


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] Changes in cofigure script

2019-06-29 Thread Dmitry A
сб, 29 июн. 2019 г. в 21:43, Dmitry A :

>
>
> сб, 29 июн. 2019 г. в 19:11, Dmitry A :
>
>>
>>
>> сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :
>>
>>> Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
>>> dmitry.adj...@gmail.com>:
>>>
>>> > What is right way to make changes in the cofigure script?
>>> > I hacked it for building ffmpeg for android since clang doesn't
>>> > support -mcpu and -march or something else.
>>>
>>> Please elaborate, building for Android works fine here.
>>>
>>> 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".
>>
>>
>> I integrated ffmpeg in aosp inside for one micro chip. I created simple
>> library  for implementation
>> fake camera based on video file etc.
>> But I built the latest ffmpeg with latest NDK. Please share the options
>> which you use.
>>
> --
>> Thanks!
>> Dmitry
>>
>
> One more question: did you build it for android with NDK with clang?
> If so please share your configure options.
> Also I remember some errors related with vairable names such as B0.
> I'll share the output later.
> --
> Thanks!
> Dmitry
>

That's what I told:

BEGIN /tmp/ffconf.MukWI5j9/test.c
1 int main(void){ return 0; }
END /tmp/ffconf.MukWI5j9/test.c
/d/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-androideabi-gcc
--sysroot=/d/Android/android-sdk/ndk-bundle/platforms/android-29/arch-arm64/
-Os -fpic -mcpu= -c -o /tmp/ffconf.MukWI5j9/test.o
/tmp/ffconf.MukWI5j9/test.c
clang: warning: joined argument expects additional value: '-mcpu='
[-Wunused-command-line-argument]
clang: error: the clang compiler does not support '-mcpu='
C compiler test failed.

Here is build script:
#!/bin/bash
NDK=/d/Android/android-sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-29/arch-arm64/
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/windows-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-programs \
--disable-doc \
--disable-symver \
--enable-protocol=concat \
--enable-protocol=file \
--enable-muxer=mp4 \
--enable-demuxer=mpegts \
--cross-prefix=$TOOLCHAIN/bin/aarch64-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
#make clean all
#make -j3
#make install
}
#CPU=arm
#PREFIX=$(pwd)/android/$CPU
#ADDI_CFLAGS="-marm"
build_one

Under linux link to clang with name gcc already exists under windows I
created it manually.
-- 
Thanks!
Dmitry
___
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 v1] Add 2 timestamp print formats

2019-06-29 Thread Ulf Zibis
Hi,

for my developement of another filter I need additional timestamp print
formats.

So I like to share my efforts. Are you interested to include them to the
project?

For libavutil/timestamp.h I'm also wondering, why these format functions
are designated for "inline". As printing is always a little heavy job,
an explicit function call would not change much for performance IMHO,
but would save project footprint.

Please review.

-Ulf

>From 3bf9cb526cb70fd0192918b6b1c1b049974ca8ec Mon Sep 17 00:00:00 2001
From: Ulf Zibis 
Date: 29.06.2019, 17:52:06

avutil/timestamp: 2 new print formats

diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index e082f01..43e8107 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -25,6 +25,7 @@
 #define AVUTIL_TIMESTAMP_H
 
 #include "common.h"
+#include "avassert.h"
 
 #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
 #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
@@ -51,11 +52,11 @@
  * Convenience macro, the return value should be used only directly in
  * function arguments but never stand-alone.
  */
-#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
+#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts)
 
 /**
  * Fill the provided buffer with a string containing a timestamp time
- * representation.
+ * representation in seconds.
  *
  * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
  * @param ts the timestamp to represent
@@ -73,6 +74,63 @@
  * Convenience macro, the return value should be used only directly in
  * function arguments but never stand-alone.
  */
-#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
+#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
+
+/**
+ * Fill the provided buffer with a string containing a timestamp time
+ * representation in minutes and seconds.
+ *
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
+ * @param ts the timestamp to represent
+ * @param tb the timebase of the timestamp
+ * @return the buffer in input
+ */
+static inline char *av_ts_make_minute_string(char *buf, int64_t ts, AVRational *tb)
+{
+if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+else {
+double time = av_q2d(*tb) * ts;
+int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%3d:%09.6f", (int)time / 60, fabs(fmod(time, 60)));
+av_assert1(len < MAX_BUF_SZ && len >= 0);
+while (buf[--len] == '0'); // strip trailing zeros and dot.
+buf[len + ((buf[len] != '.') & 1)] = '\0'; // terminate
+}
+return buf;
+}
+
+/**
+ * Convenience macro, the return value should be used only directly in
+ * function arguments but never stand-alone.
+ */
+#define av_ts2minutestr(ts, tb) av_ts_make_minute_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
+
+/**
+ * Fill the provided buffer with a string containing a timestamp time
+ * representation in hours, minutes and seconds.
+ *
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
+ * @param ts the timestamp to represent
+ * @param tb the timebase of the timestamp
+ * @return the buffer in input
+ */
+static inline char *av_ts_make_hour_string(char *buf, int64_t ts, AVRational *tb)
+{
+if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+else {
+double time = av_q2d(*tb) * ts;
+int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%d:%02d:%09.6f",
+(int)time / 60 / 60,  (int)time / 60 % 60, fabs(fmod(time, 60)));
+av_assert1(len < MAX_BUF_SZ && len >= 0);
+while (buf[--len] == '0'); // strip trailing zeros and dot.
+buf[len + ((buf[len] != '.') & 1)] = '\0'; // terminate
+}
+return buf;
+}
+
+/**
+ * Convenience macro, the return value should be used only directly in
+ * function arguments but never stand-alone.
+ */
+#define av_ts2hourstr(ts, tb) av_ts_make_hour_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
 
 #endif /* AVUTIL_TIMESTAMP_H */
___
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] Changes in cofigure script

2019-06-29 Thread Dmitry A
сб, 29 июн. 2019 г. в 19:11, Dmitry A :

>
>
> сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :
>
>> Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
>> dmitry.adj...@gmail.com>:
>>
>> > What is right way to make changes in the cofigure script?
>> > I hacked it for building ffmpeg for android since clang doesn't
>> > support -mcpu and -march or something else.
>>
>> Please elaborate, building for Android works fine here.
>>
>> 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".
>
>
> I integrated ffmpeg in aosp inside for one micro chip. I created simple
> library  for implementation fake
> camera based on video file etc.
> But I built the latest ffmpeg with latest NDK. Please share the options
> which you use.
>
-- 
> Thanks!
> Dmitry
>

One more question: did you build it for android with NDK with clang?
If so please share your configure options.
Also I remember some errors related with vairable names such as B0.
I'll share the output later.
-- 
Thanks!
Dmitry
___
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] Changes in cofigure script

2019-06-29 Thread Dmitry A
сб, 29 июн. 2019 г. в 19:04, Carl Eugen Hoyos :

> Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A <
> dmitry.adj...@gmail.com>:
>
> > What is right way to make changes in the cofigure script?
> > I hacked it for building ffmpeg for android since clang doesn't
> > support -mcpu and -march or something else.
>
> Please elaborate, building for Android works fine here.
>
> 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".


I integrated ffmpeg in aosp inside for one micro chip. I created simple
library  for implementation fake
camera based on video file etc.
But I built the latest ffmpeg with latest NDK. Please share the options
which you use.
-- 
Thanks!
Dmitry
___
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] Changes in cofigure script

2019-06-29 Thread Carl Eugen Hoyos
Am Sa., 29. Juni 2019 um 14:23 Uhr schrieb Dmitry A :

> What is right way to make changes in the cofigure script?
> I hacked it for building ffmpeg for android since clang doesn't
> support -mcpu and -march or something else.

Please elaborate, building for Android works fine here.

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

Re: [FFmpeg-devel] Changes in cofigure script

2019-06-29 Thread Dmitry A
сб, 29 июн. 2019 г. в 18:22, Dmitry A :

> Hello.
> What is right way to make changes in the cofigure script?
> I hacked it for building ffmpeg for android since clang doesn't support
> -mcpu and -march or something else.
> Does it make a sence to add some configure parameter for android?
> In this case then these options should be disabled
> --
> Thanks!
> Dmitry
>
Or better to add parameter for clang. Since llvm works fine under different
plarforms.
Please let me know

-- 
Thanks!
Dmitry
___
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] Changes in cofigure script

2019-06-29 Thread Dmitry A
Hello.
What is right way to make changes in the cofigure script?
I hacked it for building ffmpeg for android since clang doesn't support
-mcpu and -march or something else.
Does it make a sence to add some configure parameter for android?
In this case then these options should be disabled
-- 
Thanks!
Dmitry
___
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] avfilter/avf_aphasemeter: Add out-of-phase and mono detection

2019-06-29 Thread Paul B Mahol
On 6/17/19, Romane Lafon  wrote:
> New version of the patch that extends aphasemeter filter.
> It allows to get metadata for out-of-phase or mono sequences of stereo
> streams.
> It displays start, end and duration as for silencedetect filter.
>

Missing filter documentation updates.
___
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] avcodec/cfhd: add back alpha processing removed in 9cefb9e7ec

2019-06-29 Thread Kieran Kunhya
On Sat, 29 Jun 2019 at 08:09, Paul B Mahol  wrote:

> Fixes #7886.
>
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/cfhd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index 846d334b9b..49a5a2c30a 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -884,6 +884,8 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
>  high = s->plane[plane].l_h[7];
>  for (i = 0; i < lowpass_height * 2; i++) {
>  horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
> +if (avctx->pix_fmt == AV_PIX_FMT_GBRAP12 && act_plane ==
> 3)
> +process_alpha(dst, lowpass_width * 2);
>  low  += lowpass_width;
>  high += lowpass_width;
>  dst  += pic->linesize[act_plane] / 2;
> --
> 2.17.1
>

LGTM
___
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] avcodec/cfhd: add back alpha processing removed in 9cefb9e7ec

2019-06-29 Thread Paul B Mahol
Fixes #7886.

Signed-off-by: Paul B Mahol 
---
 libavcodec/cfhd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 846d334b9b..49a5a2c30a 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -884,6 +884,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 high = s->plane[plane].l_h[7];
 for (i = 0; i < lowpass_height * 2; i++) {
 horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
+if (avctx->pix_fmt == AV_PIX_FMT_GBRAP12 && act_plane == 3)
+process_alpha(dst, lowpass_width * 2);
 low  += lowpass_width;
 high += lowpass_width;
 dst  += pic->linesize[act_plane] / 2;
-- 
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
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

2019-06-29 Thread Steven Liu


> 在 2019年6月26日,19:32,Steven Liu  写道:
> 
> Jun Li  于2019年6月25日周二 上午9:26写道:
>> 
>> On Mon, Jun 17, 2019 at 5:31 PM Jun Li  wrote:
>> 
>>> 
>>> 
>>> On Sat, Jun 15, 2019 at 7:09 PM Jun Li  wrote:
>>> 
 
 
 On Tue, Jun 11, 2019 at 7:05 PM Jun Li  wrote:
 
> 
> On Sun, Jun 9, 2019 at 2:28 PM Jun Li  wrote:
> 
>> 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 | 168 -
>> 4 files changed, 192 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 +=