Re: [FFmpeg-devel] FFmpeg 2.7
Am 10.06.2015 um 01:52 schrieb Michael Niedermayer: On Sat, Jun 06, 2015 at 02:10:20PM +0200, Michael Niedermayer wrote: Hi all Its time again for another release (its about 3 months since 2.6) so if theres anything you want in it, or you want something specific written in some releas notes / changelog, write it now or its too late release made 2.7.1 will be released in 1-2 weeks, so keep cherry picking bugfixed into release/2.7, it will be in the next release soon Shared on Facebook. BR, Thomas. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264: update avctx width/height when flushing
On Tue, Jun 09, 2015 at 11:53:03PM +0200, Andreas Cadhalpun wrote: > Inconsistencies between the dimensions of avctx and the frame can > confuse API users. For example this can crash the demuxing_decoding > example. > > Signed-off-by: Andreas Cadhalpun > --- > libavcodec/h264.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavcodec/h264.c b/libavcodec/h264.c > index 9a00214..d1eaa5e 100644 > --- a/libavcodec/h264.c > +++ b/libavcodec/h264.c > @@ -1757,6 +1757,8 @@ static int h264_decode_frame(AVCodecContext *avctx, > void *data, > if (ret < 0) > return ret; > *got_frame = 1; > +avctx->width = pict->width; > +avctx->height = pict->height; > } iam not sure this is not breaking something, other parts of the h264 decoder expect this to be set relative to the last frame in coding order. also avctx->pix_fmt would then still potentially not match the last output frame, also pix_fmt has the same problem as above ive fixed one use of width/height not to depend on the AVCodecContext value but a 2nd remains [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264: update avctx width/height when flushing
On Wed, Jun 10, 2015 at 11:43:16AM +0200, Michael Niedermayer wrote: > On Tue, Jun 09, 2015 at 11:53:03PM +0200, Andreas Cadhalpun wrote: > > Inconsistencies between the dimensions of avctx and the frame can > > confuse API users. For example this can crash the demuxing_decoding > > example. > > > > Signed-off-by: Andreas Cadhalpun > > --- > > libavcodec/h264.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/libavcodec/h264.c b/libavcodec/h264.c > > index 9a00214..d1eaa5e 100644 > > --- a/libavcodec/h264.c > > +++ b/libavcodec/h264.c > > @@ -1757,6 +1757,8 @@ static int h264_decode_frame(AVCodecContext *avctx, > > void *data, > > if (ret < 0) > > return ret; > > *got_frame = 1; > > +avctx->width = pict->width; > > +avctx->height = pict->height; > > } > > iam not sure this is not breaking something, other parts of the h264 > decoder expect this to be set relative to the last frame in coding > order. > also avctx->pix_fmt would then still potentially not match the last > output frame, also pix_fmt has the same problem as above > > ive fixed one use of width/height not to depend on the AVCodecContext > value but a 2nd remains actually theres more code that uses it ff_h264_draw_horiz_band() and its callers use h->avctx->height too [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] takdec: ensure chan2 is a valid channel index
On Wed, Jun 10, 2015 at 01:40:49AM +0200, Paul B Mahol wrote: > Dana 10. 6. 2015. 01:15 osoba "Michael Niedermayer" > napisala je: > > > > On Wed, Jun 10, 2015 at 12:12:38AM +0200, Andreas Cadhalpun wrote: > > > If chan2 is not smaller than the number of channels, it can cause > > > segmentation faults due to dereferencing a NULL pointer. > > > > > > Signed-off-by: Andreas Cadhalpun > > > --- > > > libavcodec/takdec.c | 6 ++ > > > 1 file changed, 6 insertions(+) > > > > looks ok from a quick glance, but paul is the maintainer of this > > lgtm as you asked on IRC about this applied Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No great genius has ever existed without some touch of madness. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] libvpxenc: add undershoot-pct option
On Tue, Jun 09, 2015 at 11:01:16PM -0700, James Zern wrote: > replaces deprecated rc_buffer_aggressivity > --- > libavcodec/libvpxenc.c | 12 > 1 file changed, 12 insertions(+) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] libvpxenc: add overshoot-pct option
On Tue, Jun 09, 2015 at 11:01:17PM -0700, James Zern wrote: > balances the presence of undershoot-pct > --- > libavcodec/libvpxenc.c | 4 > 1 file changed, 4 insertions(+) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat: Fix bug in parse_rps for HEVC.
On Wed, Jun 10, 2015 at 12:30:46PM +0800, Deliang Fu wrote: > Make the logic in libavformat/hevc.c parse_rps align with > libavcodec/hevc_ps.c ff_hevc_decode_short_term_rps > > --- > libavformat/hevc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) do you have a sample/testcase which needs this? if so can you upload that or do you have a link ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC loop filter and sao functions
On Tue, Jun 09, 2015 at 08:50:26PM +0530, shivraj.pa...@imgtec.com wrote: > From: Shivraj Patil > > This patch adds MSA (MIPS-SIMD-Arch) optimizations for HEVC loop filter and > sao functions in new file hevc_lpf_sao_msa.c > Adds new generic macros (needed for this patch) in > libavutil/mips/generic_macros_msa.h > > In this patch, in comparision with previous patch, duplicated c functions are > removed. > > Signed-off-by: Shivraj Patil > --- > libavcodec/mips/Makefile|3 +- > libavcodec/mips/hevc_lpf_sao_msa.c | 2088 > +++ > libavcodec/mips/hevcdsp_init_mips.c | 26 + > libavcodec/mips/hevcdsp_mips.h | 30 + > libavutil/mips/generic_macros_msa.h | 111 +- > 5 files changed, 2256 insertions(+), 2 deletions(-) > create mode 100644 libavcodec/mips/hevc_lpf_sao_msa.c applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/flvdec.c: don't build index_entries for input stream if AVIOContext is not seekable
Hello. I suggest a small patch for FLV demuxer that prevent building index_entries list if AVIOContext is not seekable. Whithout this check indext_entries list behave as memory leak on continous stream (for example rtmp live stream) From 5ee9ec176f8019e117fcfdd17bcddea8911c7945 Mon Sep 17 00:00:00 2001 From: Igor Derzhavin Date: Wed, 10 Jun 2015 14:56:02 +0300 Subject: [PATCH] libavformat/flvdec.c: don't build index_entries for input stream if AVIOContext is not seekable Signed-off-by: Igor Derzhavin --- libavformat/flvdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 940d4dd..aea26c7 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -896,8 +896,9 @@ skip: } av_log(s, AV_LOG_TRACE, "%d %X %d \n", stream_type, flags, st->discard); -if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || -stream_type == FLV_STREAM_TYPE_AUDIO) +if (s->pb->seekable && +((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || + stream_type == FLV_STREAM_TYPE_AUDIO)) av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME); if ( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || (stream_type == FLV_STREAM_TYPE_AUDIO))) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC intra prediction functions
On Thu, Jun 04, 2015 at 01:31:49PM +0530, shivraj.pa...@imgtec.com wrote: > From: Shivraj Patil > > This patch adds MSA (MIPS-SIMD-Arch) optimizations for HEVC intra predition > functions in new file hevcpred_msa.c > Adds new generic macros (needed for this patch) in > libavutil/mips/generic_macros_msa.h > > Signed-off-by: Shivraj Patil > --- > libavcodec/hevcpred.c|3 + > libavcodec/hevcpred.h|1 + > libavcodec/mips/Makefile |6 +- > libavcodec/mips/hevcpred_init_mips.c | 48 + > libavcodec/mips/hevcpred_mips.h | 73 + > libavcodec/mips/hevcpred_msa.c | 3084 > ++ > libavutil/mips/generic_macros_msa.h | 47 +- > 7 files changed, 3259 insertions(+), 3 deletions(-) > create mode 100644 libavcodec/mips/hevcpred_init_mips.c > create mode 100644 libavcodec/mips/hevcpred_mips.h > create mode 100644 libavcodec/mips/hevcpred_msa.c applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH][GSoC] lavf/http: Correctly terminate session with HTTP POST client.
Le primidi 21 prairial, an CCXXIII, Stephan Holljes a écrit : > Send a footer to correctly close client sockets. > This fixes network errors in client applications. > > Signed-off-by: Stephan Holljes > --- > libavformat/http.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) It looks consistent, for now. I believe it should be applied. Maybe at some point the name of the variable will need to be fixed, since it is no longer a POST, but it is not important. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions
From: Shivraj Patil This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions in new file h264chroma_msa.c Adds new generic macros (needed for this patch) in libavutil/mips/generic_macros_msa.h Signed-off-by: Shivraj Patil --- libavcodec/mips/Makefile |1 + libavcodec/mips/h264chroma_init_mips.c | 21 + libavcodec/mips/h264chroma_mips.h | 12 + libavcodec/mips/h264chroma_msa.c | 2003 libavutil/mips/generic_macros_msa.h| 56 + 5 files changed, 2093 insertions(+) create mode 100644 libavcodec/mips/h264chroma_msa.c diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 82d1d70..aa98774 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -31,5 +31,6 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o\ mips/hevc_lpf_sao_msa.o \ mips/hevcpred_msa.o MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o +MSA-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_msa.o LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o diff --git a/libavcodec/mips/h264chroma_init_mips.c b/libavcodec/mips/h264chroma_init_mips.c index 4c10da7..1cc5767 100644 --- a/libavcodec/mips/h264chroma_init_mips.c +++ b/libavcodec/mips/h264chroma_init_mips.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Zhou Xiaoyong + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) * * This file is part of FFmpeg. * @@ -20,6 +21,23 @@ #include "h264chroma_mips.h" +#if HAVE_MSA +static av_cold void h264chroma_init_msa(H264ChromaContext *c, int bit_depth) +{ +const int high_bit_depth = bit_depth > 8; + +if (!high_bit_depth) { +c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_msa; +c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_msa; +c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_msa; + +c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_msa; +c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_msa; +c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_msa; +} +} +#endif // #if HAVE_MSA + #if HAVE_LOONGSON3 static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) { @@ -36,6 +54,9 @@ static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) av_cold void ff_h264chroma_init_mips(H264ChromaContext *c, int bit_depth) { +#if HAVE_MSA +h264chroma_init_msa(c, bit_depth); +#endif // #if HAVE_MSA #if HAVE_LOONGSON3 h264chroma_init_mmi(c, bit_depth); #endif /* HAVE_LOONGSON3 */ diff --git a/libavcodec/mips/h264chroma_mips.h b/libavcodec/mips/h264chroma_mips.h index 314e8a3..7a373b8 100644 --- a/libavcodec/mips/h264chroma_mips.h +++ b/libavcodec/mips/h264chroma_mips.h @@ -22,6 +22,18 @@ #define H264_CHROMA_MIPS_H #include "libavcodec/h264.h" +void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_put_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); diff --git a/libavcodec/mips/h264chroma_msa.c b/libavcodec/mips/h264chroma_msa.c new file mode 100644 index 000..3113ee8 --- /dev/null +++ b/libavcodec/mips/h264chroma_msa.c @@ -0,0 +1,2003 @@ +/* + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) + * + * 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
[FFmpeg-devel] [PATCH 3/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC idct functions
From: Shivraj Patil This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC idct functions in new file h264idct_msa.c Adds new generic macros (needed for this patch) in libavutil/mips/generic_macros_msa.h Signed-off-by: Shivraj Patil --- libavcodec/mips/Makefile| 3 +- libavcodec/mips/h264dsp_init_mips.c | 15 ++ libavcodec/mips/h264dsp_mips.h | 24 ++ libavcodec/mips/h264idct_msa.c | 469 libavutil/mips/generic_macros_msa.h | 96 5 files changed, 606 insertions(+), 1 deletion(-) create mode 100644 libavcodec/mips/h264idct_msa.c diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 0a97e7c..993c649 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -31,7 +31,8 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o\ mips/hevc_idct_msa.o \ mips/hevc_lpf_sao_msa.o \ mips/hevcpred_msa.o -MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o +MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o\ + mips/h264idct_msa.o MSA-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_msa.o MSA-OBJS-$(CONFIG_H264PRED) += mips/h264pred_msa.o LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o diff --git a/libavcodec/mips/h264dsp_init_mips.c b/libavcodec/mips/h264dsp_init_mips.c index d9182f2..7f74adf 100644 --- a/libavcodec/mips/h264dsp_init_mips.c +++ b/libavcodec/mips/h264dsp_init_mips.c @@ -62,6 +62,21 @@ static av_cold void h264dsp_init_msa(H264DSPContext *c, c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16_8_msa; c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_msa; c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_msa; + +c->h264_idct_add = ff_h264_idct_add_msa; +c->h264_idct8_add = ff_h264_idct8_addblk_msa; +c->h264_idct_dc_add = ff_h264_idct4x4_addblk_dc_msa; +c->h264_idct8_dc_add = ff_h264_idct8_dc_addblk_msa; +c->h264_idct_add16 = ff_h264_idct_add16_msa; +c->h264_idct8_add4 = ff_h264_idct8_add4_msa; + +if (chroma_format_idc <= 1) +c->h264_idct_add8 = ff_h264_idct_add8_msa; +else +c->h264_idct_add8 = ff_h264_idct_add8_422_msa; + +c->h264_idct_add16intra = ff_h264_idct_add16_intra_msa; +c->h264_luma_dc_dequant_idct = ff_h264_deq_idct_luma_dc_msa; } // if (8 == bit_depth) } #endif // #if HAVE_MSA diff --git a/libavcodec/mips/h264dsp_mips.h b/libavcodec/mips/h264dsp_mips.h index ef380fa..0e39057 100644 --- a/libavcodec/mips/h264dsp_mips.h +++ b/libavcodec/mips/h264dsp_mips.h @@ -41,6 +41,30 @@ void ff_h264_h_loop_filter_luma_mbaff_msa(uint8_t *src, int32_t stride, int32_t alpha, int32_t beta, int8_t *tc0); +void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride); +void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, + int32_t dst_stride); +void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, + int32_t de_q_val); +void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, +int16_t *block, int32_t stride, +const uint8_t nnzc[15 * 8]); +void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, + int16_t *block, int32_t dst_stride, + const uint8_t nnzc[15 * 8]); +void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset, + int16_t *block, int32_t dst_stride, + const uint8_t nnzc[15 * 8]); +void ff_h264_idct_add8_422_msa(uint8_t **dst, const int32_t *blk_offset, + int16_t *block, int32_t dst_stride, + const uint8_t nnzc[15 * 8]); +void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride); +void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, + int32_t dst_stride); +void ff_h264_idct8_add4_msa(uint8_t *dst, const int *blk_offset, +int16_t *blk, int dst_stride, +const uint8_t nnzc[15 * 8]); + void ff_h264_h_lpf_luma_intra_msa(uint8_t *src, int stride, int alpha, int beta); void ff_h264_v_lpf_luma_intra_msa(uint8_t *src, int stride, diff --git a/libavcodec/mips/h264idct_msa.c b/libavcodec/mips/h264idct_msa.c new file mode 100644 index 000..fac1e7a --- /dev/null +++ b/libavcodec/mips/h264idct_msa.c @@ -0,0 +1,469 @@ +/* + * Copyright (c) 2015 Man
[FFmpeg-devel] [PATCH 2/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC intra prediction functions
From: Shivraj Patil This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC intra prediction functions in new file h264pred_msa.c Adds new generic macros (needed for this patch) in libavutil/mips/generic_macros_msa.h Signed-off-by: Shivraj Patil --- libavcodec/h264pred.c| 1 + libavcodec/h264pred.h| 2 + libavcodec/mips/Makefile | 2 + libavcodec/mips/h264dsp_mips.h | 27 ++ libavcodec/mips/h264pred_init_mips.c | 104 + libavcodec/mips/h264pred_msa.c | 723 +++ libavutil/mips/generic_macros_msa.h | 11 + 7 files changed, 870 insertions(+) create mode 100644 libavcodec/mips/h264pred_init_mips.c create mode 100644 libavcodec/mips/h264pred_msa.c diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c index 044fc90..497b080 100644 --- a/libavcodec/h264pred.c +++ b/libavcodec/h264pred.c @@ -594,4 +594,5 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); +if (ARCH_MIPS) ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc); } diff --git a/libavcodec/h264pred.h b/libavcodec/h264pred.h index 6708292..edeca91 100644 --- a/libavcodec/h264pred.h +++ b/libavcodec/h264pred.h @@ -117,5 +117,7 @@ void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); +void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, +const int bit_depth, const int chroma_format_idc); #endif /* AVCODEC_H264PRED_H */ diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index aa98774..0a97e7c 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -22,6 +22,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_init_mips.o \ mips/hevcpred_init_mips.o OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_init_mips.o OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_init_mips.o +OBJS-$(CONFIG_H264PRED) += mips/h264pred_init_mips.o MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o\ mips/hevc_mc_uni_msa.o\ mips/hevc_mc_uniw_msa.o \ @@ -32,5 +33,6 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o\ mips/hevcpred_msa.o MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o MSA-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_msa.o +MSA-OBJS-$(CONFIG_H264PRED) += mips/h264pred_msa.o LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o diff --git a/libavcodec/mips/h264dsp_mips.h b/libavcodec/mips/h264dsp_mips.h index 319f6d3..ef380fa 100644 --- a/libavcodec/mips/h264dsp_mips.h +++ b/libavcodec/mips/h264dsp_mips.h @@ -68,6 +68,33 @@ void ff_weight_h264_pixels8_8_msa(uint8_t *src, int stride, int height, void ff_weight_h264_pixels4_8_msa(uint8_t *src, int stride, int height, int log2_denom, int weight, int offset); +void ff_h264_intra_predict_plane_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_predict_dc_4blk_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_predict_hor_dc_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_predict_vert_dc_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_predict_mad_cow_dc_l0t_8x8_msa(uint8_t *src, + ptrdiff_t stride); +void ff_h264_intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src, + ptrdiff_t stride); +void ff_h264_intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src, + ptrdiff_t stride); +void ff_h264_intra_predict_mad_cow_dc_0l0_8x8_msa(uint8_t *src, + ptrdiff_t stride); +void ff_h264_intra_predict_plane_16x16_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_vert_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_horiz_8x8_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_dc_16x16_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_vert_16x16_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_horiz_16x16_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_dc_left_16x16_msa(uint8_t *src, ptrdiff_t stride); +void ff_h264_intra_pred_dc_top_16x16_msa(uint8_t *src, ptrdi
[FFmpeg-devel] Contributing to the project?
Hello, I was wondering what is the best way to begin getting involved in contributing to ffmpeg/libav*? I've been a big fan of the project for years. I've been an observer on the mailing list, and have closely read the guidelines on the website, so I have a fair idea of how the development/review process works. I am a software developer with 5 years experience, mostly in Java (specifically web services, REST APIs among other things), but I do have a reasonable knowledge of C as well. I have an interest in audio/video codecs and formats, but little expertise and no experience in that area. However, I am eager to work hard and learn quickly, with minimal disruption, on any task that might be suitable. I don't want to be a burden on people's time, as I know everyone is busy and that you already engage in training and mentoring programs, but if there were some low priority tasks or tests to be written that would help me get my feet wet, I'd be very grateful to be pointed in that direction. Alternatively, if there are other channels I should engage with first, or upskilling I should do prior to contributing (e.g. a particular area of the code to study), advice to that effect would be very much appreciated too. Thanks for your time, and best wishes, George Boyle ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/flvdec.c: don't build index_entries for input stream if AVIOContext is not seekable
On Wed, Jun 10, 2015 at 03:10:28PM +0300, Igor Derzhavin wrote: > Hello. > I suggest a small patch for FLV demuxer that prevent building index_entries > list if AVIOContext is not seekable. Whithout this check indext_entries > list behave as memory leak on continous stream (for example rtmp live > stream) > flvdec.c |5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > cc3baa4ef2e564fcd53f277c1ef4e2017cfc9162 flvdec.patch > From 5ee9ec176f8019e117fcfdd17bcddea8911c7945 Mon Sep 17 00:00:00 2001 > From: Igor Derzhavin > Date: Wed, 10 Jun 2015 14:56:02 +0300 > Subject: [PATCH] libavformat/flvdec.c: don't build index_entries for input > stream if AVIOContext is not seekable applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Contributing to the project?
George Boyle thebuds.net> writes: > I was wondering what is the best way to begin getting > involved in contributing to ffmpeg/libav*? You could find a bug and fix it, or choose one from trac.ffmpeg.org. You could add documentation for a muxer, demuxer, decoder or whatever you find that is missing in the doc folder. You could go through fate coverage and find a codec that is not tested yet. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Contributing to the project?
On Wed, Jun 10, 2015 at 04:26:49PM +0100, George Boyle wrote: > Hello, > > I was wondering what is the best way to begin getting involved in > contributing to ffmpeg/libav*? I've been a big fan of the project for > years. I've been an observer on the mailing list, and have closely read > the guidelines on the website, so I have a fair idea of how the > development/review process works. > > I am a software developer with 5 years experience, mostly in Java > (specifically web services, REST APIs among other things), but I do have > a reasonable knowledge of C as well. I have an interest in audio/video > codecs and formats, but little expertise and no experience in that area. > However, I am eager to work hard and learn quickly, with minimal > disruption, on any task that might be suitable. > > I don't want to be a burden on people's time, as I know everyone is busy > and that you already engage in training and mentoring programs, but if > there were some low priority tasks or tests to be written that would > help me get my feet wet, I'd be very grateful to be pointed in that > direction. Alternatively, if there are other channels I should engage > with first, or upskilling I should do prior to contributing (e.g. a > particular area of the code to study), advice to that effect would be > very much appreciated too. contributions in all areas are welcome! if you want some random suggestion then for example the file we use for testing FFmpeg with coverity should be extended as coverity fails to find some memleaks please see tools/coverity.c in FFmpeg git for the current file the format of the file is documented at https://scan.coverity.com/models the file likely can also be extended in other ways to allow coverity to find more issues. But the memleak case is known as vittorio from libav told me that he wrote such a modelling file to find the memleaks he fixed recently. The libav coverity modeling file is non public though and yes i asked vittorio to share it a while ago already. Another area to work on would be to fix some tickets from https://trac.ffmpeg.org or implement feature requests or to help review patches on the mailing list if you see something that crosses an area you know (there are occasionally patches that require expert knowledge outside multimedia as well ...) But in the end, what i would suggest is, work on what is fun to you! [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Contributing to the project?
Great! Thank you both (Carl and Michael) for the suggestions. I'll begin by having a look at the coverity one and see how I get on. Best wishes, George On 10/06/15 17:03, Michael Niedermayer wrote: > On Wed, Jun 10, 2015 at 04:26:49PM +0100, George Boyle wrote: >> Hello, >> >> I was wondering what is the best way to begin getting involved in >> contributing to ffmpeg/libav*? I've been a big fan of the project for >> years. I've been an observer on the mailing list, and have closely read >> the guidelines on the website, so I have a fair idea of how the >> development/review process works. >> >> I am a software developer with 5 years experience, mostly in Java >> (specifically web services, REST APIs among other things), but I do have >> a reasonable knowledge of C as well. I have an interest in audio/video >> codecs and formats, but little expertise and no experience in that area. >> However, I am eager to work hard and learn quickly, with minimal >> disruption, on any task that might be suitable. >> >> I don't want to be a burden on people's time, as I know everyone is busy >> and that you already engage in training and mentoring programs, but if >> there were some low priority tasks or tests to be written that would >> help me get my feet wet, I'd be very grateful to be pointed in that >> direction. Alternatively, if there are other channels I should engage >> with first, or upskilling I should do prior to contributing (e.g. a >> particular area of the code to study), advice to that effect would be >> very much appreciated too. > > contributions in all areas are welcome! > if you want some random suggestion then for example > the file we use for testing FFmpeg with coverity should be extended > as coverity fails to find some memleaks > please see tools/coverity.c in FFmpeg git for the current file > > the format of the file is documented at > https://scan.coverity.com/models > > the file likely can also be extended in other ways to allow coverity > to find more issues. > But the memleak case is known as vittorio from libav told me that he > wrote such a modelling file to find the memleaks he fixed recently. > The libav coverity modeling file is non public though and yes i asked > vittorio to share it a while ago already. > > Another area to work on would be to fix some tickets from > https://trac.ffmpeg.org > or implement feature requests > or to help review patches on the mailing list if you see something > that crosses an area you know (there are occasionally patches that > require expert knowledge outside multimedia as well ...) > > But in the end, what i would suggest is, work on what is fun to you! > > [...] > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH][GSoC] lavf/http: Correctly terminate session with HTTP POST client.
On Wed, Jun 10, 2015 at 04:13:31PM +0200, Nicolas George wrote: > Le primidi 21 prairial, an CCXXIII, Stephan Holljes a écrit : > > Send a footer to correctly close client sockets. > > This fixes network errors in client applications. > > > > Signed-off-by: Stephan Holljes > > --- > > libavformat/http.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > It looks consistent, for now. I believe it should be applied. applied thanks > > Maybe at some point the name of the variable will need to be fixed, since it > is no longer a POST, but it is not important. > > Regards, > > -- > Nicolas George > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] encoders.texi: update libvpx documentation
On Tue, 9 Jun 2015 23:01:18 -0700, James Zern wrote: > modeled after the libx264 section. > --- > doc/encoders.texi | 162 > ++ > 1 file changed, 91 insertions(+), 71 deletions(-) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 753e683..e240494 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -1416,113 +1416,133 @@ You need to explicitly configure the build with > @code{--enable-libvpx}. > > @subsection Options > > -Mapping from FFmpeg to libvpx options with conversion notes in parentheses. > +The following options are supported by the libvpx wrapper. The > +@command{vpxenc}-equivalent options or values are listed in parentheses > +for easy migration. > > -@table @option > +To reduce the duplication of documentation, only the private options > +and some others requiring special attention are documented here. For > +the documentation of the undocumented generic options, see > +@ref{codec-options,,the Codec Options chapter}. > > -@item threads > -g_threads > +To get more documentation of the libvpx options, invoke the command > +@command{ffmpeg -help full} Alternatively, "ffmpeg -h encoder=libvpx" and "ffmpeg -h encoder=libvpx-vp9". That's all the comments from me. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.
On 15-06-09 at 22:50, Michael Niedermayer wrote: > On Tue, Jun 09, 2015 at 04:55:56AM +0200, Simon Thelen wrote: > > Fix an off-by-one in checking tail for trailing characters > > > and ensure > > that the parsing helper is only called for unknown channel layouts. > > in which case does this make a difference / how can i reproduce the > issue this fixes ? For example: ffmpeg -i stereo_audio.flac -af pan=1c|c0=0.9*c0+0.1*c1 out.wav (Input and output file format don't matter) Without this patch, this will produce silent audio. > > > > Note: This removes the check ensuring that the channel layout is > 0 and > > < 63. > > > > Signed-off-by: Simon Thelen > > --- > > If the check ensuring 0 < chlayout < 63 is necessary, I can send a v2 > > adding it back > > i think its a good idea to keep the check or why shuld it be removed ? I removed the check because a count <= 0 or >63 would have caused the function to enter the bottom portion the same way it does now. Though, if it only entered the function on count > 0, I could probably remove it entirely because it only enters that portion of the code when strtol returns 0. To be honest, I can't think of a valid reason for the existence of that piece of code in the first place since it sets out_channel_layout to 0 for valid input/output. If it were intended to catch channel_layouts unknown to FFmpeg, it should have been placed after the call to av_get_channel_layout, and not before it. (Note, removing it does not cause any breakage on my end.) > > > > libavfilter/formats.c | 19 --- > > 1 file changed, 8 insertions(+), 11 deletions(-) > > > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c > > index 4f9773b..2e00f30 100644 > > --- a/libavfilter/formats.c > > +++ b/libavfilter/formats.c > > @@ -637,20 +637,17 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, > > const char *arg, > > void *log_ctx) > > { > > char *tail; > > -int64_t chlayout, count; > > - > > -if (nret) { > > -count = strtol(arg, &tail, 10); > > -if (*tail == 'c' && !tail[1] && count > 0 && count < 63) { > > -*nret = count; > > -*ret = 0; > > -return 0; > > -} > > -} > > +int64_t chlayout; > > + > > chlayout = av_get_channel_layout(arg); > > if (chlayout == 0) { > > chlayout = strtol(arg, &tail, 10); > > -if (*tail || chlayout == 0) { > > +if (*(tail + 1) || chlayout == 0) { > > doesnt *(tail + 1) read from potentially after the array ? Fixed in v2 -- Simon Thelen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] libavfilter/formats: Fix parsing of channel specifications with a trailing 'c'.
Signed-off-by: Simon Thelen --- libavfilter/formats.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 4f9773b..2d3b859 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -637,20 +637,12 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx) { char *tail; -int64_t chlayout, count; - -if (nret) { -count = strtol(arg, &tail, 10); -if (*tail == 'c' && !tail[1] && count > 0 && count < 63) { -*nret = count; -*ret = 0; -return 0; -} -} +int64_t chlayout; + chlayout = av_get_channel_layout(arg); if (chlayout == 0) { chlayout = strtol(arg, &tail, 10); -if (*tail || chlayout == 0) { +if (!(*tail == '\0' || *tail == 'c' && *(tail + 1) == '\0') || chlayout == 0) { av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg); return AVERROR(EINVAL); } -- 2.4.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] doc/ffmpeg: remove tips
Ancient and misleading. Signed-off-by: Lou Logan --- doc/ffmpeg.texi | 41 - 1 file changed, 41 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 1078ea1..4d73788 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1299,47 +1299,6 @@ If no such file is found, then ffmpeg will search for a file named @c man end OPTIONS -@chapter Tips -@c man begin TIPS - -@itemize -@item -For streaming at very low bitrates, use a low frame rate -and a small GOP size. This is especially true for RealVideo where -the Linux player does not seem to be very fast, so it can miss -frames. An example is: - -@example -ffmpeg -g 3 -r 3 -t 10 -b:v 50k -s qcif -f rv10 /tmp/b.rm -@end example - -@item -The parameter 'q' which is displayed while encoding is the current -quantizer. The value 1 indicates that a very good quality could -be achieved. The value 31 indicates the worst quality. If q=31 appears -too often, it means that the encoder cannot compress enough to meet -your bitrate. You must either increase the bitrate, decrease the -frame rate or decrease the frame size. - -@item -If your computer is not fast enough, you can speed up the -compression at the expense of the compression ratio. You can use -'-me zero' to speed up motion estimation, and '-g 0' to disable -motion estimation completely (you have only I-frames, which means it -is about as good as JPEG compression). - -@item -To have very low audio bitrates, reduce the sampling frequency -(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3). - -@item -To have a constant quality (but a variable bitrate), use the option -'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst -quality). - -@end itemize -@c man end TIPS - @chapter Examples @c man begin EXAMPLES -- 2.4.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264: update avctx width/height when flushing
On 10.06.2015 12:01, Michael Niedermayer wrote: > On Wed, Jun 10, 2015 at 11:43:16AM +0200, Michael Niedermayer wrote: >> On Tue, Jun 09, 2015 at 11:53:03PM +0200, Andreas Cadhalpun wrote: >>> Inconsistencies between the dimensions of avctx and the frame can >>> confuse API users. For example this can crash the demuxing_decoding >>> example. >>> >>> Signed-off-by: Andreas Cadhalpun >>> --- >>> libavcodec/h264.c | 4 >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/libavcodec/h264.c b/libavcodec/h264.c >>> index 9a00214..d1eaa5e 100644 >>> --- a/libavcodec/h264.c >>> +++ b/libavcodec/h264.c >>> @@ -1757,6 +1757,8 @@ static int h264_decode_frame(AVCodecContext *avctx, >>> void *data, >>> if (ret < 0) >>> return ret; >>> *got_frame = 1; >>> +avctx->width = pict->width; >>> +avctx->height = pict->height; >>> } >> >> iam not sure this is not breaking something, other parts of the h264 >> decoder expect this to be set relative to the last frame in coding >> order. If that's the case, then I think the h264 decoder should use a field in the private H264Context for that information and not the public fields in AVCodecContext. >> also avctx->pix_fmt would then still potentially not match the last >> output frame, also pix_fmt has the same problem as above Yes, pix_fmt should also be updated. Attached patch does this, but this caused changes in some h264 reinit fate tests. Is that a problem? >> ive fixed one use of width/height not to depend on the AVCodecContext >> value but a 2nd remains > > actually theres more code that uses it > ff_h264_draw_horiz_band() and its callers use h->avctx->height too Could these be fixed to use a new H264Context field instead? On 10.06.2015 02:25, Luca Barbato wrote: > Would be better setting those in output_frame I think, I like the idea. Done. Best regards, Andreas >From c3d2a2822b6fc72ee735de3d9c6c7f964ea143e5 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 9 Jun 2015 23:38:26 +0200 Subject: [PATCH] h264: update avctx width/height/pix_fmt when returning frame Inconsistencies between the dimensions/pixel format of avctx and the frame can confuse API users. For example this can crash the demuxing_decoding example. Also update FATE reference data for some h264-reinit tests. Signed-off-by: Andreas Cadhalpun --- libavcodec/h264.c | 4 ++ .../fate/h264-reinit-small_420_8-to-large_444_10 | 44 +++--- .../fate/h264-reinit-small_420_9-to-small_420_8| 44 +++--- .../fate/h264-reinit-small_422_9-to-small_420_9| 44 +++--- 4 files changed, 70 insertions(+), 66 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 9a00214..87a600d 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1675,6 +1675,10 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(h), 0); +h->avctx->width = dst->width; +h->avctx->height = dst->height; +h->avctx->pix_fmt = dst->format; + if (srcp->sei_recovery_frame_cnt == 0) dst->key_frame = 1; if (!srcp->crop) diff --git a/tests/ref/fate/h264-reinit-small_420_8-to-large_444_10 b/tests/ref/fate/h264-reinit-small_420_8-to-large_444_10 index 7e7631a..8c3b7cf 100644 --- a/tests/ref/fate/h264-reinit-small_420_8-to-large_444_10 +++ b/tests/ref/fate/h264-reinit-small_420_8-to-large_444_10 @@ -50,28 +50,28 @@ 0, 48, 48,1, 608256, 0x80128077 0, 49, 49,1, 608256, 0x887c2fb0 0, 50, 50,1, 608256, 0xfaba3fe4 -0, 51, 51,1, 608256, 0x0369a227 -0, 52, 52,1, 608256, 0xe62cb2b1 -0, 53, 53,1, 608256, 0x851d9e78 -0, 54, 54,1, 608256, 0x6847b938 -0, 55, 55,1, 608256, 0x48eb702e -0, 56, 56,1, 608256, 0x3eb52eec -0, 57, 57,1, 608256, 0xf880edf8 -0, 58, 58,1, 608256, 0xf7ac1860 -0, 59, 59,1, 608256, 0x3ead29f3 -0, 60, 60,1, 608256, 0x6db1860a -0, 61, 61,1, 608256, 0x72ee9271 -0, 62, 62,1, 608256, 0xa8b643e4 -0, 63, 63,1, 608256, 0x22a95a3e -0, 64, 64,1, 608256, 0x4e8aa877 -0, 65, 65,1, 608256, 0x9545cfcf -0, 66, 66,1, 608256, 0x42d820e0 -0, 67, 67,1, 608256, 0xe701ea6f -0, 68, 68,1, 608256, 0x05f61a49 -0, 69, 69,1, 608256, 0xc1de9f65 -0, 70, 70,1, 608256, 0x2b121933 -0, 71, 71,1, 608256, 0x4de4e185 -0, 72,
Re: [FFmpeg-devel] [PATCH] h264: update avctx width/height when flushing
On Wed, Jun 10, 2015 at 09:10:31PM +0200, Andreas Cadhalpun wrote: > On 10.06.2015 12:01, Michael Niedermayer wrote: > > On Wed, Jun 10, 2015 at 11:43:16AM +0200, Michael Niedermayer wrote: > >> On Tue, Jun 09, 2015 at 11:53:03PM +0200, Andreas Cadhalpun wrote: > >>> Inconsistencies between the dimensions of avctx and the frame can > >>> confuse API users. For example this can crash the demuxing_decoding > >>> example. > >>> > >>> Signed-off-by: Andreas Cadhalpun > >>> --- > >>> libavcodec/h264.c | 4 > >>> 1 file changed, 4 insertions(+) > >>> > >>> diff --git a/libavcodec/h264.c b/libavcodec/h264.c > >>> index 9a00214..d1eaa5e 100644 > >>> --- a/libavcodec/h264.c > >>> +++ b/libavcodec/h264.c > >>> @@ -1757,6 +1757,8 @@ static int h264_decode_frame(AVCodecContext *avctx, > >>> void *data, > >>> if (ret < 0) > >>> return ret; > >>> *got_frame = 1; > >>> +avctx->width = pict->width; > >>> +avctx->height = pict->height; > >>> } > >> > >> iam not sure this is not breaking something, other parts of the h264 > >> decoder expect this to be set relative to the last frame in coding > >> order. > > If that's the case, then I think the h264 decoder should use a field > in the private H264Context for that information and not the public > fields in AVCodecContext. > > >> also avctx->pix_fmt would then still potentially not match the last > >> output frame, also pix_fmt has the same problem as above > > Yes, pix_fmt should also be updated. Attached patch does this, but > this caused changes in some h264 reinit fate tests. Is that a problem? looking at the testfile with ffplay shows heavy artifacts after the patch and no artifacts before > > >> ive fixed one use of width/height not to depend on the AVCodecContext > >> value but a 2nd remains > > > > actually theres more code that uses it > > ff_h264_draw_horiz_band() and its callers use h->avctx->height too > > Could these be fixed to use a new H264Context field instead? i think it might be possible for them to use the AVFrame height but the code should be tested especially with a file that uses croping and some application that uses these codepathes iam not sure this codepath works currently with files using croping and using the AVFrame height and if needed an adjusted pointer offset might fix that or might break it depending on what applications expect [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: remove tips
On Wed, Jun 10, 2015 at 10:33:26AM -0800, Lou Logan wrote: > Ancient and misleading. ok, but the very low bitrate and sample rate relation is still true for mp1/2/3 and likely others so that maybe should be preserved somewhere. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: remove tips
On Wed, 10 Jun 2015 21:52:06 +0200, Michael Niedermayer wrote: > ok, but the very low bitrate and sample rate relation is still true > for mp1/2/3 and likely others so that maybe should be preserved > somewhere. Perhaps a Tips wiki page. Or they could be moved to an appropriate location in the docs or some existing wiki page (not sure where). Or I could leave the "low bitrate" and "sample rate" tips. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] examples/decoding_encoding: Use the AVFrame width/height for processing images after decoding
This is what FFmpeg / FFplay do and it is more robust Signed-off-by: Michael Niedermayer --- doc/examples/decoding_encoding.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c index 80da664..f6643f6 100644 --- a/doc/examples/decoding_encoding.c +++ b/doc/examples/decoding_encoding.c @@ -521,7 +521,7 @@ static int decode_write_frame(const char *outfilename, AVCodecContext *avctx, /* the picture is allocated by the decoder, no need to free it */ snprintf(buf, sizeof(buf), outfilename, *frame_count); pgm_save(frame->data[0], frame->linesize[0], - avctx->width, avctx->height, buf); + frame->width, frame->height, buf); (*frame_count)++; } if (pkt->data) { -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: remove tips
On Wed, Jun 10, 2015 at 12:16:10PM -0800, Lou Logan wrote: > On Wed, 10 Jun 2015 21:52:06 +0200, Michael Niedermayer wrote: > > > ok, but the very low bitrate and sample rate relation is still true > > for mp1/2/3 and likely others so that maybe should be preserved > > somewhere. > > Perhaps a Tips wiki page. sounds like a good idea idependant of this > > Or they could be moved to an appropriate location in the docs or some > existing wiki page (not sure where). > > Or I could leave the "low bitrate" and "sample rate" tips. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] * mpegts demuxer recognizes private streams on demand
No answers? Well, I do have a question. Am Thu, 4 Jun 2015 23:46:21 +0200 schrieb Wolfgang Lorenz : > The option went into the MpegTSContext struct and can be addressed via > dictionary: > > AVFormatContext * formatContext = NULL; > > /* enable mpeg-ts private stream recognition */ > AVDictionary * dict = NULL; > av_dict_set_int(&dict, "mpegts_recognize_private_streams", 1, 0); > > /* open file */ > avformat_open_input(&formatContext, fileName, NULL, &dict); > > [...] While I have used some kind of name scoping for the dictionary access, to avoid name clashes, I've seen, that this is not done for the rest of the formats. I think in most cases, this won't matter anyway. There are many doubling names between different input formats, but these won't make a problem, as one format context can only contain one input format. I've seen one name clash between AVFormatContext and an input format ("auto", mov.c), and "strict" seems to be declared twice for AVFormatContext. So, here's my question: Is there any kind of convention for naming options? And should I rename my option to "recognize_private_streams", or something different, to get the patch accepted? Recommendations are welcome. Okay, that's two questions. Anyway... Greetings, Wolfgang signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: remove tips
On Wed, 10 Jun 2015 22:22:06 +0200, Michael Niedermayer wrote: > On Wed, Jun 10, 2015 at 12:16:10PM -0800, Lou Logan wrote: > > On Wed, 10 Jun 2015 21:52:06 +0200, Michael Niedermayer wrote: > > > > Perhaps a Tips wiki page. > > sounds like a good idea idependant of this Pushed. I'll plan on making a general Tips wiki page when I get back from my trip on 19 June unless someone else wants to. Tip ideas welcome. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] * mpegts demuxer recognizes private streams on demand
On Wed, Jun 10, 2015 at 10:41:10PM +0200, Wolfgang Lorenz wrote: > No answers? > > Well, I do have a question. > > Am Thu, 4 Jun 2015 23:46:21 +0200 > schrieb Wolfgang Lorenz : > > > The option went into the MpegTSContext struct and can be addressed via > > dictionary: > > > > AVFormatContext * formatContext = NULL; > > > > /* enable mpeg-ts private stream recognition */ > > AVDictionary * dict = NULL; > > av_dict_set_int(&dict, "mpegts_recognize_private_streams", 1, 0); > > > > /* open file */ > > avformat_open_input(&formatContext, fileName, NULL, &dict); > > > > [...] > > While I have used some kind of name scoping for the dictionary access, > to avoid name clashes, I've seen, that this is not done for the rest of > the formats. I think in most cases, this won't matter anyway. There are > many doubling names between different input formats, but these won't > make a problem, as one format context can only contain one input > format. I've seen one name clash between AVFormatContext and an input > format ("auto", mov.c), and "strict" seems to be declared twice for constants have a scope limited to their type and field to which they apply > AVFormatContext. So, here's my question: Is there any kind of > convention for naming options? And should I rename my option to > "recognize_private_streams", or something different, to get the patch > accepted? Recommendations are welcome. i have no oppinon on the name, either is fine what kept me from applying this is that i dont see why it has to break detection of streams for which reliable detection exists, it breaks at least fate-acodec-s302m and fate-dca-core This should be a fallback for private streams which are not identified by a strong probing method ill post a patch which will do this in a moment, please comment/test thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/mpegts: recognizes and export private streams
Based on patch by Wolfgang Lorenz Signed-off-by: Michael Niedermayer --- libavformat/mpegts.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index eff6819..7b35d7f 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -835,6 +835,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, st->codec->codec_id = old_codec_id; st->codec->codec_type = old_codec_type; } +if ((st->codec->codec_id == AV_CODEC_ID_NONE || st->request_probe == 1) && +!avcodec_is_open(st->codec) && +stream_type == 6) { +st->codec->codec_type = AVMEDIA_TYPE_DATA; +st->codec->codec_id = AV_CODEC_ID_BIN_DATA; +st->request_probe = 1; +} return 0; } -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions
On Wed, Jun 10, 2015 at 07:48:38PM +0530, shivraj.pa...@imgtec.com wrote: > From: Shivraj Patil > > This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc > functions in new file h264chroma_msa.c > Adds new generic macros (needed for this patch) in > libavutil/mips/generic_macros_msa.h > > Signed-off-by: Shivraj Patil > --- > libavcodec/mips/Makefile |1 + > libavcodec/mips/h264chroma_init_mips.c | 21 + > libavcodec/mips/h264chroma_mips.h | 12 + > libavcodec/mips/h264chroma_msa.c | 2003 > > libavutil/mips/generic_macros_msa.h| 56 + > 5 files changed, 2093 insertions(+) > create mode 100644 libavcodec/mips/h264chroma_msa.c > > diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile > index 82d1d70..aa98774 100644 > --- a/libavcodec/mips/Makefile > +++ b/libavcodec/mips/Makefile > @@ -31,5 +31,6 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER) += > mips/hevcdsp_msa.o\ > mips/hevc_lpf_sao_msa.o \ > mips/hevcpred_msa.o > MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o > +MSA-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_msa.o > LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o > LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o > diff --git a/libavcodec/mips/h264chroma_init_mips.c > b/libavcodec/mips/h264chroma_init_mips.c > index 4c10da7..1cc5767 100644 > --- a/libavcodec/mips/h264chroma_init_mips.c > +++ b/libavcodec/mips/h264chroma_init_mips.c > @@ -1,5 +1,6 @@ > /* > * Copyright (c) 2015 Zhou Xiaoyong > + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) > * > * This file is part of FFmpeg. > * > @@ -20,6 +21,23 @@ > > #include "h264chroma_mips.h" > > +#if HAVE_MSA > +static av_cold void h264chroma_init_msa(H264ChromaContext *c, int bit_depth) > +{ > +const int high_bit_depth = bit_depth > 8; > + > +if (!high_bit_depth) { > +c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_msa; > +c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_msa; > +c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_msa; > + > +c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_msa; > +c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_msa; > +c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_msa; > +} > +} > +#endif // #if HAVE_MSA > + > #if HAVE_LOONGSON3 > static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) > { > @@ -36,6 +54,9 @@ static av_cold void h264chroma_init_mmi(H264ChromaContext > *c, int bit_depth) > > av_cold void ff_h264chroma_init_mips(H264ChromaContext *c, int bit_depth) > { > +#if HAVE_MSA > +h264chroma_init_msa(c, bit_depth); > +#endif // #if HAVE_MSA > #if HAVE_LOONGSON3 > h264chroma_init_mmi(c, bit_depth); > #endif /* HAVE_LOONGSON3 */ > diff --git a/libavcodec/mips/h264chroma_mips.h > b/libavcodec/mips/h264chroma_mips.h > index 314e8a3..7a373b8 100644 > --- a/libavcodec/mips/h264chroma_mips.h > +++ b/libavcodec/mips/h264chroma_mips.h > @@ -22,6 +22,18 @@ > #define H264_CHROMA_MIPS_H > > #include "libavcodec/h264.h" > +void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > +void ff_put_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > +void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > +void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > +void ff_avg_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > +void ff_avg_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, > +int height, int x, int y); > > void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, int stride, > int h, int x, int y); > diff --git a/libavcodec/mips/h264chroma_msa.c > b/libavcodec/mips/h264chroma_msa.c > new file mode 100644 > index 000..3113ee8 > --- /dev/null > +++ b/libavcodec/mips/h264chroma_msa.c > @@ -0,0 +1,2003 @@ > +/* > + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) > + * > + * 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 > + *
Re: [FFmpeg-devel] [PATCH] avformat: Fix bug in parse_rps for HEVC.
On Wed, Jun 10, 2015 at 12:30:46PM +0800, Deliang Fu wrote: > Make the logic in libavformat/hevc.c parse_rps align with > libavcodec/hevc_ps.c ff_hevc_decode_short_term_rps > > --- > libavformat/hevc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) applied iam still interrested in a testcase if you have one thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavcodec/pcm-dvd: support a subset of AOB
Fixes Ticket2758 Signed-off-by: Michael Niedermayer --- libavcodec/pcm-dvd.c | 70 ++ 1 file changed, 70 insertions(+) diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c index e729cb6..7aec415 100644 --- a/libavcodec/pcm-dvd.c +++ b/libavcodec/pcm-dvd.c @@ -231,6 +231,74 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, } } +static int decode_aob(AVCodecContext *avctx, void *data, + int *got_frame_ptr, AVPacket *avpkt) +{ +AVFrame *frame = data; +const uint8_t *src = avpkt->data; +int buf_size = avpkt->size; +PCMDVDContext *s = avctx->priv_data; +int retval; +void *dst; +int ptr; + +if (buf_size < 8) +return AVERROR_INVALIDDATA; + +ptr = AV_RB16(src); +if (ptr < 8 || ptr > buf_size) +return AVERROR_INVALIDDATA; + +if (buf_size < 16) +return 0; + +switch (src[2]){ +case 0x10: +avctx->channels = 2; +break; +default: +avpriv_request_sample(avctx, "Unsupported channel layout\n"); +return AVERROR_INVALIDDATA; +} + +avctx->bits_per_coded_sample = 16 + (src[3] >> 4 & 3) * 4; +if (avctx->bits_per_coded_sample == 28) { +av_log(avctx, AV_LOG_ERROR, + "PCM DVD unsupported sample depth %i\n", + avctx->bits_per_coded_sample); +return AVERROR_INVALIDDATA; +} +switch(src[4] >> 4) { +case 0: avctx->sample_rate = 48000; break; +case 1: avctx->sample_rate = 96000; break; +case 2: avctx->sample_rate =192000; break; +case 8: avctx->sample_rate = 44100; break; +case 9: avctx->sample_rate = 88200; break; +case 10: avctx->sample_rate =176400; break; +default: +avpriv_request_sample(avctx, "Unsupported sample rate\n"); +return AVERROR_INVALIDDATA; +} +avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 + : AV_SAMPLE_FMT_S32; + +if (avctx->bits_per_coded_sample != 16) { +avpriv_request_sample(avctx, "Unsupported sample size\n"); +return AVERROR_INVALIDDATA; +} + +s->block_size = avctx->channels * 2; +frame->nb_samples = (buf_size - 16) / s->block_size; +if ((retval = ff_get_buffer(avctx, frame, 0)) < 0) +return retval; +dst = frame->data[0]; +pcm_dvd_decode_samples(avctx, src + 16, + dst, frame->nb_samples); + +*got_frame_ptr = 1; +return buf_size; +} + static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { @@ -247,6 +315,8 @@ static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } +if ((retval = decode_aob(avctx, data, got_frame_ptr, avpkt)) >= 0) +return retval; if ((retval = pcm_dvd_parse_header(avctx, src))) return retval; if (s->last_block_size && s->last_block_size != s->block_size) { -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly
From: Niklesh This patch mostly replicates the concept patch posted by Philip https://ffmpeg.org/pipermail/ffmpeg-devel/2013-March/140299.html. This sets the proper dimensions for the subtitle tracks, by making use of the height and width of the video stream. The patch is exlained in detail in the link. Signed-off-by: Niklesh --- libavformat/movenc.c | 38 ++ libavformat/movenc.h | 4 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index dc9570b..c55219e 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1505,8 +1505,20 @@ static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) if (track->enc->codec_id == AV_CODEC_ID_DVD_SUBTITLE) mov_write_esds_tag(pb, track); -else if (track->enc->extradata_size) +else if (track->enc->extradata_size) { +if (track->enc->extradata_size >= 18) { +// Rewrite text box dimensions to match video stream. +uint8_t *ed = track->enc->extradata; +uint16_t width = track->video_width; +uint16_t height = track->video_height; +height /= 10; +ed[14] = height >> 8; +ed[15] = height & 0xFF; +ed[16] = width >> 8; +ed[17] = width & 0xFF; + } avio_write(pb, track->enc->extradata, track->enc->extradata_size); +} return update_size(pb, pos); } @@ -2335,7 +2347,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, 0); /* reserved */ avio_wb32(pb, 0); /* reserved */ -avio_wb16(pb, 0); /* layer */ +avio_wb16(pb, -1); /* layer */ avio_wb16(pb, group); /* alternate group) */ /* Volume, only for audio */ if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -2352,6 +2364,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, if (display_matrix) { for (i = 0; i < 9; i++) avio_wb32(pb, display_matrix[i]); +} else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { +write_matrix(pb, 1, 0, 0, 1, 0, (track->video_height*9)/10); } else if (rotation == 90) { write_matrix(pb, 0, 1, -1, 0, track->enc->height, 0); } else if (rotation == 180) { @@ -2362,8 +2376,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, write_matrix(pb, 1, 0, 0, 1, 0, 0); } /* Track width and height, for visual only */ -if (st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO || - track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) { +if (st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO)) { if (track->mode == MODE_MOV) { avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->height << 16); @@ -2374,6 +2387,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, sample_aspect_ratio * track->enc->width * 0x1); avio_wb32(pb, track->height * 0x1); } +} else if (st && track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { +avio_wb32(pb, track->video_width * 0x1); +avio_wb32(pb, (track->video_height * 0x1) / 10); } else { avio_wb32(pb, 0); avio_wb32(pb, 0); @@ -5216,6 +5232,20 @@ static int mov_write_header(AVFormatContext *s) } } +for (i = 0; i < mov->nb_streams; i++) { +MOVTrack *track = &mov->tracks[i]; +if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { +int j; +for (j = 0; j < mov->nb_streams; j++) { +if (mov->tracks[j].enc->codec_type == AVMEDIA_TYPE_VIDEO) { +track->video_width = mov->tracks[j].enc->width; +track->video_height = mov->tracks[j].enc->height; +break; +} +} +} +} + enable_tracks(s); diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 744d14e..c89a59e 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -148,6 +148,10 @@ typedef struct MOVTrack { int slices; } vc1_info; +// For subtitle tracks. +uint16_t video_width; +uint16_t video_height; + void *eac3_priv; } MOVTrack; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles
From: Niklesh Encoding of bold, Italic, underlined styles for 3gpp timed text subtitles. All the formatting information is appended into the buffer after the text, unlike other encoders like srt, which can write out styling information as it goes. Another tricky part is to take care of the Endianness properly while writing into the buffer. Signed-off-by: Niklesh --- libavcodec/movtextenc.c | 104 +++- 1 file changed, 76 insertions(+), 28 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 1b8f454..adbe19d 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -24,14 +24,27 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/common.h" #include "ass_split.h" #include "ass.h" +#define STYLE_FLAG_BOLD 1 +#define STYLE_FLAG_ITALIC 2 +#define STYLE_FLAG_UNDERLINE4 + typedef struct { ASSSplitContext *ass_ctx; -char buffer[2048]; -char *ptr; -char *end; +AVBPrint buffer; +uint32_t tsmb_size; +uint32_t tsmb_type; +uint16_t style_entries; +uint16_t style_start; +uint16_t style_end; +uint16_t style_fontID; +uint8_t style_flag; +uint8_t style_fontsize; +uint32_t style_color; +uint16_t text_pos; } MovTextContext; @@ -47,10 +60,10 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx) 0xFF, // int8_t vertical-justification 0x00, 0x00, 0x00, 0x00, // uint8_t background-color-rgba[4] // BoxRecord { -0x00, 0x00, // int16_t top -0x00, 0x00, // int16_t left -0x00, 0x00, // int16_t bottom -0x00, 0x00, // int16_t right +0x00, 0x01, // int16_t top +0x00, 0x01, // int16_t left +0x00, 0x1E, // int16_t bottom +0x00, 0xC8, // int16_t right // }; // StyleRecord { 0x00, 0x00, // uint16_t startChar @@ -79,32 +92,54 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx) if (!avctx->extradata) return AVERROR(ENOMEM); +av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED); + memcpy(avctx->extradata, text_sample_entry, avctx->extradata_size); s->ass_ctx = ff_ass_split(avctx->subtitle_header); return s->ass_ctx ? 0 : AVERROR_INVALIDDATA; } +static void mov_text_style_cb(void *priv, const char style, int close) +{ +MovTextContext *s = priv; +s->tsmb_type = MKTAG('s','t','y','l'); +if (!close) { +s->style_start = AV_RB16(&s->text_pos); +switch (style){ +case 'b': +s->style_flag += STYLE_FLAG_BOLD; +break; +case 'i': +s->style_flag += STYLE_FLAG_ITALIC; +break; +case 'u': +s->style_flag += STYLE_FLAG_UNDERLINE; +break; +} +} else { +s->style_end = AV_RB16(&s->text_pos); +} +} + static void mov_text_text_cb(void *priv, const char *text, int len) { MovTextContext *s = priv; -av_assert0(s->end >= s->ptr); -av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1)); -s->ptr += FFMIN(s->end - s->ptr, len); +av_bprint_append_data(&s->buffer, text, len); +s->text_pos += len; } static void mov_text_new_line_cb(void *priv, int forced) { MovTextContext *s = priv; -av_assert0(s->end >= s->ptr); -av_strlcpy(s->ptr, "\n", FFMIN(s->end - s->ptr, 2)); -if (s->end > s->ptr) -s->ptr++; +av_bprint_append_data(&s->buffer, "\n", 2); +s->text_pos += 2; } static const ASSCodesCallbacks mov_text_callbacks = { .text = mov_text_text_cb, .new_line = mov_text_new_line_cb, +.style= mov_text_style_cb, }; static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, @@ -112,10 +147,9 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, { MovTextContext *s = avctx->priv_data; ASSDialog *dialog; -int i, len, num; +int i, num; -s->ptr = s->buffer; -s->end = s->ptr + sizeof(s->buffer); +av_bprint_clear(&s->buffer); for (i = 0; i < sub->num_rects; i++) { @@ -123,33 +157,47 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); return AVERROR(ENOSYS); } +s->text_pos = 0; dialog = ff_ass_split_dialog(s->ass_ctx, sub->rects[i]->ass, 0, &num); for (; dialog && num--; dialog++) { ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text); } +if (s->tsmb_type == MKTAG('s','t','y','l') && s->style_end) { +s->tsmb_size = MKTAG(0x00, 0x00, 0x00, 0x16); +s->style_entries = 0x00 | 0x01<<8; +
Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles
Tested on QuickTime 10.3 on OSX, and VLC. For some reason, it doesn't work on Quicktime Windows, I can't figure out why. Thanks, Niklesh On Thu, Jun 11, 2015 at 10:18 AM, Niklesh Lalwani < niklesh.lalw...@iitb.ac.in> wrote: > From: Niklesh > > Encoding of bold, Italic, underlined styles for 3gpp timed text subtitles. > All the formatting information is appended into the buffer after the text, > unlike other encoders like srt, which can write out styling information as > it goes. Another tricky part is to take care of the Endianness properly > while writing into the buffer. > > Signed-off-by: Niklesh > --- > libavcodec/movtextenc.c | 104 > +++- > 1 file changed, 76 insertions(+), 28 deletions(-) > > diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c > index 1b8f454..adbe19d 100644 > --- a/libavcodec/movtextenc.c > +++ b/libavcodec/movtextenc.c > @@ -24,14 +24,27 @@ > #include "libavutil/avassert.h" > #include "libavutil/avstring.h" > #include "libavutil/intreadwrite.h" > +#include "libavutil/common.h" > #include "ass_split.h" > #include "ass.h" > > +#define STYLE_FLAG_BOLD 1 > +#define STYLE_FLAG_ITALIC 2 > +#define STYLE_FLAG_UNDERLINE4 > + > typedef struct { > ASSSplitContext *ass_ctx; > -char buffer[2048]; > -char *ptr; > -char *end; > +AVBPrint buffer; > +uint32_t tsmb_size; > +uint32_t tsmb_type; > +uint16_t style_entries; > +uint16_t style_start; > +uint16_t style_end; > +uint16_t style_fontID; > +uint8_t style_flag; > +uint8_t style_fontsize; > +uint32_t style_color; > +uint16_t text_pos; > } MovTextContext; > > > @@ -47,10 +60,10 @@ static av_cold int mov_text_encode_init(AVCodecContext > *avctx) > 0xFF, // int8_t vertical-justification > 0x00, 0x00, 0x00, 0x00, // uint8_t background-color-rgba[4] > // BoxRecord { > -0x00, 0x00, // int16_t top > -0x00, 0x00, // int16_t left > -0x00, 0x00, // int16_t bottom > -0x00, 0x00, // int16_t right > +0x00, 0x01, // int16_t top > +0x00, 0x01, // int16_t left > +0x00, 0x1E, // int16_t bottom > +0x00, 0xC8, // int16_t right > // }; > // StyleRecord { > 0x00, 0x00, // uint16_t startChar > @@ -79,32 +92,54 @@ static av_cold int mov_text_encode_init(AVCodecContext > *avctx) > if (!avctx->extradata) > return AVERROR(ENOMEM); > > +av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED); > + > memcpy(avctx->extradata, text_sample_entry, avctx->extradata_size); > > s->ass_ctx = ff_ass_split(avctx->subtitle_header); > return s->ass_ctx ? 0 : AVERROR_INVALIDDATA; > } > > +static void mov_text_style_cb(void *priv, const char style, int close) > +{ > +MovTextContext *s = priv; > +s->tsmb_type = MKTAG('s','t','y','l'); > +if (!close) { > +s->style_start = AV_RB16(&s->text_pos); > +switch (style){ > +case 'b': > +s->style_flag += STYLE_FLAG_BOLD; > +break; > +case 'i': > +s->style_flag += STYLE_FLAG_ITALIC; > +break; > +case 'u': > +s->style_flag += STYLE_FLAG_UNDERLINE; > +break; > +} > +} else { > +s->style_end = AV_RB16(&s->text_pos); > +} > +} > + > static void mov_text_text_cb(void *priv, const char *text, int len) > { > MovTextContext *s = priv; > -av_assert0(s->end >= s->ptr); > -av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1)); > -s->ptr += FFMIN(s->end - s->ptr, len); > +av_bprint_append_data(&s->buffer, text, len); > +s->text_pos += len; > } > > static void mov_text_new_line_cb(void *priv, int forced) > { > MovTextContext *s = priv; > -av_assert0(s->end >= s->ptr); > -av_strlcpy(s->ptr, "\n", FFMIN(s->end - s->ptr, 2)); > -if (s->end > s->ptr) > -s->ptr++; > +av_bprint_append_data(&s->buffer, "\n", 2); > +s->text_pos += 2; > } > > static const ASSCodesCallbacks mov_text_callbacks = { > .text = mov_text_text_cb, > .new_line = mov_text_new_line_cb, > +.style= mov_text_style_cb, > }; > > static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char > *buf, > @@ -112,10 +147,9 @@ static int mov_text_encode_frame(AVCodecContext > *avctx, unsigned char *buf, > { > MovTextContext *s = avctx->priv_data; > ASSDialog *dialog; > -int i, len, num; > +int i, num; > > -s->ptr = s->buffer; > -s->end = s->ptr + sizeof(s->buffer); > +av_bprint_clear(&s->buffer); > > for (i = 0; i < sub->num_rects; i++) { > > @@ -123,33 +157,47 @@ static int mov_text_encode_frame(AVCodecContext > *avctx, unsigned char *buf, > av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type > su
Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles
Hi All, Please unsubscribe me from this list. Thanks, HItesh On Thu, Jun 11, 2015 at 10:18 AM, Niklesh Lalwani < niklesh.lalw...@iitb.ac.in> wrote: > From: Niklesh > > Encoding of bold, Italic, underlined styles for 3gpp timed text subtitles. > All the formatting information is appended into the buffer after the text, > unlike other encoders like srt, which can write out styling information as > it goes. Another tricky part is to take care of the Endianness properly > while writing into the buffer. > > Signed-off-by: Niklesh > --- > libavcodec/movtextenc.c | 104 > +++- > 1 file changed, 76 insertions(+), 28 deletions(-) > > diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c > index 1b8f454..adbe19d 100644 > --- a/libavcodec/movtextenc.c > +++ b/libavcodec/movtextenc.c > @@ -24,14 +24,27 @@ > #include "libavutil/avassert.h" > #include "libavutil/avstring.h" > #include "libavutil/intreadwrite.h" > +#include "libavutil/common.h" > #include "ass_split.h" > #include "ass.h" > > +#define STYLE_FLAG_BOLD 1 > +#define STYLE_FLAG_ITALIC 2 > +#define STYLE_FLAG_UNDERLINE4 > + > typedef struct { > ASSSplitContext *ass_ctx; > -char buffer[2048]; > -char *ptr; > -char *end; > +AVBPrint buffer; > +uint32_t tsmb_size; > +uint32_t tsmb_type; > +uint16_t style_entries; > +uint16_t style_start; > +uint16_t style_end; > +uint16_t style_fontID; > +uint8_t style_flag; > +uint8_t style_fontsize; > +uint32_t style_color; > +uint16_t text_pos; > } MovTextContext; > > > @@ -47,10 +60,10 @@ static av_cold int mov_text_encode_init(AVCodecContext > *avctx) > 0xFF, // int8_t vertical-justification > 0x00, 0x00, 0x00, 0x00, // uint8_t background-color-rgba[4] > // BoxRecord { > -0x00, 0x00, // int16_t top > -0x00, 0x00, // int16_t left > -0x00, 0x00, // int16_t bottom > -0x00, 0x00, // int16_t right > +0x00, 0x01, // int16_t top > +0x00, 0x01, // int16_t left > +0x00, 0x1E, // int16_t bottom > +0x00, 0xC8, // int16_t right > // }; > // StyleRecord { > 0x00, 0x00, // uint16_t startChar > @@ -79,32 +92,54 @@ static av_cold int mov_text_encode_init(AVCodecContext > *avctx) > if (!avctx->extradata) > return AVERROR(ENOMEM); > > +av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED); > + > memcpy(avctx->extradata, text_sample_entry, avctx->extradata_size); > > s->ass_ctx = ff_ass_split(avctx->subtitle_header); > return s->ass_ctx ? 0 : AVERROR_INVALIDDATA; > } > > +static void mov_text_style_cb(void *priv, const char style, int close) > +{ > +MovTextContext *s = priv; > +s->tsmb_type = MKTAG('s','t','y','l'); > +if (!close) { > +s->style_start = AV_RB16(&s->text_pos); > +switch (style){ > +case 'b': > +s->style_flag += STYLE_FLAG_BOLD; > +break; > +case 'i': > +s->style_flag += STYLE_FLAG_ITALIC; > +break; > +case 'u': > +s->style_flag += STYLE_FLAG_UNDERLINE; > +break; > +} > +} else { > +s->style_end = AV_RB16(&s->text_pos); > +} > +} > + > static void mov_text_text_cb(void *priv, const char *text, int len) > { > MovTextContext *s = priv; > -av_assert0(s->end >= s->ptr); > -av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1)); > -s->ptr += FFMIN(s->end - s->ptr, len); > +av_bprint_append_data(&s->buffer, text, len); > +s->text_pos += len; > } > > static void mov_text_new_line_cb(void *priv, int forced) > { > MovTextContext *s = priv; > -av_assert0(s->end >= s->ptr); > -av_strlcpy(s->ptr, "\n", FFMIN(s->end - s->ptr, 2)); > -if (s->end > s->ptr) > -s->ptr++; > +av_bprint_append_data(&s->buffer, "\n", 2); > +s->text_pos += 2; > } > > static const ASSCodesCallbacks mov_text_callbacks = { > .text = mov_text_text_cb, > .new_line = mov_text_new_line_cb, > +.style= mov_text_style_cb, > }; > > static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char > *buf, > @@ -112,10 +147,9 @@ static int mov_text_encode_frame(AVCodecContext > *avctx, unsigned char *buf, > { > MovTextContext *s = avctx->priv_data; > ASSDialog *dialog; > -int i, len, num; > +int i, num; > > -s->ptr = s->buffer; > -s->end = s->ptr + sizeof(s->buffer); > +av_bprint_clear(&s->buffer); > > for (i = 0; i < sub->num_rects; i++) { > > @@ -123,33 +157,47 @@ static int mov_text_encode_frame(AVCodecContext > *avctx, unsigned char *buf, > av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type > supported.\n"); > return AVERROR(ENOSYS); > } > +
[FFmpeg-devel] [PATCH 1/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions
From: Shivraj Patil Added const. Will do same for MIPS MSA hevc code in next patch. Signed-off-by: Shivraj Patil --- libavcodec/mips/Makefile |1 + libavcodec/mips/h264chroma_init_mips.c | 21 + libavcodec/mips/h264chroma_mips.h | 12 + libavcodec/mips/h264chroma_msa.c | 2003 libavutil/mips/generic_macros_msa.h| 56 + 5 files changed, 2093 insertions(+) create mode 100644 libavcodec/mips/h264chroma_msa.c diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 82d1d70..aa98774 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -31,5 +31,6 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o\ mips/hevc_lpf_sao_msa.o \ mips/hevcpred_msa.o MSA-OBJS-$(CONFIG_H264DSP)+= mips/h264dsp_msa.o +MSA-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_msa.o LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o diff --git a/libavcodec/mips/h264chroma_init_mips.c b/libavcodec/mips/h264chroma_init_mips.c index 4c10da7..1cc5767 100644 --- a/libavcodec/mips/h264chroma_init_mips.c +++ b/libavcodec/mips/h264chroma_init_mips.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Zhou Xiaoyong + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) * * This file is part of FFmpeg. * @@ -20,6 +21,23 @@ #include "h264chroma_mips.h" +#if HAVE_MSA +static av_cold void h264chroma_init_msa(H264ChromaContext *c, int bit_depth) +{ +const int high_bit_depth = bit_depth > 8; + +if (!high_bit_depth) { +c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_msa; +c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_msa; +c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_msa; + +c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_msa; +c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_msa; +c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_msa; +} +} +#endif // #if HAVE_MSA + #if HAVE_LOONGSON3 static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) { @@ -36,6 +54,9 @@ static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth) av_cold void ff_h264chroma_init_mips(H264ChromaContext *c, int bit_depth) { +#if HAVE_MSA +h264chroma_init_msa(c, bit_depth); +#endif // #if HAVE_MSA #if HAVE_LOONGSON3 h264chroma_init_mmi(c, bit_depth); #endif /* HAVE_LOONGSON3 */ diff --git a/libavcodec/mips/h264chroma_mips.h b/libavcodec/mips/h264chroma_mips.h index 314e8a3..7a373b8 100644 --- a/libavcodec/mips/h264chroma_mips.h +++ b/libavcodec/mips/h264chroma_mips.h @@ -22,6 +22,18 @@ #define H264_CHROMA_MIPS_H #include "libavcodec/h264.h" +void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_put_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); +void ff_avg_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride, +int height, int x, int y); void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); diff --git a/libavcodec/mips/h264chroma_msa.c b/libavcodec/mips/h264chroma_msa.c new file mode 100644 index 000..3113ee8 --- /dev/null +++ b/libavcodec/mips/h264chroma_msa.c @@ -0,0 +1,2003 @@ +/* + * Copyright (c) 2015 Shivraj Patil (shivraj.pa...@imgtec.com) + * + * 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/mips/generic_macros_msa.h" +#include "h264chroma_mips.h" + +static const uint8_t chro
Re: [FFmpeg-devel] [PATCH] libavcodec/pcm-dvd: support a subset of AOB
On Thursday 11 June 2015 05:05:48 am Michael Niedermayer wrote: > Fixes Ticket2758 > +if (avctx->bits_per_coded_sample != 16) { > +avpriv_request_sample(avctx, "Unsupported sample size\n"); 24bit sample is available: http://samples.ffmpeg.org/DVD-Audio/ats.AOB Attached is a variant of my patch from years ago, the lavc part is a revert of an earlier codec removal. This should be a separate codec imo because remuxing to mpeg-ts will fail badly iirc. Carl Eugen diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4aeb57a..f261ce7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -359,6 +359,7 @@ enum AVCodecID { AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'), AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'), AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16), +AV_CODEC_ID_PCM_AOB = MKBETAG('P','A','O','B'), /* various ADPCM codecs */ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 0a4ad0b..3549a66 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -302,6 +302,17 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, /* we process 40-bit blocks per channel for LXF */ samples_per_block = 2; sample_size = 5; +} else if (avctx->codec_id == AV_CODEC_ID_PCM_AOB) { +if (avctx->bits_per_coded_sample != 20 && +avctx->bits_per_coded_sample != 24) { +av_log(avctx, AV_LOG_ERROR, + "PCM DVD unsupported sample depth %i\n", + avctx->bits_per_coded_sample); +return AVERROR(EINVAL); +} +/* 2 samples are interleaved per block in PCM_DVD */ +samples_per_block = 2; +sample_size = avctx->bits_per_coded_sample * 2 / 8; } if (sample_size == 0) { @@ -459,6 +470,37 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, samples += 2; } break; +case AV_CODEC_ID_PCM_AOB: +{ +const uint8_t *src8; +dst_int32_t = (int32_t *)frame->data[0]; +n /= avctx->channels; +switch (avctx->bits_per_coded_sample) { +case 20: +while (n--) { +c= avctx->channels; +src8 = src + 4 * c; +while (c--) { +*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8); +*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12); +} +src = src8; +} +break; +case 24: +while (n--) { +c= avctx->channels; +src8 = src + 4 * c; +while (c--) { +*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); +*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8); +} +src = src8; +} +break; +} +break; +} case AV_CODEC_ID_PCM_LXF: { int i; @@ -541,6 +583,7 @@ AVCodec ff_ ## name_ ## _decoder = { \ /* Note: Do not forget to add new entries to the Makefile as well. */ PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law"); +PCM_DECODER(PCM_AOB, AV_SAMPLE_FMT_S32, pcm_aob, "PCM signed 20|24-bit big-endian"); PCM_CODEC (PCM_F32BE,AV_SAMPLE_FMT_FLT, pcm_f32be,"PCM 32-bit floating point big-endian"); PCM_CODEC (PCM_F32LE,AV_SAMPLE_FMT_FLT, pcm_f32le,"PCM 32-bit floating point little-endian"); PCM_CODEC (PCM_F64BE,AV_SAMPLE_FMT_DBL, pcm_f64be,"PCM 64-bit floating point big-endian"); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index edb134f..6d6c9a9 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -611,7 +611,52 @@ skip: found: if (st->discard >= AVDISCARD_ALL) goto skip; -if (startcode >= 0xa0 && startcode <= 0xaf) { +if (av_match_ext(s->filename, "aob") && lpcm_header_len > 8 && startcode == 0xa0) { +// DVD-A LPCM audio +int sample_rates[] = { 48000, 96000, 192000, + 0, 0, 0, 0, 0, + 44100, 88200, 176400, + 0, 0, 0, 0, 0 }; +avio_skip(s->pb, 2); // Pointer to start of audio frame +avio_skip(s->pb, 1); // Unknown +switch (avio_r8(s->pb) >> 4) { +case 2: +st->codec->codec_id = AV_CODEC_ID_PCM_AOB; +st->codec->bits_per_coded_sample = 24; +break; +case 1: +st->codec->codec_id = AV_CODEC_ID_PCM_AOB; +st->codec->bits_per_coded_sample = 20; +break; +case 0: +st->codec->codec_id = AV_CODEC_ID_PCM_S16BE; +st->codec->bits