[FFmpeg-cvslog] configure: error out if jni is enabled and cannot be found
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 15 15:23:34 2017 +0100| [d839c4716cdcecf3b46d05d0aec8f460cdb4ce23] | committer: Matthieu Bouron configure: error out if jni is enabled and cannot be found > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d839c4716cdcecf3b46d05d0aec8f460cdb4ce23 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index e1b7c61..3232b9f 100755 --- a/configure +++ b/configure @@ -5751,7 +5751,7 @@ enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h hea enabled gmp && require gmp gmp.h mpz_export -lgmp enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads && - check_lib "dlfcn.h" dlopen -ldl; } + check_lib "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; } enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h header not found"; } enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 enabled libass&& require_pkg_config libass ass/ass.h ass_library_init ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/muxing: re-indent block
ffmpeg | branch: master | Matthieu Bouron | Tue Mar 28 12:38:41 2017 +0200| [7e3e0f87e6e911250855f03dd2fa8b4533a3e654] | committer: Matthieu Bouron doc/examples/muxing: re-indent block > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e3e0f87e6e911250855f03dd2fa8b4533a3e654 --- doc/examples/muxing.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index 1df5912..e1a4770 100644 --- a/doc/examples/muxing.c +++ b/doc/examples/muxing.c @@ -335,15 +335,15 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost) if (ret < 0) exit(1); -/* convert to destination format */ -ret = swr_convert(ost->swr_ctx, - ost->frame->data, dst_nb_samples, - (const uint8_t **)frame->data, frame->nb_samples); -if (ret < 0) { -fprintf(stderr, "Error while converting\n"); -exit(1); -} -frame = ost->frame; +/* convert to destination format */ +ret = swr_convert(ost->swr_ctx, + ost->frame->data, dst_nb_samples, + (const uint8_t **)frame->data, frame->nb_samples); +if (ret < 0) { +fprintf(stderr, "Error while converting\n"); +exit(1); +} +frame = ost->frame; frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base); ost->samples_count += dst_nb_samples; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/remuxing: switch to codecpar
ffmpeg | branch: master | Matthieu Bouron | Tue Mar 28 11:57:26 2017 +0200| [4a946aca7cf3c03d232953852405577e85f4da71] | committer: Matthieu Bouron doc/examples/remuxing: switch to codecpar Also limits remuxing to audio, video and subtitle streams. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a946aca7cf3c03d232953852405577e85f4da71 --- doc/examples/remuxing.c | 42 +++--- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c index 65437d9..5959418 100644 --- a/doc/examples/remuxing.c +++ b/doc/examples/remuxing.c @@ -50,6 +50,9 @@ int main(int argc, char **argv) AVPacket pkt; const char *in_filename, *out_filename; int ret, i; +int stream_index = 0; +int *stream_mapping = NULL; +int stream_mapping_size = 0; if (argc < 3) { printf("usage: %s input output\n" @@ -83,25 +86,42 @@ int main(int argc, char **argv) goto end; } +stream_mapping_size = ifmt_ctx->nb_streams; +stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping)); +if (!stream_mapping) { +ret = AVERROR(ENOMEM); +goto end; +} + ofmt = ofmt_ctx->oformat; for (i = 0; i < ifmt_ctx->nb_streams; i++) { +AVStream *out_stream; AVStream *in_stream = ifmt_ctx->streams[i]; -AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec); +AVCodecParameters *in_codecpar = in_stream->codecpar; + +if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO && +in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO && +in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) { +stream_mapping[i] = -1; +continue; +} + +stream_mapping[i] = stream_index++; + +out_stream = avformat_new_stream(ofmt_ctx, NULL); if (!out_stream) { fprintf(stderr, "Failed allocating output stream\n"); ret = AVERROR_UNKNOWN; goto end; } -ret = avcodec_copy_context(out_stream->codec, in_stream->codec); +ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar); if (ret < 0) { -fprintf(stderr, "Failed to copy context from input to output stream codec context\n"); +fprintf(stderr, "Failed to copy codec parameters\n"); goto end; } -out_stream->codec->codec_tag = 0; -if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) -out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; +out_stream->codecpar->codec_tag = 0; } av_dump_format(ofmt_ctx, 0, out_filename, 1); @@ -127,8 +147,14 @@ int main(int argc, char **argv) break; in_stream = ifmt_ctx->streams[pkt.stream_index]; -out_stream = ofmt_ctx->streams[pkt.stream_index]; +if (pkt.stream_index >= stream_mapping_size || +stream_mapping[pkt.stream_index] < 0) { +av_packet_unref(&pkt); +continue; +} +pkt.stream_index = stream_mapping[pkt.stream_index]; +out_stream = ofmt_ctx->streams[pkt.stream_index]; log_packet(ifmt_ctx, &pkt, "in"); /* copy packet */ @@ -156,6 +182,8 @@ end: avio_closep(&ofmt_ctx->pb); avformat_free_context(ofmt_ctx); +av_freep(&stream_mapping); + if (ret < 0 && ret != AVERROR_EOF) { fprintf(stderr, "Error occurred: %s\n", av_err2str(ret)); return 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/extract_mvs: switch to codecpar
ffmpeg | branch: master | Matthieu Bouron | Tue Mar 28 13:46:36 2017 +0200| [64b553998567141b05239dcf11ad4d24aeaead8e] | committer: Matthieu Bouron doc/examples/extract_mvs: switch to codecpar > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64b553998567141b05239dcf11ad4d24aeaead8e --- doc/examples/extract_mvs.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index 975189c..8b22b40 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -69,8 +69,7 @@ static int decode_packet(int *got_frame, int cached) return decoded; } -static int open_codec_context(int *stream_idx, - AVFormatContext *fmt_ctx, enum AVMediaType type) +static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) { int ret; AVStream *st; @@ -78,24 +77,27 @@ static int open_codec_context(int *stream_idx, AVCodec *dec = NULL; AVDictionary *opts = NULL; -ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0); +ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", av_get_media_type_string(type), src_filename); return ret; } else { -*stream_idx = ret; -st = fmt_ctx->streams[*stream_idx]; - -/* find decoder for the stream */ -dec_ctx = st->codec; -dec = avcodec_find_decoder(dec_ctx->codec_id); -if (!dec) { -fprintf(stderr, "Failed to find %s codec\n", -av_get_media_type_string(type)); +int stream_idx = ret; +st = fmt_ctx->streams[stream_idx]; + +dec_ctx = avcodec_alloc_context3(dec); +if (!dec_ctx) { +fprintf(stderr, "Failed to allocate codec\n"); return AVERROR(EINVAL); } +ret = avcodec_parameters_to_context(dec_ctx, st->codecpar); +if (ret < 0) { +fprintf(stderr, "Failed to copy codec parameters to codec context\n"); +return ret; +} + /* Init the video decoder */ av_dict_set(&opts, "flags2", "+export_mvs", 0); if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) { @@ -103,6 +105,10 @@ static int open_codec_context(int *stream_idx, av_get_media_type_string(type)); return ret; } + +video_stream_idx = stream_idx; +video_stream = fmt_ctx->streams[video_stream_idx]; +video_dec_ctx = dec_ctx; } return 0; @@ -130,10 +136,7 @@ int main(int argc, char **argv) exit(1); } -if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) { -video_stream = fmt_ctx->streams[video_stream_idx]; -video_dec_ctx = video_stream->codec; -} +open_codec_context(fmt_ctx, AVMEDIA_TYPE_VIDEO); av_dump_format(fmt_ctx, 0, src_filename, 0); @@ -178,7 +181,7 @@ int main(int argc, char **argv) } while (got_frame); end: -avcodec_close(video_dec_ctx); +avcodec_free_context(&video_dec_ctx); avformat_close_input(&fmt_ctx); av_frame_free(&frame); return ret < 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '7433feb82f75827884d909de34d341a1c4401d4a'
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 23:11:10 2017 +0200| [b265e5ba50b86f2ca640e3a565bd54f7e4292bb0] | committer: Matthieu Bouron Merge commit '7433feb82f75827884d909de34d341a1c4401d4a' * commit '7433feb82f75827884d909de34d341a1c4401d4a': lavfi: Make default get_video_buffer work with hardware frames Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b265e5ba50b86f2ca640e3a565bd54f7e4292bb0 --- libavfilter/video.c | 16 1 file changed, 16 insertions(+) diff --git a/libavfilter/video.c b/libavfilter/video.c index fabdafd..6f9020b 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -25,6 +25,7 @@ #include "libavutil/avassert.h" #include "libavutil/buffer.h" +#include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -47,6 +48,21 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) int pool_align = 0; enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; +if (link->hw_frames_ctx && +((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { +int ret; +AVFrame *frame = av_frame_alloc(); + +if (!frame) +return NULL; + +ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); +if (ret < 0) +av_frame_free(&frame); + +return frame; +} + if (!link->frame_pool) { link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, link->format, BUFFER_ALIGN); == diff --cc libavfilter/video.c index fabdafd,533946a..6f9020b --- a/libavfilter/video.c +++ b/libavfilter/video.c @@@ -23,8 -19,8 +23,9 @@@ #include #include +#include "libavutil/avassert.h" #include "libavutil/buffer.h" + #include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@@ -40,37 -33,31 +41,52 @@@ AVFrame *ff_null_get_video_buffer(AVFil return ff_get_video_buffer(link->dst->outputs[0], w, h); } -/* TODO: set the buffer's priv member to a context structure for the whole - * filter chain. This will allow for a buffer pool instead of the constant - * alloc & free cycle currently implemented. */ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) { -AVFrame *frame = av_frame_alloc(); -int ret; - -if (!frame) -return NULL; +int pool_width = 0; +int pool_height = 0; +int pool_align = 0; +enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; + if (link->hw_frames_ctx && + ((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { ++int ret; ++AVFrame *frame = av_frame_alloc(); ++ ++if (!frame) ++return NULL; ++ + ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); ++if (ret < 0) ++av_frame_free(&frame); ++ ++return frame; ++} ++ +if (!link->frame_pool) { +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, +link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; } else { -frame->width = w; -frame->height = h; -frame->format = link->format; +if (ff_frame_pool_get_video_config(link->frame_pool, + &pool_width, &pool_height, + &pool_format, &pool_align) < 0) { +return NULL; +} + +if (pool_width != w || pool_height != h || +pool_format != link->format || pool_align != BUFFER_ALIGN) { -ret = av_frame_get_buffer(frame, 32); +ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, +link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; +} } -if (ret < 0) -av_frame_free(&frame); -return frame; +return ff_frame_pool_get(link->frame_pool); } AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d'
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 23:31:20 2017 +0200| [78e871ebbcc6f3c877e7292c4dda0c9979f8ede4] | committer: Matthieu Bouron Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d' * commit '7e2561fa8313982aa21f7657953eedeeb33b210d': lavfi: Use ff_get_video_buffer in all filters using hwframes vf_hwupload_cuda: Fix build error Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78e871ebbcc6f3c877e7292c4dda0c9979f8ede4 --- libavfilter/vf_deinterlace_qsv.c | 10 -- libavfilter/vf_hwupload.c| 9 ++--- libavfilter/vf_hwupload_cuda.c | 8 ++-- libavfilter/vf_scale_qsv.c | 6 +- libavfilter/vf_scale_vaapi.c | 11 +++ 5 files changed, 12 insertions(+), 32 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index e7491e1..2fe74c1 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -434,13 +434,11 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, mfxStatus err; int ret, again = 0; -out = av_frame_alloc(); -if (!out) -return AVERROR(ENOMEM); - -ret = av_hwframe_get_buffer(s->hw_frames_ctx, out, 0); -if (ret < 0) +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); +if (!out) { +ret = AVERROR(ENOMEM); goto fail; +} surf_out = (mfxFrameSurface1*)out->data[3]; surf_out->Info.CropW = outlink->w; diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index f54ce9f..9237253 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -159,15 +159,10 @@ static int hwupload_filter_frame(AVFilterLink *link, AVFrame *input) if (input->format == outlink->format) return ff_filter_frame(outlink, input); -output = av_frame_alloc(); +output = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!output) { -err = AVERROR(ENOMEM); -goto fail; -} - -err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0); -if (err < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n"); +err = AVERROR(ENOMEM); goto fail; } diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index 49f34b6..1e47ada 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -113,21 +113,17 @@ static int cudaupload_config_output(AVFilterLink *outlink) static int cudaupload_filter_frame(AVFilterLink *link, AVFrame *in) { AVFilterContext *ctx = link->dst; -CudaUploadContext *s = ctx->priv; +AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = NULL; int ret; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->hwframe, out, 0); -if (ret < 0) -goto fail; - out->width = in->width; out->height = in->height; diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 88fca8b..52e3ef9 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -530,16 +530,12 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out = NULL; int ret = 0; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->out_frames_ref, out, 0); -if (ret < 0) -goto fail; - do { err = MFXVideoVPP_RunFrameVPPAsync(s->session, (mfxFrameSurface1*)in->data[3], diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 8221849..c4334c7 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -32,6 +32,7 @@ #include "formats.h" #include "internal.h" #include "scale.h" +#include "video.h" typedef struct ScaleVAAPIContext { const AVClass *class; @@ -288,19 +289,13 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n", input_surface); -output_frame = av_frame_alloc(); +output_frame = ff_get_video_buffer(outlink, ctx->output_width, + ctx->output_height); if (!output_frame) { -av_log(ctx, AV_LOG_ERROR, "Failed to allocate output frame."); err = AVERROR(ENOMEM); goto fail; } -err = av_hwframe_get_buffer(ctx->output_frames_ref, output_frame, 0); -if (err < 0) { -av_log
[FFmpeg-cvslog] doc/examples/filtering_video: switch to new decoding API
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 14:58:01 2017 +0200| [afd257b43feb6ba60d823b65f02b283f404a7e13] | committer: Matthieu Bouron doc/examples/filtering_video: switch to new decoding API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afd257b43feb6ba60d823b65f02b283f404a7e13 --- doc/examples/filtering_video.c | 46 +- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 15116d3..4d97302 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -213,7 +213,6 @@ int main(int argc, char **argv) AVPacket packet; AVFrame *frame = av_frame_alloc(); AVFrame *filt_frame = av_frame_alloc(); -int got_frame; if (!frame || !filt_frame) { perror("Could not allocate frame"); @@ -238,33 +237,42 @@ int main(int argc, char **argv) break; if (packet.stream_index == video_stream_index) { -got_frame = 0; -ret = avcodec_decode_video2(dec_ctx, frame, &got_frame, &packet); +ret = avcodec_send_packet(dec_ctx, &packet); if (ret < 0) { -av_log(NULL, AV_LOG_ERROR, "Error decoding video\n"); +av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n"); break; } -if (got_frame) { -frame->pts = av_frame_get_best_effort_timestamp(frame); - -/* push the decoded frame into the filtergraph */ -if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) { -av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); +while (ret >= 0) { +ret = avcodec_receive_frame(dec_ctx, frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { break; +} else if (ret < 0) { +av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame from the decoder\n"); +goto end; } -/* pull filtered frames from the filtergraph */ -while (1) { -ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); -if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) +if (ret >= 0) { +frame->pts = av_frame_get_best_effort_timestamp(frame); + +/* push the decoded frame into the filtergraph */ +if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) { +av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); break; -if (ret < 0) -goto end; -display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base); -av_frame_unref(filt_frame); +} + +/* pull filtered frames from the filtergraph */ +while (1) { +ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) +break; +if (ret < 0) +goto end; +display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base); +av_frame_unref(filt_frame); +} +av_frame_unref(frame); } -av_frame_unref(frame); } } av_packet_unref(&packet); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/filtering_audio: switch to new decoding API
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 16:25:24 2017 +0200| [03372d0a90c01ad4e74f7f35cb0022d6bc681575] | committer: Matthieu Bouron doc/examples/filtering_audio: switch to new decoding API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03372d0a90c01ad4e74f7f35cb0022d6bc681575 --- doc/examples/filtering_audio.c | 63 -- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c index c6a930b..679218c 100644 --- a/doc/examples/filtering_audio.c +++ b/doc/examples/filtering_audio.c @@ -216,10 +216,9 @@ static void print_frame(const AVFrame *frame) int main(int argc, char **argv) { int ret; -AVPacket packet0, packet; +AVPacket packet; AVFrame *frame = av_frame_alloc(); AVFrame *filt_frame = av_frame_alloc(); -int got_frame; if (!frame || !filt_frame) { perror("Could not allocate frame"); @@ -239,50 +238,48 @@ int main(int argc, char **argv) goto end; /* read all packets */ -packet0.data = NULL; -packet.data = NULL; while (1) { -if (!packet0.data) { -if ((ret = av_read_frame(fmt_ctx, &packet)) < 0) -break; -packet0 = packet; -} +if ((ret = av_read_frame(fmt_ctx, &packet)) < 0) +break; if (packet.stream_index == audio_stream_index) { -got_frame = 0; -ret = avcodec_decode_audio4(dec_ctx, frame, &got_frame, &packet); +ret = avcodec_send_packet(dec_ctx, &packet); if (ret < 0) { -av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n"); -continue; +av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n"); +break; } -packet.size -= ret; -packet.data += ret; -if (got_frame) { -/* push the audio data from decoded frame into the filtergraph */ -if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 0) < 0) { -av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n"); +while (ret >= 0) { +ret = avcodec_receive_frame(dec_ctx, frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { break; +} else if (ret < 0) { +av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame from the decoder\n"); +goto end; } -/* pull filtered audio from the filtergraph */ -while (1) { -ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); -if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) +if (ret >= 0) { +/* push the audio data from decoded frame into the filtergraph */ +if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) { +av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n"); break; -if (ret < 0) -goto end; -print_frame(filt_frame); -av_frame_unref(filt_frame); +} + +/* pull filtered audio from the filtergraph */ +while (1) { +ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) +break; +if (ret < 0) +goto end; +print_frame(filt_frame); +av_frame_unref(filt_frame); +} +av_frame_unref(frame); } } - -if (packet.size <= 0) -av_packet_unref(&packet0); -} else { -/* discard non-wanted packets */ -av_packet_unref(&packet0); } +av_packet_unref(&packet); } end: avfilter_graph_free(&filter_graph); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: set AV_CODEC_CAP_AVOID_PROBING capability
ffmpeg | branch: master | Matthieu Bouron | Tue Apr 4 09:12:42 2017 +0200| [3fce174d4f08f76a82ad6d4a481463cfb8611dfe] | committer: Matthieu Bouron lavc/mediacodecdec: set AV_CODEC_CAP_AVOID_PROBING capability > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fce174d4f08f76a82ad6d4a481463cfb8611dfe --- libavcodec/mediacodecdec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 4cbec09..857e7a5 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -552,7 +552,7 @@ AVCodec ff_h264_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -568,7 +568,7 @@ AVCodec ff_hevc_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -584,7 +584,7 @@ AVCodec ff_mpeg4_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -600,7 +600,7 @@ AVCodec ff_vp8_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -616,7 +616,7 @@ AVCodec ff_vp9_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: switch to AV_CODEC_CAP_DELAY
ffmpeg | branch: master | Matthieu Bouron | Tue Apr 4 09:07:54 2017 +0200| [6ffaf90b32e42b6114cf558ed92bbd4fa93c6f49] | committer: Matthieu Bouron lavc/mediacodecdec: switch to AV_CODEC_CAP_DELAY > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ffaf90b32e42b6114cf558ed92bbd4fa93c6f49 --- libavcodec/mediacodecdec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 79a51ec..4cbec09 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -552,7 +552,7 @@ AVCodec ff_h264_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -568,7 +568,7 @@ AVCodec ff_hevc_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -584,7 +584,7 @@ AVCodec ff_mpeg4_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -600,7 +600,7 @@ AVCodec ff_vp8_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif @@ -616,7 +616,7 @@ AVCodec ff_vp9_mediacodec_decoder = { .decode = mediacodec_decode_frame, .flush = mediacodec_decode_flush, .close = mediacodec_decode_close, -.capabilities = CODEC_CAP_DELAY, +.capabilities = AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, }; #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/extract_mvs: switch to new decoding API
ffmpeg | branch: master | Matthieu Bouron | Mon Apr 3 15:25:09 2017 +0200| [82116bd8a45c9c5ad8874233ebc2f5583170856f] | committer: Matthieu Bouron doc/examples/extract_mvs: switch to new decoding API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82116bd8a45c9c5ad8874233ebc2f5583170856f --- doc/examples/extract_mvs.c | 72 ++ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index 8b22b40..d6730db 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -34,39 +34,46 @@ static AVFrame *frame = NULL; static AVPacket pkt; static int video_frame_count = 0; -static int decode_packet(int *got_frame, int cached) +static int decode_packet(void) { -int decoded = pkt.size; - -*got_frame = 0; - if (pkt.stream_index == video_stream_idx) { -int ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt); +int ret = avcodec_send_packet(video_dec_ctx, &pkt); if (ret < 0) { -fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret)); +fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret)); return ret; } -if (*got_frame) { -int i; -AVFrameSideData *sd; - -video_frame_count++; -sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); -if (sd) { -const AVMotionVector *mvs = (const AVMotionVector *)sd->data; -for (i = 0; i < sd->size / sizeof(*mvs); i++) { -const AVMotionVector *mv = &mvs[i]; -printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n", - video_frame_count, mv->source, - mv->w, mv->h, mv->src_x, mv->src_y, - mv->dst_x, mv->dst_y, mv->flags); +while (ret >= 0) { +ret = avcodec_receive_frame(video_dec_ctx, frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { +break; +} else if (ret < 0) { +fprintf(stderr, "Error while receiving a frame from the decoder: %s\n", av_err2str(ret)); +return ret; +} + +if (ret >= 0) { +int i; +AVFrameSideData *sd; + +video_frame_count++; +sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); +if (sd) { +const AVMotionVector *mvs = (const AVMotionVector *)sd->data; +for (i = 0; i < sd->size / sizeof(*mvs); i++) { +const AVMotionVector *mv = &mvs[i]; +printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n", +video_frame_count, mv->source, +mv->w, mv->h, mv->src_x, mv->src_y, +mv->dst_x, mv->dst_y, mv->flags); +} } +av_frame_unref(frame); } } } -return decoded; +return 0; } static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) @@ -116,7 +123,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) int main(int argc, char **argv) { -int ret = 0, got_frame; +int ret = 0; if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); @@ -157,28 +164,19 @@ int main(int argc, char **argv) /* initialize packet, set data to NULL, let the demuxer fill it */ av_init_packet(&pkt); -pkt.data = NULL; -pkt.size = 0; /* read frames from the file */ while (av_read_frame(fmt_ctx, &pkt) >= 0) { -AVPacket orig_pkt = pkt; -do { -ret = decode_packet(&got_frame, 0); -if (ret < 0) -break; -pkt.data += ret; -pkt.size -= ret; -} while (pkt.size > 0); -av_packet_unref(&orig_pkt); +ret = decode_packet(); +av_packet_unref(&pkt); +if (ret < 0) +break; } /* flush cached frames */ pkt.data = NULL; pkt.size = 0; -do { -decode_packet(&got_frame, 1); -} while (got_frame); +decode_packet(); end: avcodec_free_context(&video_dec_ctx); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/extract_mvs: make pkt local to the main function
ffmpeg | branch: master | Matthieu Bouron | Mon Apr 3 16:15:58 2017 +0200| [1cf93196fc6993541194c06a67bd59e45a4b3a44] | committer: Matthieu Bouron doc/examples/extract_mvs: make pkt local to the main function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cf93196fc6993541194c06a67bd59e45a4b3a44 --- doc/examples/extract_mvs.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index d6730db..552a733 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -31,13 +31,11 @@ static const char *src_filename = NULL; static int video_stream_idx = -1; static AVFrame *frame = NULL; -static AVPacket pkt; static int video_frame_count = 0; -static int decode_packet(void) +static int decode_packet(const AVPacket *pkt) { -if (pkt.stream_index == video_stream_idx) { -int ret = avcodec_send_packet(video_dec_ctx, &pkt); +int ret = avcodec_send_packet(video_dec_ctx, pkt); if (ret < 0) { fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret)); return ret; @@ -71,7 +69,6 @@ static int decode_packet(void) av_frame_unref(frame); } } -} return 0; } @@ -124,6 +121,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) int main(int argc, char **argv) { int ret = 0; +AVPacket pkt = { 0 }; if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); @@ -162,21 +160,17 @@ int main(int argc, char **argv) printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n"); -/* initialize packet, set data to NULL, let the demuxer fill it */ -av_init_packet(&pkt); - /* read frames from the file */ while (av_read_frame(fmt_ctx, &pkt) >= 0) { -ret = decode_packet(); +if (pkt.stream_index == video_stream_idx) +ret = decode_packet(&pkt); av_packet_unref(&pkt); if (ret < 0) break; } /* flush cached frames */ -pkt.data = NULL; -pkt.size = 0; -decode_packet(); +decode_packet(NULL); end: avcodec_free_context(&video_dec_ctx); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/extract_mvs: re-indent after previous commit
ffmpeg | branch: master | Matthieu Bouron | Mon Apr 3 16:32:50 2017 +0200| [400378b7b3a4fb34991c7267beb09272615fdea2] | committer: Matthieu Bouron doc/examples/extract_mvs: re-indent after previous commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=400378b7b3a4fb34991c7267beb09272615fdea2 --- doc/examples/extract_mvs.c | 56 +++--- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index 552a733..7ae934e 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -35,40 +35,40 @@ static int video_frame_count = 0; static int decode_packet(const AVPacket *pkt) { -int ret = avcodec_send_packet(video_dec_ctx, pkt); -if (ret < 0) { -fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret)); +int ret = avcodec_send_packet(video_dec_ctx, pkt); +if (ret < 0) { +fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret)); +return ret; +} + +while (ret >= 0) { +ret = avcodec_receive_frame(video_dec_ctx, frame); +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { +break; +} else if (ret < 0) { +fprintf(stderr, "Error while receiving a frame from the decoder: %s\n", av_err2str(ret)); return ret; } -while (ret >= 0) { -ret = avcodec_receive_frame(video_dec_ctx, frame); -if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { -break; -} else if (ret < 0) { -fprintf(stderr, "Error while receiving a frame from the decoder: %s\n", av_err2str(ret)); -return ret; -} - -if (ret >= 0) { -int i; -AVFrameSideData *sd; - -video_frame_count++; -sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); -if (sd) { -const AVMotionVector *mvs = (const AVMotionVector *)sd->data; -for (i = 0; i < sd->size / sizeof(*mvs); i++) { -const AVMotionVector *mv = &mvs[i]; -printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n", -video_frame_count, mv->source, -mv->w, mv->h, mv->src_x, mv->src_y, -mv->dst_x, mv->dst_y, mv->flags); -} +if (ret >= 0) { +int i; +AVFrameSideData *sd; + +video_frame_count++; +sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); +if (sd) { +const AVMotionVector *mvs = (const AVMotionVector *)sd->data; +for (i = 0; i < sd->size / sizeof(*mvs); i++) { +const AVMotionVector *mv = &mvs[i]; +printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n", +video_frame_count, mv->source, +mv->w, mv->h, mv->src_x, mv->src_y, +mv->dst_x, mv->dst_y, mv->flags); } -av_frame_unref(frame); } +av_frame_unref(frame); } +} return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor
ffmpeg | branch: master | Matthieu Bouron | Fri Apr 28 21:58:55 2017 +0200| [5d0b8b1ae307951310c7d9a8fa282fbca9b997cd] | committer: Matthieu Bouron lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor Separates macro arguments with commas and passes .4H/.8H as macro arguments instead of 4H/8H (the later form being interpreted as an hexadecimal value). Fixes ticket #6324. Suggested-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d0b8b1ae307951310c7d9a8fa282fbca9b997cd --- libavcodec/aarch64/simple_idct_neon.S | 74 +-- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S index 52273420f9..92987985d2 100644 --- a/libavcodec/aarch64/simple_idct_neon.S +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -61,37 +61,37 @@ endconst br x10 .endm -.macro smull1 a b c +.macro smull1 a, b, c smull \a, \b, \c .endm -.macro smlal1 a b c +.macro smlal1 a, b, c smlal \a, \b, \c .endm -.macro smlsl1 a b c +.macro smlsl1 a, b, c smlsl \a, \b, \c .endm -.macro idct_col4_top y1 y2 y3 y4 i l -smull\i v7.4S, \y3\().\l, z2 -smull\i v16.4S, \y3\().\l, z6 -smull\i v17.4S, \y2\().\l, z1 +.macro idct_col4_top y1, y2, y3, y4, i, l +smull\i v7.4S, \y3\l, z1 +smull\i v16.4S, \y3\l, z6 +smull\i v17.4S, \y2\l, z1 add v19.4S, v23.4S, v7.4S -smull\i v18.4S, \y2\().\l, z3 +smull\i v18.4S, \y2\l, z3 add v20.4S, v23.4S, v16.4S -smull\i v5.4S, \y2\().\l, z5 +smull\i v5.4S, \y2\l, z5 sub v21.4S, v23.4S, v16.4S -smull\i v6.4S, \y2\().\l, z7 +smull\i v6.4S, \y2\l, z7 sub v22.4S, v23.4S, v7.4S -smlal\i v17.4S, \y4\().\l, z3 -smlsl\i v18.4S, \y4\().\l, z7 -smlsl\i v5.4S, \y4\().\l, z1 -smlsl\i v6.4S, \y4\().\l, z5 +smlal\i v17.4S, \y4\l, z3 +smlsl\i v18.4S, \y4\l, z7 +smlsl\i v5.4S, \y4\l, z1 +smlsl\i v6.4S, \y4\l, z5 .endm -.macro idct_row4_neon y1 y2 y3 y4 pass +.macro idct_row4_neon y1, y2, y3, y4, pass ld1 {\y1\().2D-\y2\().2D}, [x2], #32 moviv23.4S, #1<<2, lsl #8 orr v5.16B, \y1\().16B, \y2\().16B @@ -101,7 +101,7 @@ endconst mov x3, v5.D[1] smlal v23.4S, \y1\().4H, z4 -idct_col4_top \y1 \y2 \y3 \y4 1 4H +idct_col4_top \y1, \y2, \y3, \y4, 1, .4H cmp x3, #0 beq \pass\()f @@ -153,7 +153,7 @@ endconst trn2\y4\().4S, v17.4S, v19.4S .endm -.macro declare_idct_col4_neon i l +.macro declare_idct_col4_neon i, l function idct_col4_neon\i dup v23.4H, z4c .if \i == 1 @@ -164,14 +164,14 @@ function idct_col4_neon\i .endif smull v23.4S, v23.4H, z4 -idct_col4_top v24 v25 v26 v27 \i \l +idct_col4_top v24, v25, v26, v27, \i, \l mov x4, v28.D[\i - 1] mov x5, v29.D[\i - 1] cmp x4, #0 beq 1f -smull\i v7.4S, v28.\l, z4 +smull\i v7.4S, v28\l, z4 add v19.4S, v19.4S, v7.4S sub v20.4S, v20.4S, v7.4S sub v21.4S, v21.4S, v7.4S @@ -181,17 +181,17 @@ function idct_col4_neon\i cmp x5, #0 beq 2f -smlal\i v17.4S, v29.\l, z5 -smlsl\i v18.4S, v29.\l, z1 -smlal\i v5.4S, v29.\l, z7 -smlal\i v6.4S, v29.\l, z3 +smlal\i v17.4S, v29\l, z5 +smlsl\i v18.4S, v29\l, z1 +smlal\i v5.4S, v29\l, z7 +smlal\i v6.4S, v29\l, z3 2: mov x5, v31.D[\i - 1] cmp x4, #0 beq 3f -smull\i v7.4S, v30.\l, z6 -smull\i v16.4S, v30.\l, z2 +smull\i v7.4S, v30\l, z6 +smull\i v16.4S, v30\l, z2 add v19.4S, v19.4S, v7.4S sub v22.4S, v22.4S, v7.4S sub v20.4S, v20.4S, v16.4S @@ -200,10 +200,10 @@ function idct_col4_neon\i 3: cmp x5, #0 beq 4f -smlal\i v17.4S, v31.\l, z7 -smlsl\i v18.4S, v31.\l, z5 -smlal\i v5.4S, v31.\l, z3 -smlsl\i v6.4S, v31.\l, z1 +smlal\i v17.4S, v31\l, z7 +smlsl\i v18.4S,
[FFmpeg-cvslog] lavc/ffjni: fix local reference leak
ffmpeg | branch: master | Matthieu Bouron | Wed May 10 15:57:57 2017 +0200| [2f43897f657974d8f94d0d075eb67dac1147ddde] | committer: Matthieu Bouron lavc/ffjni: fix local reference leak Reviewed-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f43897f657974d8f94d0d075eb67dac1147ddde --- libavcodec/ffjni.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c index 3f4c380673..b2bcae9602 100644 --- a/libavcodec/ffjni.c +++ b/libavcodec/ffjni.c @@ -303,6 +303,11 @@ int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfi last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) = global ? (*env)->NewGlobalRef(env, clazz) : clazz; + +if (global) { +(*env)->DeleteLocalRef(env, clazz); +} + } else { if (!last_clazz) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks
ffmpeg | branch: master | Matthieu Bouron | Wed May 10 15:59:41 2017 +0200| [1795dccde0ad22fc8201142f92fb8d58c234f3e4] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix local reference leaks Reviewed-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1795dccde0ad22fc8201142f92fb8d58c234f3e4 --- libavcodec/mediacodec_wrapper.c | 63 +++-- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index c2af950f39..43fbb511fd 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1129,9 +1129,11 @@ fail: FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring codec_name = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1154,12 +1156,12 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1172,24 +1174,31 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) codec->has_get_i_o_buffer = 1; } -return codec; +ret = 0; fail: -ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); - if (codec_name) { (*env)->DeleteLocalRef(env, codec_name); } -av_freep(&codec); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -return NULL; +if (ret < 0) { +ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); +av_freep(&codec); +} + +return codec; } FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1212,12 +1221,12 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1230,24 +1239,31 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) codec->has_get_i_o_buffer = 1; } -return codec; +ret = 0; fail: -ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); - if (mime_type) { (*env)->DeleteLocalRef(env, mime_type); } -av_freep(&codec); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -return NULL; +if (ret < 0) { +ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); +av_freep(&codec); +} + +return codec; } FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1270,12 +1286,12 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1288,17 +1304,22 @
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks
ffmpeg | branch: release/3.3 | Matthieu Bouron | Wed May 10 15:59:41 2017 +0200| [1d37fe95e85806f02b8c79dba459eede3fa239f4] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix local reference leaks Reviewed-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d37fe95e85806f02b8c79dba459eede3fa239f4 --- libavcodec/mediacodec_wrapper.c | 63 +++-- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index c2af950f39..43fbb511fd 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1129,9 +1129,11 @@ fail: FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring codec_name = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1154,12 +1156,12 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1172,24 +1174,31 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) codec->has_get_i_o_buffer = 1; } -return codec; +ret = 0; fail: -ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); - if (codec_name) { (*env)->DeleteLocalRef(env, codec_name); } -av_freep(&codec); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -return NULL; +if (ret < 0) { +ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); +av_freep(&codec); +} + +return codec; } FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1212,12 +1221,12 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1230,24 +1239,31 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) codec->has_get_i_o_buffer = 1; } -return codec; +ret = 0; fail: -ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); - if (mime_type) { (*env)->DeleteLocalRef(env, mime_type); } -av_freep(&codec); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -return NULL; +if (ret < 0) { +ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); +av_freep(&codec); +} + +return codec; } FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime) { +int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; +jobject object = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1270,12 +1286,12 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime) goto fail; } -codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type); +object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->object = (*env)->NewGlobalRef(env, codec->object); +codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; } @@ -1288,17 +1
[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor
ffmpeg | branch: release/3.3 | Matthieu Bouron | Fri Apr 28 21:58:55 2017 +0200| [d8afd8d371ec0dc05baa2585caffba100ca45cec] | committer: Matthieu Bouron lavc/aarch64/simple_idct: fix iOS build without gas-preprocessor Separates macro arguments with commas and passes .4H/.8H as macro arguments instead of 4H/8H (the later form being interpreted as an hexadecimal value). Fixes ticket #6324. Suggested-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8afd8d371ec0dc05baa2585caffba100ca45cec --- libavcodec/aarch64/simple_idct_neon.S | 74 +-- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S index 52273420f9..92987985d2 100644 --- a/libavcodec/aarch64/simple_idct_neon.S +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -61,37 +61,37 @@ endconst br x10 .endm -.macro smull1 a b c +.macro smull1 a, b, c smull \a, \b, \c .endm -.macro smlal1 a b c +.macro smlal1 a, b, c smlal \a, \b, \c .endm -.macro smlsl1 a b c +.macro smlsl1 a, b, c smlsl \a, \b, \c .endm -.macro idct_col4_top y1 y2 y3 y4 i l -smull\i v7.4S, \y3\().\l, z2 -smull\i v16.4S, \y3\().\l, z6 -smull\i v17.4S, \y2\().\l, z1 +.macro idct_col4_top y1, y2, y3, y4, i, l +smull\i v7.4S, \y3\l, z1 +smull\i v16.4S, \y3\l, z6 +smull\i v17.4S, \y2\l, z1 add v19.4S, v23.4S, v7.4S -smull\i v18.4S, \y2\().\l, z3 +smull\i v18.4S, \y2\l, z3 add v20.4S, v23.4S, v16.4S -smull\i v5.4S, \y2\().\l, z5 +smull\i v5.4S, \y2\l, z5 sub v21.4S, v23.4S, v16.4S -smull\i v6.4S, \y2\().\l, z7 +smull\i v6.4S, \y2\l, z7 sub v22.4S, v23.4S, v7.4S -smlal\i v17.4S, \y4\().\l, z3 -smlsl\i v18.4S, \y4\().\l, z7 -smlsl\i v5.4S, \y4\().\l, z1 -smlsl\i v6.4S, \y4\().\l, z5 +smlal\i v17.4S, \y4\l, z3 +smlsl\i v18.4S, \y4\l, z7 +smlsl\i v5.4S, \y4\l, z1 +smlsl\i v6.4S, \y4\l, z5 .endm -.macro idct_row4_neon y1 y2 y3 y4 pass +.macro idct_row4_neon y1, y2, y3, y4, pass ld1 {\y1\().2D-\y2\().2D}, [x2], #32 moviv23.4S, #1<<2, lsl #8 orr v5.16B, \y1\().16B, \y2\().16B @@ -101,7 +101,7 @@ endconst mov x3, v5.D[1] smlal v23.4S, \y1\().4H, z4 -idct_col4_top \y1 \y2 \y3 \y4 1 4H +idct_col4_top \y1, \y2, \y3, \y4, 1, .4H cmp x3, #0 beq \pass\()f @@ -153,7 +153,7 @@ endconst trn2\y4\().4S, v17.4S, v19.4S .endm -.macro declare_idct_col4_neon i l +.macro declare_idct_col4_neon i, l function idct_col4_neon\i dup v23.4H, z4c .if \i == 1 @@ -164,14 +164,14 @@ function idct_col4_neon\i .endif smull v23.4S, v23.4H, z4 -idct_col4_top v24 v25 v26 v27 \i \l +idct_col4_top v24, v25, v26, v27, \i, \l mov x4, v28.D[\i - 1] mov x5, v29.D[\i - 1] cmp x4, #0 beq 1f -smull\i v7.4S, v28.\l, z4 +smull\i v7.4S, v28\l, z4 add v19.4S, v19.4S, v7.4S sub v20.4S, v20.4S, v7.4S sub v21.4S, v21.4S, v7.4S @@ -181,17 +181,17 @@ function idct_col4_neon\i cmp x5, #0 beq 2f -smlal\i v17.4S, v29.\l, z5 -smlsl\i v18.4S, v29.\l, z1 -smlal\i v5.4S, v29.\l, z7 -smlal\i v6.4S, v29.\l, z3 +smlal\i v17.4S, v29\l, z5 +smlsl\i v18.4S, v29\l, z1 +smlal\i v5.4S, v29\l, z7 +smlal\i v6.4S, v29\l, z3 2: mov x5, v31.D[\i - 1] cmp x4, #0 beq 3f -smull\i v7.4S, v30.\l, z6 -smull\i v16.4S, v30.\l, z2 +smull\i v7.4S, v30\l, z6 +smull\i v16.4S, v30\l, z2 add v19.4S, v19.4S, v7.4S sub v22.4S, v22.4S, v7.4S sub v20.4S, v20.4S, v16.4S @@ -200,10 +200,10 @@ function idct_col4_neon\i 3: cmp x5, #0 beq 4f -smlal\i v17.4S, v31.\l, z7 -smlsl\i v18.4S, v31.\l, z5 -smlal\i v5.4S, v31.\l, z3 -smlsl\i v6.4S, v31.\l, z1 +smlal\i v17.4S, v31\l, z7 +smlsl\i v18.4S,
[FFmpeg-cvslog] lavc/ffjni: fix local reference leak
ffmpeg | branch: release/3.3 | Matthieu Bouron | Wed May 10 15:57:57 2017 +0200| [79122e26713579acca576d81e6f7b9efebdb447f] | committer: Matthieu Bouron lavc/ffjni: fix local reference leak Reviewed-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79122e26713579acca576d81e6f7b9efebdb447f --- libavcodec/ffjni.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c index 3f4c380673..b2bcae9602 100644 --- a/libavcodec/ffjni.c +++ b/libavcodec/ffjni.c @@ -303,6 +303,11 @@ int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfi last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) = global ? (*env)->NewGlobalRef(env, clazz) : clazz; + +if (global) { +(*env)->DeleteLocalRef(env, clazz); +} + } else { if (!last_clazz) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out
ffmpeg | branch: master | Matthieu Bouron | Thu May 11 15:16:22 2017 +0200| [ab61b79b1c707a9ea0512238d837ea3e8b8395ed] | committer: Matthieu Bouron lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out Some samples have their metadata track time_scale incorrectly set to 0 and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71 prevents playback of those samples. Setting the time_scale to 1 fixes playback. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab61b79b1c707a9ea0512238d837ea3e8b8395ed --- libavformat/mov.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index afef53b79a..90b0ab1de7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1236,8 +1236,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { -av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); -return AVERROR_INVALIDDATA; +av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale); +sc->time_scale = 1; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ @@ -1266,8 +1266,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { -av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", c->time_scale); -return AVERROR_INVALIDDATA; +av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); +c->time_scale = 1; } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks
ffmpeg | branch: master | Matthieu Bouron | Sun May 21 16:48:30 2017 +0200| [224bb46fb857dab589597bdab302ba8ba012008c] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix local reference leaks > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=224bb46fb857dab589597bdab302ba8ba012008c --- libavcodec/mediacodec_wrapper.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 43fbb511fd..5e1beed43a 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -608,6 +608,7 @@ FFAMediaFormat *ff_AMediaFormat_new(void) { JNIEnv *env = NULL; FFAMediaFormat *format = NULL; +jobject object = NULL; format = av_mallocz(sizeof(FFAMediaFormat)); if (!format) { @@ -625,23 +626,27 @@ FFAMediaFormat *ff_AMediaFormat_new(void) goto fail; } -format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id); -if (!format->object) { +object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id); +if (!object) { goto fail; } -format->object = (*env)->NewGlobalRef(env, format->object); +format->object = (*env)->NewGlobalRef(env, object); if (!format->object) { goto fail; } -return format; fail: -ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -av_freep(&format); +if (!format->object) { +ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); +av_freep(&format); +} -return NULL; +return format; } static FFAMediaFormat *ff_AMediaFormat_newFromObject(void *object) @@ -1562,6 +1567,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNIEnv *env = NULL; jobject buffer = NULL; +jobject input_buffers = NULL; JNI_GET_ENV_OR_RETURN(env, codec, NULL); @@ -1572,12 +1578,12 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t } } else { if (!codec->input_buffers) { -codec->input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id); +input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->input_buffers = (*env)->NewGlobalRef(env, codec->input_buffers); +codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1596,6 +1602,10 @@ fail: (*env)->DeleteLocalRef(env, buffer); } +if (input_buffers) { +(*env)->DeleteLocalRef(env, input_buffers); +} + return ret; } @@ -1605,6 +1615,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNIEnv *env = NULL; jobject buffer = NULL; +jobject output_buffers = NULL; JNI_GET_ENV_OR_RETURN(env, codec, NULL); @@ -1615,12 +1626,12 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t } } else { if (!codec->output_buffers) { -codec->output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id); +output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->output_buffers = (*env)->NewGlobalRef(env, codec->output_buffers); +codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1639,6 +1650,10 @@ fail: (*env)->DeleteLocalRef(env, buffer); } +if (output_buffers) { +(*env)->DeleteLocalRef(env, output_buffers); +} + return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack
ffmpeg | branch: master | Matthieu Bouron | Sun May 21 17:48:05 2017 +0200| [fb3228bee8fe55c48bc8c7d3a5342497ae78b730] | committer: Matthieu Bouron lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb3228bee8fe55c48bc8c7d3a5342497ae78b730 --- libavcodec/mediacodec_wrapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 5e1beed43a..4a37cd7cd7 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -66,7 +66,7 @@ struct JNIAMediaCodecListFields { jfieldID hevc_profile_main10_id; jfieldID hevc_profile_main10_hdr10_id; -} JNIAMediaCodecListFields; +}; static const struct FFJniField jni_amediacodeclist_mapping[] = { { "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 }, @@ -125,7 +125,7 @@ struct JNIAMediaFormatFields { jmethodID to_string_id; -} JNIAMediaFormatFields; +}; static const struct FFJniField jni_amediaformat_mapping[] = { { "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaFormatFields, mediaformat_class), 1 }, @@ -210,7 +210,7 @@ struct JNIAMediaCodecFields { jfieldID presentation_time_us_id; jfieldID size_id; -} JNIAMediaCodecFields; +}; static const struct FFJniField jni_amediacodec_mapping[] = { { "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediacodec_class), 1 }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/ffjni: add missing '\n'
ffmpeg | branch: master | Matthieu Bouron | Sun May 21 17:44:12 2017 +0200| [37de7f71758bd0ce2e3912bd70b223a718602e09] | committer: Matthieu Bouron lavc/ffjni: add missing '\n' > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37de7f71758bd0ce2e3912bd70b223a718602e09 --- libavcodec/ffjni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c index b2bcae9602..f5b581f0f6 100644 --- a/libavcodec/ffjni.c +++ b/libavcodec/ffjni.c @@ -85,7 +85,7 @@ JNIEnv *ff_jni_get_env(void *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not supported\n"); break; default: -av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread"); +av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread\n"); break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack
ffmpeg | branch: release/3.3 | Matthieu Bouron | Sun May 21 17:48:05 2017 +0200| [cbae648eb8b2789eeb624959e8451967ea9e263a] | committer: Matthieu Bouron lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbae648eb8b2789eeb624959e8451967ea9e263a --- libavcodec/mediacodec_wrapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 5e1beed43a..4a37cd7cd7 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -66,7 +66,7 @@ struct JNIAMediaCodecListFields { jfieldID hevc_profile_main10_id; jfieldID hevc_profile_main10_hdr10_id; -} JNIAMediaCodecListFields; +}; static const struct FFJniField jni_amediacodeclist_mapping[] = { { "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 }, @@ -125,7 +125,7 @@ struct JNIAMediaFormatFields { jmethodID to_string_id; -} JNIAMediaFormatFields; +}; static const struct FFJniField jni_amediaformat_mapping[] = { { "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaFormatFields, mediaformat_class), 1 }, @@ -210,7 +210,7 @@ struct JNIAMediaCodecFields { jfieldID presentation_time_us_id; jfieldID size_id; -} JNIAMediaCodecFields; +}; static const struct FFJniField jni_amediacodec_mapping[] = { { "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediacodec_class), 1 }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/ffjni: add missing '\n'
ffmpeg | branch: release/3.3 | Matthieu Bouron | Sun May 21 17:44:12 2017 +0200| [3e38bf95c53714f5b5d8c5214481073aedf7d11d] | committer: Matthieu Bouron lavc/ffjni: add missing '\n' > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e38bf95c53714f5b5d8c5214481073aedf7d11d --- libavcodec/ffjni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c index b2bcae9602..f5b581f0f6 100644 --- a/libavcodec/ffjni.c +++ b/libavcodec/ffjni.c @@ -85,7 +85,7 @@ JNIEnv *ff_jni_get_env(void *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not supported\n"); break; default: -av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread"); +av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread\n"); break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix local reference leaks
ffmpeg | branch: release/3.3 | Matthieu Bouron | Sun May 21 16:48:30 2017 +0200| [2fb25e2dd6ff6bf7803fd2ebc2716ffc540bd19a] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix local reference leaks > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fb25e2dd6ff6bf7803fd2ebc2716ffc540bd19a --- libavcodec/mediacodec_wrapper.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 43fbb511fd..5e1beed43a 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -608,6 +608,7 @@ FFAMediaFormat *ff_AMediaFormat_new(void) { JNIEnv *env = NULL; FFAMediaFormat *format = NULL; +jobject object = NULL; format = av_mallocz(sizeof(FFAMediaFormat)); if (!format) { @@ -625,23 +626,27 @@ FFAMediaFormat *ff_AMediaFormat_new(void) goto fail; } -format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id); -if (!format->object) { +object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id); +if (!object) { goto fail; } -format->object = (*env)->NewGlobalRef(env, format->object); +format->object = (*env)->NewGlobalRef(env, object); if (!format->object) { goto fail; } -return format; fail: -ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); +if (object) { +(*env)->DeleteLocalRef(env, object); +} -av_freep(&format); +if (!format->object) { +ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); +av_freep(&format); +} -return NULL; +return format; } static FFAMediaFormat *ff_AMediaFormat_newFromObject(void *object) @@ -1562,6 +1567,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNIEnv *env = NULL; jobject buffer = NULL; +jobject input_buffers = NULL; JNI_GET_ENV_OR_RETURN(env, codec, NULL); @@ -1572,12 +1578,12 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t } } else { if (!codec->input_buffers) { -codec->input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id); +input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->input_buffers = (*env)->NewGlobalRef(env, codec->input_buffers); +codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1596,6 +1602,10 @@ fail: (*env)->DeleteLocalRef(env, buffer); } +if (input_buffers) { +(*env)->DeleteLocalRef(env, input_buffers); +} + return ret; } @@ -1605,6 +1615,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNIEnv *env = NULL; jobject buffer = NULL; +jobject output_buffers = NULL; JNI_GET_ENV_OR_RETURN(env, codec, NULL); @@ -1615,12 +1626,12 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t } } else { if (!codec->output_buffers) { -codec->output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id); +output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } -codec->output_buffers = (*env)->NewGlobalRef(env, codec->output_buffers); +codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1639,6 +1650,10 @@ fail: (*env)->DeleteLocalRef(env, buffer); } +if (output_buffers) { +(*env)->DeleteLocalRef(env, output_buffers); +} + return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out
ffmpeg | branch: release/3.3 | Matthieu Bouron | Thu May 11 15:16:22 2017 +0200| [6ee4b20f4ae3e726868d3efa038ed3103f69d2a2] | committer: Matthieu Bouron lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out Some samples have their metadata track time_scale incorrectly set to 0 and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71 prevents playback of those samples. Setting the time_scale to 1 fixes playback. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ee4b20f4ae3e726868d3efa038ed3103f69d2a2 --- libavformat/mov.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index f2296f8917..036693a652 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1232,8 +1232,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { -av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); -return AVERROR_INVALIDDATA; +av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale); +sc->time_scale = 1; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ @@ -1262,8 +1262,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { -av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", c->time_scale); -return AVERROR_INVALIDDATA; +av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); +c->time_scale = 1; } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: switch to the new generic filtering mechanism
ffmpeg | branch: master | Matthieu Bouron | Sat Jun 10 00:41:07 2017 +0200| [3839580b71345ec7a8245dc5faa562eb9903cb22] | committer: Matthieu Bouron lavc/mediacodecdec: switch to the new generic filtering mechanism > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3839580b71345ec7a8245dc5faa562eb9903cb22 --- libavcodec/mediacodecdec.c | 74 -- 1 file changed, 13 insertions(+), 61 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 5bdeb6c1d7..6962ce2474 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -41,11 +41,9 @@ typedef struct MediaCodecH264DecContext { MediaCodecDecContext *ctx; -AVBSFContext *bsf; - AVFifoBuffer *fifo; -AVPacket filtered_pkt; +AVPacket buffered_pkt; } MediaCodecH264DecContext; @@ -58,8 +56,7 @@ static av_cold int mediacodec_decode_close(AVCodecContext *avctx) av_fifo_free(s->fifo); -av_bsf_free(&s->bsf); -av_packet_unref(&s->filtered_pkt); +av_packet_unref(&s->buffered_pkt); return 0; } @@ -312,9 +309,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) const char *codec_mime = NULL; -const char *bsf_name = NULL; -const AVBitStreamFilter *bsf = NULL; - FFAMediaFormat *format = NULL; MediaCodecH264DecContext *s = avctx->priv_data; @@ -329,7 +323,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) #if CONFIG_H264_MEDIACODEC_DECODER case AV_CODEC_ID_H264: codec_mime = "video/avc"; -bsf_name = "h264_mp4toannexb"; ret = h264_set_extradata(avctx, format); if (ret < 0) @@ -339,7 +332,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) #if CONFIG_HEVC_MEDIACODEC_DECODER case AV_CODEC_ID_HEVC: codec_mime = "video/hevc"; -bsf_name = "hevc_mp4toannexb"; ret = hevc_set_extradata(avctx, format); if (ret < 0) @@ -410,25 +402,6 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) goto done; } -if (bsf_name) { -bsf = av_bsf_get_by_name(bsf_name); -if(!bsf) { -ret = AVERROR_BSF_NOT_FOUND; -goto done; -} - -if ((ret = av_bsf_alloc(bsf, &s->bsf))) { -goto done; -} - -if (((ret = avcodec_parameters_from_context(s->bsf->par_in, avctx)) < 0) || -((ret = av_bsf_init(s->bsf)) < 0)) { - goto done; -} -} - -av_init_packet(&s->filtered_pkt); - done: if (format) { ff_AMediaFormat_delete(format); @@ -502,11 +475,9 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data, /* process buffered data */ while (!*got_frame) { -/* prepare the input data -- convert to Annex B if needed */ -if (s->filtered_pkt.size <= 0) { -AVPacket input_pkt = { 0 }; - -av_packet_unref(&s->filtered_pkt); +/* prepare the input data */ +if (s->buffered_pkt.size <= 0) { +av_packet_unref(&s->buffered_pkt); /* no more data */ if (av_fifo_size(s->fifo) < sizeof(AVPacket)) { @@ -514,38 +485,17 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data, ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, avpkt); } -av_fifo_generic_read(s->fifo, &input_pkt, sizeof(input_pkt), NULL); - -if (s->bsf) { -ret = av_bsf_send_packet(s->bsf, &input_pkt); -if (ret < 0) { -return ret; -} - -ret = av_bsf_receive_packet(s->bsf, &s->filtered_pkt); -if (ret == AVERROR(EAGAIN)) { -goto done; -} -} else { -av_packet_move_ref(&s->filtered_pkt, &input_pkt); -} - -/* {h264,hevc}_mp4toannexb are used here and do not require flushing */ -av_assert0(ret != AVERROR_EOF); - -if (ret < 0) { -return ret; -} +av_fifo_generic_read(s->fifo, &s->buffered_pkt, sizeof(s->buffered_pkt), NULL); } -ret = mediacodec_process_data(avctx, frame, got_frame, &s->filtered_pkt); +ret = mediacodec_process_data(avctx, frame, got_frame, &s->buffered_pkt); if (ret < 0) return ret; -s->filtered_pkt.size -= ret; -s->filtered_pkt.data += ret; +s->buffered_pkt.size -= ret; +s->buffered_pkt.data += ret; } -done: + return avpkt->size; } @@ -560,7 +510,7 @@ static void mediacodec_decode_flush(AVCodecContext *avctx) } av_fifo_reset(s->fifo); -av_packet_unref(&a
[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix idct_col4_top coefficient
ffmpeg | branch: master | Matthieu Bouron | Tue Jun 13 17:19:51 2017 +0200| [8aa60606fb64b8280627935b0df55d4d2aeca5d1] | committer: Matthieu Bouron lavc/aarch64/simple_idct: fix idct_col4_top coefficient Fixes regression introduced by 5d0b8b1ae307951310c7d9a8fa282fbca9b997cd. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8aa60606fb64b8280627935b0df55d4d2aeca5d1 --- libavcodec/aarch64/simple_idct_neon.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S index 92987985d2..5bd31e5be9 100644 --- a/libavcodec/aarch64/simple_idct_neon.S +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -74,7 +74,7 @@ endconst .endm .macro idct_col4_top y1, y2, y3, y4, i, l -smull\i v7.4S, \y3\l, z1 +smull\i v7.4S, \y3\l, z2 smull\i v16.4S, \y3\l, z6 smull\i v17.4S, \y2\l, z1 add v19.4S, v23.4S, v7.4S ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix idct_col4_top coefficient
ffmpeg | branch: release/3.3 | Matthieu Bouron | Tue Jun 13 17:19:51 2017 +0200| [20f5e2c17785ef84db565e658420faf6f8ca0807] | committer: Matthieu Bouron lavc/aarch64/simple_idct: fix idct_col4_top coefficient Fixes regression introduced by 5d0b8b1ae307951310c7d9a8fa282fbca9b997cd. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20f5e2c17785ef84db565e658420faf6f8ca0807 --- libavcodec/aarch64/simple_idct_neon.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S index 92987985d2..5bd31e5be9 100644 --- a/libavcodec/aarch64/simple_idct_neon.S +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -74,7 +74,7 @@ endconst .endm .macro idct_col4_top y1, y2, y3, y4, i, l -smull\i v7.4S, \y3\l, z1 +smull\i v7.4S, \y3\l, z2 smull\i v16.4S, \y3\l, z6 smull\i v17.4S, \y2\l, z1 add v19.4S, v23.4S, v7.4S ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64/simple_idct: fix build with Xcode 7.2
ffmpeg | branch: master | Matthieu Bouron | Wed Jun 14 13:28:18 2017 +0200| [204008354f7f18fa9e64a6d487f65495f1cc9885] | committer: Matthieu Bouron lavc/aarch64/simple_idct: fix build with Xcode 7.2 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=204008354f7f18fa9e64a6d487f65495f1cc9885 --- libavcodec/aarch64/simple_idct_neon.S | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S index 5bd31e5be9..5e4d021a97 100644 --- a/libavcodec/aarch64/simple_idct_neon.S +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -92,10 +92,10 @@ endconst .endm .macro idct_row4_neon y1, y2, y3, y4, pass -ld1 {\y1\().2D-\y2\().2D}, [x2], #32 +ld1 {\y1\().2D,\y2\().2D}, [x2], #32 moviv23.4S, #1<<2, lsl #8 orr v5.16B, \y1\().16B, \y2\().16B -ld1 {\y3\().2D, \y4\().2D}, [x2], #32 +ld1 {\y3\().2D,\y4\().2D}, [x2], #32 orr v6.16B, \y3\().16B, \y4\().16B orr v5.16B, v5.16B, v6.16B mov x3, v5.D[1] @@ -104,7 +104,7 @@ endconst idct_col4_top \y1, \y2, \y3, \y4, 1, .4H cmp x3, #0 -beq \pass\()f +b.eq\pass\()f smull2 v7.4S, \y1\().8H, z4 smlal2 v17.4S, \y2\().8H, z5 @@ -169,7 +169,7 @@ function idct_col4_neon\i mov x4, v28.D[\i - 1] mov x5, v29.D[\i - 1] cmp x4, #0 -beq 1f +b.eq1f smull\i v7.4S, v28\l, z4 add v19.4S, v19.4S, v7.4S @@ -179,7 +179,7 @@ function idct_col4_neon\i 1: mov x4, v30.D[\i - 1] cmp x5, #0 -beq 2f +b.eq2f smlal\i v17.4S, v29\l, z5 smlsl\i v18.4S, v29\l, z1 @@ -188,7 +188,7 @@ function idct_col4_neon\i 2: mov x5, v31.D[\i - 1] cmp x4, #0 -beq 3f +b.eq3f smull\i v7.4S, v30\l, z6 smull\i v16.4S, v30\l, z2 @@ -198,7 +198,7 @@ function idct_col4_neon\i add v21.4S, v21.4S, v16.4S 3: cmp x5, #0 -beq 4f +b.eq4f smlal\i v17.4S, v31\l, z7 smlsl\i v18.4S, v31\l, z5 @@ -267,14 +267,14 @@ function ff_simple_idct_add_neon, export=1 idct_row4_neon v28, v29, v30, v31, 2 bl idct_col4_neon1 -sshrv1.8H, V7.8H, #COL_SHIFT-16 +sshrv1.8H, v7.8H, #COL_SHIFT-16 sshrv2.8H, v16.8H, #COL_SHIFT-16 sshrv3.8H, v17.8H, #COL_SHIFT-16 sshrv4.8H, v18.8H, #COL_SHIFT-16 bl idct_col4_neon2 -sshrv7.8H, V7.8H, #COL_SHIFT-16 +sshrv7.8H, v7.8H, #COL_SHIFT-16 sshrv16.8H, v16.8H, #COL_SHIFT-16 sshrv17.8H, v17.8H, #COL_SHIFT-16 sshrv18.8H, v18.8H, #COL_SHIFT-16 @@ -330,7 +330,7 @@ function ff_simple_idct_neon, export=1 mov x2, x0 idct_row4_neon v24, v25, v26, v27, 1 idct_row4_neon v28, v29, v30, v31, 2 -add x2, x2, #-128 +sub x2, x2, #128 bl idct_col4_neon1 sshrv1.8H, v7.8H, #COL_SHIFT-16 @@ -347,16 +347,16 @@ function ff_simple_idct_neon, export=1 zip1v23.2D, v1.2D, v7.2D zip2v24.2D, v1.2D, v7.2D -st1 {v23.2D,V24.2D}, [x2], #32 +st1 {v23.2D,v24.2D}, [x2], #32 zip1v25.2D, v2.2D, v16.2D zip2v26.2D, v2.2D, v16.2D -st1 {v25.2D,V26.2D}, [x2], #32 +st1 {v25.2D,v26.2D}, [x2], #32 zip1v27.2D, v3.2D, v17.2D zip2v28.2D, v3.2D, v17.2D -st1 {v27.2D,V28.2D}, [x2], #32 +st1 {v27.2D,v28.2D}, [x2], #32 zip1v29.2D, v4.2D, v18.2D zip2v30.2D, v4.2D, v18.2D -st1 {v29.2D,V30.2D}, [x2], #32 +st1 {v29.2D,v30.2D}, [x2], #32 idct_end endfunc ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] checkasm/aarch64: fix tests returning a float
ffmpeg | branch: master | Matthieu Bouron | Mon Jun 19 10:55:28 2017 +0200| [067e42b851a707924a154c4757516cc488985eb3] | committer: Matthieu Bouron checkasm/aarch64: fix tests returning a float Avoids overriding the v0 register (which containins the result of the tested function) in checkasm_call_checked. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=067e42b851a707924a154c4757516cc488985eb3 --- tests/checkasm/aarch64/checkasm.S | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/checkasm/aarch64/checkasm.S b/tests/checkasm/aarch64/checkasm.S index 53a2a478dc..75a9a56143 100644 --- a/tests/checkasm/aarch64/checkasm.S +++ b/tests/checkasm/aarch64/checkasm.S @@ -112,10 +112,10 @@ function checkasm_checked_call, export=1 moviv3.8h, #0 .macro check_reg_neon reg1, reg2 -ldr q0, [x9], #16 -uzp1v1.2d, v\reg1\().2d, v\reg2\().2d -eor v0.16b, v0.16b, v1.16b -orr v3.16b, v3.16b, v0.16b +ldr q1, [x9], #16 +uzp1v2.2d, v\reg1\().2d, v\reg2\().2d +eor v1.16b, v1.16b, v2.16b +orr v3.16b, v3.16b, v1.16b .endm check_reg_neon 8, 9 check_reg_neon 10, 11 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/x86: clear r2 higher bits in ff_sbr_sum_square
ffmpeg | branch: master | Matthieu Bouron | Fri Jun 23 16:32:31 2017 +0200| [db5bf64b214d9888c8cf30a8235d0655a63139d7] | committer: Matthieu Bouron lavc/x86: clear r2 higher bits in ff_sbr_sum_square Suggested-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db5bf64b214d9888c8cf30a8235d0655a63139d7 --- libavcodec/x86/sbrdsp.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm index 07a412b2ae..d0f774b277 100644 --- a/libavcodec/x86/sbrdsp.asm +++ b/libavcodec/x86/sbrdsp.asm @@ -38,7 +38,7 @@ SECTION .text INIT_XMM sse cglobal sbr_sum_square, 2, 3, 6 -mov r2, r1 +movr2d, r1d xorps m0, m0 xorps m1, m1 sar r2, 3 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] checkasm: add sbrdsp tests
ffmpeg | branch: master | Matthieu Bouron | Fri Jun 9 09:34:12 2017 +| [7864e07f4af248d35a1e81d6d5c435f4cd2023e1] | committer: Matthieu Bouron checkasm: add sbrdsp tests > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7864e07f4af248d35a1e81d6d5c435f4cd2023e1 --- tests/checkasm/Makefile | 3 +- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/sbrdsp.c | 298 ++ 4 files changed, 302 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 638e811931..60e80ab738 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -13,7 +13,8 @@ AVCODECOBJS-$(CONFIG_VP8DSP)+= vp8dsp.o AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o # decoders/encoders -AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o +AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \ + sbrdsp.o AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e66744b162..29f201b1b3 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -67,6 +67,7 @@ static const struct { #if CONFIG_AVCODEC #if CONFIG_AAC_DECODER { "aacpsdsp", checkasm_check_aacpsdsp }, +{ "sbrdsp", checkasm_check_sbrdsp }, #endif #if CONFIG_ALAC_DECODER { "alacdsp", checkasm_check_alacdsp }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index dfb0ce561c..fa51e71e4b 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -50,6 +50,7 @@ void checkasm_check_hevc_idct(void); void checkasm_check_jpeg2000dsp(void); void checkasm_check_llviddsp(void); void checkasm_check_pixblockdsp(void); +void checkasm_check_sbrdsp(void); void checkasm_check_synth_filter(void); void checkasm_check_v210enc(void); void checkasm_check_vp8dsp(void); diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c new file mode 100644 index 00..038318e021 --- /dev/null +++ b/tests/checkasm/sbrdsp.c @@ -0,0 +1,298 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "libavcodec/sbrdsp.h" + +#include "checkasm.h" + +#define randomize(buf, len) do {\ +int i; \ +for (i = 0; i < len; i++) { \ +const INTFLOAT f = (INTFLOAT)rnd() / UINT_MAX; \ +(buf)[i] = f; \ +} \ +} while (0) + +#define EPS 0.0001 + +static void test_sum64x5(void) +{ +LOCAL_ALIGNED_16(INTFLOAT, dst0, [64 + 256]); +LOCAL_ALIGNED_16(INTFLOAT, dst1, [64 + 256]); + +declare_func(void, INTFLOAT *z); + +randomize((INTFLOAT *)dst0, 64 + 256); +memcpy(dst1, dst0, (64 + 256) * sizeof(INTFLOAT)); +call_ref(dst0); +call_new(dst1); +if (!float_near_abs_eps_array(dst0, dst1, EPS, 64 + 256)) +fail(); +bench_new(dst1); +} + +static void test_sum_square(void) +{ +INTFLOAT res0; +INTFLOAT res1; +LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]); + +declare_func(INTFLOAT, INTFLOAT (*x)[2], int n); + +randomize((INTFLOAT *)src, 256 * 2); +res0 = call_ref(src, 256); +res1 = call_new(src, 256); +if (!float_near_abs_eps(res0, res1, EPS)) +fail(); +bench_new(src, 256); +} + +static void test_neg_odd_64(void) +{ +LOCAL_ALIGNED_16(INTFLOAT, dst0, [64]); +LOCAL_ALIGNED_16(INTFLOAT, dst1, [64]); + +declare_func(void, INTFLOAT *x); + +randomize((INTFLOAT *)dst0, 64); +memcpy(dst1, dst0, (64) * sizeof(INTFLOAT)); +call_ref(dst0); +call_new(dst1); +if (!float_near_abs_eps_array(dst0, dst1, EPS, 64)) +fail(); +bench_new(dst1); +} + +static void test_qmf_pre_shuffle(void) +{ +LOCAL_ALIGNED_16(INTFLOAT, dst0, [128]); +LOCAL_ALIGNED_16(INTFLOAT, dst1, [128]); + +declare_func(void, INTFLOAT *z); + +randomize((INTFL
[FFmpeg-cvslog] lavc/aarch64: add sbrdsp neon implementation
ffmpeg | branch: master | Matthieu Bouron | Tue May 23 14:29:35 2017 +| [0a24d7ca831b85db18593e5f18d765adb40e5cd9] | committer: Matthieu Bouron lavc/aarch64: add sbrdsp neon implementation autocorrelate_c: 644.0 autocorrelate_neon: 420.0 hf_apply_noise_0_c: 1688.5 hf_apply_noise_0_neon: 1498.6 hf_apply_noise_1_c: 1691.2 hf_apply_noise_1_neon: 1500.6 hf_apply_noise_2_c: 1688.1 hf_apply_noise_2_neon: 1500.3 hf_apply_noise_3_c: 1696.6 hf_apply_noise_3_neon: 1502.2 hf_g_filt_c: 2117.8 hf_g_filt_neon: 1218.7 hf_gen_c: 4573.4 hf_gen_neon: 2461.0 neg_odd_64_c: 72.0 neg_odd_64_neon: 64.7 qmf_deint_bfly_c: 1107.6 qmf_deint_bfly_neon: 291.6 qmf_deint_neg_c: 210.4 qmf_deint_neg_neon: 107.4 qmf_post_shuffle_c: 163.0 qmf_post_shuffle_neon: 107.7 qmf_pre_shuffle_c: 120.5 qmf_pre_shuffle_neon: 110.7 sum64x5_c: 1361.6 sum64x5_neon: 435.4 sum_square_c: 1686.4 sum_square_neon: 787.2 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a24d7ca831b85db18593e5f18d765adb40e5cd9 --- libavcodec/aarch64/Makefile | 4 +- libavcodec/aarch64/sbrdsp_init_aarch64.c | 70 +++ libavcodec/aarch64/sbrdsp_neon.S | 327 +++ libavcodec/sbrdsp.h | 1 + libavcodec/sbrdsp_template.c | 2 + 5 files changed, 403 insertions(+), 1 deletion(-) diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index d440b1b18a..72080c2dbb 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -11,7 +11,8 @@ OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o # decoders/encoders -OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_init_aarch64.o +OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_init_aarch64.o \ + aarch64/sbrdsp_init_aarch64.o OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_init.o OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o @@ -28,6 +29,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o # NEON optimizations # subsystems +NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/sbrdsp_neon.o NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o NEON-OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_neon.o NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o diff --git a/libavcodec/aarch64/sbrdsp_init_aarch64.c b/libavcodec/aarch64/sbrdsp_init_aarch64.c new file mode 100644 index 00..9c967990df --- /dev/null +++ b/libavcodec/aarch64/sbrdsp_init_aarch64.c @@ -0,0 +1,70 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/aarch64/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/sbrdsp.h" + +void ff_sbr_sum64x5_neon(float *z); +float ff_sbr_sum_square_neon(float (*x)[2], int n); +void ff_sbr_neg_odd_64_neon(float *x); +void ff_sbr_qmf_pre_shuffle_neon(float *z); +void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z); +void ff_sbr_qmf_deint_neg_neon(float *v, const float *src); +void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1); +void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, intptr_t ixh); +void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2], +const float alpha0[2], const float alpha1[2], +float bw, int start, int end); +void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]); +void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m, +
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix jni vaargs types
ffmpeg | branch: master | Matthieu Bouron | Fri Sep 15 13:45:47 2017 +0200| [dd8ffb191fd24f5b783b9722f63019120d61c48c] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix jni vaargs types Fixes decoding on 32-bit devices with Android NDK >= 15. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd8ffb191fd24f5b783b9722f63019120d61c48c --- libavcodec/mediacodec_wrapper.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 4a37cd7cd7..f34450a6d8 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1448,7 +1448,7 @@ int ff_AMediaCodec_releaseOutputBuffer(FFAMediaCodec* codec, size_t idx, int ren JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); -(*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_id, idx, render); +(*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_id, (jint)idx, (jboolean)render); if (ff_jni_exception_check(env, 1, codec) < 0) { ret = AVERROR_EXTERNAL; goto fail; @@ -1465,7 +1465,7 @@ int ff_AMediaCodec_releaseOutputBufferAtTime(FFAMediaCodec *codec, size_t idx, i JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); -(*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_at_time_id, idx, timestampNs); +(*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_at_time_id, (jint)idx, timestampNs); if (ff_jni_exception_check(env, 1, codec) < 0) { ret = AVERROR_EXTERNAL; goto fail; @@ -1499,7 +1499,7 @@ int ff_AMediaCodec_queueInputBuffer(FFAMediaCodec* codec, size_t idx, off_t offs JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); -(*env)->CallVoidMethod(env, codec->object, codec->jfields.queue_input_buffer_id, idx, offset, size, time, flags); +(*env)->CallVoidMethod(env, codec->object, codec->jfields.queue_input_buffer_id, (jint)idx, (jint)offset, (jint)size, time, flags); if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { ret = AVERROR_EXTERNAL; goto fail; @@ -1572,7 +1572,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNI_GET_ENV_OR_RETURN(env, codec, NULL); if (codec->has_get_i_o_buffer) { -buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffer_id, idx); +buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffer_id, (jint)idx); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1620,7 +1620,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t JNI_GET_ENV_OR_RETURN(env, codec, NULL); if (codec->has_get_i_o_buffer) { -buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffer_id, idx); +buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffer_id, (jint)idx); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: fix potential jni global reference leak
ffmpeg | branch: master | Matthieu Bouron | Sat Dec 16 00:16:02 2017 +0100| [1f1207145a0f2d26e5e3525bea6cc417a3ec39cf] | committer: Matthieu Bouron lavc/mediacodec_wrapper: fix potential jni global reference leak > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f1207145a0f2d26e5e3525bea6cc417a3ec39cf --- libavcodec/mediacodec_wrapper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 329a5eb896..d9f0e27a7d 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1206,6 +1206,9 @@ fail: } if (ret < 0) { +if (codec->object) { +(*env)->DeleteGlobalRef(env, codec->object); +} ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); av_freep(&codec); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: factorize MediaCodec creation functions
ffmpeg | branch: master | Matthieu Bouron | Wed Dec 13 13:49:58 2017 +0100| [f3cffd121b990717996d8ddd646bd555c1db135b] | committer: Matthieu Bouron lavc/mediacodec_wrapper: factorize MediaCodec creation functions > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3cffd121b990717996d8ddd646bd555c1db135b --- libavcodec/mediacodec_wrapper.c | 162 +++- 1 file changed, 29 insertions(+), 133 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index f34450a6d8..329a5eb896 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1132,13 +1132,18 @@ fail: return ret; } -FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) +#define CREATE_CODEC_BY_NAME 0 +#define CREATE_DECODER_BY_TYPE 1 +#define CREATE_ENCODER_BY_TYPE 2 + +static inline FFAMediaCodec *codec_create(int method, const char *arg) { int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; -jstring codec_name = NULL; +jstring jarg = NULL; jobject object = NULL; +jmethodID create_id = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { @@ -1156,77 +1161,23 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) goto fail; } -codec_name = ff_jni_utf_chars_to_jstring(env, name, codec); -if (!codec_name) { -goto fail; -} - -object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); -if (ff_jni_exception_check(env, 1, codec) < 0) { -goto fail; -} - -codec->object = (*env)->NewGlobalRef(env, object); -if (!codec->object) { -goto fail; -} - -if (codec_init_static_fields(codec) < 0) { -goto fail; -} - -if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { -codec->has_get_i_o_buffer = 1; -} - -ret = 0; -fail: -if (codec_name) { -(*env)->DeleteLocalRef(env, codec_name); -} - -if (object) { -(*env)->DeleteLocalRef(env, object); -} - -if (ret < 0) { -ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); -av_freep(&codec); -} - -return codec; -} - -FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) -{ -int ret = -1; -JNIEnv *env = NULL; -FFAMediaCodec *codec = NULL; -jstring mime_type = NULL; -jobject object = NULL; - -codec = av_mallocz(sizeof(FFAMediaCodec)); -if (!codec) { -return NULL; -} -codec->class = &amediacodec_class; - -env = ff_jni_get_env(codec); -if (!env) { -av_freep(&codec); -return NULL; -} - -if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { +jarg = ff_jni_utf_chars_to_jstring(env, arg, codec); +if (!jarg) { goto fail; } -mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec); -if (!mime_type) { -goto fail; +switch (method) { +case CREATE_CODEC_BY_NAME: create_id = codec->jfields.create_by_codec_name_id; break; +case CREATE_DECODER_BY_TYPE: create_id = codec->jfields.create_decoder_by_type_id; break; +case CREATE_ENCODER_BY_TYPE: create_id = codec->jfields.create_encoder_by_type_id; break; +default: +av_assert0(0); } -object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); +object = (*env)->CallStaticObjectMethod(env, +codec->jfields.mediacodec_class, +create_id, +jarg); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } @@ -1246,8 +1197,8 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) ret = 0; fail: -if (mime_type) { -(*env)->DeleteLocalRef(env, mime_type); +if (jarg) { +(*env)->DeleteLocalRef(env, jarg); } if (object) { @@ -1262,70 +1213,15 @@ fail: return codec; } -FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime) -{ -int ret = -1; -JNIEnv *env = NULL; -FFAMediaCodec *codec = NULL; -jstring mime_type = NULL; -jobject object = NULL; +#define DECLARE_FF_AMEDIACODEC_CREATE_FUNC(name, method) \ +FFAMediaCodec *ff_AMediaCodec_##name(const char *arg)\ +{\ +return codec_create(method, arg);\ +}\ -codec = av_mallocz(sizeof(FFAMediaCodec)); -if (!codec) { -return NULL; -} -codec->class =
[FFmpeg-cvslog] lavc/mediacodecdec: remove mediacodec_process_data() indirection
ffmpeg | branch: master | Matthieu Bouron | Wed Jan 3 13:10:58 2018 +0100| [d19174c673b8788de825a936d8d7c9340aefcd56] | committer: Matthieu Bouron lavc/mediacodecdec: remove mediacodec_process_data() indirection > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d19174c673b8788de825a936d8d7c9340aefcd56 --- libavcodec/mediacodecdec.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 35a9e34861..6c5d3ddd79 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -416,15 +416,6 @@ done: return ret; } - -static int mediacodec_process_data(AVCodecContext *avctx, AVFrame *frame, - int *got_frame, AVPacket *pkt) -{ -MediaCodecH264DecContext *s = avctx->priv_data; - -return ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, pkt); -} - static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) { MediaCodecH264DecContext *s = avctx->priv_data; @@ -505,7 +496,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) av_fifo_generic_read(s->fifo, &s->buffered_pkt, sizeof(s->buffered_pkt), NULL); } -ret = mediacodec_process_data(avctx, frame, &got_frame, &s->buffered_pkt); +ret = ff_mediacodec_dec_decode(avctx, s->ctx, frame, &got_frame, &s->buffered_pkt); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once
ffmpeg | branch: master | Matthieu Bouron | Wed Jan 3 13:54:34 2018 +0100| [e30b46b1aeea03fc5cbcecc03f7103cf204090f0] | committer: Matthieu Bouron lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e30b46b1aeea03fc5cbcecc03f7103cf204090f0 --- libavcodec/mediacodec_wrapper.c | 61 +++-- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index d9f0e27a7d..dbc37bf463 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -274,6 +274,7 @@ struct FFAMediaCodec { struct JNIAMediaCodecFields jfields; jobject object; +jobject buffer_info; jobject input_buffers; jobject output_buffers; @@ -1143,6 +1144,7 @@ static inline FFAMediaCodec *codec_create(int method, const char *arg) FFAMediaCodec *codec = NULL; jstring jarg = NULL; jobject object = NULL; +jobject buffer_info = NULL; jmethodID create_id = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); @@ -1195,6 +1197,16 @@ static inline FFAMediaCodec *codec_create(int method, const char *arg) codec->has_get_i_o_buffer = 1; } +buffer_info = (*env)->NewObject(env, codec->jfields.mediainfo_class, codec->jfields.init_id); +if (ff_jni_exception_check(env, 1, codec) < 0) { +goto fail; +} + +codec->buffer_info = (*env)->NewGlobalRef(env, buffer_info); +if (!codec->buffer_info) { +goto fail; +} + ret = 0; fail: if (jarg) { @@ -1205,10 +1217,19 @@ fail: (*env)->DeleteLocalRef(env, object); } +if (buffer_info) { +(*env)->DeleteLocalRef(env, buffer_info); +} + if (ret < 0) { if (codec->object) { (*env)->DeleteGlobalRef(env, codec->object); } + +if (codec->buffer_info) { +(*env)->DeleteGlobalRef(env, codec->buffer_info); +} + ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); av_freep(&codec); } @@ -1246,6 +1267,9 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec) (*env)->DeleteGlobalRef(env, codec->object); codec->object = NULL; +(*env)->DeleteGlobalRef(env, codec->buffer_info); +codec->buffer_info = NULL; + ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); av_freep(&codec); @@ -1413,48 +1437,31 @@ ssize_t ff_AMediaCodec_dequeueOutputBuffer(FFAMediaCodec* codec, FFAMediaCodecBu int ret = 0; JNIEnv *env = NULL; -jobject mediainfo = NULL; - JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); -mediainfo = (*env)->NewObject(env, codec->jfields.mediainfo_class, codec->jfields.init_id); +ret = (*env)->CallIntMethod(env, codec->object, codec->jfields.dequeue_output_buffer_id, codec->buffer_info, timeoutUs); if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; +return AVERROR_EXTERNAL; } -ret = (*env)->CallIntMethod(env, codec->object, codec->jfields.dequeue_output_buffer_id, mediainfo, timeoutUs); +info->flags = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.flags_id); if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; +return AVERROR_EXTERNAL; } -info->flags = (*env)->GetIntField(env, mediainfo, codec->jfields.flags_id); +info->offset = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.offset_id); if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; +return AVERROR_EXTERNAL; } -info->offset = (*env)->GetIntField(env, mediainfo, codec->jfields.offset_id); +info->presentationTimeUs = (*env)->GetLongField(env, codec->buffer_info, codec->jfields.presentation_time_us_id); if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; +return AVERROR_EXTERNAL; } -info->presentationTimeUs = (*env)->GetLongField(env, mediainfo, codec->jfields.presentation_time_us_id); +info->size = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.size_id); if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; -} - -info->size = (*env)->GetIntField(env, mediainfo, codec->jfields.size_id); -if (ff_jni_exception_check(env, 1, codec) < 0) { -ret = AVERROR_EXTERNAL; -goto fail; -} -fail: -if (mediainfo) { -(*env)->DeleteLocalRef(env, mediainfo); +return AVERROR_EXTERNAL; } return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format()
ffmpeg | branch: master | Matthieu Bouron | Mon Feb 19 16:13:00 2018 +0100| [a079eaba8ee20bc3869852df658f2f6cc11875e3] | committer: Matthieu Bouron avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a079eaba8ee20bc3869852df658f2f6cc11875e3 --- libavcodec/mediacodecdec_common.c | 82 ++- 1 file changed, 30 insertions(+), 52 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index b44abaef7f..ab26df04bd 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -339,11 +339,22 @@ done: return ret; } +#define AMEDIAFORMAT_GET_INT32(name, key, mandatory) do { \ +int32_t value = 0; \ +if (ff_AMediaFormat_getInt32(s->format, key, &value)) { \ +(name) = value; \ +} else if (mandatory) { \ +av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", key, format); \ +ret = AVERROR_EXTERNAL; \ +goto fail; \ +} \ +} while (0) \ + static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecContext *s) { +int ret = 0; int width = 0; int height = 0; -int32_t value = 0; char *format = NULL; if (!s->format) { @@ -356,40 +367,16 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte return AVERROR_EXTERNAL; } av_log(avctx, AV_LOG_DEBUG, "Parsing MediaFormat %s\n", format); -av_freep(&format); /* Mandatory fields */ -if (!ff_AMediaFormat_getInt32(s->format, "width", &value)) { -format = ff_AMediaFormat_toString(s->format); -av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", "width", format); -av_freep(&format); -return AVERROR_EXTERNAL; -} -s->width = value; +AMEDIAFORMAT_GET_INT32(s->width, "width", 1); +AMEDIAFORMAT_GET_INT32(s->height, "height", 1); -if (!ff_AMediaFormat_getInt32(s->format, "height", &value)) { -format = ff_AMediaFormat_toString(s->format); -av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", "height", format); -av_freep(&format); -return AVERROR_EXTERNAL; -} -s->height = value; +AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1); +s->stride = s->stride > 0 ? s->stride : s->width; -if (!ff_AMediaFormat_getInt32(s->format, "stride", &value)) { -format = ff_AMediaFormat_toString(s->format); -av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", "stride", format); -av_freep(&format); -return AVERROR_EXTERNAL; -} -s->stride = value > 0 ? value : s->width; - -if (!ff_AMediaFormat_getInt32(s->format, "slice-height", &value)) { -format = ff_AMediaFormat_toString(s->format); -av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", "slice-height", format); -av_freep(&format); -return AVERROR_EXTERNAL; -} -s->slice_height = value > 0 ? value : s->height; +AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1); +s->slice_height = s->slice_height > 0 ? s->slice_height : s->height; if (strstr(s->codec_name, "OMX.Nvidia.")) { s->slice_height = FFALIGN(s->height, 16); @@ -398,32 +385,19 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte s->stride = avctx->width; } -if (!ff_AMediaFormat_getInt32(s->format, "color-format", &value)) { -format = ff_AMediaFormat_toString(s->format); -av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", "color-format", format); -av_freep(&format); -return AVERROR_EXTERNAL; -} -s->color_format = value; - -s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, value); +AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1); +s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, s->color_f
[FFmpeg-cvslog] avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContext
ffmpeg | branch: master | Matthieu Bouron | Tue Feb 20 11:08:01 2018 +0100| [cc9875dc29383dd2c82dee3736e0cf53008a865e] | committer: Matthieu Bouron avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContext > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc9875dc29383dd2c82dee3736e0cf53008a865e --- libavcodec/mediacodecdec_common.c | 2 +- libavcodec/mediacodecdec_common.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 195cc70ba7..929db78361 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -386,7 +386,7 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte } AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1); -s->pix_fmt = avctx->pix_fmt = mcdec_map_color_format(avctx, s, s->color_format); +avctx->pix_fmt = mcdec_map_color_format(avctx, s, s->color_format); if (avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Output color format is not supported\n"); ret = AVERROR(EINVAL); diff --git a/libavcodec/mediacodecdec_common.h b/libavcodec/mediacodecdec_common.h index 32d16d3e3a..85df507ffb 100644 --- a/libavcodec/mediacodecdec_common.h +++ b/libavcodec/mediacodecdec_common.h @@ -55,7 +55,6 @@ typedef struct MediaCodecDecContext { int stride; int slice_height; int color_format; -enum AVPixelFormat pix_fmt; int crop_top; int crop_bottom; int crop_left; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec_common: remove spurious space
ffmpeg | branch: master | Matthieu Bouron | Mon Feb 19 16:13:51 2018 +0100| [5d69e249c81ec71630b4cb536907cc831fadef6b] | committer: Matthieu Bouron avcodec/mediacodecdec_common: remove spurious space > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d69e249c81ec71630b4cb536907cc831fadef6b --- libavcodec/mediacodecdec_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index ab26df04bd..195cc70ba7 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -415,7 +415,6 @@ fail: return ret; } - static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContext *s) { FFAMediaCodec *codec = s->codec; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()
ffmpeg | branch: master | Matthieu Bouron | Wed Feb 21 14:15:42 2018 +0100| [c55ba52a6a0698e0d6a9f7698f7dcc384764505a] | committer: Matthieu Bouron avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey() Avoids triggering an exception in MediaFormat getter functions if the key does not exist. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c55ba52a6a0698e0d6a9f7698f7dcc384764505a --- libavcodec/mediacodec_wrapper.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index dbc37bf463..9436b3c994 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -111,6 +111,8 @@ struct JNIAMediaFormatFields { jmethodID init_id; +jmethodID contains_key_id; + jmethodID get_integer_id; jmethodID get_long_id; jmethodID get_float_id; @@ -132,6 +134,8 @@ static const struct FFJniField jni_amediaformat_mapping[] = { { "android/media/MediaFormat", "", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, init_id), 1 }, +{ "android/media/MediaFormat", "containsKey", "(Ljava/lang/String;)Z", FF_JNI_METHOD,offsetof(struct JNIAMediaFormatFields, contains_key_id), 1 }, + { "android/media/MediaFormat", "getInteger", "(Ljava/lang/String;)I", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_integer_id), 1 }, { "android/media/MediaFormat", "getLong", "(Ljava/lang/String;)J", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_long_id), 1 }, { "android/media/MediaFormat", "getFloat", "(Ljava/lang/String;)F", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_float_id), 1 }, @@ -738,6 +742,7 @@ int ff_AMediaFormat_getInt32(FFAMediaFormat* format, const char *name, int32_t * JNIEnv *env = NULL; jstring key = NULL; +jboolean contains_key; av_assert0(format != NULL); @@ -749,6 +754,12 @@ int ff_AMediaFormat_getInt32(FFAMediaFormat* format, const char *name, int32_t * goto fail; } +contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); +if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { +ret = 0; +goto fail; +} + *out = (*env)->CallIntMethod(env, format->object, format->jfields.get_integer_id, key); if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { ret = 0; @@ -770,6 +781,7 @@ int ff_AMediaFormat_getInt64(FFAMediaFormat* format, const char *name, int64_t * JNIEnv *env = NULL; jstring key = NULL; +jboolean contains_key; av_assert0(format != NULL); @@ -781,6 +793,12 @@ int ff_AMediaFormat_getInt64(FFAMediaFormat* format, const char *name, int64_t * goto fail; } +contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); +if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { +ret = 0; +goto fail; +} + *out = (*env)->CallLongMethod(env, format->object, format->jfields.get_long_id, key); if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { ret = 0; @@ -802,6 +820,7 @@ int ff_AMediaFormat_getFloat(FFAMediaFormat* format, const char *name, float *ou JNIEnv *env = NULL; jstring key = NULL; +jboolean contains_key; av_assert0(format != NULL); @@ -813,6 +832,12 @@ int ff_AMediaFormat_getFloat(FFAMediaFormat* format, const char *name, float *ou goto fail; } +contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); +if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { +ret = 0; +goto fail; +} + *out = (*env)->CallFloatMethod(env, format->object, format->jfields.get_float_id, key); if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { ret = 0; @@ -834,6 +859,7 @@ int ff_AMediaFormat_getBuffer(FFAMediaFormat* format, const char *name, void** d JNIEnv *env = NULL; jstring key = NULL; +jboolean contains_key; jobject result = NULL; av_assert0(format != NULL); @@ -846,6 +872,12 @@ int ff_AMediaFormat_getBuffer(FFAMediaFormat* format, const char *name, void** d goto fail; } +contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); +if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { +ret = 0; +goto fail; +} + result = (*env)->CallObjectMethod(env, format->object, format->jfields.get_bytebuffer_id, key);
[FFmpeg-cvslog] avcodec/mediacodecdec: factorize codec declarations
ffmpeg | branch: master | Matthieu Bouron | Fri Mar 2 12:06:19 2018 +0100| [2238e54ef02b7a7ce3ddf614280d7d883ed2a9e6] | committer: Matthieu Bouron avcodec/mediacodecdec: factorize codec declarations > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2238e54ef02b7a7ce3ddf614280d7d883ed2a9e6 --- libavcodec/mediacodecdec.c | 116 ++--- 1 file changed, 24 insertions(+), 92 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 4579da1fa5..0fe14846c3 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -485,112 +485,44 @@ static const AVCodecHWConfigInternal *mediacodec_hw_configs[] = { NULL }; +#define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf) \ +AVCodec ff_##short_name##_mediacodec_decoder = { \ +.name = #short_name "_mediacodec", \ +.long_name = NULL_IF_CONFIG_SMALL(full_name " Android MediaCodec decoder"), \ +.type = AVMEDIA_TYPE_VIDEO, \ +.id = codec_id, \ +.priv_data_size = sizeof(MediaCodecH264DecContext), \ +.init = mediacodec_decode_init, \ +.receive_frame = mediacodec_receive_frame, \ +.flush = mediacodec_decode_flush, \ +.close = mediacodec_decode_close, \ +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \ +.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \ +.bsfs = bsf, \ +.hw_configs = mediacodec_hw_configs, \ +.wrapper_name = "mediacodec", \ +}; \ + #if CONFIG_H264_MEDIACODEC_DECODER -AVCodec ff_h264_mediacodec_decoder = { -.name = "h264_mediacodec", -.long_name = NULL_IF_CONFIG_SMALL("H.264 Android MediaCodec decoder"), -.type = AVMEDIA_TYPE_VIDEO, -.id = AV_CODEC_ID_H264, -.priv_data_size = sizeof(MediaCodecH264DecContext), -.init = mediacodec_decode_init, -.receive_frame = mediacodec_receive_frame, -.flush = mediacodec_decode_flush, -.close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, -.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, -.bsfs = "h264_mp4toannexb", -.hw_configs = mediacodec_hw_configs, -.wrapper_name = "mediacodec", -}; +DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb") #endif #if CONFIG_HEVC_MEDIACODEC_DECODER -AVCodec ff_hevc_mediacodec_decoder = { -.name = "hevc_mediacodec", -.long_name = NULL_IF_CONFIG_SMALL("H.265 Android MediaCodec decoder"), -.type = AVMEDIA_TYPE_VIDEO, -.id = AV_CODEC_ID_HEVC, -.priv_data_size = sizeof(MediaCodecH264DecContext), -.init = mediacodec_decode_init, -.receive_frame = mediacodec_receive_frame, -.flush = mediacodec_decode_flush, -.close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, -.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, -.bsfs = "hevc_mp4toannexb", -.hw_configs = mediacodec_hw_configs, -.wrapper_name = "mediacodec", -}; +DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb") #endif #if CONFIG_MPEG2_MEDIACODEC_DECODER -AVCodec ff_mpeg2_mediacodec_decoder = { -.name = "mpeg2_mediacodec", -.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 Android MediaCodec decoder"), -.type = AVMEDIA_TYPE_VIDEO, -.id = AV_CODEC_ID_MPEG2VIDEO, -.priv_data_size = sizeof(MediaCodecH264DecContext), -.init = mediacodec_decode_init, -.receive_frame = mediacodec_receive_frame, -.flush = mediacodec_decode_flush, -.close = mediacodec_decode_close, -.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_C
[FFmpeg-cvslog] avcodec/mediacodecdec: factorize common extradata functions
ffmpeg | branch: master | Matthieu Bouron | Fri Mar 2 10:36:08 2018 +0100| [af167d970bbf86c5741e4ba8d524be77085c30ae] | committer: Matthieu Bouron avcodec/mediacodecdec: factorize common extradata functions > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af167d970bbf86c5741e4ba8d524be77085c30ae --- libavcodec/mediacodecdec.c | 41 + 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index ad09d16398..4579da1fa5 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -264,34 +264,11 @@ done: } #endif -#if CONFIG_MPEG2_MEDIACODEC_DECODER -static int mpeg2_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) -{ -int ret = 0; - -if (avctx->extradata) { -ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size); -} - -return ret; -} -#endif - -#if CONFIG_MPEG4_MEDIACODEC_DECODER -static int mpeg4_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) -{ -int ret = 0; - -if (avctx->extradata) { -ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size); -} - -return ret; -} -#endif - -#if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER -static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) +#if CONFIG_MPEG2_MEDIACODEC_DECODER || \ +CONFIG_MPEG4_MEDIACODEC_DECODER || \ +CONFIG_VP8_MEDIACODEC_DECODER || \ +CONFIG_VP9_MEDIACODEC_DECODER +static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) { int ret = 0; @@ -342,7 +319,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) case AV_CODEC_ID_MPEG2VIDEO: codec_mime = "video/mpeg2"; -ret = mpeg2_set_extradata(avctx, format); +ret = common_set_extradata(avctx, format); if (ret < 0) goto done; break; @@ -351,7 +328,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) case AV_CODEC_ID_MPEG4: codec_mime = "video/mp4v-es", -ret = mpeg4_set_extradata(avctx, format); +ret = common_set_extradata(avctx, format); if (ret < 0) goto done; break; @@ -360,7 +337,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) case AV_CODEC_ID_VP8: codec_mime = "video/x-vnd.on2.vp8"; -ret = vpx_set_extradata(avctx, format); +ret = common_set_extradata(avctx, format); if (ret < 0) goto done; break; @@ -369,7 +346,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) case AV_CODEC_ID_VP9: codec_mime = "video/x-vnd.on2.vp9"; -ret = vpx_set_extradata(avctx, format); +ret = common_set_extradata(avctx, format); if (ret < 0) goto done; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec: add missing "libavutil/internal.h" include
ffmpeg | branch: master | Matthieu Bouron | Fri Mar 2 12:04:30 2018 +0100| [535e020225486514dd3cd2f4e3b59f0cc42c54f7] | committer: Matthieu Bouron avcodec/mediacodecdec: add missing "libavutil/internal.h" include libavutil/internal.h defines NULL_IF_CONFIG_SMALL. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=535e020225486514dd3cd2f4e3b59f0cc42c54f7 --- libavcodec/mediacodecdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 363e12427e..ad09d16398 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -28,6 +28,7 @@ #include "libavutil/opt.h" #include "libavutil/intreadwrite.h" #include "libavutil/pixfmt.h" +#include "libavutil/internal.h" #include "avcodec.h" #include "decode.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec_common: make INFO_TRY_AGAIN trace messages more consistent
ffmpeg | branch: master | Matthieu Bouron | Mon Mar 12 09:10:57 2018 +0100| [41d7c4d3813b71d0feefb19c69f6a246ea2bdcee] | committer: Matthieu Bouron avcodec/mediacodecdec_common: make INFO_TRY_AGAIN trace messages more consistent Signed-off-by: Aman Gupta Signed-off-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41d7c4d3813b71d0feefb19c69f6a246ea2bdcee --- libavcodec/mediacodecdec_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 2697af3d08..635ee73486 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -579,7 +579,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us); if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { -av_log(avctx, AV_LOG_TRACE, "Failed to dequeue input buffer, try again later..\n"); +av_log(avctx, AV_LOG_TRACE, "No input buffer available, try again later\n"); break; } @@ -743,7 +743,7 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, "while draining remaining frames, output will probably lack frames\n", output_dequeue_timeout_us / 1000); } else { -av_log(avctx, AV_LOG_DEBUG, "No output buffer available, try again later\n"); +av_log(avctx, AV_LOG_TRACE, "No output buffer available, try again later\n"); } } else { av_log(avctx, AV_LOG_ERROR, "Failed to dequeue output buffer (status=%zd)\n", index); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields
ffmpeg | branch: master | Matthieu Bouron | Wed Apr 11 10:28:56 2018 +0200| [67d0911f27e29d551865dbca3af5c49abe029885] | committer: Matthieu Bouron avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields Fixes decoding on the Samsung Chromebook Pro which do not set the codec output format stride and slice-height fields. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67d0911f27e29d551865dbca3af5c49abe029885 --- libavcodec/mediacodecdec_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index e31adb487c..e59cf19aad 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -385,10 +385,10 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte AMEDIAFORMAT_GET_INT32(s->width, "width", 1); AMEDIAFORMAT_GET_INT32(s->height, "height", 1); -AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1); +AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0); s->stride = s->stride > 0 ? s->stride : s->width; -AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1); +AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0); s->slice_height = s->slice_height > 0 ? s->slice_height : s->height; if (strstr(s->codec_name, "OMX.Nvidia.")) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields
ffmpeg | branch: release/4.0 | Matthieu Bouron | Wed Apr 11 10:28:56 2018 +0200| [9b7111424797e458aa51f7569dc132d44b18fd79] | committer: Matthieu Bouron avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields Fixes decoding on the Samsung Chromebook Pro which do not set the codec output format stride and slice-height fields. (cherry picked from commit 67d0911f27e29d551865dbca3af5c49abe029885) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b7111424797e458aa51f7569dc132d44b18fd79 --- libavcodec/mediacodecdec_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index e31adb487c..e59cf19aad 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -385,10 +385,10 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte AMEDIAFORMAT_GET_INT32(s->width, "width", 1); AMEDIAFORMAT_GET_INT32(s->height, "height", 1); -AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1); +AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0); s->stride = s->stride > 0 ? s->stride : s->width; -AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1); +AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0); s->slice_height = s->slice_height > 0 ? s->slice_height : s->height; if (strstr(s->codec_name, "OMX.Nvidia.")) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] RELEASE: update for git after 4.0 branchpoint
ffmpeg | branch: master | Matthieu Bouron | Tue Sep 25 11:30:50 2018 +0200| [e294b5cf6464e3d8ee0d0bdedcfb4ca0ad0297ed] | committer: Matthieu Bouron RELEASE: update for git after 4.0 branchpoint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e294b5cf6464e3d8ee0d0bdedcfb4ca0ad0297ed --- RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE b/RELEASE index 9b601acc0d..ff2c9d1a30 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -3.4.git +4.0.git ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: fix size variable shadowing in ff_mediacodec_dec_decode
ffmpeg | branch: master | Matthieu Bouron | Thu Oct 6 12:04:57 2016 +0200| [09191516511840edb0356b0f13fc149f78f8a09e] | committer: Matthieu Bouron lavc/mediacodecdec: fix size variable shadowing in ff_mediacodec_dec_decode Fixes incompatible pointer type warning on 64-bit systems. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09191516511840edb0356b0f13fc149f78f8a09e --- libavcodec/mediacodecdec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 0faa4cf..223942b 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -565,7 +565,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s, } while (offset < pkt->size || (need_draining && !s->draining)) { -int size; index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us); if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: remove first output buffer timing debug log
ffmpeg | branch: master | Matthieu Bouron | Thu Oct 6 11:53:13 2016 +0200| [a458ed65b5d1007a9184226edd39fa78d01f694b] | committer: Matthieu Bouron lavc/mediacodecdec: remove first output buffer timing debug log > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a458ed65b5d1007a9184226edd39fa78d01f694b --- libavcodec/mediacodecdec.c | 8 libavcodec/mediacodecdec.h | 3 --- 2 files changed, 11 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 6683de7..e0d71d3 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -449,9 +449,6 @@ static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContex return AVERROR_EXTERNAL; } -s->first_buffer = 0; -s->first_buffer_at = av_gettime(); - return 0; } @@ -468,7 +465,6 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, AV_PIX_FMT_NONE, }; -s->first_buffer_at = av_gettime(); s->refcount = 1; pix_fmt = ff_get_format(avctx, pix_fmts); @@ -645,10 +641,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s, if (index >= 0) { int ret; -if (!s->first_buffer++) { -av_log(avctx, AV_LOG_DEBUG, "Got first buffer after %fms\n", (av_gettime() - s->first_buffer_at) / 1000); -} - av_log(avctx, AV_LOG_DEBUG, "Got output buffer %zd" " offset=%" PRIi32 " size=%" PRIi32 " ts=%" PRIi64 " flags=%" PRIu32 "\n", index, info.offset, info.size, diff --git a/libavcodec/mediacodecdec.h b/libavcodec/mediacodecdec.h index 8613352..52c8bf1 100644 --- a/libavcodec/mediacodecdec.h +++ b/libavcodec/mediacodecdec.h @@ -61,9 +61,6 @@ typedef struct MediaCodecDecContext { uint64_t dequeued_buffer_nb; -int first_buffer; -double first_buffer_at; - } MediaCodecDecContext; int ff_mediacodec_dec_init(AVCodecContext *avctx, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodecdec: rename dequeued_buffer_nb to output_buffer_count
ffmpeg | branch: master | Matthieu Bouron | Thu Oct 6 11:56:24 2016 +0200| [cfa3c2655ac2bafe7b76f1e68c8fe6ecee03f1a8] | committer: Matthieu Bouron lavc/mediacodecdec: rename dequeued_buffer_nb to output_buffer_count > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfa3c2655ac2bafe7b76f1e68c8fe6ecee03f1a8 --- libavcodec/mediacodecdec.c | 6 +++--- libavcodec/mediacodecdec.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index e0d71d3..8ff1138 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -437,7 +437,7 @@ static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContex FFAMediaCodec *codec = s->codec; int status; -s->dequeued_buffer_nb = 0; +s->output_buffer_count = 0; s->draining = 0; s->flushing = 0; @@ -630,7 +630,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s, /* If the codec is flushing or need to be flushed, block for a fair * amount of time to ensure we got a frame */ output_dequeue_timeout_us = OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US; -} else if (s->dequeued_buffer_nb == 0) { +} else if (s->output_buffer_count == 0) { /* If the codec hasn't produced any frames, do not block so we * can push data to it as fast as possible, and get the first * frame */ @@ -670,7 +670,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s, } *got_frame = 1; -s->dequeued_buffer_nb++; +s->output_buffer_count++; } else { status = ff_AMediaCodec_releaseOutputBuffer(codec, index, 0); if (status < 0) { diff --git a/libavcodec/mediacodecdec.h b/libavcodec/mediacodecdec.h index 52c8bf1..7b0b7bb 100644 --- a/libavcodec/mediacodecdec.h +++ b/libavcodec/mediacodecdec.h @@ -59,7 +59,7 @@ typedef struct MediaCodecDecContext { int crop_left; int crop_right; -uint64_t dequeued_buffer_nb; +uint64_t output_buffer_count; } MediaCodecDecContext; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mediacodec_wrapper: do not discard codecs reporting they do not support any profile
ffmpeg | branch: master | Matthieu Bouron | Fri Oct 7 11:20:33 2016 +0200| [b8c158a4eddb79ba3964dbe51b0e1db01454f96a] | committer: Matthieu Bouron lavc/mediacodec_wrapper: do not discard codecs reporting they do not support any profile Depending on the device, some (VP8/VP9/...) decoders report that they do not support any profiles. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8c158a4eddb79ba3964dbe51b0e1db01454f96a --- libavcodec/mediacodec_wrapper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 97e3a29..c2af950 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -480,6 +480,9 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e } profile_count = (*env)->GetArrayLength(env, profile_levels); +if (!profile_count) { +found_codec = 1; +} for (k = 0; k < profile_count; k++) { int supported_profile = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: add mpeg4 mediacodec decoder
ffmpeg | branch: master | Matthieu Bouron | Tue Oct 4 17:47:44 2016 +0200| [f62c54456db0fdd3ff82397f9142715d5c479354] | committer: Matthieu Bouron lavc: add mpeg4 mediacodec decoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f62c54456db0fdd3ff82397f9142715d5c479354 --- Changelog| 4 ++-- configure| 2 ++ libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 2 ++ libavcodec/mediacodecdec.c | 7 +++ libavcodec/mediacodecdec_h2645.c | 40 +++- libavcodec/version.h | 2 +- 7 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 9f1b8e5..c319388 100644 --- a/Changelog +++ b/Changelog @@ -10,7 +10,7 @@ version : - curves filter doesn't automatically insert points at x=0 and x=1 anymore - 16-bit support in curves filter and selectivecolor filter - OpenH264 decoder wrapper -- MediaCodec H.264/HEVC/VP8/VP9 hwaccel +- MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel - True Audio (TTA) muxer - crystalizer audio filter - acrusher audio filter @@ -28,7 +28,7 @@ version : - gblur filter - avgblur filter - sobel and prewitt filter -- MediaCodec HEVC/VP8/VP9 decoding +- MediaCodec HEVC/MPEG-4/VP8/VP9 decoding - Meridian Lossless Packing (MLP) / TrueHD encoder - Non-Local Means (nlmeans) denoising filter - sdl2 output device and ffplay support diff --git a/configure b/configure index 294ff64..1e6834f 100755 --- a/configure +++ b/configure @@ -2630,6 +2630,8 @@ mpeg2_xvmc_hwaccel_deps="xvmc" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_cuvid_hwaccel_deps="cuda cuvid" +mpeg4_mediacodec_decoder_deps="mediacodec" +mpeg4_mediacodec_hwaccel_deps="mediacodec" mpeg4_mmal_decoder_deps="mmal" mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_hwaccel_deps="mmal" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 734c79d..e8b1b00 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -413,6 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 44f7205..b592aa3 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -103,6 +103,7 @@ void avcodec_register_all(void) REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau); REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox); REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid); +REGISTER_HWACCEL(MPEG4_MEDIACODEC, mpeg4_mediacodec); REGISTER_HWACCEL(MPEG4_MMAL,mpeg4_mmal); REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi); REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau); @@ -657,6 +658,7 @@ void avcodec_register_all(void) REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid); REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid); +REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec); REGISTER_DECODER(VC1_CUVID, vc1_cuvid); REGISTER_DECODER(VP8_CUVID, vp8_cuvid); REGISTER_DECODER(VP8_MEDIACODEC,vp8_mediacodec); diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index e5a8dbc..c031de8 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -767,6 +767,13 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = { .pix_fmt = AV_PIX_FMT_MEDIACODEC, }; +AVHWAccel ff_mpeg4_mediacodec_hwaccel = { +.name= "mediacodec", +.type= AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_MPEG4, +.pix_fmt = AV_PIX_FMT_MEDIACODEC, +}; + AVHWAccel ff_vp8_mediacodec_hwaccel = { .name= "mediacodec", .type= AVMEDIA_TYPE_VIDEO, diff --git a/libavcodec/mediacodecdec_h2645.c b/libavcodec/mediacodecdec_h2645.c index c5f5af2..578b10d 100644 --- a/libavcodec/mediacodecdec_h2645.c +++ b/libavcodec/mediacodecdec_h2645.c @@ -1,5 +1,5 @@ /* - * Android MediaCodec H.264 / H.265 / VP8 / VP9 decoders + * Android MediaCodec H.264 / H.265 / MPEG-4 / VP8 / VP9 decoders * * Copyright (c) 2015-2016 Matthieu Bouron * @@ -266,6 +266,19 @@ done: } #endif +#if CONFIG_MPEG4_MEDIACODEC_DECODER +static int mpeg4_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) +{ +int ret = 0; + +if (avctx->extradata) { +ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size); +} + +
[FFmpeg-cvslog] lavc: add vp8/vp9 mediacodec decoders
ffmpeg | branch: master | Matthieu Bouron | Tue Oct 4 16:02:59 2016 +0200| [0f7fce87ea9842261076f93bd0f28557fcd065bb] | committer: Matthieu Bouron lavc: add vp8/vp9 mediacodec decoders > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f7fce87ea9842261076f93bd0f28557fcd065bb --- Changelog| 4 +-- configure| 4 +++ libavcodec/Makefile | 2 ++ libavcodec/allcodecs.c | 4 +++ libavcodec/mediacodecdec.c | 14 libavcodec/mediacodecdec_h2645.c | 73 +++- libavcodec/version.h | 2 +- 7 files changed, 99 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 32f0bd4..9f1b8e5 100644 --- a/Changelog +++ b/Changelog @@ -10,7 +10,7 @@ version : - curves filter doesn't automatically insert points at x=0 and x=1 anymore - 16-bit support in curves filter and selectivecolor filter - OpenH264 decoder wrapper -- MediaCodec H.264 and HEVC hwaccel +- MediaCodec H.264/HEVC/VP8/VP9 hwaccel - True Audio (TTA) muxer - crystalizer audio filter - acrusher audio filter @@ -28,7 +28,7 @@ version : - gblur filter - avgblur filter - sobel and prewitt filter -- MediaCodec HEVC decoding +- MediaCodec HEVC/VP8/VP9 decoding - Meridian Lossless Packing (MLP) / TrueHD encoder - Non-Local Means (nlmeans) denoising filter - sdl2 output device and ffplay support diff --git a/configure b/configure index 96f575f..294ff64 100755 --- a/configure +++ b/configure @@ -2662,10 +2662,14 @@ vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_cuvid_hwaccel_deps="cuda cuvid" vp9_cuvid_hwaccel_deps="cuda cuvid" +vp8_mediacodec_decoder_deps="mediacodec" +vp8_mediacodec_hwaccel_deps="mediacodec" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" +vp9_mediacodec_decoder_deps="mediacodec" +vp9_mediacodec_hwaccel_deps="mediacodec" vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9" vp9_vaapi_hwaccel_select="vp9_decoder" wmv3_crystalhd_decoder_select="crystalhd" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index a1560ba..734c79d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -595,9 +595,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \ OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuvid.o +OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec_h2645.o OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o vp9dsp_8bpp.o \ vp9dsp_10bpp.o vp9dsp_12bpp.o OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuvid.o +OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec_h2645.o OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index fed740a..44f7205 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -115,9 +115,11 @@ void avcodec_register_all(void) REGISTER_HWACCEL(VC1_MMAL, vc1_mmal); REGISTER_HWACCEL(VC1_QSV, vc1_qsv); REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid); +REGISTER_HWACCEL(VP8_MEDIACODEC,vp8_mediacodec); REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid); REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va); REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2); +REGISTER_HWACCEL(VP9_MEDIACODEC,vp9_mediacodec); REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi); REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va); REGISTER_HWACCEL(WMV3_DXVA2,wmv3_dxva2); @@ -657,7 +659,9 @@ void avcodec_register_all(void) REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid); REGISTER_DECODER(VC1_CUVID, vc1_cuvid); REGISTER_DECODER(VP8_CUVID, vp8_cuvid); +REGISTER_DECODER(VP8_MEDIACODEC,vp8_mediacodec); REGISTER_DECODER(VP9_CUVID, vp9_cuvid); +REGISTER_DECODER(VP9_MEDIACODEC,vp9_mediacodec); /* parsers */ REGISTER_PARSER(AAC,aac); diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 8ff1138..e5a8dbc 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -766,3 +766,17 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = { .id = AV_CODEC_ID_HEVC, .pix_fmt = AV_PIX_FMT_MEDIACODEC, }; + +AVHWAccel ff_vp8_mediacodec_hwaccel = { +.name= "mediacodec", +.type= AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_VP8, +.pix_fmt = AV_PIX_FMT_MED
[FFmpeg-cvslog] lavc/mediacodec: use more meaningful filenames
ffmpeg | branch: master | Matthieu Bouron | Wed Oct 12 14:44:08 2016 +0200| [d5082a2ce776a2e43e25998aa07541c9ab7af0d3] | committer: Matthieu Bouron lavc/mediacodec: use more meaningful filenames Adds the following changes: * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h} * mediacodecdec_h2645.c -> mediacodecdec.c > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5082a2ce776a2e43e25998aa07541c9ab7af0d3 --- libavcodec/Makefile| 14 +- libavcodec/mediacodec.c|3 +- libavcodec/mediacodec_sw_buffer.c |2 +- libavcodec/mediacodec_sw_buffer.h |2 +- libavcodec/mediacodecdec.c | 1064 +--- libavcodec/mediacodecdec_common.c | 789 +++ .../{mediacodecdec.h => mediacodecdec_common.h}|6 +- libavcodec/mediacodecdec_h2645.c | 623 8 files changed, 1252 insertions(+), 1251 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index e8b1b00..f1d5bf1 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -94,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LZF) += lzf.o OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o mdct_fixed_32.o OBJS-$(CONFIG_ME_CMP) += me_cmp.o -OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o +OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \ mpegaudiodecheader.o @@ -316,7 +316,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o h264_cabac.o h264_cavlc.o \ h264_slice.o h264data.o h264_parse.o \ h2645_parse.o OBJS-$(CONFIG_H264_CUVID_DECODER) += cuvid.o -OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h2645.o +OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o @@ -333,7 +333,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o hevc_cabac.o hevc_refs.o hevcpred.o \ hevcdsp.o hevc_filter.o h2645_parse.o hevc_data.o OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuvid.o -OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec_h2645.o hevc_parse.o +OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o OBJS-$(CONFIG_NVENC_HEVC_ENCODER) += nvenc_hevc.o OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o @@ -413,7 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o -OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o @@ -596,11 +596,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \ OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuvid.o -OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec_h2645.o +OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o vp9dsp_8bpp.o \ vp9dsp_10bpp.o vp9dsp_12bpp.o OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuvid.o -OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec_h2645.o +OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o @@ -1008,7 +1008,7 @@ SKIPHEADERS-$(CONFIG_JNI) += ffjni.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h -SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec.h mediacodec_surface.h mediacodec_wrapper.h mediacodec_sw_buffer.h +SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodec
[FFmpeg-cvslog] mov: fix stream extradata_size allocation
ffmpeg | branch: master | Matthieu Bouron | Fri Jul 15 10:00:34 2016 +0200| [61cb9fac47498a38dfe7623f66aa1f3696e9158c] | committer: Martin Storsjö mov: fix stream extradata_size allocation Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61cb9fac47498a38dfe7623f66aa1f3696e9158c --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 0cb3271..14be96e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1900,7 +1900,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); sc->stsd_count = entries; -sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(sc->extradata_size)); +sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata_size)); if (!sc->extradata_size) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/framepool: re-indent after previous commit
ffmpeg | branch: master | Matthieu Bouron | Tue Jan 3 17:44:55 2017 +0100| [e2d336cf6499923691baf53b10d193aefa77fa89] | committer: Matthieu Bouron lavfi/framepool: re-indent after previous commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2d336cf6499923691baf53b10d193aefa77fa89 --- libavfilter/framepool.c | 54 - 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 588dcb6..74235d4 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -205,41 +205,41 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) switch(pool->type) { case AVMEDIA_TYPE_VIDEO: -desc = av_pix_fmt_desc_get(pool->format); -if (!desc) { -goto fail; -} +desc = av_pix_fmt_desc_get(pool->format); +if (!desc) { +goto fail; +} -frame->width = pool->width; -frame->height = pool->height; -frame->format = pool->format; +frame->width = pool->width; +frame->height = pool->height; +frame->format = pool->format; -for (i = 0; i < 4; i++) { -frame->linesize[i] = pool->linesize[i]; -if (!pool->pools[i]) -break; +for (i = 0; i < 4; i++) { +frame->linesize[i] = pool->linesize[i]; +if (!pool->pools[i]) +break; -frame->buf[i] = av_buffer_pool_get(pool->pools[i]); -if (!frame->buf[i]) { -goto fail; -} +frame->buf[i] = av_buffer_pool_get(pool->pools[i]); +if (!frame->buf[i]) { +goto fail; +} -frame->data[i] = frame->buf[i]->data; -} +frame->data[i] = frame->buf[i]->data; +} -if (desc->flags & AV_PIX_FMT_FLAG_PAL || -desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { -enum AVPixelFormat format = -pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format; +if (desc->flags & AV_PIX_FMT_FLAG_PAL || +desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { +enum AVPixelFormat format = +pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format; -av_assert0(frame->data[1] != NULL); -if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) < 0) { -goto fail; +av_assert0(frame->data[1] != NULL); +if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) < 0) { +goto fail; +} } -} -frame->extended_data = frame->data; -break; +frame->extended_data = frame->data; +break; case AVMEDIA_TYPE_AUDIO: frame->nb_samples = pool->nb_samples; av_frame_set_channels(frame, pool->channels); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/framepool: rename FFVideoFramePool to FFFramePool
ffmpeg | branch: master | Matthieu Bouron | Tue May 10 17:45:59 2016 +0200| [b1f68f00b12a3706f8aabf68ea714eaecc23b295] | committer: Matthieu Bouron lavfi/framepool: rename FFVideoFramePool to FFFramePool > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1f68f00b12a3706f8aabf68ea714eaecc23b295 --- libavfilter/avfilter.c | 2 +- libavfilter/avfilter.h | 4 ++-- libavfilter/framepool.c | 24 libavfilter/framepool.h | 32 libavfilter/video.c | 20 ++-- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 0020ee1..12f12d1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -179,7 +179,7 @@ void avfilter_link_free(AVFilterLink **link) av_frame_free(&(*link)->partial_buf); ff_framequeue_free(&(*link)->fifo); -ff_video_frame_pool_uninit((FFVideoFramePool**)&(*link)->video_frame_pool); +ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool); av_freep(link); } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 828b270..02df8a3 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -531,9 +531,9 @@ struct AVFilterLink { int64_t frame_count_in, frame_count_out; /** - * A pointer to a FFVideoFramePool struct. + * A pointer to a FFFramePool struct. */ -void *video_frame_pool; +void *frame_pool; /** * True if a frame is currently wanted on the output of this filter. diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 6df574e..36c6e8f 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -26,7 +26,7 @@ #include "libavutil/mem.h" #include "libavutil/pixfmt.h" -struct FFVideoFramePool { +struct FFFramePool { int width; int height; @@ -37,20 +37,20 @@ struct FFVideoFramePool { }; -FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*alloc)(int size), - int width, - int height, - enum AVPixelFormat format, - int align) +FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), + int width, + int height, + enum AVPixelFormat format, + int align) { int i, ret; -FFVideoFramePool *pool; +FFFramePool *pool; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); if (!desc) return NULL; -pool = av_mallocz(sizeof(FFVideoFramePool)); +pool = av_mallocz(sizeof(FFFramePool)); if (!pool) return NULL; @@ -100,11 +100,11 @@ FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*alloc)(int size), return pool; fail: -ff_video_frame_pool_uninit(&pool); +ff_frame_pool_uninit(&pool); return NULL; } -int ff_video_frame_pool_get_config(FFVideoFramePool *pool, +int ff_frame_pool_get_video_config(FFFramePool *pool, int *width, int *height, enum AVPixelFormat *format, @@ -122,7 +122,7 @@ int ff_video_frame_pool_get_config(FFVideoFramePool *pool, } -AVFrame *ff_video_frame_pool_get(FFVideoFramePool *pool) +AVFrame *ff_frame_pool_get(FFFramePool *pool) { int i; AVFrame *frame; @@ -174,7 +174,7 @@ fail: return NULL; } -void ff_video_frame_pool_uninit(FFVideoFramePool **pool) +void ff_frame_pool_uninit(FFFramePool **pool) { int i; diff --git a/libavfilter/framepool.h b/libavfilter/framepool.h index 2a6c9e8..4824824 100644 --- a/libavfilter/framepool.h +++ b/libavfilter/framepool.h @@ -25,11 +25,11 @@ #include "libavutil/frame.h" /** - * Video frame pool. This structure is opaque and not meant to be accessed - * directly. It is allocated with ff_video_frame_pool_init() and freed with - * ff_video_frame_pool_uninit(). + * Frame pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with ff_frame_pool_init() and freed with + * ff_frame_pool_uninit(). */ -typedef struct FFVideoFramePool FFVideoFramePool; +typedef struct FFFramePool FFFramePool; /** * Allocate and initialize a video frame pool. @@ -41,21 +41,21 @@ typedef struct FFVideoFramePool FFVideoFramePool; * @param height height of each frame in this pool * @param format format of each frame in this pool * @param align buffers alignement of each frame in this pool - * @return newly created video frame pool on success, NULL on error. + * @return newly created frame pool on success, NULL on error. */ -FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*al
[FFmpeg-cvslog] lavfi: use an audio frame pool for each link of the filtergraph
ffmpeg | branch: master | Matthieu Bouron | Tue Jan 3 17:44:14 2017 +0100| [e1f49712099d3b68c35cf8ebb95cc7f34b06ee55] | committer: Matthieu Bouron lavfi: use an audio frame pool for each link of the filtergraph > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1f49712099d3b68c35cf8ebb95cc7f34b06ee55 --- libavfilter/audio.c | 50 -- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/libavfilter/audio.c b/libavfilter/audio.c index a18be89..5996f60 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -27,6 +27,9 @@ #include "avfilter.h" #include "internal.h" +#define BUFFER_ALIGN 0 + + AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples) { return ff_get_audio_buffer(link->dst->outputs[0], nb_samples); @@ -34,29 +37,48 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples) AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) { -AVFrame *frame = av_frame_alloc(); +AVFrame *frame = NULL; int channels = link->channels; -int ret; av_assert0(channels == av_get_channel_layout_nb_channels(link->channel_layout) || !av_get_channel_layout_nb_channels(link->channel_layout)); +if (!link->frame_pool) { +link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, +nb_samples, link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; +} else { +int pool_channels = 0; +int pool_nb_samples = 0; +int pool_align = 0; +enum AVSampleFormat pool_format = AV_SAMPLE_FMT_NONE; + +if (ff_frame_pool_get_audio_config(link->frame_pool, + &pool_channels, &pool_nb_samples, + &pool_format, &pool_align) < 0) { +return NULL; +} + +if (pool_channels != channels || pool_nb_samples < nb_samples || +pool_format != link->format || pool_align != BUFFER_ALIGN) { + +ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); +link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, +nb_samples, link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; +} +} + +frame = ff_frame_pool_get(link->frame_pool); if (!frame) return NULL; -frame->nb_samples = nb_samples; -frame->format = link->format; -av_frame_set_channels(frame, link->channels); +frame->nb_samples = nb_samples; frame->channel_layout = link->channel_layout; -frame->sample_rate= link->sample_rate; -ret = av_frame_get_buffer(frame, 0); -if (ret < 0) { -av_frame_free(&frame); -return NULL; -} - -av_samples_set_silence(frame->extended_data, 0, nb_samples, channels, - link->format); +frame->sample_rate = link->sample_rate; +av_samples_set_silence(frame->extended_data, 0, nb_samples, channels, link->format); return frame; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/framepool: cosmetic style fixes
ffmpeg | branch: master | Matthieu Bouron | Tue Jan 3 17:46:24 2017 +0100| [b1ed7957b835eed84fa151487d9014814daefa3d] | committer: Matthieu Bouron lavfi/framepool: cosmetic style fixes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1ed7957b835eed84fa151487d9014814daefa3d --- libavfilter/framepool.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 74235d4..e1f1e2c 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -220,9 +220,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) break; frame->buf[i] = av_buffer_pool_get(pool->pools[i]); -if (!frame->buf[i]) { +if (!frame->buf[i]) goto fail; -} frame->data[i] = frame->buf[i]->data; } @@ -233,9 +232,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) pool->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : pool->format; av_assert0(frame->data[1] != NULL); -if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) < 0) { +if (avpriv_set_systematic_pal2((uint32_t *)frame->data[1], format) < 0) goto fail; -} } frame->extended_data = frame->data; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/framepool: add audio support
ffmpeg | branch: master | Matthieu Bouron | Tue Jan 3 17:44:07 2017 +0100| [eb3368178ed9e1b3401e1f71ceebcb510fbbdf52] | committer: Matthieu Bouron lavfi/framepool: add audio support > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb3368178ed9e1b3401e1f71ceebcb510fbbdf52 --- libavfilter/framepool.c | 109 libavfilter/framepool.h | 36 +++- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 36c6e8f..588dcb6 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -20,6 +20,7 @@ #include "framepool.h" #include "libavutil/avassert.h" +#include "libavutil/avutil.h" #include "libavutil/buffer.h" #include "libavutil/frame.h" #include "libavutil/imgutils.h" @@ -28,8 +29,18 @@ struct FFFramePool { +enum AVMediaType type; + +/* video */ int width; int height; + +/* audio */ +int planes; +int channels; +int nb_samples; + +/* common */ int format; int align; int linesize[4]; @@ -54,6 +65,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), if (!pool) return NULL; +pool->type = AVMEDIA_TYPE_VIDEO; pool->width = width; pool->height = height; pool->format = format; @@ -104,6 +116,44 @@ fail: return NULL; } +FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(int size), + int channels, + int nb_samples, + enum AVSampleFormat format, + int align) +{ +int ret, planar; +FFFramePool *pool; + +pool = av_mallocz(sizeof(FFFramePool)); +if (!pool) +return NULL; + +planar = av_sample_fmt_is_planar(format); + +pool->type = AVMEDIA_TYPE_AUDIO; +pool->planes = planar ? channels : 1; +pool->channels = channels; +pool->nb_samples = nb_samples; +pool->format = format; +pool->align = align; + +ret = av_samples_get_buffer_size(&pool->linesize[0], channels, + nb_samples, format, 0); +if (ret < 0) +goto fail; + +pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL); +if (!pool->pools[0]) +goto fail; + +return pool; + +fail: +ff_frame_pool_uninit(&pool); +return NULL; +} + int ff_frame_pool_get_video_config(FFFramePool *pool, int *width, int *height, @@ -113,6 +163,8 @@ int ff_frame_pool_get_video_config(FFFramePool *pool, if (!pool) return AVERROR(EINVAL); +av_assert0(pool->type == AVMEDIA_TYPE_VIDEO); + *width = pool->width; *height = pool->height; *format = pool->format; @@ -121,6 +173,24 @@ int ff_frame_pool_get_video_config(FFFramePool *pool, return 0; } +int ff_frame_pool_get_audio_config(FFFramePool *pool, + int *channels, + int *nb_samples, + enum AVSampleFormat *format, + int *align) +{ +if (!pool) +return AVERROR(EINVAL); + +av_assert0(pool->type == AVMEDIA_TYPE_AUDIO); + +*channels = pool->channels; +*nb_samples = pool->nb_samples; +*format = pool->format; +*align = pool->align; + +return 0; +} AVFrame *ff_frame_pool_get(FFFramePool *pool) { @@ -133,6 +203,8 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) return NULL; } +switch(pool->type) { +case AVMEDIA_TYPE_VIDEO: desc = av_pix_fmt_desc_get(pool->format); if (!desc) { goto fail; @@ -167,6 +239,43 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) } frame->extended_data = frame->data; +break; +case AVMEDIA_TYPE_AUDIO: +frame->nb_samples = pool->nb_samples; +av_frame_set_channels(frame, pool->channels); +frame->format = pool->format; +frame->linesize[0] = pool->linesize[0]; + +if (pool->planes > AV_NUM_DATA_POINTERS) { +frame->extended_data = av_mallocz_array(pool->planes, + sizeof(*frame->extended_data)); +frame->nb_extended_buf = pool->planes - AV_NUM_DATA_POINTERS; +frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, + sizeof(*frame->extended_buf)); +if (!frame->extended_data || !frame->extended_buf) +goto fail; +} else { +frame->extended_data = frame->data; +av_assert0(frame->nb_extend
[FFmpeg-cvslog] swresample/aarch64: add ff_resample_common_apply_filter_{x4, x8}_{float, s16}_neon
ffmpeg | branch: master | Matthieu Bouron | Mon Jan 9 14:26:37 2017 +| [0265aec5650dcb17a8e3e8b0a36c3979dbd64188] | committer: Matthieu Bouron swresample/aarch64: add ff_resample_common_apply_filter_{x4,x8}_{float,s16}_neon > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0265aec5650dcb17a8e3e8b0a36c3979dbd64188 --- libswresample/aarch64/Makefile| 6 +- libswresample/aarch64/resample.S | 76 + libswresample/aarch64/resample_init.c | 120 ++ libswresample/resample.h | 1 + libswresample/resample_dsp.c | 1 + 5 files changed, 202 insertions(+), 2 deletions(-) diff --git a/libswresample/aarch64/Makefile b/libswresample/aarch64/Makefile index 320ed67..5c34f8d 100644 --- a/libswresample/aarch64/Makefile +++ b/libswresample/aarch64/Makefile @@ -1,5 +1,7 @@ -OBJS += aarch64/audio_convert_init.o +OBJS += aarch64/audio_convert_init.o \ +aarch64/resample_init.o OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o -NEON-OBJS+= aarch64/audio_convert_neon.o +NEON-OBJS+= aarch64/audio_convert_neon.o \ +aarch64/resample.o diff --git a/libswresample/aarch64/resample.S b/libswresample/aarch64/resample.S new file mode 100644 index 000..b3b1bb9 --- /dev/null +++ b/libswresample/aarch64/resample.S @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017 Matthieu Bouron + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +function ff_resample_common_apply_filter_x4_float_neon, export=1 +moviv0.4S, #0 // accumulator +1: ld1 {v1.4S}, [x1], #16 // src[0..3] +ld1 {v2.4S}, [x2], #16 // filter[0..3] +fmlav0.4S, v1.4S, v2.4S// accumulator += src[0..3] * filter[0..3] +subsw3, w3, #4 // filter_length -= 4 +b.gt1b // loop until filter_length +faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values +faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values +st1 {v0.S}[0], [x0], #4// write accumulator +ret +endfunc + +function ff_resample_common_apply_filter_x8_float_neon, export=1 +moviv0.4S, #0 // accumulator +1: ld1 {v1.4S}, [x1], #16 // src[0..3] +ld1 {v2.4S}, [x2], #16 // filter[0..3] +ld1 {v3.4S}, [x1], #16 // src[4..7] +ld1 {v4.4S}, [x2], #16 // filter[4..7] +fmlav0.4S, v1.4S, v2.4S// accumulator += src[0..3] * filter[0..3] +fmlav0.4S, v3.4S, v4.4S// accumulator += src[4..7] * filter[4..7] +subsw3, w3, #8 // filter_length -= 8 +b.gt1b // loop until filter_length +faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values +faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values +st1 {v0.S}[0], [x0], #4// write accumulator +endfunc + +function ff_resample_common_apply_filter_x4_s16_neon, export=1 +moviv0.4S, #0 // accumulator +1: ld1 {v1.4H}, [x1], #8 // src[0..3] +ld1 {v2.4H}, [x2], #8 //
[FFmpeg-cvslog] swresample/arm: cosmetic fixes
ffmpeg | branch: master | Matthieu Bouron | Mon Jan 9 17:22:40 2017 +0100| [e109c54a697b6cbd2a5b27cb9e8df2729e73351c] | committer: Matthieu Bouron swresample/arm: cosmetic fixes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e109c54a697b6cbd2a5b27cb9e8df2729e73351c --- libswresample/arm/resample.S | 32 libswresample/arm/resample_init.c | 12 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libswresample/arm/resample.S b/libswresample/arm/resample.S index c231301..3ce7623 100644 --- a/libswresample/arm/resample.S +++ b/libswresample/arm/resample.S @@ -22,9 +22,9 @@ function ff_resample_common_apply_filter_x4_float_neon, export=1 vmov.f32q0, #0.0 @ accumulator -1: vld1.32 {q1}, [r1]!@ src -vld1.32 {q2}, [r2]!@ filter -vmla.f32q0, q1, q2 @ accumulator += src + {0..3} * filter + {0..3} +1: vld1.32 {q1}, [r1]!@ src[0..3] +vld1.32 {q2}, [r2]!@ filter[0..3] +vmla.f32q0, q1, q2 @ accumulator += src[0..3] * filter[0..3] subsr3, #4 @ filter_length -= 4 bgt 1b @ loop until filter_length vpadd.f32 d0, d0, d1 @ pair adding of the 4x32-bit accumulated values @@ -35,12 +35,12 @@ endfunc function ff_resample_common_apply_filter_x8_float_neon, export=1 vmov.f32q0, #0.0 @ accumulator -1: vld1.32 {q1}, [r1]!@ src -vld1.32 {q2}, [r2]!@ filter -vld1.32 {q8}, [r1]!@ src -vld1.32 {q9}, [r2]!@ filter -vmla.f32q0, q1, q2 @ accumulator += src + {0..3} * filter + {0..3} -vmla.f32q0, q8, q9 @ accumulator += src + {4..7} * filter + {4..7} +1: vld1.32 {q1}, [r1]!@ src[0..3] +vld1.32 {q2}, [r2]!@ filter[0..3] +vld1.32 {q8}, [r1]!@ src[4..7] +vld1.32 {q9}, [r2]!@ filter[4..7] +vmla.f32q0, q1, q2 @ accumulator += src[0..3] * filter[0..3] +vmla.f32q0, q8, q9 @ accumulator += src[4..7] * filter[4..7] subsr3, #8 @ filter_length -= 8 bgt 1b @ loop until filter_length vpadd.f32 d0, d0, d1 @ pair adding of the 4x32-bit accumulated values @@ -51,9 +51,9 @@ endfunc function ff_resample_common_apply_filter_x4_s16_neon, export=1 vmov.s32q0, #0 @ accumulator -1: vld1.16 {d2}, [r1]!@ src -vld1.16 {d4}, [r2]!@ filter -vmlal.s16 q0, d2, d4 @ accumulator += src + {0..3} * filter + {0..3} +1: vld1.16 {d2}, [r1]!@ src[0..3] +vld1.16 {d4}, [r2]!@ filter[0..3] +vmlal.s16 q0, d2, d4 @ accumulator += src[0..3] * filter[0..3] subsr3, #4 @ filter_length -= 4 bgt 1b @ loop until filter_length vpadd.s32 d0, d0, d1 @ pair adding of the 4x32-bit accumulated values @@ -64,10 +64,10 @@ endfunc function ff_resample_common_apply_filter_x8_s16_neon, export=1 vmov.s32q0, #0 @ accumulator -1: vld1.16 {q1}, [r1]!@ src -vld1.16 {q2}, [r2]!@ filter -vmlal.s16 q0, d2, d4 @ accumulator += src + {0..3} * filter + {0..3} -vmlal.s16 q0, d3, d5 @ accumulator += src + {4..7} * filter + {4..7} +1: vld1
[FFmpeg-cvslog] avutil/tests: add aes_ctr, audio_fifo and imgutils to .gitignore
ffmpeg | branch: master | Matthieu Bouron | Mon Jan 16 11:41:34 2017 +0100| [adf5dc90a951bd1a94647f3e8bf79271a5e98e0e] | committer: Matthieu Bouron avutil/tests: add aes_ctr, audio_fifo and imgutils to .gitignore > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adf5dc90a951bd1a94647f3e8bf79271a5e98e0e --- libavutil/tests/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore index d2cc5cb..ae7a0ea 100644 --- a/libavutil/tests/.gitignore +++ b/libavutil/tests/.gitignore @@ -1,6 +1,8 @@ /adler32 /aes +/aes_ctr /atomic +/audio_fifo /avstring /base64 /blowfish @@ -21,6 +23,7 @@ /float_dsp /hash /hmac +/imgutils /lfg /lls /log ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a'
ffmpeg | branch: master | Matthieu Bouron | Mon Jan 16 11:33:47 2017 +0100| [bdbbb8f11edbf10add874508c5125c174d8939be] | committer: Matthieu Bouron Merge commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a' * commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a': h264: eliminate decode_postinit() Also includes fixes from 1f7b4f9abc and e344e65109. Original patch replace H264Context.next_output_pic (H264Picture *) by H264Context.output_frame (AVFrame *). This change is discarded as it is incompatible with the frame reconstruction and motion vectors display code which needs the extra information from the H264Picture. Merged-by: Clément Bœsch Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bdbbb8f11edbf10add874508c5125c174d8939be --- libavcodec/h264_slice.c | 106 +++- libavcodec/h264dec.c| 139 +++- 2 files changed, 111 insertions(+), 134 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 2dc98c1..fe71d57 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -44,6 +44,7 @@ #include "golomb.h" #include "mathops.h" #include "mpegutils.h" +#include "mpegvideo.h" #include "rectangle.h" #include "thread.h" @@ -1283,6 +1284,105 @@ static int h264_export_frame_props(H264Context *h) return 0; } +static int h264_select_output_frame(H264Context *h) +{ +const SPS *sps = h->ps.sps; +H264Picture *out = h->cur_pic_ptr; +H264Picture *cur = h->cur_pic_ptr; +int i, pics, out_of_order, out_idx; + +cur->mmco_reset = h->mmco_reset; +h->mmco_reset = 0; + +if (sps->bitstream_restriction_flag || +h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) { +h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames); +} + +for (i = 0; 1; i++) { +if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){ +if(i) +h->last_pocs[i-1] = cur->poc; +break; +} else if(i) { +h->last_pocs[i-1]= h->last_pocs[i]; +} +} +out_of_order = MAX_DELAYED_PIC_COUNT - i; +if( cur->f->pict_type == AV_PICTURE_TYPE_B + || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2)) +out_of_order = FFMAX(out_of_order, 1); +if (out_of_order == MAX_DELAYED_PIC_COUNT) { +av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]); +for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++) +h->last_pocs[i] = INT_MIN; +h->last_pocs[0] = cur->poc; +cur->mmco_reset = 1; +} else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){ +int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE; +av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order); +h->avctx->has_b_frames = out_of_order; +} + +pics = 0; +while (h->delayed_pic[pics]) +pics++; + +av_assert0(pics <= MAX_DELAYED_PIC_COUNT); + +h->delayed_pic[pics++] = cur; +if (cur->reference == 0) +cur->reference = DELAYED_PIC_REF; + +out = h->delayed_pic[0]; +out_idx = 0; +for (i = 1; h->delayed_pic[i] && +!h->delayed_pic[i]->f->key_frame && +!h->delayed_pic[i]->mmco_reset; + i++) +if (h->delayed_pic[i]->poc < out->poc) { +out = h->delayed_pic[i]; +out_idx = i; +} +if (h->avctx->has_b_frames == 0 && +(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) +h->next_outputed_poc = INT_MIN; +out_of_order = out->poc < h->next_outputed_poc; + +if (out_of_order || pics > h->avctx->has_b_frames) { +out->reference &= ~DELAYED_PIC_REF; +for (i = out_idx; h->delayed_pic[i]; i++) +h->delayed_pic[i] = h->delayed_pic[i + 1]; +} +if (!out_of_order && pics > h->avctx->has_b_frames) { +h->next_output_pic = out; +if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) { +h->next_outputed_poc = INT_MIN; +} else +h->next_outputed_poc = out->poc; + +if (out->recovered) { +// We have reached an recovery point and all frames after it in +//
[FFmpeg-cvslog] lavc/h264dec: make sure a slice is decoded before finishing setup
ffmpeg | branch: master | Matthieu Bouron | Fri Jan 20 17:24:52 2017 +0100| [639e26297147866534c093fd39f89fe386d81ebd] | committer: Matthieu Bouron lavc/h264dec: make sure a slice is decoded before finishing setup Fixes regression in fate-h264-attachment-631 with THREADS=8 introduced by bdbbb8f11edbf10add874508c5125c174d8939be. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=639e26297147866534c093fd39f89fe386d81ebd --- libavcodec/h264dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index c24818b..f18fb0b 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -679,13 +679,13 @@ again: if (sl->redundant_pic_count > 0) break; +if (h->current_slice == 1) { if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel && i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) { ff_thread_finish_setup(avctx); h->setup_finished = 1; } -if (h->current_slice == 1) { if (h->avctx->hwaccel && (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) goto end; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/h264dec: re-indent after previous commit
ffmpeg | branch: master | Matthieu Bouron | Fri Jan 20 17:29:09 2017 +0100| [cf3affabb449671ce16cee61d98393c43ff171f4] | committer: Matthieu Bouron lavc/h264dec: re-indent after previous commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf3affabb449671ce16cee61d98393c43ff171f4 --- libavcodec/h264dec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index f18fb0b..665d3e46 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -680,11 +680,11 @@ again: break; if (h->current_slice == 1) { -if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel && -i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) { -ff_thread_finish_setup(avctx); -h->setup_finished = 1; -} +if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel && +i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) { +ff_thread_finish_setup(avctx); +h->setup_finished = 1; +} if (h->avctx->hwaccel && (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mjpegdec: consume SOS data even if the frame is discarded
ffmpeg | branch: master | Matthieu Bouron | Sat Jan 28 13:49:52 2017 +0100| [2ae82788324481dd56bb85f9d815902854c044fd] | committer: Matthieu Bouron lavc/mjpegdec: consume SOS data even if the frame is discarded Speeds up next marker search when a SOS marker is found but the frame is discarded (which happens in avformat_find_stream_info). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ae82788324481dd56bb85f9d815902854c044fd --- libavcodec/mjpegdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 7d17e3d..07988b6 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2247,8 +2247,10 @@ eoi_parser: goto the_end; case SOS: s->cur_scan++; -if (avctx->skip_frame == AVDISCARD_ALL) +if (avctx->skip_frame == AVDISCARD_ALL) { +skip_bits(&s->gb, get_bits_left(&s->gb)); break; +} if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mov: Fix stsc_count comparison
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 20 18:48:08 2016 +0200| [209ee680ce99035202520b900326a57f7fa0aceb] | committer: Vittorio Giovara mov: Fix stsc_count comparison Signed-off-by: Vittorio Giovara > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=209ee680ce99035202520b900326a57f7fa0aceb --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 14be96e..c0421d2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3680,7 +3680,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) /* Keep track of the stsc index for the given sample, then check * if the stsd index is different from the last used one. */ sc->stsc_sample++; -if (sc->stsc_index < sc->stsc_count && +if (sc->stsc_index + 1 < sc->stsc_count && mov_get_stsc_samples(sc, sc->stsc_index) == sc->stsc_sample) { sc->stsc_index++; sc->stsc_sample = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff'
ffmpeg | branch: master | Matthieu Bouron | Thu Feb 2 12:05:21 2017 +0100| [d30870cc730337b7017cc194d696f68ee48f7f1d] | committer: Matthieu Bouron Merge commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff' * commit 'ed9b2a5178d7a7c5a95694da3a808af327f36aff': mov: Rework the check for invalid indexes in stsc This commit is a noop, see 3c058f570128dcfa3a68f0860e2be7f098e8d6e1. The proposed fix breaks seeking in multiple_stsd.mp4 (ticket #3962) and playback of wwwq_cut.mp4 (ticket #2991). Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d30870cc730337b7017cc194d696f68ee48f7f1d --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon
ffmpeg | branch: master | Matthieu Bouron | Thu Feb 16 11:50:58 2017 +0100| [5ef2f4f39480dc5caa5e5c9ad19eb49ea0a08e35] | committer: Matthieu Bouron swr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ef2f4f39480dc5caa5e5c9ad19eb49ea0a08e35 --- libswresample/aarch64/resample.S | 1 + 1 file changed, 1 insertion(+) diff --git a/libswresample/aarch64/resample.S b/libswresample/aarch64/resample.S index b3b1bb9..bbad619 100644 --- a/libswresample/aarch64/resample.S +++ b/libswresample/aarch64/resample.S @@ -46,6 +46,7 @@ function ff_resample_common_apply_filter_x8_float_neon, export=1 faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values faddp v0.4S, v0.4S, v0.4S// pair adding of the 4x32-bit accumulated values st1 {v0.S}[0], [x0], #4// write accumulator +ret endfunc function ff_resample_common_apply_filter_x4_s16_neon, export=1 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/h264dec: use OFFSET macro
ffmpeg | branch: master | Matthieu Bouron | Mon Feb 6 17:14:57 2017 +0100| [1ade4d87bae8db3f2073c18eb322382ad7827bb9] | committer: Matthieu Bouron lavc/h264dec: use OFFSET macro > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ade4d87bae8db3f2073c18eb322382ad7827bb9 --- libavcodec/h264dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 35598ea..9042169 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -1077,8 +1077,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, #define OFFSET(x) offsetof(H264Context, x) #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM static const AVOption h264_options[] = { -{"is_avc", "is avc", offsetof(H264Context, is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0}, -{"nal_length_size", "nal_length_size", offsetof(H264Context, nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0}, +{ "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 }, +{ "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 }, { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD }, { NULL }, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/tests/dct/aarch64: add ff_simple_idct_neon test
ffmpeg | branch: master | Matthieu Bouron | Thu Feb 16 12:34:53 2017 +| [0c6105dde0c42bc64c93e7e7fbf286869c0bffa2] | committer: Matthieu Bouron lavc/tests/dct/aarch64: add ff_simple_idct_neon test > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c6105dde0c42bc64c93e7e7fbf286869c0bffa2 --- libavcodec/tests/aarch64/dct.c | 30 ++ libavcodec/tests/dct.c | 4 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/libavcodec/tests/aarch64/dct.c b/libavcodec/tests/aarch64/dct.c new file mode 100644 index 000..032a963 --- /dev/null +++ b/libavcodec/tests/aarch64/dct.c @@ -0,0 +1,30 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavcodec/aarch64/idct.h" + +static const struct algo fdct_tab_arch[] = { +{ 0 } +}; + +static const struct algo idct_tab_arch[] = { +{ "SIMPLE-NEON", ff_simple_idct_neon, FF_IDCT_PERM_PARTTRANS, AV_CPU_FLAG_NEON }, +{ 0 } +}; diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c index 5303fdf..4f0e0d9 100644 --- a/libavcodec/tests/dct.c +++ b/libavcodec/tests/dct.c @@ -94,7 +94,9 @@ static const struct algo idct_tab[] = { #endif /* CONFIG_MPEG4_DECODER */ }; -#if ARCH_ARM +#if ARCH_AARCH64 +#include "aarch64/dct.c" +#elif ARCH_ARM #include "arm/dct.c" #elif ARCH_PPC #include "ppc/dct.c" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64: add ff_simple_idct{, _add, _put}_neon functions
ffmpeg | branch: master | Matthieu Bouron | Fri Jan 27 11:55:48 2017 +| [4c8e528d19a37d796a9808908e5b5cb0ce039fb2] | committer: Matthieu Bouron lavc/aarch64: add ff_simple_idct{,_add,_put}_neon functions > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c8e528d19a37d796a9808908e5b5cb0ce039fb2 --- libavcodec/aarch64/Makefile | 2 + libavcodec/aarch64/idct.h | 28 +++ libavcodec/aarch64/idctdsp_init_aarch64.c | 41 libavcodec/aarch64/simple_idct_neon.S | 362 ++ libavcodec/idctdsp.c | 2 + libavcodec/idctdsp.h | 2 + 6 files changed, 437 insertions(+) diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index 37666b4..104bc67 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -36,6 +36,8 @@ NEON-OBJS-$(CONFIG_H264PRED)+= aarch64/h264pred_neon.o NEON-OBJS-$(CONFIG_H264QPEL)+= aarch64/h264qpel_neon.o \ aarch64/hpeldsp_neon.o NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o \ + aarch64/simple_idct_neon.o NEON-OBJS-$(CONFIG_MDCT)+= aarch64/mdct_neon.o NEON-OBJS-$(CONFIG_MPEGAUDIODSP)+= aarch64/mpegaudiodsp_neon.o diff --git a/libavcodec/aarch64/idct.h b/libavcodec/aarch64/idct.h new file mode 100644 index 000..05699c2 --- /dev/null +++ b/libavcodec/aarch64/idct.h @@ -0,0 +1,28 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AARCH64_IDCT_H +#define AVCODEC_AARCH64_IDCT_H + +#include + +void ff_simple_idct_neon(int16_t *data); +void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data); +void ff_simple_idct_add_neon(uint8_t *dest, int line_size, int16_t *data); + +#endif /* AVCODEC_AARCH64_IDCT_H */ diff --git a/libavcodec/aarch64/idctdsp_init_aarch64.c b/libavcodec/aarch64/idctdsp_init_aarch64.c new file mode 100644 index 000..0406e60 --- /dev/null +++ b/libavcodec/aarch64/idctdsp_init_aarch64.c @@ -0,0 +1,41 @@ +/* + * ARM-NEON-optimized IDCT functions + * Copyright (c) 2008 Mans Rullgard + * Copyright (c) 2017 Matthieu Bouron + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" + +av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ +if (!avctx->lowres && !high_bit_depth) { +if (avctx->idct_algo == FF_IDCT_AUTO || +avctx->idct_algo == FF_IDCT_SIMPLEAUTO || +avctx->idct_algo == FF_IDCT_SIMPLENEON) { +c->idct_put = ff_simple_idct_put_neon; +c->idct_add = ff_simple_idct_add_neon; +c->idct = ff_simple_idct_neon; +c->perm_type = FF_IDCT_PERM_PARTTRANS; +} +} +} diff --git a/libavcodec/aarch64/simple_idct_neon.S b/libavcodec/aarch64/simple_idct_neon.S new file mode 100644 index 000..5227342 --- /dev/null +++ b/libavcodec/aarch64/simple_idct_neon.S @@ -0,0 +1,362 @@ +/* + * ARM NEON IDCT + * + * Copyright (c) 2008 Mans Rullgard + * Copyright (c) 2017 Matthieu Bouron + * + * Based on Simple IDCT + * Copyright (c) 2001
[FFmpeg-cvslog] Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33'
ffmpeg | branch: master | Matthieu Bouron | Fri Mar 17 13:31:03 2017 +0100| [e2adbcbd97de1595b26a116ca22475b6f9acdf07] | committer: Matthieu Bouron Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33' * commit '0638b99cdba52554691fc668d9e477bc184c7a33': aiff: Skip padding byte for odd-sized chunks Also removes to odd-size checks from get_aiff_header and get_meta to use the generic path introduced by the original commit. Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2adbcbd97de1595b26a116ca22475b6f9acdf07 --- libavformat/aiffdec.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 9e7a39c..3bbe4a0 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -330,10 +330,14 @@ static int aiff_read_header(AVFormatContext *s) if (offset > 0 && st->codecpar->block_align) // COMM && SSND goto got_sound; default: /* Jump */ -if (size & 1) /* Always even aligned */ -size++; avio_skip(pb, size); } + +/* Skip required padding byte for odd-sized chunks. */ +if (size & 1) { +filesize--; +avio_skip(pb, 1); +} } got_sound: == diff --cc libavformat/aiffdec.c index 9e7a39c,3c45c61..3bbe4a0 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@@ -299,41 -260,21 +299,45 @@@ static int aiff_read_header(AVFormatCon case MKTAG('w', 'a', 'v', 'e'): if ((uint64_t)size > (1<<30)) return -1; -st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); -if (!st->codecpar->extradata) +if (ff_get_extradata(s, st->codecpar, pb, size) < 0) return AVERROR(ENOMEM); -st->codecpar->extradata_size = size; -avio_read(pb, st->codecpar->extradata, size); +if ( (st->codecpar->codec_id == AV_CODEC_ID_QDMC || st->codecpar->codec_id == AV_CODEC_ID_QDM2) +&& size>=12*4 && !st->codecpar->block_align) { +st->codecpar->block_align = AV_RB32(st->codecpar->extradata+11*4); +aiff->block_duration = AV_RB32(st->codecpar->extradata+9*4); +} else if (st->codecpar->codec_id == AV_CODEC_ID_QCELP) { +char rate = 0; +if (size >= 25) +rate = st->codecpar->extradata[24]; +switch (rate) { +case 'H': // RATE_HALF +st->codecpar->block_align = 17; +break; +case 'F': // RATE_FULL +default: +st->codecpar->block_align = 35; +} +aiff->block_duration = 160; +st->codecpar->bit_rate = (int64_t)st->codecpar->sample_rate * (st->codecpar->block_align << 3) / + aiff->block_duration; +} break; +case MKTAG('C','H','A','N'): +if(ff_mov_read_chan(s, pb, st, size) < 0) +return AVERROR_INVALIDDATA; +break; +case 0: +if (offset > 0 && st->codecpar->block_align) // COMM && SSND +goto got_sound; default: /* Jump */ - if (size & 1) /* Always even aligned */ - size++; avio_skip(pb, size); } + + /* Skip required padding byte for odd-sized chunks. */ + if (size & 1) { + filesize--; + avio_skip(pb, 1); + } } got_sound: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly
ffmpeg | branch: master | Matthieu Bouron | Fri Sep 27 14:57:09 2019 +0200| [1921f866ecf27b8b2b2764c24450d85577ff96c7] | committer: Matthieu Bouron avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly Allows the creation of the sdtp atom while remuxing MP4 to MP4. This atom is required by Apple devices (iPhone, Apple TV) in order to accept 2160p medias. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1921f866ecf27b8b2b2764c24450d85577ff96c7 --- libavformat/isom.h | 2 ++ libavformat/mov.c | 41 ++ .../ref/fate/hapqa-extract-snappy1-to-hapalphaonly | 2 +- tests/ref/fate/hapqa-extract-snappy1-to-hapq | 2 +- .../fate/hapqa-extract-snappy16-to-hapalphaonly| 2 +- tests/ref/fate/hapqa-extract-snappy16-to-hapq | 2 +- 6 files changed, 47 insertions(+), 4 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 69452cae8e..4943b80ccf 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -163,6 +163,8 @@ typedef struct MOVStreamContext { int64_t *chunk_offsets; unsigned int stts_count; MOVStts *stts_data; +unsigned int sdtp_count; +uint8_t *sdtp_data; unsigned int ctts_count; unsigned int ctts_allocated_size; MOVStts *ctts_data; diff --git a/libavformat/mov.c b/libavformat/mov.c index 8e916a28c6..4f69664eaf 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2959,6 +2959,40 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ +AVStream *st; +MOVStreamContext *sc; +int64_t i, entries; + +if (c->fc->nb_streams < 1) +return 0; +st = c->fc->streams[c->fc->nb_streams - 1]; +sc = st->priv_data; + +avio_r8(pb); /* version */ +avio_rb24(pb); /* flags */ +entries = atom.size - 4; + +av_log(c->fc, AV_LOG_TRACE, "track[%u].sdtp.entries = %" PRId64 "\n", + c->fc->nb_streams - 1, entries); + +if (sc->sdtp_data) +av_log(c->fc, AV_LOG_WARNING, "Duplicated SDTP atom\n"); +av_freep(&sc->sdtp_data); +sc->sdtp_count = 0; + +sc->sdtp_data = av_mallocz(entries); +if (!sc->sdtp_data) +return AVERROR(ENOMEM); + +for (i = 0; i < entries && !pb->eof_reached; i++) +sc->sdtp_data[i] = avio_r8(pb); +sc->sdtp_count = i; + +return 0; +} + static void mov_update_dts_shift(MOVStreamContext *sc, int duration) { if (duration < 0) { @@ -6767,6 +6801,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */ { MKTAG('s','t','t','s'), mov_read_stts }, { MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */ +{ MKTAG('s','d','t','p'), mov_read_sdtp }, /* independent and disposable samples */ { MKTAG('t','k','h','d'), mov_read_tkhd }, /* track header */ { MKTAG('t','f','d','t'), mov_read_tfdt }, { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */ @@ -7231,6 +7266,7 @@ static int mov_read_close(AVFormatContext *s) av_freep(&sc->sample_sizes); av_freep(&sc->keyframes); av_freep(&sc->stts_data); +av_freep(&sc->sdtp_data); av_freep(&sc->stps_data); av_freep(&sc->elst_data); av_freep(&sc->rap_group); @@ -7820,6 +7856,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) } if (st->discard == AVDISCARD_ALL) goto retry; +if (sc->sdtp_data && sc->current_sample <= sc->sdtp_count) { +uint8_t sample_flags = sc->sdtp_data[sc->current_sample - 1]; +uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3; +pkt->flags |= sample_is_depended_on == MOV_SAMPLE_DEPENDENCY_NO ? AV_PKT_FLAG_DISPOSABLE : 0; +} pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; pkt->pos = sample->pos; diff --git a/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly b/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly index 9ab123f09d..7edd5fa65b 100644 --- a/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly +++ b/tests/ref/fate/hapqa-extract-snappy1-to-hapalphaonly @@ -3,4 +3,4 @@ #codec_id 0: hap #dimensions 0: 127x71 #sar 0: 1/1 -0, 0, 0,1, 3044, 0xcaf6ddd0 +0, 0, 0,1, 3044, 0xcaf6ddd0, F=0x11 diff --git a/tests/ref/fat
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak
ffmpeg | branch: master | Matthieu Bouron | Thu Apr 9 16:53:21 2020 +0200| [5216edbc54c79869ce630579199e53454f96df96] | committer: Matthieu Bouron avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak Fixes ticket #8607. Signed-off-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5216edbc54c79869ce630579199e53454f96df96 --- libavcodec/mediacodec_wrapper.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 5213cf640a..79abc8b6aa 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1303,6 +1303,12 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec) ret = AVERROR_EXTERNAL; } +(*env)->DeleteGlobalRef(env, codec->input_buffers); +codec->input_buffers = NULL; + +(*env)->DeleteGlobalRef(env, codec->output_buffers); +codec->output_buffers = NULL; + (*env)->DeleteGlobalRef(env, codec->object); codec->object = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/mjpegdec: honor skip_frame option
ffmpeg | branch: master | Matthieu Bouron | Fri Oct 9 15:15:15 2015 +0200| [ff0dfb5c361aae841147f9f0ad2f72c45b973da5] | committer: Matthieu Bouron lavc/mjpegdec: honor skip_frame option > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff0dfb5c361aae841147f9f0ad2f72c45b973da5 --- libavcodec/mjpegdec.c | 25 + 1 file changed, 25 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 1a86b7b..e17b213 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2038,6 +2038,22 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR(ENOSYS); } +if (avctx->skip_frame == AVDISCARD_ALL) { +switch(start_code) { +case SOF0: +case SOF1: +case SOF2: +case SOF3: +case SOF48: +case SOI: +case SOS: +case EOI: +break; +default: +goto skip; +} +} + switch (start_code) { case SOI: s->restart_interval = 0; @@ -2103,6 +2119,10 @@ eoi_parser: if (s->bottom_field == !s->interlace_polarity) break; } +if (avctx->skip_frame == AVDISCARD_ALL) { +s->got_picture = 0; +goto the_end_no_picture; +} if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0) return ret; *got_frame = 1; @@ -2126,6 +2146,9 @@ eoi_parser: goto the_end; case SOS: s->cur_scan++; +if (avctx->skip_frame == AVDISCARD_ALL) +break; + if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) goto fail; @@ -2148,6 +2171,7 @@ eoi_parser: break; } +skip: /* eof process start code */ buf_ptr += (get_bits_count(&s->gb) + 7) / 8; av_log(avctx, AV_LOG_DEBUG, @@ -2344,6 +2368,7 @@ the_end: av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0); av_dict_free(&s->exif_metadata); +the_end_no_picture: av_log(avctx, AV_LOG_DEBUG, "decode frame unused %"PTRDIFF_SPECIFIER" bytes\n", buf_end - buf_ptr); // return buf_end - buf_ptr; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/pngdec: honor skip_frame option
ffmpeg | branch: master | Matthieu Bouron | Fri Oct 9 15:14:11 2015 +0200| [cbe2dfa4e51b92b0e291ed71be6fcee595c4201d] | committer: Matthieu Bouron lavc/pngdec: honor skip_frame option > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbe2dfa4e51b92b0e291ed71be6fcee595c4201d --- libavcodec/pngdec.c | 32 1 file changed, 32 insertions(+) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 99111d4..0bdd04e 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1088,6 +1088,13 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, for (;;) { length = bytestream2_get_bytes_left(&s->gb); if (length <= 0) { + +if (avctx->codec_id == AV_CODEC_ID_PNG && +avctx->skip_frame == AVDISCARD_ALL) { +av_frame_set_metadata(p, metadata); +return 0; +} + if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) { if (!(s->state & PNG_IDAT)) return 0; @@ -1115,6 +1122,20 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), ((tag >> 24) & 0xff), length); + +if (avctx->codec_id == AV_CODEC_ID_PNG && +avctx->skip_frame == AVDISCARD_ALL) { +switch(tag) { +case MKTAG('I', 'H', 'D', 'R'): +case MKTAG('p', 'H', 'Y', 's'): +case MKTAG('t', 'E', 'X', 't'): +case MKTAG('I', 'D', 'A', 'T'): +break; +default: +goto skip_tag; +} +} + switch (tag) { case MKTAG('I', 'H', 'D', 'R'): if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0) @@ -1197,6 +1218,11 @@ skip_tag: } } exit_loop: +if (avctx->codec_id == AV_CODEC_ID_PNG && +avctx->skip_frame == AVDISCARD_ALL) { +av_frame_set_metadata(p, metadata); +return 0; +} if (s->bits_per_pixel <= 4) handle_small_bpp(s, p); @@ -1294,6 +1320,12 @@ static int decode_frame_png(AVCodecContext *avctx, if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0) goto the_end; +if (avctx->skip_frame == AVDISCARD_ALL) { +*got_frame = 0; +ret = bytestream2_tell(&s->gb); +goto the_end; +} + if ((ret = av_frame_ref(data, s->picture.f)) < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/mjpegdec: set FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability
ffmpeg | branch: master | Matthieu Bouron | Mon Nov 2 10:32:51 2015 +0100| [ad0203d7b026d97d7c2127383f944ce0674fc227] | committer: Matthieu Bouron lavc/mjpegdec: set FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad0203d7b026d97d7c2127383f944ce0674fc227 --- libavcodec/mjpegdec.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index ebde12c..46c416a 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2459,7 +2459,8 @@ AVCodec ff_mjpeg_decoder = { .capabilities = AV_CODEC_CAP_DR1, .max_lowres = 3, .priv_class = &mjpegdec_class, -.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, }; #endif #if CONFIG_THP_DECODER ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/internal: add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
ffmpeg | branch: master | Matthieu Bouron | Mon Nov 2 10:27:58 2015 +0100| [e162542e156ac02c96c80c3dd47bdcd13ad20dbf] | committer: Matthieu Bouron lavc/internal: add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame setting. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e162542e156ac02c96c80c3dd47bdcd13ad20dbf --- libavcodec/internal.h |5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 0abe17f..9ab507a 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -53,6 +53,11 @@ * from the input AVPacket. */ #define FF_CODEC_CAP_SETS_PKT_DTS (1 << 2) +/** + * The decoder extracts and fills its parameters even if the frame is + * skiped due to the skip_frame setting. + */ +#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM (1 << 3) #ifdef TRACE # define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/pngdec: set FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability
ffmpeg | branch: master | Matthieu Bouron | Mon Nov 2 10:34:20 2015 +0100| [0cdc77f1040c2c7eb9331b43a7f371ab60396b2a] | committer: Matthieu Bouron lavc/pngdec: set FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0cdc77f1040c2c7eb9331b43a7f371ab60396b2a --- libavcodec/pngdec.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index feb1763..fe81d02 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1523,5 +1523,6 @@ AVCodec ff_png_decoder = { .init_thread_copy = ONLY_IF_THREADS_ENABLED(png_dec_init), .update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context), .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/, +.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, }; #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm: add ff_nv{12, 21}_to_{argb, rgba, abgr, bgra}_neon
ffmpeg | branch: master | Matthieu Bouron | Thu Nov 5 14:49:57 2015 +0100| [46feb66972bb9e872aebf15b9fe6ee9075e2615a] | committer: Clément Bœsch swscale/arm: add ff_nv{12,21}_to_{argb,rgba,abgr,bgra}_neon Signed-off-by: Matthieu Bouron Signed-off-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46feb66972bb9e872aebf15b9fe6ee9075e2615a --- libswscale/arm/Makefile |3 +- libswscale/arm/swscale_unscaled.c | 66 +++ libswscale/arm/yuv2rgb_neon.S | 162 + libswscale/swscale_unscaled.c |4 +- 4 files changed, 232 insertions(+), 3 deletions(-) diff --git a/libswscale/arm/Makefile b/libswscale/arm/Makefile index 8b5a97b..97b3561 100644 --- a/libswscale/arm/Makefile +++ b/libswscale/arm/Makefile @@ -1,4 +1,5 @@ -# OBJS+= arm/swscale_unscaled.o +OBJS+= arm/swscale_unscaled.o # NEON-OBJS += arm/rgb2yuv_neon_32.o # NEON-OBJS += arm/rgb2yuv_neon_16.o +NEON-OBJS += arm/yuv2rgb_neon.o diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 04be762..5d0c8e9 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -23,6 +23,7 @@ #include "libswscale/swscale_internal.h" #include "libavutil/arm/cpu.h" +#if 0 extern void rgbx_to_nv12_neon_32(const uint8_t *src, uint8_t *y, uint8_t *chroma, int width, int height, int y_stride, int c_stride, int src_stride, @@ -60,8 +61,69 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ return 0; } +#endif + +#define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt) \ +int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcC, int linesizeC, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff); \ + \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ +const int16_t yuv2rgb_table[] = { \ +c->yuv2rgb_v2r_coeff, \ +c->yuv2rgb_u2g_coeff, \ +c->yuv2rgb_v2g_coeff, \ +c->yuv2rgb_u2b_coeff, \ +}; \ + \ +ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0] + srcSliceY * srcStride[0], srcStride[0], \ + src[1] + (srcSliceY / 2) * srcStride[1], srcStride[1], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 9, \ + c->yuv2rgb_y_coeff); \ + \ +return 0; \ +} + +#define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra) \ + +DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv12) +DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) + +/* We need a 16 pixel width alignment. This constrai
[FFmpeg-cvslog] fate: add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM tests
ffmpeg | branch: master | Matthieu Bouron | Wed Nov 25 10:30:15 2015 +0100| [39290f271550c762cb4553e7c8405d344d630d36] | committer: Matthieu Bouron fate: add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM tests > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39290f271550c762cb4553e7c8405d344d630d36 --- tests/api/Makefile |1 + tests/api/api-codec-param-test.c| 252 tests/fate/api.mak |8 + tests/ref/fate/api-jpeg-codec-param | 310 +++ tests/ref/fate/api-png-codec-param | 310 +++ 5 files changed, 881 insertions(+) diff --git a/tests/api/Makefile b/tests/api/Makefile index 27f499f..c48c34a 100644 --- a/tests/api/Makefile +++ b/tests/api/Makefile @@ -1,6 +1,7 @@ APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264 APITESTPROGS-yes += api-seek +APITESTPROGS-yes += api-codec-param APITESTPROGS-$(call DEMDEC, H263, H263) += api-band APITESTPROGS += $(APITESTPROGS-yes) diff --git a/tests/api/api-codec-param-test.c b/tests/api/api-codec-param-test.c new file mode 100644 index 000..9989825 --- /dev/null +++ b/tests/api/api-codec-param-test.c @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2015 Matthieu Bouron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "libavformat/avformat.h" +#include "libavutil/pixdesc.h" +#include "libavcodec/internal.h" +#include "libavutil/avassert.h" +#include "libavutil/opt.h" + +static int try_decode_video_frame(AVCodecContext *codec_ctx, AVPacket *pkt, int decode) +{ +int ret = 0; +int got_frame = 0; +AVFrame *frame = NULL; +int skip_frame = codec_ctx->skip_frame; + +if (!avcodec_is_open(codec_ctx)) { +const AVCodec *codec = avcodec_find_decoder(codec_ctx->codec_id); + +ret = avcodec_open2(codec_ctx, codec, NULL); +if (ret < 0) { +av_log(codec_ctx, AV_LOG_ERROR, "Failed to open codec\n"); +goto end; +} +} + +frame = av_frame_alloc(); +if (!frame) { +av_log(NULL, AV_LOG_ERROR, "Failed to allocate frame\n"); +goto end; +} + +if (!decode && codec_ctx->codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM) { +codec_ctx->skip_frame = AVDISCARD_ALL; +} + +do { +ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, pkt); +av_assert0(decode || (!decode && !got_frame)); +if (ret < 0) +break; +pkt->data += ret; +pkt->size -= ret; + +if (got_frame) { +break; +} +} while (pkt->size > 0); + +end: +codec_ctx->skip_frame = skip_frame; + +av_frame_free(&frame); +return ret; +} + +static int find_video_stream_info(AVFormatContext *fmt_ctx, int decode) +{ +int ret = 0; +int i, done = 0; +AVPacket pkt; + +av_init_packet(&pkt); + +while (!done) { +AVCodecContext *codec_ctx = NULL; +AVStream *st; + +if ((ret = av_read_frame(fmt_ctx, &pkt)) < 0) { +av_log(fmt_ctx, AV_LOG_ERROR, "Failed to read frame\n"); +goto end; +} + +st = fmt_ctx->streams[pkt.stream_index]; +codec_ctx = st->codec; + +/* Writing to AVStream.codec_info_nb_frames must not be done by + * user applications. It is done here for testing purposing as + * find_video_stream_info tries to mimic avformat_find_stream_info + * which writes to this field. + * */ +if (codec_ctx->codec_type != AVMEDIA_TYPE_VIDEO || +st->codec_info_nb_frames++ > 0) { +av_packet_unref(&pkt); +continue; +
[FFmpeg-cvslog] lavf/utils: avoid decoding a frame to get the codec parameters
ffmpeg | branch: master | Matthieu Bouron | Tue Nov 24 14:14:54 2015 +0100| [72eaf726236331e739952806a5fe47b40165ac76] | committer: Matthieu Bouron lavf/utils: avoid decoding a frame to get the codec parameters Avoid decoding a frame to get the codec parameters while the codec supports FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM. This is particulary useful to avoid decoding twice images (once in avformat_find_stream_info and once when the actual decode is made). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72eaf726236331e739952806a5fe47b40165ac76 --- libavformat/utils.c | 12 1 file changed, 12 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index f33f2f5..8cb7d38 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2695,6 +2695,8 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, AVFrame *frame = av_frame_alloc(); AVSubtitle subtitle; AVPacket pkt = *avpkt; +int do_skip_frame = 0; +enum AVDiscard skip_frame; if (!frame) return AVERROR(ENOMEM); @@ -2733,6 +2735,12 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, goto fail; } +if (st->codec->codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM) { +do_skip_frame = 1; +skip_frame = st->codec->skip_frame; +st->codec->skip_frame = AVDISCARD_ALL; +} + while ((pkt.size > 0 || (!pkt.data && got_picture)) && ret >= 0 && (!has_codec_parameters(st, NULL) || !has_decode_delay_been_guessed(st) || @@ -2768,6 +2776,10 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, ret = -1; fail: +if (do_skip_frame) { +st->codec->skip_frame = skip_frame; +} + av_frame_free(&frame); return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm: add ff_nv{12, 21}_to_{argb, rgba, abgr, bgra}_neon_16
ffmpeg | branch: master | Matthieu Bouron | Mon Dec 7 13:56:25 2015 +0100| [5aca33c2cfc39e23fc977df1b0aed720c7043574] | committer: Matthieu Bouron swscale/arm: add ff_nv{12,21}_to_{argb,rgba,abgr,bgra}_neon_16 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5aca33c2cfc39e23fc977df1b0aed720c7043574 --- libswscale/arm/swscale_unscaled.c | 59 +++-- libswscale/arm/yuv2rgb_neon.S | 167 ++--- 2 files changed, 167 insertions(+), 59 deletions(-) diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 5d0c8e9..dbb0fb0 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -63,8 +63,8 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ } #endif -#define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt) \ -int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ +#define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt, precision) \ +int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h, \ uint8_t *dst, int linesize, \ const uint8_t *srcY, int linesizeY, \ const uint8_t *srcC, int linesizeC, \ @@ -72,59 +72,64 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const uint8_t *src[], \ int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *dst[], int dstStride[]) { \ const int16_t yuv2rgb_table[] = { \ -c->yuv2rgb_v2r_coeff, \ -c->yuv2rgb_u2g_coeff, \ -c->yuv2rgb_v2g_coeff, \ -c->yuv2rgb_u2b_coeff, \ +c->yuv2rgb_v2r_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_u2g_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_v2g_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_u2b_coeff / ((precision) == 16 ? 1 << 7 : 1), \ }; \ \ -ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ +ff_##ifmt##_to_##ofmt##_neon_##precision(c->srcW, srcSliceH, \ dst[0] + srcSliceY * dstStride[0], dstStride[0], \ src[0] + srcSliceY * srcStride[0], srcStride[0], \ src[1] + (srcSliceY / 2) * srcStride[1], srcStride[1], \ yuv2rgb_table, \ c->yuv2rgb_y_offset >> 9, \ - c->yuv2rgb_y_coeff); \ + c->yuv2rgb_y_coeff / ((precision) == 16 ? 1 << 7 : 1));\ \ return 0; \ -} +} \ + +#define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx, precision) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb, precision) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba, precision) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr, precision) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra, precision)
[FFmpeg-cvslog] fate/api-{jpeg, png}-codec-param: add missing codec dependencies
ffmpeg | branch: master | Matthieu Bouron | Mon Dec 7 10:12:27 2015 +0100| [102842d5fbb7c38a437bc128938466b231fe0ce9] | committer: Matthieu Bouron fate/api-{jpeg,png}-codec-param: add missing codec dependencies > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=102842d5fbb7c38a437bc128938466b231fe0ce9 --- tests/fate/api.mak |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/api.mak b/tests/fate/api.mak index 3013239..7a99710 100644 --- a/tests/fate/api.mak +++ b/tests/fate/api.mak @@ -20,11 +20,11 @@ fate-api-seek: CMD = run $(APITESTSDIR)/api-seek-test $(TARGET_PATH)/tests/data/ fate-api-seek: CMP = null fate-api-seek: REF = /dev/null -FATE_API_SAMPLES_LIBAVFORMAT-yes += fate-api-png-codec-param +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, PNG) += fate-api-png-codec-param fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF) fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/png1/lena-rgba.png -FATE_API_SAMPLES_LIBAVFORMAT-yes += fate-api-jpeg-codec-param +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) += fate-api-jpeg-codec-param fate-api-jpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF) fate-api-jpeg-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/api-codec-param: fix codec context leak
ffmpeg | branch: master | Matthieu Bouron | Mon Dec 7 10:00:35 2015 +0100| [bd0a9f603d0c1d0f3be782865f72ac29ab89bc5b] | committer: Matthieu Bouron fate/api-codec-param: fix codec context leak > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd0a9f603d0c1d0f3be782865f72ac29ab89bc5b --- tests/api/api-codec-param-test.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/tests/api/api-codec-param-test.c b/tests/api/api-codec-param-test.c index 9989825..fa51964 100644 --- a/tests/api/api-codec-param-test.c +++ b/tests/api/api-codec-param-test.c @@ -129,6 +129,12 @@ static int find_video_stream_info(AVFormatContext *fmt_ctx, int decode) end: av_packet_unref(&pkt); +/* close all codecs opened in try_decode_video_frame */ +for (i = 0; i < fmt_ctx->nb_streams; i++) { +AVStream *st = fmt_ctx->streams[i]; +avcodec_close(st->codec); +} + return ret < 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param
ffmpeg | branch: master | Matthieu Bouron | Mon Dec 7 10:40:03 2015 +0100| [3d090653168c1a0753b0efa3de9ea352c1a187ba] | committer: Matthieu Bouron fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d090653168c1a0753b0efa3de9ea352c1a187ba --- tests/fate/api.mak |6 +++--- tests/ref/fate/{api-jpeg-codec-param => api-mjpeg-codec-param} |0 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fate/api.mak b/tests/fate/api.mak index 7a99710..2ebc531 100644 --- a/tests/fate/api.mak +++ b/tests/fate/api.mak @@ -24,9 +24,9 @@ FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, PNG) += fate-api-png-codec-p fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF) fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/png1/lena-rgba.png -FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) += fate-api-jpeg-codec-param -fate-api-jpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF) -fate-api-jpeg-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) += fate-api-mjpeg-codec-param +fate-api-mjpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF) +fate-api-mjpeg-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg FATE_API-$(HAVE_THREADS) += fate-api-threadmessage fate-api-threadmessage: $(APITESTSDIR)/api-threadmessage-test$(EXESUF) diff --git a/tests/ref/fate/api-jpeg-codec-param b/tests/ref/fate/api-mjpeg-codec-param similarity index 100% rename from tests/ref/fate/api-jpeg-codec-param rename to tests/ref/fate/api-mjpeg-codec-param ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi: use a video frame pool for each link of the filtergraph
ffmpeg | branch: master | Matthieu Bouron | Fri Dec 11 13:32:47 2015 +0100| [0c59d40ae06b680de33d77b4124947813367] | committer: Matthieu Bouron lavfi: use a video frame pool for each link of the filtergraph > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c59d40ae06b680de33d77b4124947813367 --- libavfilter/Makefile|1 + libavfilter/avfilter.c |1 + libavfilter/avfilter.h |5 ++ libavfilter/framepool.c | 189 +++ libavfilter/framepool.h | 84 + libavfilter/internal.h |1 + libavfilter/video.c | 42 +++ 7 files changed, 309 insertions(+), 14 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index d7a3f61..dea012a 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -17,6 +17,7 @@ OBJS = allfilters.o \ drawutils.o \ fifo.o \ formats.o\ + framepool.o \ graphdump.o \ graphparser.o\ opencl_allkernels.o \ diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c5c3044..5d7bc09 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -168,6 +168,7 @@ void avfilter_link_free(AVFilterLink **link) return; av_frame_free(&(*link)->partial_buf); +ff_video_frame_pool_uninit((FFVideoFramePool**)&(*link)->video_frame_pool); av_freep(link); } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 7aac3cf..dca0294 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -509,6 +509,11 @@ struct AVFilterLink { * Number of past frames sent through the link. */ int64_t frame_count; + +/** + * A pointer to a FFVideoFramePool struct. + */ +void *video_frame_pool; }; /** diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c new file mode 100644 index 000..ff3a4f7 --- /dev/null +++ b/libavfilter/framepool.c @@ -0,0 +1,189 @@ +/* + * This file is part of FFmpeg. + * + * Copyright (c) 2015 Matthieu Bouron + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "framepool.h" +#include "libavutil/avassert.h" +#include "libavutil/buffer.h" +#include "libavutil/frame.h" +#include "libavutil/imgutils.h" +#include "libavutil/mem.h" +#include "libavutil/pixfmt.h" + +struct FFVideoFramePool { + +int width; +int height; +int format; +int align; +int linesize[4]; +AVBufferPool *pools[4]; + +}; + +FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*alloc)(int size), + int width, + int height, + enum AVPixelFormat format, + int align) +{ +int i, ret; +FFVideoFramePool *pool; +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); + +if (!desc) +return NULL; + +pool = av_mallocz(sizeof(FFVideoFramePool)); +if (!pool) +return NULL; + +pool->width = width; +pool->height = height; +pool->format = format; +pool->align = align; + +if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) { +goto fail; +} + +if (!pool->linesize[0]) { +for(i = 1; i <= align; i += i) { +ret = av_image_fill_linesizes(pool->linesize, pool->format, + FFALIGN(pool->width, i)); +if (ret < 0) { +goto fail; +} +if (!(pool->linesize[0] & (pool->align - 1))) +break; +} + +for (i = 0; i < 4 && pool->linesize[i]; i++) { +pool->linesize[i] = FFALIGN(pool->linesize[i],
[FFmpeg-cvslog] lavc/utils: use AVPixFmtDescriptor to probe palette formats
ffmpeg | branch: master | Matthieu Bouron | Mon Dec 14 17:49:48 2015 +0100| [ae1c750cb49ff5d6641a11cd9765da1150e6a9bd] | committer: Matthieu Bouron lavc/utils: use AVPixFmtDescriptor to probe palette formats Also use the input frame format instead of the AVCodecContext one according to the documentation of AVCodecContext.get_buffer2(). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ae1c750cb49ff5d6641a11cd9765da1150e6a9bd --- libavcodec/utils.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9a7ffde..94ec2f6 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -646,6 +646,7 @@ fail: static int video_get_buffer(AVCodecContext *s, AVFrame *pic) { FramePool *pool = s->internal->pool; +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format); int i; if (pic->data[0]) { @@ -653,6 +654,13 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) return -1; } +if (!desc) { +av_log(s, AV_LOG_ERROR, +"Unable to get pixel format descriptor for format %s\n", +av_get_pix_fmt_name(pic->format)); +return AVERROR(EINVAL); +} + memset(pic->data, 0, sizeof(pic->data)); pic->extended_data = pic->data; @@ -669,8 +677,9 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) pic->data[i] = NULL; pic->linesize[i] = 0; } -if (pic->data[1] && !pic->data[2]) -avpriv_set_systematic_pal2((uint32_t *)pic->data[1], s->pix_fmt); +if (desc->flags & AV_PIX_FMT_FLAG_PAL || +desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) +avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format); if (s->debug & FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm/yuv2rgb: simplify process_16px_* macro call
ffmpeg | branch: master | Matthieu Bouron | Tue Dec 15 17:04:09 2015 +0100| [c2ad24832139699815b9666b91ae8876fe3b47c1] | committer: Matthieu Bouron swscale/arm/yuv2rgb: simplify process_16px_* macro call > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2ad24832139699815b9666b91ae8876fe3b47c1 --- libswscale/arm/yuv2rgb_neon.S |8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libswscale/arm/yuv2rgb_neon.S b/libswscale/arm/yuv2rgb_neon.S index 01d8536..9f9dd2a 100644 --- a/libswscale/arm/yuv2rgb_neon.S +++ b/libswscale/arm/yuv2rgb_neon.S @@ -226,13 +226,7 @@ function ff_\ifmt\()_to_\ofmt\()_neon_\precision\(), export=1 vsubl.u8q15, d2, d10 @ q15 = V - 128 .endif -.ifc \precision,16 -process_16px_16 \ofmt -.endif - -.ifc \precision,32 -process_16px_32 \ofmt -.endif +process_16px_\precision \ofmt subsr8, r8, #16@ width -= 16 bgt 2b ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm/yuv2rgb: add ff_yuv420p_to_{argb, rgba, abgr, bgra}_neon_{16, 32}
ffmpeg | branch: master | Matthieu Bouron | Tue Dec 15 14:42:22 2015 +0100| [b32a42295ad7b254f9662082d799c0aae2071c2e] | committer: Matthieu Bouron swscale/arm/yuv2rgb: add ff_yuv420p_to_{argb,rgba,abgr,bgra}_neon_{16,32} > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b32a42295ad7b254f9662082d799c0aae2071c2e --- libswscale/arm/swscale_unscaled.c | 52 ++--- libswscale/arm/yuv2rgb_neon.S | 77 ++--- 2 files changed, 118 insertions(+), 11 deletions(-) diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 4c12122..1b50acd 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -63,6 +63,50 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ } #endif +#define YUV_TO_RGB_TABLE(precision) \ +c->yuv2rgb_v2r_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_u2g_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_v2g_coeff / ((precision) == 16 ? 1 << 7 : 1), \ +c->yuv2rgb_u2b_coeff / ((precision) == 16 ? 1 << 7 : 1), \ + +#define DECLARE_FF_YUV420P_TO_RGBX_FUNCS(ofmt, precision) \ +int ff_yuv420p_to_##ofmt##_neon_##precision(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcU, int linesizeU, \ + const uint8_t *srcV, int linesizeV, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff); \ + \ +static int yuv420p_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const uint8_t *src[],\ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ +const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE(precision) }; \ + \ +ff_yuv420p_to_##ofmt##_neon_##precision(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0], srcStride[0], \ + src[1], srcStride[1], \ + src[2], srcStride[2], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 9, \ + c->yuv2rgb_y_coeff / ((precision) == 16 ? 1 << 7 : 1));\ + \ +return 0; \ +} \ + +#define DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(precision) \ +DECLARE_FF_YUV420P_TO_RGBX_FUNCS(argb, precision) \ +DECLARE_FF_YUV420P_TO_RGBX_FUNCS(rgba, precision) \ +DECLARE_FF_YUV420P_TO_RGBX_FUNCS(abgr, precision) \ +DECLARE_FF_YUV420P_TO_RGBX_FUNCS(bgra, precision) \ + +#define DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS \ +DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(16) \ + +DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS + #define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt, precision) \ int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h, \ uint8_t *dst, int linesize, \ @@ -75,12 +119,7 @@ int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h, static int ifmt
[FFmpeg-cvslog] swscale/arm/yuv2rgb: disable neon if accurate_rnd is enabled
ffmpeg | branch: master | Matthieu Bouron | Fri Dec 18 14:24:52 2015 +0100| [e0dc22b99e85823ea85a9da85eced1e9b2bf24e4] | committer: Matthieu Bouron swscale/arm/yuv2rgb: disable neon if accurate_rnd is enabled This disables the 32bit precision neon code path in favor of the default C one and avoids breaking fate. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0dc22b99e85823ea85a9da85eced1e9b2bf24e4 --- libswscale/arm/swscale_unscaled.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index e694ef4..4c12122 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -100,7 +100,6 @@ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra, precision) #define DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nvx) \ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx, 16) \ -DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx, 32) \ DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv12) DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv21) @@ -113,9 +112,9 @@ DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv21) if (c->srcFormat == AV_PIX_FMT_##IFMT \ && c->dstFormat == AV_PIX_FMT_##OFMT \ && !(c->srcH & 1) \ -&& !(c->srcW & 15)) { \ -c->swscale = (accurate_rnd) ? ifmt##_to_##ofmt##_neon_wrapper_32 : \ - ifmt##_to_##ofmt##_neon_wrapper_16 ; \ +&& !(c->srcW & 15) \ +&& !accurate_rnd) { \ +c->swscale = ifmt##_to_##ofmt##_neon_wrapper_16; \ } \ } while (0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm/yuv2rgb: fix typo
ffmpeg | branch: master | Matthieu Bouron | Sat Dec 26 17:45:33 2015 +| [44913d19457d553f1056c388be2e37748a854052] | committer: Matthieu Bouron swscale/arm/yuv2rgb: fix typo > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44913d19457d553f1056c388be2e37748a854052 --- libswscale/arm/yuv2rgb_neon.S |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/arm/yuv2rgb_neon.S b/libswscale/arm/yuv2rgb_neon.S index dd00246..d497dd4 100644 --- a/libswscale/arm/yuv2rgb_neon.S +++ b/libswscale/arm/yuv2rgb_neon.S @@ -299,7 +299,7 @@ function ff_\ifmt\()_to_\ofmt\()_neon_\precision\(), export=1 ldr r7, [sp, #124] @ r7 = linesizeV sub r7, r7, r0, lsr #1 @ r7 = linesizeV - width / 2 (paddingV) -add r10, r10, r7 @ srcU += paddingV +add r10, r10, r7 @ srcV += paddingV .endif subsr1, r1, #2 @ height -= 2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/arm/yuv2rgb: add ff_yuv422p_to_{argb, rgba, abgr, bgra}_neon_{16, 32}
ffmpeg | branch: master | Matthieu Bouron | Sat Dec 26 18:17:49 2015 +0100| [e4e9b9454e9705878a221dd0ba8c7da963df40a8] | committer: Matthieu Bouron swscale/arm/yuv2rgb: add ff_yuv422p_to_{argb,rgba,abgr,bgra}_neon_{16,32} > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4e9b9454e9705878a221dd0ba8c7da963df40a8 --- libswscale/arm/swscale_unscaled.c | 26 ++- libswscale/arm/yuv2rgb_neon.S | 93 ++--- 2 files changed, 101 insertions(+), 18 deletions(-) diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 1b50acd..ac1e4a9 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -69,8 +69,8 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ c->yuv2rgb_v2g_coeff / ((precision) == 16 ? 1 << 7 : 1), \ c->yuv2rgb_u2b_coeff / ((precision) == 16 ? 1 << 7 : 1), \ -#define DECLARE_FF_YUV420P_TO_RGBX_FUNCS(ofmt, precision) \ -int ff_yuv420p_to_##ofmt##_neon_##precision(int w, int h, \ +#define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt, precision) \ +int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h, \ uint8_t *dst, int linesize, \ const uint8_t *srcY, int linesizeY, \ const uint8_t *srcU, int linesizeU, \ @@ -79,12 +79,12 @@ int ff_yuv420p_to_##ofmt##_neon_##precision(int w, int h, int y_offset, \ int y_coeff); \ \ -static int yuv420p_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const uint8_t *src[],\ +static int ifmt##_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const uint8_t *src[], \ int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *dst[], int dstStride[]) { \ const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE(precision) }; \ \ -ff_yuv420p_to_##ofmt##_neon_##precision(c->srcW, srcSliceH, \ +ff_##ifmt##_to_##ofmt##_neon_##precision(c->srcW, srcSliceH, \ dst[0] + srcSliceY * dstStride[0], dstStride[0], \ src[0], srcStride[0], \ src[1], srcStride[1], \ @@ -96,16 +96,17 @@ static int yuv420p_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const uin return 0; \ } \ -#define DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(precision) \ -DECLARE_FF_YUV420P_TO_RGBX_FUNCS(argb, precision) \ -DECLARE_FF_YUV420P_TO_RGBX_FUNCS(rgba, precision) \ -DECLARE_FF_YUV420P_TO_RGBX_FUNCS(abgr, precision) \ -DECLARE_FF_YUV420P_TO_RGBX_FUNCS(bgra, precision) \ +#define DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx, precision) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, argb, precision) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgba, precision) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, abgr, precision) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgra, precision) \ -#define DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS \ -DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(16) \ +#define DECLARE_FF_YUVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(yuvx) \ +DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx, 16) \ -DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS +DECLARE_FF_YUVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(yuv420p) +DECLARE_FF_YUVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(yuv422p) #define DECLARE_FF_NVX_TO_RGBX_
[FFmpeg-cvslog] swresample/arm: add ff_resample_common_apply_filter_{x4, x8}_{float, s16}_neon
ffmpeg | branch: master | Matthieu Bouron | Sun May 8 18:56:03 2016 +| [f6265a5cbcfb94c34e233a47930ec50495b176de] | committer: Matthieu Bouron swresample/arm: add ff_resample_common_apply_filter_{x4,x8}_{float,s16}_neon > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f6265a5cbcfb94c34e233a47930ec50495b176de --- libswresample/arm/Makefile|7 ++- libswresample/arm/resample.S | 77 + libswresample/arm/resample_init.c | 115 + libswresample/resample.h |1 + libswresample/resample_dsp.c |1 + 5 files changed, 199 insertions(+), 2 deletions(-) diff --git a/libswresample/arm/Makefile b/libswresample/arm/Makefile index 60f3f6d..53ab462 100644 --- a/libswresample/arm/Makefile +++ b/libswresample/arm/Makefile @@ -1,5 +1,8 @@ -OBJS += arm/audio_convert_init.o +OBJS += arm/audio_convert_init.o \ + arm/resample_init.o + OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o -NEON-OBJS += arm/audio_convert_neon.o +NEON-OBJS += arm/audio_convert_neon.o \ + arm/resample.o diff --git a/libswresample/arm/resample.S b/libswresample/arm/resample.S new file mode 100644 index 000..c231301 --- /dev/null +++ b/libswresample/arm/resample.S @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Matthieu Bouron + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/arm/asm.S" + +function ff_resample_common_apply_filter_x4_float_neon, export=1 +vmov.f32q0, #0.0 @ accumulator +1: vld1.32 {q1}, [r1]!@ src +vld1.32 {q2}, [r2]!@ filter +vmla.f32q0, q1, q2 @ accumulator += src + {0..3} * filter + {0..3} +subsr3, #4 @ filter_length -= 4 +bgt 1b @ loop until filter_length +vpadd.f32 d0, d0, d1 @ pair adding of the 4x32-bit accumulated values +vpadd.f32 d0, d0, d0 @ pair adding of the 4x32-bit accumulator values +vst1.32 {d0[0]}, [r0] @ write accumulator +mov pc, lr +endfunc + +function ff_resample_common_apply_filter_x8_float_neon, export=1 +vmov.f32q0, #0.0 @ accumulator +1: vld1.32 {q1}, [r1]!@ src +vld1.32 {q2}, [r2]!@ filter +vld1.32 {q8}, [r1]!@ src +vld1.32 {q9}, [r2]!@ filter +vmla.f32q0, q1, q2 @ accumulator += src + {0..3} * filter + {0..3} +vmla.f32q0, q8, q9 @ accumulator += src + {4..7} * filter + {4..7} +subsr3, #8 @ filter_length -= 8 +bgt 1b @ loop until filter_length +vpadd.f32 d0, d0, d1 @ pair adding of the 4x32-bit accumulated values +vpadd.f32 d0, d0, d0 @ pair adding of the 4x32-bit accumulator values +vst1.32 {d0[0]}, [r0] @ write accumulator +mov pc, lr +endfunc + +function ff_resample_common_apply_filter_x4_s16_neon, export=1 +vmov.s32q0, #0 @ accumulator +1: vld1.16 {d2}, [r1]!@ src +vld1.16 {d4}, [r2]!@ filter +vmlal.s16 q0, d2, d4 @ accumulator += src + {0..3} * filter + {0..3} +subsr3, #4 @ filter_length -= 4 +bgt