[FFmpeg-cvslog] Merge commit 'bf2f748fc74fff5272075e1fe1c07b4152421526'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:16:57 
2017 -0300| [12290077d1ceda29c47ce9f222e42a5019664131] | committer: James Almer

Merge commit 'bf2f748fc74fff5272075e1fe1c07b4152421526'

* commit 'bf2f748fc74fff5272075e1fe1c07b4152421526':
  configure: Use correct libm linker flag during math function checks

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12290077d1ceda29c47ce9f222e42a5019664131
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index a62e8b1..6dc0b7a 100755
--- a/configure
+++ b/configure
@@ -5744,7 +5744,7 @@ ldexpf_args=2
 powf_args=2
 
 for func in $MATH_FUNCS; do
-eval check_mathfunc $func \${${func}_args:-1}
+eval check_mathfunc $func \${${func}_args:-1} $LIBM
 done
 
 for func in $COMPLEX_FUNCS; do


==

diff --cc configure
index a62e8b1,bfae451..6dc0b7a
--- a/configure
+++ b/configure
@@@ -5744,49 -4620,22 +5744,49 @@@ ldexpf_args=
  powf_args=2
  
  for func in $MATH_FUNCS; do
- eval check_mathfunc $func \${${func}_args:-1}
+ eval check_mathfunc $func \${${func}_args:-1} $LIBM
  done
  
 +for func in $COMPLEX_FUNCS; do
 +eval check_complexfunc $func \${${func}_args:-1}
 +done
 +
  # these are off by default, so fail if requested and not available
 -enabled avisynth  && { check_lib "avisynth/avisynth_c.h windows.h" 
LoadLibrary ||
 -   check_lib "avxsynth/avxsynth_c.h dlfcn.h" 
dlopen -ldl   ||
 -   die "ERROR: LoadLibrary/dlopen not found, or 
avisynth header not found"; }
 -enabled cuda  && check_lib cuda.h cuInit -lcuda
 +enabled avfoundation_indev && { check_header_objcc 
AVFoundation/AVFoundation.h || disable avfoundation_indev; }
 +enabled avfoundation_indev && { check_lib CoreGraphics/CoreGraphics.h 
CGGetActiveDisplayList -framework CoreGraphics ||
 +check_lib 
ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework 
ApplicationServices; }
 +enabled cuda  && check_header cuda.h # this is not a dependency
 +enabled cuvid && { enabled cuda ||
 +   die "ERROR: CUVID requires CUDA"; }
 +enabled chromaprint   && require chromaprint chromaprint.h 
chromaprint_get_version -lchromaprint
 +enabled coreimage_filter  && { check_header_objcc QuartzCore/CoreImage.h || 
disable coreimage_filter; }
 +enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || 
disable coreimagesrc_filter; }
 +enabled decklink  && { { check_header DeckLinkAPI.h || die "ERROR: 
DeckLinkAPI.h header not found"; } &&
 +   { check_cpp_condition DeckLinkAPIVersion.h 
"BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API 
version must be >= 10.6.1."; } }
  enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
 +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 || 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
 +enabled libbluray && require_pkg_config libbluray libbluray/bluray.h 
bd_open
  enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
 -enabled libdcadec && require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec
 -enabled libfaac   && require libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 -enabled libfdk_aac&& require_pkg_config fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen
 +enabled libcelt   && require libcelt celt/celt.h celt_decode -lcelt0 
&&
 + { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
 +   die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 +enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
 +enabled libfdk_aac&& { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" 
aacEncOpen ||
 +   { require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac &&
 + warn "using libfdk without pkg-config"; } }
 +flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt 

[FFmpeg-cvslog] configure: Use correct libm linker flag during math function checks

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Wed Nov 23 
09:27:28 2016 +0100| [bf2f748fc74fff5272075e1fe1c07b4152421526] | committer: 
Diego Biurrun

configure: Use correct libm linker flag during math function checks

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf2f748fc74fff5272075e1fe1c07b4152421526
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index eb51476..bfae451 100755
--- a/configure
+++ b/configure
@@ -4620,7 +4620,7 @@ ldexpf_args=2
 powf_args=2
 
 for func in $MATH_FUNCS; do
-eval check_mathfunc $func \${${func}_args:-1}
+eval check_mathfunc $func \${${func}_args:-1} $LIBM
 done
 
 # these are off by default, so fail if requested and not available

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] configure: Add missing asyncts filter, movie filter, and output example deps

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Nov 22 
16:51:04 2016 +0100| [ce6f780bc6656ad3895f81a988b239ad3c8af4b8] | committer: 
Diego Biurrun

configure: Add missing asyncts filter, movie filter, and output example deps

Also add a missing avcodec.h #include in the movie filter.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce6f780bc6656ad3895f81a988b239ad3c8af4b8
---

 configure| 7 +--
 libavfilter/vsrc_movie.c | 4 
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f204dc2..eb51476 100755
--- a/configure
+++ b/configure
@@ -2426,6 +2426,7 @@ unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
 # filters
+asyncts_filter_deps="avresample"
 blackframe_filter_deps="gpl"
 boxblur_filter_deps="gpl"
 bs2b_filter_deps="libbs2b"
@@ -2440,6 +2441,7 @@ frei0r_src_filter_extralibs='$ldl'
 hdcd_filter_deps="libhdcd"
 hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
+movie_filter_deps="avcodec avformat"
 ocv_filter_deps="libopencv"
 resample_filter_deps="avresample"
 scale_filter_deps="swscale"
@@ -2453,7 +2455,7 @@ encode_audio_example_deps="avcodec avutil"
 encode_video_example_deps="avcodec avutil"
 filter_audio_example_deps="avfilter avutil"
 metadata_example_deps="avformat avutil"
-output_example_deps="avcodec avformat avutil swscale"
+output_example_deps="avcodec avformat avresample avutil swscale"
 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
 transcode_aac_example_deps="avcodec avformat avresample"
 
@@ -5109,7 +5111,8 @@ enabled zlib && add_cppflags -DZLIB_CONST
 
 # conditional library dependencies, in linking order
 enabled movie_filter&& prepend avfilter_deps "avformat avcodec"
-enabled resample_filter && prepend avfilter_deps "avresample"
+enabled_any asyncts_filter resample_filter &&
+   prepend avfilter_deps "avresample"
 enabled scale_filter&& prepend avfilter_deps "swscale"
 
 enabled opus_decoder&& prepend avcodec_deps "avresample"
diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
index 5989a59..7fc9925 100644
--- a/libavfilter/vsrc_movie.c
+++ b/libavfilter/vsrc_movie.c
@@ -35,7 +35,11 @@
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
+
+#include "libavcodec/avcodec.h"
+
 #include "libavformat/avformat.h"
+
 #include "avfilter.h"
 #include "formats.h"
 #include "internal.h"

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'ce6f780bc6656ad3895f81a988b239ad3c8af4b8'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:15:02 
2017 -0300| [655418014c88d5a87b3427a8f89d20cf5c86520d] | committer: James Almer

Merge commit 'ce6f780bc6656ad3895f81a988b239ad3c8af4b8'

* commit 'ce6f780bc6656ad3895f81a988b239ad3c8af4b8':
  configure: Add missing asyncts filter, movie filter, and output example deps

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=655418014c88d5a87b3427a8f89d20cf5c86520d
---

 libavfilter/src_movie.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 23dcb7b..a93842e 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -37,7 +37,11 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/timestamp.h"
+
+#include "libavcodec/avcodec.h"
+
 #include "libavformat/avformat.h"
+
 #include "audio.h"
 #include "avfilter.h"
 #include "formats.h"


==

diff --cc libavfilter/src_movie.c
index 23dcb7b,000..a93842e
mode 100644,00..100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@@ -1,691 -1,0 +1,695 @@@
 +/*
 + * Copyright (c) 2010 Stefano Sabatini
 + * Copyright (c) 2008 Victor Paesa
 + *
 + * 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
 + */
 +
 +/**
 + * @file
 + * movie video source
 + *
 + * @todo use direct rendering (no allocation of a new frame)
 + * @todo support a PTS correction mechanism
 + */
 +
 +#include 
 +#include 
 +
 +#include "libavutil/attributes.h"
 +#include "libavutil/avstring.h"
 +#include "libavutil/avassert.h"
 +#include "libavutil/opt.h"
 +#include "libavutil/imgutils.h"
 +#include "libavutil/internal.h"
 +#include "libavutil/timestamp.h"
++
++#include "libavcodec/avcodec.h"
++
 +#include "libavformat/avformat.h"
++
 +#include "audio.h"
 +#include "avfilter.h"
 +#include "formats.h"
 +#include "internal.h"
 +#include "video.h"
 +
 +typedef struct MovieStream {
 +AVStream *st;
 +AVCodecContext *codec_ctx;
 +int done;
 +int64_t discontinuity_threshold;
 +int64_t last_pts;
 +} MovieStream;
 +
 +typedef struct MovieContext {
 +/* common A/V fields */
 +const AVClass *class;
 +int64_t seek_point;   ///< seekpoint in microseconds
 +double seek_point_d;
 +char *format_name;
 +char *file_name;
 +char *stream_specs; /**< user-provided list of streams, separated by + */
 +int stream_index; /**< for compatibility */
 +int loop_count;
 +int64_t discontinuity_threshold;
 +int64_t ts_offset;
 +
 +AVFormatContext *format_ctx;
 +int eof;
 +AVPacket pkt, pkt0;
 +
 +int max_stream_index; /**< max stream # actually used for output */
 +MovieStream *st; /**< array of all streams, one per output */
 +int *out_index; /**< stream number -> output number map, or -1 */
 +} MovieContext;
 +
 +#define OFFSET(x) offsetof(MovieContext, x)
 +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_VIDEO_PARAM
 +
 +static const AVOption movie_options[]= {
 +{ "filename", NULL,  OFFSET(file_name),
AV_OPT_TYPE_STRING,.flags = FLAGS },
 +{ "format_name",  "set format name", OFFSET(format_name),  
AV_OPT_TYPE_STRING,.flags = FLAGS },
 +{ "f","set format name", OFFSET(format_name),  
AV_OPT_TYPE_STRING,.flags = FLAGS },
 +{ "stream_index", "set stream index",OFFSET(stream_index), 
AV_OPT_TYPE_INT,{ .i64 = -1 }, -1, INT_MAX, FLAGS  },
 +{ "si",   "set stream index",OFFSET(stream_index), 
AV_OPT_TYPE_INT,{ .i64 = -1 }, -1, INT_MAX, FLAGS  },
 +{ "seek_point",   "set seekpoint (seconds)", OFFSET(seek_point_d), 
AV_OPT_TYPE_DOUBLE, { .dbl =  0 },  0, (INT64_MAX-1) / 100, FLAGS },
 +{ "sp",   "set seekpoint (seconds)", OFFSET(seek_point_d), 
AV_OPT_TYPE_DOUBLE, { .dbl =  0 },  0, (INT64_MAX-1) / 100, FLAGS },
 +{ "streams",  "set streams", OFFSET(stream_specs), 
AV_OPT_TYPE_STRING, 

[FFmpeg-cvslog] configure: Use correct variable name in libsnappy test

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Wed Nov 23 
08:54:01 2016 +0100| [04698d528cac334b6b5cabd3384f01406a766285] | committer: 
Diego Biurrun

configure: Use correct variable name in libsnappy test

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04698d528cac334b6b5cabd3384f01406a766285
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 78f1cac..f204dc2 100755
--- a/configure
+++ b/configure
@@ -4653,7 +4653,7 @@ enabled libopus   && require_pkg_config opus 
opus_multistream.h opus_mul
 enabled libpulse  && require_pkg_config libpulse-simple pulse/simple.h 
pa_simple_new
 enabled librtmp   && require_pkg_config librtmp librtmp/rtmp.h 
RTMP_Socket
 enabled libschroedinger   && require_pkg_config schroedinger-1.0 
schroedinger/schro.h schro_init
-enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
+enabled libsnappy && require libsnappy snappy-c.h snappy_compress 
-lsnappy
 enabled libspeex  && require_pkg_config speex speex/speex.h 
speex_decoder_init -lspeex
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
 enabled libtwolame&& require libtwolame twolame.h twolame_init 
-ltwolame

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '04698d528cac334b6b5cabd3384f01406a766285'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:08:21 
2017 -0300| [b26b4d62be4e26c4ebc1f30c082b2ffbbe9bc40a] | committer: James Almer

Merge commit '04698d528cac334b6b5cabd3384f01406a766285'

* commit '04698d528cac334b6b5cabd3384f01406a766285':
  configure: Use correct variable name in libsnappy test

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b26b4d62be4e26c4ebc1f30c082b2ffbbe9bc40a
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 517d54d..a62e8b1 100755
--- a/configure
+++ b/configure
@@ -5819,7 +5819,7 @@ enabled libschroedinger   && require_pkg_config 
schroedinger-1.0 schroedinger/sc
 enabled libshine  && require_pkg_config shine shine/layer3.h 
shine_encode_buffer
 enabled libsmbclient  && { use_pkg_config smbclient libsmbclient.h 
smbc_init ||
require smbclient libsmbclient.h smbc_init 
-lsmbclient; }
-enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
+enabled libsnappy && require libsnappy snappy-c.h snappy_compress 
-lsnappy
 enabled libsoxr   && require libsoxr soxr.h soxr_create -lsoxr && 
LIBSOXR="-lsoxr"
 enabled libssh&& require_pkg_config libssh libssh/sftp.h sftp_init
 enabled libspeex  && require_pkg_config speex speex/speex.h 
speex_decoder_init -lspeex


==

diff --cc configure
index 517d54d,f204dc2..a62e8b1
--- a/configure
+++ b/configure
@@@ -5799,60 -4645,37 +5799,60 @@@ enabled libnut&& require li
  enabled libnpp&& require libnpp npp.h nppGetLibVersion -lnppi 
-lnppc
  enabled libopencore_amrnb && require libopencore_amrnb 
opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  enabled libopencore_amrwb && require libopencore_amrwb 
opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 -enabled libopencv && require_pkg_config opencv opencv/cv.h 
cvCreateImageHeader
 +enabled libopencv && { check_header opencv2/core/core_c.h &&
 +   { use_pkg_config opencv opencv2/core/core_c.h 
cvCreateImageHeader ||
 + require opencv opencv2/core/core_c.h 
cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
 +   require_pkg_config opencv opencv/cxcore.h 
cvCreateImageHeader; }
  enabled libopenh264   && require_pkg_config openh264 wels/codec_api.h 
WelsGetCodecVersion
 -enabled libopenjpeg   && { check_lib openjpeg.h opj_version -lopenjpeg 
-DOPJ_STATIC ||
 -   require_pkg_config libopenjpeg1 openjpeg.h 
opj_version -DOPJ_STATIC; }
 +enabled libopenjpeg   && { { check_lib openjpeg-2.1/openjpeg.h 
opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +   check_lib openjpeg-2.1/openjpeg.h opj_version 
-lopenjp2 ||
 +   { check_lib openjpeg-2.0/openjpeg.h 
opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +   { check_lib openjpeg-1.5/openjpeg.h 
opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +   { check_lib openjpeg.h opj_version -lopenjpeg 
-DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +   die "ERROR: libopenjpeg not found"; }
 +enabled libopenmpt&& require_pkg_config "libopenmpt >= 0.2.6557" 
libopenmpt/libopenmpt.h openmpt_module_create
  enabled libopus   && require_pkg_config opus opus_multistream.h 
opus_multistream_decoder_create
 -enabled libpulse  && require_pkg_config libpulse-simple 
pulse/simple.h pa_simple_new
 +enabled libpulse  && require_pkg_config libpulse pulse/pulseaudio.h 
pa_context_new
  enabled librtmp   && require_pkg_config librtmp librtmp/rtmp.h 
RTMP_Socket
 +enabled librubberband && require_pkg_config "rubberband >= 1.8.1" 
rubberband/rubberband-c.h rubberband_new
  enabled libschroedinger   && require_pkg_config schroedinger-1.0 
schroedinger/schro.h schro_init
 +enabled libshine  && require_pkg_config shine shine/layer3.h 
shine_encode_buffer
 +enabled libsmbclient  && { use_pkg_config smbclient libsmbclient.h 
smbc_init ||
 +   require smbclient libsmbclient.h smbc_init 
-lsmbclient; }
- enabled libsnappy && require snappy snappy-c.h snappy_compress 
-lsnappy
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress 
-lsnappy
 +enabled libsoxr   && require libsoxr soxr.h soxr_create -lsoxr && 
LIBSOXR="-lsoxr"
 +enabled libssh&& require_pkg_config libssh libssh/sftp.h sftp_init
  enabled libspeex  && require_pkg_config speex speex/speex.h 
speex_decoder_init -lspeex
 +enabled libtesseract  && require_pkg_config tesseract 

[FFmpeg-cvslog] configure: Remove old avisynth support leftover

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Nov 22 
08:11:59 2016 +0100| [30f0d1b997f15d667c05feab0b54f0b2814ba7a9] | committer: 
Diego Biurrun

configure: Remove old avisynth support leftover

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30f0d1b997f15d667c05feab0b54f0b2814ba7a9
---

 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 42c1848..78f1cac 100755
--- a/configure
+++ b/configure
@@ -3039,7 +3039,6 @@ msvc_common_flags(){
 -mthumb)  ;;
 -march=*) ;;
 -lz)  echo zlib.lib ;;
--lavifil32)   echo vfw32.lib ;;
 -lavicap32)   echo vfw32.lib user32.lib ;;
 -lx264)   echo libx264.lib ;;
 -l*)  echo ${flag#-l}.lib ;;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '30f0d1b997f15d667c05feab0b54f0b2814ba7a9'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:06:02 
2017 -0300| [743eae3cd6f9755b22077befd6a78761caa741f5] | committer: James Almer

Merge commit '30f0d1b997f15d667c05feab0b54f0b2814ba7a9'

* commit '30f0d1b997f15d667c05feab0b54f0b2814ba7a9':
  configure: Remove old avisynth support leftover

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=743eae3cd6f9755b22077befd6a78761caa741f5
---

 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 426fae1..517d54d 100755
--- a/configure
+++ b/configure
@@ -3846,7 +3846,6 @@ msvc_common_flags(){
 -mthumb)  ;;
 -march=*) ;;
 -lz)  echo zlib.lib ;;
--lavifil32)   echo vfw32.lib ;;
 -lavicap32)   echo vfw32.lib user32.lib ;;
 -lx264)   echo libx264.lib ;;
 -l*)  echo ${flag#-l}.lib ;;


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] arm: warn/error on movrelx usage problematic with PIC on ELF

2017-04-04 Thread Janne Grunau
ffmpeg | branch: master | Janne Grunau  | Fri Nov 18 
21:06:40 2016 +0100| [6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f] | committer: 
Janne Grunau

arm: warn/error on movrelx usage problematic with PIC on ELF

The warning has false positives but our asm does not trigger it. For
new code false positives can only be avoided by changing the register
allocation.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f
---

 libavutil/arm/asm.S | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 4ac0ea2..a791e80 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -184,6 +184,15 @@ T   ldr \rd, [\rd]
 .endm
 
 .macro  movrelx rd,  val, gp
+.ifc \rd,\gp
+.error  "movrelx needs two distinct registers"
+.endif
+.ifc \rd\()_\gp,r12_
+.warning"movrelx rd=\rd without explicit set gp"
+.endif
+.ifc \rd\()_\gp,ip_
+.warning"movrelx rd=\rd without explicit set gp"
+.endif
 #if CONFIG_PIC && defined(__ELF__)
 .ifnb \gp
   .if .Lpic_gp

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:04:29 
2017 -0300| [d1ee6fb72945d43d55aa0e7f946a957274cd94c9] | committer: James Almer

Merge commit '6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f'

* commit '6a1ea4ec932f4fc9fdc00ec51ee070b298ddb35f':
  arm: warn/error on movrelx usage problematic with PIC on ELF

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1ee6fb72945d43d55aa0e7f946a957274cd94c9
---

 libavutil/arm/asm.S | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index f488289..7d33a64 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -184,6 +184,15 @@ T   ldr \rd, [\rd]
 .endm
 
 .macro  movrelx rd,  val, gp
+.ifc \rd,\gp
+.error  "movrelx needs two distinct registers"
+.endif
+.ifc \rd\()_\gp,r12_
+.warning"movrelx rd=\rd without explicit set gp"
+.endif
+.ifc \rd\()_\gp,ip_
+.warning"movrelx rd=\rd without explicit set gp"
+.endif
 #if CONFIG_PIC && defined(__ELF__)
 .ifnb \gp
   .if .Lpic_gp


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] configure: Disable warning C4703 with MSVC

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Nov 22 
08:18:38 2016 +0100| [5bcc6f76f180d0f88269018727c92fc562fb8abb] | committer: 
Diego Biurrun

configure: Disable warning C4703 with MSVC

This disables warnings about potentially uninitialized local pointer
variables.  Disabling the warning is in line with what we do for gcc.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5bcc6f76f180d0f88269018727c92fc562fb8abb
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index beab6ba..42c1848 100755
--- a/configure
+++ b/configure
@@ -3056,7 +3056,7 @@ msvc_flags(){
 -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 
\
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4273 -wd4554 -wd4701 ;;
+   -wd4273 -wd4554 -wd4701 -wd4703 ;;
 esac
 done
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '5bcc6f76f180d0f88269018727c92fc562fb8abb'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 16:03:05 
2017 -0300| [b9886e569a9c5748222b4ebf5f601823e3a6aeb6] | committer: James Almer

Merge commit '5bcc6f76f180d0f88269018727c92fc562fb8abb'

* commit '5bcc6f76f180d0f88269018727c92fc562fb8abb':
  configure: Disable warning C4703 with MSVC

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9886e569a9c5748222b4ebf5f601823e3a6aeb6
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index a631a1b..426fae1 100755
--- a/configure
+++ b/configure
@@ -3865,7 +3865,7 @@ msvc_flags(){
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-wd4307 \
-   -wd4273 -wd4554 -wd4701 ;;
+   -wd4273 -wd4554 -wd4701 -wd4703 ;;
 esac
 done
 }


==

diff --cc configure
index a631a1b,42c1848..426fae1
--- a/configure
+++ b/configure
@@@ -3864,8 -3056,7 +3864,8 @@@ msvc_flags()
  -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389
 \
 -wd4146 -wd4057 -wd4204 -wd4706 
-wd4305 \
 -wd4152 -wd4324 -we4013 -wd4100 
-wd4214 \
 +   -wd4307 \
--wd4273 -wd4554 -wd4701 ;;
+-wd4273 -wd4554 -wd4701 -wd4703 ;;
  esac
  done
  }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'bd9cd04626a98a752c5771d057a6b86779359904'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:59:56 
2017 -0300| [b30cd14b5732a668ca185f3e97dad73319893673] | committer: James Almer

Merge commit 'bd9cd04626a98a752c5771d057a6b86779359904'

* commit 'bd9cd04626a98a752c5771d057a6b86779359904':
  w32pthreads: Fix function pointer casts

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b30cd14b5732a668ca185f3e97dad73319893673
---

 compat/w32pthreads.h | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 4ac2a99..0c9a7fa 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -399,18 +399,18 @@ static av_unused void w32thread_init(void)
 #if _WIN32_WINNT < 0x0600
 HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
 /* if one is available, then they should all be available */
-cond_init  =
-(void*)GetProcAddress(kernel_dll, "InitializeConditionVariable");
-cond_broadcast =
-(void*)GetProcAddress(kernel_dll, "WakeAllConditionVariable");
-cond_signal=
-(void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
-cond_wait  =
-(void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
-initonce_begin =
-(void*)GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
-initonce_complete =
-(void*)GetProcAddress(kernel_dll, "InitOnceComplete");
+cond_init  = (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "InitializeConditionVariable");
+cond_broadcast = (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "WakeAllConditionVariable");
+cond_signal= (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "WakeConditionVariable");
+cond_wait  = (BOOL (WINAPI*)(pthread_cond_t *, pthread_mutex_t *, 
DWORD))
+GetProcAddress(kernel_dll, "SleepConditionVariableCS");
+initonce_begin = (BOOL (WINAPI*)(pthread_once_t *, DWORD, BOOL *, void **))
+GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
+initonce_complete = (BOOL (WINAPI*)(pthread_once_t *, DWORD, void *))
+GetProcAddress(kernel_dll, "InitOnceComplete");
 #endif
 
 }


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] w32pthreads: Fix function pointer casts

2017-04-04 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Nov 22 
08:46:07 2016 +0100| [bd9cd04626a98a752c5771d057a6b86779359904] | committer: 
Diego Biurrun

w32pthreads: Fix function pointer casts

This eliminates a handful of warnings at every inclusion of the header.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd9cd04626a98a752c5771d057a6b86779359904
---

 compat/w32pthreads.h | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 2fe2a5a..f38f767 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -382,18 +382,18 @@ static av_unused void w32thread_init(void)
 #if _WIN32_WINNT < 0x0600
 HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
 /* if one is available, then they should all be available */
-cond_init  =
-(void*)GetProcAddress(kernel_dll, "InitializeConditionVariable");
-cond_broadcast =
-(void*)GetProcAddress(kernel_dll, "WakeAllConditionVariable");
-cond_signal=
-(void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
-cond_wait  =
-(void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
-initonce_begin =
-(void*)GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
-initonce_complete =
-(void*)GetProcAddress(kernel_dll, "InitOnceComplete");
+cond_init  = (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "InitializeConditionVariable");
+cond_broadcast = (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "WakeAllConditionVariable");
+cond_signal= (void (WINAPI*)(pthread_cond_t *))
+GetProcAddress(kernel_dll, "WakeConditionVariable");
+cond_wait  = (BOOL (WINAPI*)(pthread_cond_t *, pthread_mutex_t *, 
DWORD))
+GetProcAddress(kernel_dll, "SleepConditionVariableCS");
+initonce_begin = (BOOL (WINAPI*)(pthread_once_t *, DWORD, BOOL *, void **))
+GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
+initonce_complete = (BOOL (WINAPI*)(pthread_once_t *, DWORD, void *))
+GetProcAddress(kernel_dll, "InitOnceComplete");
 #endif
 
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] qt-faststart: Do not try to use fancy 64-bit seeking functions on mingw32ce

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Thu Sep 13 
12:55:32 2012 +0300| [233d50b275dd7cf6cc0656851e670e1b2dfba56f] | committer: 
Diego Biurrun

qt-faststart: Do not try to use fancy 64-bit seeking functions on mingw32ce

These functions are not available on mingw32ce.

Signed-off-by: Diego Biurrun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=233d50b275dd7cf6cc0656851e670e1b2dfba56f
---

 tools/qt-faststart.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index 0db5ca2..b798ccd 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -29,7 +29,10 @@
 #include 
 #include 
 
-#ifdef __MINGW32__
+#ifdef __MINGW32CE__
+#define fseeko(x, y, z) fseek(x, y, z)
+#define ftello(x)   ftell(x)
+#elif defined(__MINGW32__)
 #undef fseeko
 #define fseeko(x, y, z) fseeko64(x, y, z)
 #undef ftello

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '233d50b275dd7cf6cc0656851e670e1b2dfba56f'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:58:11 
2017 -0300| [2c40adf218c8991769fd6f55deffdea697361e3d] | committer: James Almer

Merge commit '233d50b275dd7cf6cc0656851e670e1b2dfba56f'

* commit '233d50b275dd7cf6cc0656851e670e1b2dfba56f':
  qt-faststart: Do not try to use fancy 64-bit seeking functions on mingw32ce

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c40adf218c8991769fd6f55deffdea697361e3d
---

 tools/qt-faststart.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index 97be019..728f80c 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -29,7 +29,10 @@
 #include 
 #include 
 
-#ifdef __MINGW32__
+#ifdef __MINGW32CE__
+#define fseeko(x, y, z) fseek(x, y, z)
+#define ftello(x)   ftell(x)
+#elif defined(__MINGW32__)
 #undef fseeko
 #define fseeko(x, y, z) fseeko64(x, y, z)
 #undef ftello


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '537b5b773b317af79d3a5b576ee9683e15ed84f6'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:56:36 
2017 -0300| [30518a68a74b82abaf2a8f230fee18b7e6c477fa] | committer: James Almer

Merge commit '537b5b773b317af79d3a5b576ee9683e15ed84f6'

* commit '537b5b773b317af79d3a5b576ee9683e15ed84f6':
  rtmpdh: Do global initialization before running the test

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30518a68a74b82abaf2a8f230fee18b7e6c477fa
---

 libavformat/tests/rtmpdh.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tests/rtmpdh.c b/libavformat/tests/rtmpdh.c
index 929b3f3..77139a5 100644
--- a/libavformat/tests/rtmpdh.c
+++ b/libavformat/tests/rtmpdh.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavformat/avformat.h"
 #include "libavformat/rtmpdh.c"
 
 #include 
@@ -150,6 +151,7 @@ fail:
 
 int main(void)
 {
+avformat_network_init();
 if (test_random_shared_secret() < 0)
 return 1;
 if (test_ref_data() < 0)


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] rtmpdh: Do global initialization before running the test

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Wed Nov 23 
23:27:26 2016 +0200| [537b5b773b317af79d3a5b576ee9683e15ed84f6] | committer: 
Martin Storsjö

rtmpdh: Do global initialization before running the test

The rtmpdh code can use crypto libraries which may require
a process global init. (gcrypt is one of the libraries
where the rtmpdh test code can fail if global init hasn't been
done, depending on gcrypt version.)

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=537b5b773b317af79d3a5b576ee9683e15ed84f6
---

 libavformat/tests/rtmpdh.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tests/rtmpdh.c b/libavformat/tests/rtmpdh.c
index c25ca91..cf567fb 100644
--- a/libavformat/tests/rtmpdh.c
+++ b/libavformat/tests/rtmpdh.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavformat/avformat.h"
 #include "libavformat/rtmpdh.c"
 
 #include 
@@ -150,6 +151,7 @@ fail:
 
 int main(void)
 {
+avformat_network_init();
 if (test_random_shared_secret() < 0)
 return 1;
 if (test_ref_data() < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '2f99117f6ff24ce5be2abb9e014cb8b86c2aa0e0'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:53:58 
2017 -0300| [7d88bc10d57b035c3545f931adef360dcf8d407a] | committer: James Almer

Merge commit '2f99117f6ff24ce5be2abb9e014cb8b86c2aa0e0'

* commit '2f99117f6ff24ce5be2abb9e014cb8b86c2aa0e0':
  aarch64: vp9itxfm: Don't repeatedly set x9 when nothing overwrites it

This commit is a noop, see 37cb224e3e65b92eb6d77f1a788d882fbee972c3

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d88bc10d57b035c3545f931adef360dcf8d407a
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] aarch64: vp9itxfm: Don't repeatedly set x9 when nothing overwrites it

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Nov 22 
15:47:17 2016 +0200| [2f99117f6ff24ce5be2abb9e014cb8b86c2aa0e0] | committer: 
Martin Storsjö

aarch64: vp9itxfm: Don't repeatedly set x9 when nothing overwrites it

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f99117f6ff24ce5be2abb9e014cb8b86c2aa0e0
---

 libavcodec/aarch64/vp9itxfm_neon.S | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavcodec/aarch64/vp9itxfm_neon.S 
b/libavcodec/aarch64/vp9itxfm_neon.S
index 2dc6b75..f4194a6 100644
--- a/libavcodec/aarch64/vp9itxfm_neon.S
+++ b/libavcodec/aarch64/vp9itxfm_neon.S
@@ -599,9 +599,9 @@ endfunc
 // x1 = unused
 // x2 = src
 // x3 = slice offset
+// x9 = input stride
 .macro itxfm16_1d_funcs txfm
 function \txfm\()16_1d_8x16_pass1_neon
-mov x9, #32
 moviv2.8h, #0
 .irp i, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
 load_clear  \i,  x2,  x9
@@ -649,8 +649,8 @@ endfunc
 // x1 = dst stride
 // x2 = src (temp buffer)
 // x3 = slice offset
+// x9 = temp buffer stride
 function \txfm\()16_1d_8x16_pass2_neon
-mov x9, #32
 .irp i, 16, 17, 18, 19, 20, 21, 22, 23
 load\i,  x2,  x9
 .endr
@@ -747,6 +747,7 @@ function ff_vp9_\txfm1\()_\txfm2\()_16x16_add_neon, export=1
 .ifc \txfm1,idct
 ld1 {v0.8h,v1.8h}, [x10]
 .endif
+mov x9, #32
 
 .irp i, 0, 8
 add x0,  sp,  #(\i*32)
@@ -882,13 +883,12 @@ endfunc
 // x0 = dst (temp buffer)
 // x1 = unused
 // x2 = src
+// x9 = double input stride
 // x10 = idct_coeffs
 // x11 = idct_coeffs + 32
 function idct32_1d_8x32_pass1_neon
 ld1 {v0.8h,v1.8h}, [x10]
 
-// Double stride of the input, since we only read every other line
-mov x9,  #128
 moviv4.8h, #0
 
 // v16 = IN(0), v17 = IN(2) ... v31 = IN(30)
@@ -987,12 +987,13 @@ endfunc
 // x0 = dst
 // x1 = dst stride
 // x2 = src (temp buffer)
+// x7 = negative double temp buffer stride
+// x9 = double temp buffer stride
 // x10 = idct_coeffs
 // x11 = idct_coeffs + 32
 function idct32_1d_8x32_pass2_neon
 ld1 {v0.8h,v1.8h}, [x10]
 
-mov x9, #128
 // v16 = IN(0), v17 = IN(2) ... v31 = IN(30)
 .irp i, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
 ld1 {v\i\().8h}, [x2], x9
@@ -1001,7 +1002,6 @@ function idct32_1d_8x32_pass2_neon
 
 idct16
 
-mov x9,  #128
 .irp i, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
 st1 {v\i\().8h}, [x2], x9
 .endr
@@ -1018,11 +1018,10 @@ function idct32_1d_8x32_pass2_neon
 
 idct32_odd
 
-mov x9,  #128
 .macro load_acc_store a, b, c, d, neg=0
+.if \neg == 0
 ld1 {v4.8h},  [x2], x9
 ld1 {v5.8h},  [x2], x9
-.if \neg == 0
 add v4.8h, v4.8h, v\a\().8h
 ld1 {v6.8h},  [x2], x9
 add v5.8h, v5.8h, v\b\().8h
@@ -1030,10 +1029,12 @@ function idct32_1d_8x32_pass2_neon
 add v6.8h, v6.8h, v\c\().8h
 add v7.8h, v7.8h, v\d\().8h
 .else
+ld1 {v4.8h},  [x2], x7
+ld1 {v5.8h},  [x2], x7
 sub v4.8h, v4.8h, v\a\().8h
-ld1 {v6.8h},  [x2], x9
+ld1 {v6.8h},  [x2], x7
 sub v5.8h, v5.8h, v\b\().8h
-ld1 {v7.8h},  [x2], x9
+ld1 {v7.8h},  [x2], x7
 sub v6.8h, v6.8h, v\c\().8h
 sub v7.8h, v7.8h, v\d\().8h
 .endif
@@ -1064,7 +1065,6 @@ function idct32_1d_8x32_pass2_neon
 load_acc_store  23, 22, 21, 20
 load_acc_store  19, 18, 17, 16
 sub x2,  x2,  x9
-neg x9,  x9
 load_acc_store  16, 17, 18, 19, 1
 load_acc_store  20, 21, 22, 23, 1
 load_acc_store  24, 25, 26, 27, 1
@@ -1093,6 +1093,10 @@ function ff_vp9_idct_idct_32x32_add_neon, export=1
 mov x5,  x1
 mov x6,  x2
 
+// Double stride of the input, since we only read every other line
+mov x9,  #128
+neg x7,  x9
+
 .irp i, 0, 8, 16, 24
 add x0,  sp,  #(\i*64)
 add x2,  x6,  #(\i*2)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] svq1dec: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 20:25:22 2016 +0200| [9f78e3a46d15abbdc900d755818ef235ae5e886c] | committer: 
Diego Biurrun

svq1dec: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f78e3a46d15abbdc900d755818ef235ae5e886c
---

 libavcodec/svq1dec.c | 120 +--
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index cc43f14..2ab0f23 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -33,7 +33,7 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "h263.h"
 #include "hpeldsp.h"
 #include "internal.h"
@@ -55,7 +55,7 @@ typedef struct svq1_pmv_s {
 
 typedef struct SVQ1Context {
 HpelDSPContext hdsp;
-GetBitContext gb;
+BitstreamContext bc;
 AVFrame *prev;
 
 uint8_t *pkt_swapped;
@@ -111,7 +111,7 @@ static const uint8_t string_table[256] = {
 break;  \
 }   \
 /* divide block if next bit set */  \
-if (get_bits1(bitbuf) == 0) \
+if (bitstream_read_bit(bc) == 0)\
 break;  \
 /* add child nodes */   \
 list[n++] = list[i];\
@@ -145,7 +145,7 @@ static const uint8_t string_table[256] = {
 #define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)   \
 codebook = (const uint32_t *)cbook[level];  \
 if (stages > 0) \
-bit_cache = get_bits(bitbuf, 4 * stages);   \
+bit_cache = bitstream_read(bc, 4 * stages); \
 /* calculate codebook entries for this vector */\
 for (j = 0; j < stages; j++) {  \
 entries[j] = (((bit_cache >> (4 * (stages - j - 1))) & 0xF) +   \
@@ -154,7 +154,7 @@ static const uint8_t string_table[256] = {
 mean -= stages * 128;   \
 n4= mean + (mean >> 31) << 16 | (mean & 0x);
 
-static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
+static int svq1_decode_block_intra(BitstreamContext *bc, uint8_t *pixels,
ptrdiff_t pitch)
 {
 uint32_t bit_cache;
@@ -180,7 +180,7 @@ static int svq1_decode_block_intra(GetBitContext *bitbuf, 
uint8_t *pixels,
 height = 1 << ((3 + level) / 2);
 
 /* get number of stages (-1 skips vector, 0 for mean only) */
-stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 
1;
+stages = bitstream_read_vlc(bc, svq1_intra_multistage[level].table, 3, 
3) - 1;
 
 if (stages == -1) {
 for (y = 0; y < height; y++)
@@ -195,7 +195,7 @@ static int svq1_decode_block_intra(GetBitContext *bitbuf, 
uint8_t *pixels,
 return AVERROR_INVALIDDATA;  /* invalid vector */
 }
 
-mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
+mean = bitstream_read_vlc(bc, svq1_intra_mean.table, 8, 3);
 
 if (stages == 0) {
 for (y = 0; y < height; y++)
@@ -219,7 +219,7 @@ static int svq1_decode_block_intra(GetBitContext *bitbuf, 
uint8_t *pixels,
 return 0;
 }
 
-static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels,
+static int svq1_decode_block_non_intra(BitstreamContext *bc, uint8_t *pixels,
ptrdiff_t pitch)
 {
 uint32_t bit_cache;
@@ -245,7 +245,7 @@ static int svq1_decode_block_non_intra(GetBitContext 
*bitbuf, uint8_t *pixels,
 height = 1 << ((3 + level) / 2);
 
 /* get number of stages (-1 skips vector, 0 for mean only) */
-stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 
1;
+stages = bitstream_read_vlc(bc, svq1_inter_multistage[level].table, 3, 
2) - 1;
 
 if (stages == -1)
 continue;   /* skip vector */
@@ -257,7 +257,7 @@ static int svq1_decode_block_non_intra(GetBitContext 
*bitbuf, uint8_t *pixels,
 return AVERROR_INVALIDDATA;  /* invalid vector */
 }
 
-mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
+mean = bitstream_read_vlc(bc, svq1_inter_mean.table, 9, 3) - 256;
 
 SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
 
@@ -277,7 +277,7 @@ static int svq1_decode_block_non_intra(GetBitContext 
*bitbuf, uint8_t *pixels,
 return 0;
 }
 
-static int svq1_decode_motion_vector(GetBitContext *bitbuf, svq1_pmv *mv,
+static int 

[FFmpeg-cvslog] rdt: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Apr 
16 17:58:30 2016 +0200| [2dbe2aa2c2d4f02d2669feae45dee4fc45414813] | committer: 
Diego Biurrun

rdt: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2dbe2aa2c2d4f02d2669feae45dee4fc45414813
---

 libavformat/rdt.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index eb718cf..da5ff59 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -25,6 +25,8 @@
  * @author Ronald S. Bultje 
  */
 
+#include "libavcodec/bitstream.h"
+
 #include "avformat.h"
 #include "libavutil/avstring.h"
 #include "rtpdec.h"
@@ -34,7 +36,6 @@
 #include "rm.h"
 #include "internal.h"
 #include "avio_internal.h"
-#include "libavcodec/get_bits.h"
 
 struct RDTDemuxContext {
 AVFormatContext *ic; /**< the containing (RTSP) demux context */
@@ -191,7 +192,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
 int *pset_id, int *pseq_no, int *pstream_id,
 int *pis_keyframe, uint32_t *ptimestamp)
 {
-GetBitContext gb;
+BitstreamContext bc;
 int consumed = 0, set_id, seq_no, stream_id, is_keyframe,
 len_included, need_reliable;
 uint32_t timestamp;
@@ -261,24 +262,24 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
  * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
  * 
http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
  */
-init_get_bits(, buf, len << 3);
-len_included  = get_bits1();
-need_reliable = get_bits1();
-set_id= get_bits(, 5);
-skip_bits(, 1);
-seq_no= get_bits(, 16);
+bitstream_init(, buf, len << 3);
+len_included  = bitstream_read_bit();
+need_reliable = bitstream_read_bit();
+set_id= bitstream_read(, 5);
+bitstream_skip(, 1);
+seq_no= bitstream_read(, 16);
 if (len_included)
-skip_bits(, 16);
-skip_bits(, 2);
-stream_id = get_bits(, 5);
-is_keyframe   = !get_bits1();
-timestamp = get_bits_long(, 32);
+bitstream_skip(, 16);
+bitstream_skip(, 2);
+stream_id = bitstream_read(, 5);
+is_keyframe   = !bitstream_read_bit();
+timestamp = bitstream_read(, 32);
 if (set_id == 0x1f)
-set_id= get_bits(, 16);
+set_id= bitstream_read(, 16);
 if (need_reliable)
-skip_bits(, 16);
+bitstream_skip(, 16);
 if (stream_id == 0x1f)
-stream_id = get_bits(, 16);
+stream_id = bitstream_read(, 16);
 
 if (pset_id)  *pset_id  = set_id;
 if (pseq_no)  *pseq_no  = seq_no;
@@ -286,7 +287,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
 if (pis_keyframe) *pis_keyframe = is_keyframe;
 if (ptimestamp)   *ptimestamp   = timestamp;
 
-return consumed + (get_bits_count() >> 3);
+return consumed + (bitstream_tell() >> 3);
 }
 
 /**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] xsubdec: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Fri Apr 
15 11:03:55 2016 +0200| [178b4ea5f9a43009781311af2737284fdca48a5c] | committer: 
Diego Biurrun

xsubdec: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=178b4ea5f9a43009781311af2737284fdca48a5c
---

 libavcodec/xsubdec.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index 3af300c..a07f94c 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -21,8 +21,9 @@
 
 #include "libavutil/mathematics.h"
 #include "libavutil/imgutils.h"
+
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "bytestream.h"
 
 static av_cold int decode_init(AVCodecContext *avctx) {
@@ -55,7 +56,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *data_size,
 uint8_t *bitmap;
 int w, h, x, y, i;
 int64_t packet_time = 0;
-GetBitContext gb;
+BitstreamContext bc;
 int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
 
 memset(sub, 0, sizeof(*sub));
@@ -146,15 +147,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
 // process RLE-compressed data
-init_get_bits(, buf, (buf_end - buf) * 8);
+bitstream_init(, buf, (buf_end - buf) * 8);
 bitmap = sub->rects[0]->data[0];
 for (y = 0; y < h; y++) {
 // interlaced: do odd lines
 if (y == (h + 1) / 2) bitmap = sub->rects[0]->data[0] + w;
 for (x = 0; x < w; ) {
-int log2 = ff_log2_tab[show_bits(, 8)];
-int run = get_bits(, 14 - 4 * (log2 >> 1));
-int color = get_bits(, 2);
+int log2 = ff_log2_tab[bitstream_peek(, 8)];
+int run = bitstream_read(, 14 - 4 * (log2 >> 1));
+int color = bitstream_read(, 2);
 run = FFMIN(run, w - x);
 // run length 0 means till end of row
 if (!run) run = w - x;
@@ -164,7 +165,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 // interlaced, skip every second line
 bitmap += w;
-align_get_bits();
+bitstream_align();
 }
 *data_size = 1;
 return buf_size;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vble: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 11:52:48 2016 +0200| [e5bdfc679004199c4a1837e256046331e5e4e713] | committer: 
Diego Biurrun

vble: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5bdfc679004199c4a1837e256046331e5e4e713
---

 libavcodec/vble.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index 1a78036..fef1090 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -28,7 +28,7 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "huffyuvdsp.h"
 #include "internal.h"
 #include "mathops.h"
@@ -41,18 +41,18 @@ typedef struct VBLEContext {
 uint8_t*val; /* First holds the lengths of vlc symbols and then 
their values */
 } VBLEContext;
 
-static uint8_t vble_read_reverse_unary(GetBitContext *gb)
+static uint8_t vble_read_reverse_unary(BitstreamContext *bc)
 {
 /* At most we need to read 9 bits total to get indices up to 8 */
-uint8_t val = show_bits(gb, 8);
+uint8_t val = bitstream_peek(bc, 8);
 
 if (val) {
 val = 7 - av_log2_16bit(ff_reverse[val]);
-skip_bits(gb, val + 1);
+bitstream_skip(bc, val + 1);
 return val;
 } else {
-skip_bits(gb, 8);
-if (get_bits1(gb))
+bitstream_skip(bc, 8);
+if (bitstream_read_bit(bc))
 return 8;
 }
 
@@ -60,13 +60,13 @@ static uint8_t vble_read_reverse_unary(GetBitContext *gb)
 return UINT8_MAX;
 }
 
-static int vble_unpack(VBLEContext *ctx, GetBitContext *gb)
+static int vble_unpack(VBLEContext *ctx, BitstreamContext *bc)
 {
 int i;
 
 /* Read all the lengths in first */
 for (i = 0; i < ctx->size; i++) {
-ctx->val[i] = vble_read_reverse_unary(gb);
+ctx->val[i] = vble_read_reverse_unary(bc);
 
 if (ctx->val[i] == UINT8_MAX)
 return -1;
@@ -74,12 +74,12 @@ static int vble_unpack(VBLEContext *ctx, GetBitContext *gb)
 
 for (i = 0; i < ctx->size; i++) {
 /* Check we have enough bits left */
-if (get_bits_left(gb) < ctx->val[i])
+if (bitstream_bits_left(bc) < ctx->val[i])
 return -1;
 
 /* get_bits can't take a length of 0 */
 if (ctx->val[i])
-ctx->val[i] = (1 << ctx->val[i]) + get_bits(gb, ctx->val[i]) - 1;
+ctx->val[i] = (1 << ctx->val[i]) + bitstream_read(bc, ctx->val[i]) 
- 1;
 }
 
 return 0;
@@ -118,7 +118,7 @@ static int vble_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 {
 VBLEContext *ctx = avctx->priv_data;
 AVFrame *pic = data;
-GetBitContext gb;
+BitstreamContext bc;
 const uint8_t *src = avpkt->data;
 int version;
 int offset = 0;
@@ -140,10 +140,10 @@ static int vble_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 if (version != 1)
 av_log(avctx, AV_LOG_WARNING, "Unsupported VBLE Version: %d\n", 
version);
 
-init_get_bits(, src + 4, (avpkt->size - 4) * 8);
+bitstream_init(, src + 4, (avpkt->size - 4) * 8);
 
 /* Unpack */
-if (vble_unpack(ctx, ) < 0) {
+if (vble_unpack(ctx, ) < 0) {
 av_log(avctx, AV_LOG_ERROR, "Invalid Code\n");
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] truemotion2: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Apr 
23 15:11:27 2016 +0200| [9ab1a3e28371f599afe05aea9f7ca75fd8eb3c3f] | committer: 
Diego Biurrun

truemotion2: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ab1a3e28371f599afe05aea9f7ca75fd8eb3c3f
---

 libavcodec/truemotion2.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 1726440..99884be 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -27,9 +27,9 @@
 #include 
 
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bswapdsp.h"
 #include "bytestream.h"
-#include "get_bits.h"
 #include "internal.h"
 
 #define TM2_ESCAPE 0x8000
@@ -62,7 +62,7 @@ typedef struct TM2Context {
 AVCodecContext *avctx;
 AVFrame *pic;
 
-GetBitContext gb;
+BitstreamContext bc;
 BswapDSPContext bdsp;
 
 /* TM2 streams */
@@ -117,7 +117,7 @@ static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, 
int length, TM2Huff *
 return AVERROR_INVALIDDATA;
 }
 
-if (!get_bits1(>gb)) { /* literal */
+if (!bitstream_read_bit(>bc)) { /* literal */
 if (length == 0) {
 length = 1;
 }
@@ -125,7 +125,7 @@ static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, 
int length, TM2Huff *
 av_log(ctx->avctx, AV_LOG_DEBUG, "Too many literals\n");
 return AVERROR_INVALIDDATA;
 }
-huff->nums[huff->num] = get_bits_long(>gb, huff->val_bits);
+huff->nums[huff->num] = bitstream_read(>bc, huff->val_bits);
 huff->bits[huff->num] = prefix;
 huff->lens[huff->num] = length;
 huff->num++;
@@ -144,10 +144,10 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes 
*code)
 TM2Huff huff;
 int res = 0;
 
-huff.val_bits = get_bits(>gb, 5);
-huff.max_bits = get_bits(>gb, 5);
-huff.min_bits = get_bits(>gb, 5);
-huff.nodes= get_bits_long(>gb, 17);
+huff.val_bits = bitstream_read(>bc, 5);
+huff.max_bits = bitstream_read(>bc, 5);
+huff.min_bits = bitstream_read(>bc, 5);
+huff.nodes= bitstream_read(>bc, 17);
 huff.num  = 0;
 
 /* check for correct codes parameters */
@@ -222,10 +222,10 @@ static void tm2_free_codes(TM2Codes *code)
 ff_free_vlc(>vlc);
 }
 
-static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
+static inline int tm2_get_token(BitstreamContext *bc, TM2Codes *code)
 {
 int val;
-val = get_vlc2(gb, code->vlc.table, code->bits, 1);
+val = bitstream_read_vlc(bc, code->vlc.table, code->bits, 1);
 return code->recode[val];
 }
 
@@ -254,8 +254,8 @@ static int tm2_read_deltas(TM2Context *ctx, int stream_id)
 int d, mb;
 int i, v;
 
-d  = get_bits(>gb, 9);
-mb = get_bits(>gb, 5);
+d  = bitstream_read(>bc, 9);
+mb = bitstream_read(>bc, 5);
 
 if ((d < 1) || (d > TM2_DELTAS) || (mb < 1) || (mb > 32)) {
 av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect delta table: %i deltas x 
%i bits\n", d, mb);
@@ -263,7 +263,7 @@ static int tm2_read_deltas(TM2Context *ctx, int stream_id)
 }
 
 for (i = 0; i < d; i++) {
-v = get_bits_long(>gb, mb);
+v = bitstream_read(>bc, mb);
 if (v & (1 << (mb - 1)))
 ctx->deltas[stream_id][i] = v - (1 << mb);
 else
@@ -306,10 +306,10 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t 
*buf, int stream_id, i
 pos = bytestream2_tell();
 if (skip <= pos)
 return AVERROR_INVALIDDATA;
-init_get_bits(>gb, buf + pos, (skip - pos) * 8);
+bitstream_init(>bc, buf + pos, (skip - pos) * 8);
 if ((ret = tm2_read_deltas(ctx, stream_id)) < 0)
 return ret;
-bytestream2_skip(, ((get_bits_count(>gb) + 31) >> 5) << 2);
+bytestream2_skip(, ((bitstream_tell(>bc) + 31) >> 5) << 2);
 }
 }
 /* skip unused fields */
@@ -323,10 +323,10 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t 
*buf, int stream_id, i
 pos = bytestream2_tell();
 if (skip <= pos)
 return AVERROR_INVALIDDATA;
-init_get_bits(>gb, buf + pos, (skip - pos) * 8);
+bitstream_init(>bc, buf + pos, (skip - pos) * 8);
 if ((ret = tm2_build_huff_table(ctx, )) < 0)
 return ret;
-bytestream2_skip(, ((get_bits_count(>gb) + 31) >> 5) << 2);
+bytestream2_skip(, ((bitstream_tell(>bc) + 31) >> 5) << 2);
 
 toks >>= 1;
 /* check if we have sane number of tokens */
@@ -342,13 +342,13 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t 
*buf, int stream_id, i
 pos = bytestream2_tell();
 if (skip <= pos)
 return AVERROR_INVALIDDATA;
-init_get_bits(>gb, buf + pos, (skip - pos) * 8);
+bitstream_init(>bc, buf + pos, (skip - pos) * 8);
 for (i = 0; i < toks; 

[FFmpeg-cvslog] ra288: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 19:34:49 2016 +0200| [c60cda7cb476315fd7f6d28715316b1aff2e080a] | committer: 
Diego Biurrun

ra288: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c60cda7cb476315fd7f6d28715316b1aff2e080a
---

 libavcodec/ra288.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index 96d8d1e..bc3fe29 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -25,8 +25,8 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
+#include "bitstream.h"
 #include "celp_filters.h"
-#include "get_bits.h"
 #include "internal.h"
 #include "lpc.h"
 #include "ra288.h"
@@ -181,7 +181,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void 
*data,
 float *out;
 int i, ret;
 RA288Context *ractx = avctx->priv_data;
-GetBitContext gb;
+BitstreamContext bc;
 
 if (buf_size < avctx->block_align) {
 av_log(avctx, AV_LOG_ERROR,
@@ -198,11 +198,11 @@ static int ra288_decode_frame(AVCodecContext * avctx, 
void *data,
 }
 out = (float *)frame->data[0];
 
-init_get_bits(, buf, avctx->block_align * 8);
+bitstream_init(, buf, avctx->block_align * 8);
 
 for (i=0; i < RA288_BLOCKS_PER_FRAME; i++) {
-float gain = amptable[get_bits(, 3)];
-int cb_coef = get_bits(, 6 + (i&1));
+float gain = amptable[bitstream_read(, 3)];
+int cb_coef = bitstream_read(, 6 + (i & 1));
 
 decode(ractx, gain, cb_coef);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] smacker: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 19:56:53 2016 +0200| [6efbc88a5cf40c8e6f3c4f7897caf83165920d3b] | committer: 
Diego Biurrun

smacker: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6efbc88a5cf40c8e6f3c4f7897caf83165920d3b
---

 libavcodec/smacker.c | 143 +++
 1 file changed, 75 insertions(+), 68 deletions(-)

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index e3e5475..027728e 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -35,8 +35,8 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bytestream.h"
-#include "get_bits.h"
 #include "internal.h"
 #include "mathops.h"
 
@@ -93,9 +93,10 @@ enum SmkBlockTypes {
 /**
  * Decode local frame tree
  */
-static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t 
prefix, int length)
+static int smacker_decode_tree(BitstreamContext *bc, HuffContext *hc,
+   uint32_t prefix, int length)
 {
-if(!get_bits1(gb)){ //Leaf
+if (!bitstream_read_bit(bc)) { // Leaf
 if(hc->current >= 256){
 av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
 return -1;
@@ -107,7 +108,7 @@ static int smacker_decode_tree(GetBitContext *gb, 
HuffContext *hc, uint32_t pref
 hc->bits[hc->current] = 0;
 hc->lengths[hc->current] = 0;
 }
-hc->values[hc->current] = get_bits(gb, 8);
+hc->values[hc->current] = bitstream_read(bc, 8);
 hc->current++;
 if(hc->maxlength < length)
 hc->maxlength = length;
@@ -115,26 +116,27 @@ static int smacker_decode_tree(GetBitContext *gb, 
HuffContext *hc, uint32_t pref
 } else { //Node
 int r;
 length++;
-r = smacker_decode_tree(gb, hc, prefix, length);
+r = smacker_decode_tree(bc, hc, prefix, length);
 if(r)
 return r;
-return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), 
length);
+return smacker_decode_tree(bc, hc, prefix | (1 << (length - 1)), 
length);
 }
 }
 
 /**
  * Decode header tree
  */
-static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx 
*ctx)
+static int smacker_decode_bigtree(BitstreamContext *bc, HuffContext *hc,
+  DBCtx *ctx)
 {
 if (hc->current + 1 >= hc->length) {
 av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
 return -1;
 }
-if(!get_bits1(gb)){ //Leaf
+if (!bitstream_read_bit(bc)) { // Leaf
 int val, i1, i2;
-i1 = ctx->v1->table ? get_vlc2(gb, ctx->v1->table, SMKTREE_BITS, 3) : 
0;
-i2 = ctx->v2->table ? get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3) : 
0;
+i1 = ctx->v1->table ? bitstream_read_vlc(bc, ctx->v1->table, 
SMKTREE_BITS, 3) : 0;
+i2 = ctx->v2->table ? bitstream_read_vlc(bc, ctx->v2->table, 
SMKTREE_BITS, 3) : 0;
 if (i1 < 0 || i2 < 0)
 return -1;
 val = ctx->recode1[i1] | (ctx->recode2[i2] << 8);
@@ -155,12 +157,12 @@ static int smacker_decode_bigtree(GetBitContext *gb, 
HuffContext *hc, DBCtx *ctx
 int r = 0, r_new, t;
 
 t = hc->current++;
-r = smacker_decode_bigtree(gb, hc, ctx);
+r = smacker_decode_bigtree(bc, hc, ctx);
 if(r < 0)
 return r;
 hc->values[t] = SMK_NODE | r;
 r++;
-r_new = smacker_decode_bigtree(gb, hc, ctx);
+r_new = smacker_decode_bigtree(bc, hc, ctx);
 if (r_new < 0)
 return r_new;
 return r + r_new;
@@ -170,7 +172,8 @@ static int smacker_decode_bigtree(GetBitContext *gb, 
HuffContext *hc, DBCtx *ctx
 /**
  * Store large tree as Libav's vlc codes
  */
-static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, 
int **recodes, int *last, int size)
+static int smacker_decode_header_tree(SmackVContext *smk, BitstreamContext *bc,
+  int **recodes, int *last, int size)
 {
 int res;
 HuffContext huff;
@@ -204,9 +207,9 @@ static int smacker_decode_header_tree(SmackVContext *smk, 
GetBitContext *gb, int
 goto error;
 }
 
-if(get_bits1(gb)) {
-smacker_decode_tree(gb, , 0, 0);
-skip_bits1(gb);
+if (bitstream_read_bit(bc)) {
+smacker_decode_tree(bc, , 0, 0);
+bitstream_skip(bc, 1);
 res = init_vlc([0], SMKTREE_BITS, tmp1.length,
 tmp1.lengths, sizeof(int), sizeof(int),
 tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), 
INIT_VLC_LE);
@@ -218,9 +221,9 @@ static int smacker_decode_header_tree(SmackVContext *smk, 
GetBitContext *gb, int
 } else {
 av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n");
 }
-if(get_bits1(gb)){
-smacker_decode_tree(gb, , 0, 0);
-skip_bits1(gb);
+if (bitstream_read_bit(bc)) 

[FFmpeg-cvslog] utvideodec: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 11:07:15 2016 +0200| [104a4289f925c600c13035de6c282fe656510a27] | committer: 
Diego Biurrun

utvideodec: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=104a4289f925c600c13035de6c282fe656510a27
---

 libavcodec/utvideodec.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 3a58156..29de815 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -28,10 +28,11 @@
 #include 
 
 #include "libavutil/intreadwrite.h"
+
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bswapdsp.h"
 #include "bytestream.h"
-#include "get_bits.h"
 #include "thread.h"
 #include "utvideo.h"
 
@@ -85,7 +86,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
 int i, j, slice, pix;
 int sstart, send;
 VLC vlc;
-GetBitContext gb;
+BitstreamContext bc;
 int prev, fsym;
 const int cmask = ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
 
@@ -146,17 +147,17 @@ static int decode_plane(UtvideoContext *c, int plane_no,
 c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
   (uint32_t *) c->slice_bits,
   (slice_data_end - slice_data_start + 3) >> 2);
-init_get_bits(, c->slice_bits, slice_size * 8);
+bitstream_init(, c->slice_bits, slice_size * 8);
 
 prev = 0x80;
 for (j = sstart; j < send; j++) {
 for (i = 0; i < width * step; i += step) {
-if (get_bits_left() <= 0) {
+if (bitstream_bits_left() <= 0) {
 av_log(c->avctx, AV_LOG_ERROR,
"Slice decoding ran out of bits\n");
 goto fail;
 }
-pix = get_vlc2(, vlc.table, vlc.bits, 4);
+pix = bitstream_read_vlc(, vlc.table, vlc.bits, 4);
 if (pix < 0) {
 av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
 goto fail;
@@ -169,9 +170,9 @@ static int decode_plane(UtvideoContext *c, int plane_no,
 }
 dest += stride;
 }
-if (get_bits_left() > 32)
+if (bitstream_bits_left() > 32)
 av_log(c->avctx, AV_LOG_WARNING,
-   "%d bits left after decoding slice\n", get_bits_left());
+   "%d bits left after decoding slice\n", 
bitstream_bits_left());
 }
 
 ff_free_vlc();

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] rtjpeg: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 19:41:09 2016 +0200| [f26cbb555b9547b7a532c7a0d883579a52815b1d] | committer: 
Diego Biurrun

rtjpeg: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f26cbb555b9547b7a532c7a0d883579a52815b1d
---

 libavcodec/rtjpeg.c | 42 +++---
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c
index 67eeff8..baa1f78 100644
--- a/libavcodec/rtjpeg.c
+++ b/libavcodec/rtjpeg.c
@@ -18,8 +18,10 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
 #include "libavutil/common.h"
-#include "get_bits.h"
+
+#include "bitstream.h"
 #include "rtjpeg.h"
 
 #define PUT_COEFF(c) \
@@ -28,34 +30,36 @@
 
 /// aligns the bitstream to the given power of two
 #define ALIGN(a) \
-n = (-get_bits_count(gb)) & (a - 1); \
-if (n) {skip_bits(gb, n);}
+n = (-bitstream_tell(bc)) & (a - 1); \
+if (n)   \
+bitstream_skip(bc, n);
 
 /**
  * @brief read one block from stream
- * @param gb contains stream data
+ * @param bc contains stream data
  * @param block where data is written to
  * @param scan array containing the mapping stream address -> block position
  * @param quant quantization factors
  * @return 0 means the block is not coded, < 0 means an error occurred.
  *
- * Note: GetBitContext is used to make the code simpler, since all data is
+ * Note: BitstreamContext is used to make the code simpler, since all data is
  * aligned this could be done faster in a different way, e.g. as it is done
  * in MPlayer libmpcodecs/native/rtjpegn.c.
  */
-static inline int get_block(GetBitContext *gb, int16_t *block, const uint8_t 
*scan,
-const uint32_t *quant) {
+static inline int get_block(BitstreamContext *bc, int16_t *block,
+const uint8_t *scan, const uint32_t *quant)
+{
 int coeff, i, n;
 int8_t ac;
-uint8_t dc = get_bits(gb, 8);
+uint8_t dc = bitstream_read(bc, 8);
 
 // block not coded
 if (dc == 255)
return 0;
 
 // number of non-zero coefficients
-coeff = get_bits(gb, 6);
-if (get_bits_left(gb) < (coeff << 1))
+coeff = bitstream_read(bc, 6);
+if (bitstream_bits_left(bc) < (coeff << 1))
 return AVERROR_INVALIDDATA;
 
 // normally we would only need to clear the (63 - coeff) last values,
@@ -64,7 +68,7 @@ static inline int get_block(GetBitContext *gb, int16_t 
*block, const uint8_t *sc
 
 // 2 bits per coefficient
 while (coeff) {
-ac = get_sbits(gb, 2);
+ac = bitstream_read_signed(bc, 2);
 if (ac == -2)
 break; // continue with more bits
 PUT_COEFF(ac);
@@ -72,10 +76,10 @@ static inline int get_block(GetBitContext *gb, int16_t 
*block, const uint8_t *sc
 
 // 4 bits per coefficient
 ALIGN(4);
-if (get_bits_left(gb) < (coeff << 2))
+if (bitstream_bits_left(bc) < (coeff << 2))
 return AVERROR_INVALIDDATA;
 while (coeff) {
-ac = get_sbits(gb, 4);
+ac = bitstream_read_signed(bc, 4);
 if (ac == -8)
 break; // continue with more bits
 PUT_COEFF(ac);
@@ -83,10 +87,10 @@ static inline int get_block(GetBitContext *gb, int16_t 
*block, const uint8_t *sc
 
 // 8 bits per coefficient
 ALIGN(8);
-if (get_bits_left(gb) < (coeff << 3))
+if (bitstream_bits_left(bc) < (coeff << 3))
 return AVERROR_INVALIDDATA;
 while (coeff) {
-ac = get_sbits(gb, 8);
+ac = bitstream_read_signed(bc, 8);
 PUT_COEFF(ac);
 }
 
@@ -105,19 +109,19 @@ static inline int get_block(GetBitContext *gb, int16_t 
*block, const uint8_t *sc
  */
 int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
   const uint8_t *buf, int buf_size) {
-GetBitContext gb;
+BitstreamContext bc;
 int w = c->w / 16, h = c->h / 16;
 int x, y, ret;
 uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0];
 uint8_t *u = f->data[1], *v = f->data[2];
 
-if ((ret = init_get_bits8(, buf, buf_size)) < 0)
+if ((ret = bitstream_init8(, buf, buf_size)) < 0)
 return ret;
 
 for (y = 0; y < h; y++) {
 for (x = 0; x < w; x++) {
 #define BLOCK(quant, dst, stride) do { \
-int res = get_block(, block, c->scan, quant); \
+int res = get_block(, block, c->scan, quant); \
 if (res < 0) \
 return res; \
 if (res > 0) \
@@ -142,7 +146,7 @@ int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame 
*f,
 u += 8 * (f->linesize[1] - w);
 v += 8 * (f->linesize[2] - w);
 }
-return get_bits_count() / 8;
+return bitstream_tell() / 8;
 }
 
 /**

___
ffmpeg-cvslog mailing list

[FFmpeg-cvslog] ra144: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 11:53:47 2016 +0200| [7d8075cf471459dee372595c74b7f28cb4e9a05d] | committer: 
Diego Biurrun

ra144: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d8075cf471459dee372595c74b7f28cb4e9a05d
---

 libavcodec/ra144dec.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c
index 2895357..35ee697 100644
--- a/libavcodec/ra144dec.c
+++ b/libavcodec/ra144dec.c
@@ -23,8 +23,9 @@
  */
 
 #include "libavutil/channel_layout.h"
+
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 #include "ra144.h"
 
@@ -46,12 +47,12 @@ static av_cold int ra144_decode_init(AVCodecContext * avctx)
 }
 
 static void do_output_subblock(RA144Context *ractx, const uint16_t  *lpc_coefs,
-   int gval, GetBitContext *gb)
+   int gval, BitstreamContext *bc)
 {
-int cba_idx = get_bits(gb, 7); // index of the adaptive CB, 0 if none
-int gain= get_bits(gb, 8);
-int cb1_idx = get_bits(gb, 7);
-int cb2_idx = get_bits(gb, 7);
+int cba_idx = bitstream_read(bc, 7); // index of the adaptive CB, 0 if none
+int gain= bitstream_read(bc, 8);
+int cb1_idx = bitstream_read(bc, 7);
+int cb2_idx = bitstream_read(bc, 7);
 
 ff_subblock_synthesis(ractx, lpc_coefs, cba_idx, cb1_idx, cb2_idx, gval,
   gain);
@@ -74,7 +75,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void 
*data,
 unsigned int energy;
 
 RA144Context *ractx = avctx->priv_data;
-GetBitContext gb;
+BitstreamContext bc;
 
 if (buf_size < FRAMESIZE) {
 av_log(avctx, AV_LOG_ERROR,
@@ -91,15 +92,15 @@ static int ra144_decode_frame(AVCodecContext * avctx, void 
*data,
 }
 samples = (int16_t *)frame->data[0];
 
-init_get_bits(, buf, FRAMESIZE * 8);
+bitstream_init(, buf, FRAMESIZE * 8);
 
 for (i = 0; i < LPC_ORDER; i++)
-lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(, sizes[i])];
+lpc_refl[i] = ff_lpc_refl_cb[i][bitstream_read(, sizes[i])];
 
 ff_eval_coefs(ractx->lpc_coef[0], lpc_refl);
 ractx->lpc_refl_rms[0] = ff_rms(lpc_refl);
 
-energy = ff_energy_tab[get_bits(, 5)];
+energy = ff_energy_tab[bitstream_read(, 5)];
 
 refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
 refl_rms[1] = ff_interp(ractx, block_coefs[1], 2,
@@ -111,7 +112,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void 
*data,
 ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
 
 for (i=0; i < NBLOCKS; i++) {
-do_output_subblock(ractx, block_coefs[i], refl_rms[i], );
+do_output_subblock(ractx, block_coefs[i], refl_rms[i], );
 
 for (j=0; j < BLOCKSIZE; j++)
 *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] ogg: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Apr 
16 17:51:16 2016 +0200| [2cef81a87cd88cf7904ef815ee109e3611fe3fa4] | committer: 
Diego Biurrun

ogg: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cef81a87cd88cf7904ef815ee109e3611fe3fa4
---

 libavformat/oggparseflac.c   | 22 --
 libavformat/oggparsetheora.c | 39 +--
 2 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index dab1040..90b1495 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -19,8 +19,10 @@
  */
 
 #include 
-#include "libavcodec/get_bits.h"
+
+#include "libavcodec/bitstream.h"
 #include "libavcodec/flac.h"
+
 #include "avformat.h"
 #include "internal.h"
 #include "oggdec.h"
@@ -33,28 +35,28 @@ flac_header (AVFormatContext * s, int idx)
 struct ogg *ogg = s->priv_data;
 struct ogg_stream *os = ogg->streams + idx;
 AVStream *st = s->streams[idx];
-GetBitContext gb;
+BitstreamContext bc;
 int mdt;
 
 if (os->buf[os->pstart] == 0xff)
 return 0;
 
-init_get_bits(, os->buf + os->pstart, os->psize*8);
-skip_bits1(); /* metadata_last */
-mdt = get_bits(, 7);
+bitstream_init(, os->buf + os->pstart, os->psize * 8);
+bitstream_skip(, 1); /* metadata_last */
+mdt = bitstream_read(, 7);
 
 if (mdt == OGG_FLAC_METADATA_TYPE_STREAMINFO) {
 uint8_t *streaminfo_start = os->buf + os->pstart + 5 + 4 + 4 + 4;
 uint32_t samplerate;
 
-skip_bits_long(, 4*8); /* "FLAC" */
-if(get_bits(, 8) != 1) /* unsupported major version */
+bitstream_skip(, 4 * 8); /* "FLAC" */
+if (bitstream_read(, 8) != 1) /* unsupported major version */
 return -1;
-skip_bits_long(, 8 + 16); /* minor version + header count */
-skip_bits_long(, 4*8); /* "fLaC" */
+bitstream_skip(, 8 + 16); /* minor version + header count */
+bitstream_skip(, 4 * 8); /* "fLaC" */
 
 /* METADATA_BLOCK_HEADER */
-if (get_bits_long(, 32) != FLAC_STREAMINFO_SIZE)
+if (bitstream_read(, 32) != FLAC_STREAMINFO_SIZE)
 return -1;
 
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 1e7a776..da47a0c 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -23,8 +23,11 @@
  **/
 
 #include 
+
 #include "libavutil/bswap.h"
-#include "libavcodec/get_bits.h"
+
+#include "libavcodec/bitstream.h"
+
 #include "avformat.h"
 #include "internal.h"
 #include "oggdec.h"
@@ -57,41 +60,41 @@ static int theora_header(AVFormatContext *s, int idx)
 
 switch (os->buf[os->pstart]) {
 case 0x80: {
-GetBitContext gb;
+BitstreamContext bc;
 AVRational timebase;
 
-init_get_bits(, os->buf + os->pstart, os->psize * 8);
+bitstream_init(, os->buf + os->pstart, os->psize * 8);
 
 /* 0x80"theora" */
-skip_bits_long(, 7 * 8);
+bitstream_skip(, 7 * 8);
 
-thp->version = get_bits_long(, 24);
+thp->version = bitstream_read(, 24);
 if (thp->version < 0x030100) {
 av_log(s, AV_LOG_ERROR,
"Too old or unsupported Theora (%x)\n", thp->version);
 return AVERROR(ENOSYS);
 }
 
-st->codecpar->width  = get_bits(, 16) << 4;
-st->codecpar->height = get_bits(, 16) << 4;
+st->codecpar->width  = bitstream_read(, 16) << 4;
+st->codecpar->height = bitstream_read(, 16) << 4;
 
 if (thp->version >= 0x030400)
-skip_bits(, 100);
+bitstream_skip(, 100);
 
 if (thp->version >= 0x030200) {
-int width  = get_bits_long(, 24);
-int height = get_bits_long(, 24);
+int width  = bitstream_read(, 24);
+int height = bitstream_read(, 24);
 if (width  <= st->codecpar->width  && width  > st->codecpar->width 
 - 16 &&
 height <= st->codecpar->height && height > 
st->codecpar->height - 16) {
 st->codecpar->width  = width;
 st->codecpar->height = height;
 }
 
-skip_bits(, 16);
+bitstream_skip(, 16);
 }
 
-timebase.den = get_bits_long(, 32);
-timebase.num = get_bits_long(, 32);
+timebase.den = bitstream_read(, 32);
+timebase.num = bitstream_read(, 32);
 if (!(timebase.num > 0 && timebase.den > 0)) {
 av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, 
assuming 25 FPS\n");
 timebase.num = 1;
@@ -99,15 +102,15 @@ static int theora_header(AVFormatContext *s, int idx)
 }
 avpriv_set_pts_info(st, 64, timebase.num, timebase.den);
 
-st->sample_aspect_ratio.num = get_bits_long(, 24);
-

[FFmpeg-cvslog] tscc2: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 10:42:27 2016 +0200| [0bea79afa6cc71e38d58350d05cdeb33e97f6234] | committer: 
Diego Biurrun

tscc2: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bea79afa6cc71e38d58350d05cdeb33e97f6234
---

 libavcodec/tscc2.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index d3d45e4..d86428a 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -28,8 +28,8 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bytestream.h"
-#include "get_bits.h"
 #include "internal.h"
 #include "mathops.h"
 #include "tscc2data.h"
@@ -41,7 +41,7 @@ typedef struct TSCC2Context {
 uint8_t*slice_quants;
 intquant[2];
 intq[2][3];
-GetBitContext  gb;
+BitstreamContext bc;
 
 VLCdc_vlc, nc_vlc[NUM_VLC_SETS], ac_vlc[NUM_VLC_SETS];
 intblock[16];
@@ -127,21 +127,21 @@ static void tscc2_idct4_put(int *in, int q[3], uint8_t 
*dst, int stride)
 static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set,
uint8_t *dst, int stride, int plane)
 {
-GetBitContext *gb = >gb;
+BitstreamContext *bc = >bc;
 int prev_dc, dc, nc, ac, bpos, val;
 int i, j, k, l;
 
-if (get_bits1(gb)) {
-if (get_bits1(gb)) {
-val = get_bits(gb, 8);
+if (bitstream_read_bit(bc)) {
+if (bitstream_read_bit(bc)) {
+val = bitstream_read(bc, 8);
 for (i = 0; i < 8; i++, dst += stride)
 memset(dst, val, 16);
 } else {
-if (get_bits_left(gb) < 16 * 8 * 8)
+if (bitstream_bits_left(bc) < 16 * 8 * 8)
 return AVERROR_INVALIDDATA;
 for (i = 0; i < 8; i++) {
 for (j = 0; j < 16; j++)
-dst[j] = get_bits(gb, 8);
+dst[j] = bitstream_read(bc, 8);
 dst += stride;
 }
 }
@@ -152,30 +152,30 @@ static int tscc2_decode_mb(TSCC2Context *c, int *q, int 
vlc_set,
 for (j = 0; j < 2; j++) {
 for (k = 0; k < 4; k++) {
 if (!(j | k)) {
-dc = get_bits(gb, 8);
+dc = bitstream_read(bc, 8);
 } else {
-dc = get_vlc2(gb, c->dc_vlc.table, 9, 2);
+dc = bitstream_read_vlc(bc, c->dc_vlc.table, 9, 2);
 if (dc == -1)
 return AVERROR_INVALIDDATA;
 if (dc == 0x100)
-dc = get_bits(gb, 8);
+dc = bitstream_read(bc, 8);
 }
 dc  = (dc + prev_dc) & 0xFF;
 prev_dc = dc;
 c->block[0] = dc;
 
-nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1);
+nc = bitstream_read_vlc(bc, c->nc_vlc[vlc_set].table, 9, 1);
 if (nc == -1)
 return AVERROR_INVALIDDATA;
 
 bpos = 1;
 memset(c->block + 1, 0, 15 * sizeof(*c->block));
 for (l = 0; l < nc; l++) {
-ac = get_vlc2(gb, c->ac_vlc[vlc_set].table, 9, 2);
+ac = bitstream_read_vlc(bc, c->ac_vlc[vlc_set].table, 9, 2);
 if (ac == -1)
 return AVERROR_INVALIDDATA;
 if (ac == 0x1000)
-ac = get_bits(gb, 12);
+ac = bitstream_read(bc, 12);
 bpos += ac & 0xF;
 if (bpos >= 16)
 return AVERROR_INVALIDDATA;
@@ -195,7 +195,7 @@ static int tscc2_decode_slice(TSCC2Context *c, int mb_y,
 int i, mb_x, q, ret;
 int off;
 
-init_get_bits(>gb, buf, buf_size * 8);
+bitstream_init(>bc, buf, buf_size * 8);
 
 for (mb_x = 0; mb_x < c->mb_width; mb_x++) {
 q = c->slice_quants[mb_x + c->mb_width * mb_y];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tiertex: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Apr 
23 15:13:41 2016 +0200| [0ac07d0b8d75cce10a139c868d415284a9d2ca48] | committer: 
Diego Biurrun

tiertex: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ac07d0b8d75cce10a139c868d415284a9d2ca48
---

 libavcodec/tiertexseqv.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
index 8ca7edf..d952266 100644
--- a/libavcodec/tiertexseqv.c
+++ b/libavcodec/tiertexseqv.c
@@ -26,7 +26,7 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 
 
@@ -41,18 +41,18 @@ static const unsigned char *seq_unpack_rle_block(const 
unsigned char *src,
  unsigned char *dst, int 
dst_size)
 {
 int i, len, sz;
-GetBitContext gb;
+BitstreamContext bc;
 int code_table[64];
 
 /* get the rle codes */
-init_get_bits(, src, (src_end - src) * 8);
+bitstream_init(, src, (src_end - src) * 8);
 for (i = 0, sz = 0; i < 64 && sz < dst_size; i++) {
-if (get_bits_left() < 4)
+if (bitstream_bits_left() < 4)
 return NULL;
-code_table[i] = get_sbits(, 4);
+code_table[i] = bitstream_read_signed(, 4);
 sz += FFABS(code_table[i]);
 }
-src += (get_bits_count() + 7) / 8;
+src += (bitstream_tell() + 7) / 8;
 
 /* do the rle unpacking */
 for (i = 0; i < 64 && dst_size > 0; i++) {
@@ -81,7 +81,7 @@ static const unsigned char *seq_decode_op1(SeqVideoContext 
*seq,
 {
 const unsigned char *color_table;
 int b, i, len, bits;
-GetBitContext gb;
+BitstreamContext bc;
 unsigned char block[8 * 8];
 
 if (src_end - src < 1)
@@ -113,10 +113,11 @@ static const unsigned char 
*seq_decode_op1(SeqVideoContext *seq,
 return NULL;
 color_table = src;
 src += len;
-init_get_bits(, src, bits * 8 * 8); src += bits * 8;
+bitstream_init(, src, bits * 8 * 8);
+src += bits * 8;
 for (b = 0; b < 8; b++) {
 for (i = 0; i < 8; i++)
-dst[i] = color_table[get_bits(, bits)];
+dst[i] = color_table[bitstream_read(, bits)];
 dst += seq->frame->linesize[0];
 }
 }
@@ -164,7 +165,7 @@ static const unsigned char *seq_decode_op3(SeqVideoContext 
*seq,
 static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, 
int data_size)
 {
 const unsigned char *data_end = data + data_size;
-GetBitContext gb;
+BitstreamContext bc;
 int flags, i, j, x, y, op;
 unsigned char c[3];
 unsigned char *dst;
@@ -187,11 +188,12 @@ static int seqvideo_decode(SeqVideoContext *seq, const 
unsigned char *data, int
 if (flags & 2) {
 if (data_end - data < 128)
 return AVERROR_INVALIDDATA;
-init_get_bits(, data, 128 * 8); data += 128;
+bitstream_init(, data, 128 * 8);
+data += 128;
 for (y = 0; y < 128; y += 8)
 for (x = 0; x < 256; x += 8) {
 dst = >frame->data[0][y * seq->frame->linesize[0] + x];
-op = get_bits(, 2);
+op = bitstream_read(, 2);
 switch (op) {
 case 1:
 data = seq_decode_op1(seq, data, data_end, dst);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] twinvq: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 10:59:22 2016 +0200| [85f760fedd49816f3a197da22f4c8e33d1b3dda7] | committer: 
Diego Biurrun

twinvq: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85f760fedd49816f3a197da22f4c8e33d1b3dda7
---

 libavcodec/twinvq_data.h |  2 +-
 libavcodec/twinvqdec.c   | 42 +-
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/libavcodec/twinvq_data.h b/libavcodec/twinvq_data.h
index 01a54a5..cc7ba59 100644
--- a/libavcodec/twinvq_data.h
+++ b/libavcodec/twinvq_data.h
@@ -130,7 +130,7 @@ static const uint16_t bark_tab_s44_128[] = {
 /**
  * TwinVQ codebooks. They are coded in a struct so we can use code such as
  *
- * float val = tab.fcb0808l[get_bits(gb, 12)];
+ * float val = tab.fcb0808l[bitstream_read(bc, 12)];
  *
  * without risking a segfault on malformed files.
  */
diff --git a/libavcodec/twinvqdec.c b/libavcodec/twinvqdec.c
index 56df105..6355ad4 100644
--- a/libavcodec/twinvqdec.c
+++ b/libavcodec/twinvqdec.c
@@ -23,8 +23,9 @@
 #include 
 
 #include "libavutil/channel_layout.h"
+
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 #include "twinvq.h"
 #include "twinvq_data.h"
@@ -235,7 +236,7 @@ static void dec_bark_env(TwinVQContext *tctx, const uint8_t 
*in, int use_hist,
 }
 }
 
-static void read_cb_data(TwinVQContext *tctx, GetBitContext *gb,
+static void read_cb_data(TwinVQContext *tctx, BitstreamContext *bc,
  uint8_t *dst, enum TwinVQFrameType ftype)
 {
 int i;
@@ -243,8 +244,8 @@ static void read_cb_data(TwinVQContext *tctx, GetBitContext 
*gb,
 for (i = 0; i < tctx->n_div[ftype]; i++) {
 int bs_second_part = (i >= tctx->bits_main_spec_change[ftype]);
 
-*dst++ = get_bits(gb, tctx->bits_main_spec[0][ftype][bs_second_part]);
-*dst++ = get_bits(gb, tctx->bits_main_spec[1][ftype][bs_second_part]);
+*dst++ = bitstream_read(bc, 
tctx->bits_main_spec[0][ftype][bs_second_part]);
+*dst++ = bitstream_read(bc, 
tctx->bits_main_spec[1][ftype][bs_second_part]);
 }
 }
 
@@ -255,13 +256,13 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, 
TwinVQContext *tctx,
 const TwinVQModeTab *mtab = tctx->mtab;
 int channels  = tctx->avctx->channels;
 int sub;
-GetBitContext gb;
+BitstreamContext bc;
 int i, j, k;
 
-init_get_bits(, buf, buf_size * 8);
-skip_bits(, get_bits(, 8));
+bitstream_init(, buf, buf_size * 8);
+bitstream_skip(, bitstream_read(, 8));
 
-bits->window_type = get_bits(, TWINVQ_WINDOW_TYPE_BITS);
+bits->window_type = bitstream_read(, TWINVQ_WINDOW_TYPE_BITS);
 
 if (bits->window_type > 8) {
 av_log(avctx, AV_LOG_ERROR, "Invalid window type, broken sample?\n");
@@ -272,43 +273,42 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, 
TwinVQContext *tctx,
 
 sub = mtab->fmode[bits->ftype].sub;
 
-read_cb_data(tctx, , bits->main_coeffs, bits->ftype);
+read_cb_data(tctx, , bits->main_coeffs, bits->ftype);
 
 for (i = 0; i < channels; i++)
 for (j = 0; j < sub; j++)
 for (k = 0; k < mtab->fmode[bits->ftype].bark_n_coef; k++)
 bits->bark1[i][j][k] =
-get_bits(, mtab->fmode[bits->ftype].bark_n_bit);
+bitstream_read(, mtab->fmode[bits->ftype].bark_n_bit);
 
 for (i = 0; i < channels; i++)
 for (j = 0; j < sub; j++)
-bits->bark_use_hist[i][j] = get_bits1();
+bits->bark_use_hist[i][j] = bitstream_read_bit();
 
 if (bits->ftype == TWINVQ_FT_LONG) {
 for (i = 0; i < channels; i++)
-bits->gain_bits[i] = get_bits(, TWINVQ_GAIN_BITS);
+bits->gain_bits[i] = bitstream_read(, TWINVQ_GAIN_BITS);
 } else {
 for (i = 0; i < channels; i++) {
-bits->gain_bits[i] = get_bits(, TWINVQ_GAIN_BITS);
+bits->gain_bits[i] = bitstream_read(, TWINVQ_GAIN_BITS);
 for (j = 0; j < sub; j++)
-bits->sub_gain_bits[i * sub + j] = get_bits(,
-   TWINVQ_SUB_GAIN_BITS);
+bits->sub_gain_bits[i * sub + j] = bitstream_read(, 
TWINVQ_SUB_GAIN_BITS);
 }
 }
 
 for (i = 0; i < channels; i++) {
-bits->lpc_hist_idx[i] = get_bits(, mtab->lsp_bit0);
-bits->lpc_idx1[i] = get_bits(, mtab->lsp_bit1);
+bits->lpc_hist_idx[i] = bitstream_read(, mtab->lsp_bit0);
+bits->lpc_idx1[i] = bitstream_read(, mtab->lsp_bit1);
 
 for (j = 0; j < mtab->lsp_split; j++)
-bits->lpc_idx2[i][j] = get_bits(, mtab->lsp_bit2);
+bits->lpc_idx2[i][j] = bitstream_read(, mtab->lsp_bit2);
 }
 
 if (bits->ftype == TWINVQ_FT_LONG) {
-read_cb_data(tctx, , bits->ppc_coeffs, 3);
+read_cb_data(tctx, , 

[FFmpeg-cvslog] Merge commit '2dbe2aa2c2d4f02d2669feae45dee4fc45414813'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:51:14 
2017 -0300| [7c5adf6c88dd89e716dec33d97ef63530a9ce05f] | committer: James Almer

Merge commit '2dbe2aa2c2d4f02d2669feae45dee4fc45414813'

* commit '2dbe2aa2c2d4f02d2669feae45dee4fc45414813':
  rdt: Convert to the new bitstream reader
  ogg: Convert to the new bitstream reader
  mpegts: Convert to the new bitstream reader
  xsubdec: Convert to the new bitstream reader
  xan: Convert to the new bitstream reader
  wnv1: Convert to the new bitstream reader
  vima: Convert to the new bitstream reader
  vble: Convert to the new bitstream reader
  utvideodec: Convert to the new bitstream reader
  twinvq: Convert to the new bitstream reader
  tscc2: Convert to the new bitstream reader
  truespeech: Convert to the new bitstream reader
  tiertex: Convert to the new bitstream reader
  truemotion2: Convert to the new bitstream reader
  svq1dec: Convert to the new bitstream reader
  smacker: Convert to the new bitstream reader
  sipr: Convert to the new bitstream reader
  rtjpeg: Convert to the new bitstream reader
  ra288: Convert to the new bitstream reader
  ra144: Convert to the new bitstream reader

This merge is a noop, see
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209609.html

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c5adf6c88dd89e716dec33d97ef63530a9ce05f
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] xan: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Fri Apr 
15 10:57:22 2016 +0200| [be35ef92a418916f0fceaf18af5f5b768c44117f] | committer: 
Diego Biurrun

xan: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be35ef92a418916f0fceaf18af5f5b768c44117f
---

 libavcodec/xan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index c16c651..33149e5 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -37,8 +37,8 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bytestream.h"
-#include "get_bits.h"
 #include "internal.h"
 
 #define RUNTIME_GAMMA 0
@@ -124,15 +124,15 @@ static int xan_huffman_decode(unsigned char *dest, int 
dest_len,
 unsigned char val = ival;
 unsigned char *dest_end = dest + dest_len;
 unsigned char *dest_start = dest;
-GetBitContext gb;
+BitstreamContext bc;
 
 if (ptr_len < 0)
 return AVERROR_INVALIDDATA;
 
-init_get_bits(, ptr, ptr_len * 8);
+bitstream_init(, ptr, ptr_len * 8);
 
 while (val != 0x16) {
-unsigned idx = val - 0x17 + get_bits1() * byte;
+unsigned idx = val - 0x17 + bitstream_read_bit() * byte;
 if (idx >= 2 * byte)
 return AVERROR_INVALIDDATA;
 val = src[idx];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] wnv1: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Fri Apr 
15 10:50:38 2016 +0200| [f9c59f26c852cec4dd7e5c04d26ec284a796a919] | committer: 
Diego Biurrun

wnv1: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9c59f26c852cec4dd7e5c04d26ec284a796a919
---

 libavcodec/wnv1.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index d0304c9..80d66ae 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -25,7 +25,7 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 #include "mathops.h"
 
@@ -34,7 +34,7 @@ typedef struct WNV1Context {
 AVCodecContext *avctx;
 
 int shift;
-GetBitContext gb;
+BitstreamContext bc;
 } WNV1Context;
 
 static const uint16_t code_tab[16][2] = {
@@ -49,10 +49,10 @@ static VLC code_vlc;
 /* returns modified base_value */
 static inline int wnv1_get_code(WNV1Context *w, int base_value)
 {
-int v = get_vlc2(>gb, code_vlc.table, CODE_VLC_BITS, 1);
+int v = bitstream_read_vlc(>bc, code_vlc.table, CODE_VLC_BITS, 1);
 
 if (v == 15)
-return ff_reverse[get_bits(>gb, 8 - w->shift)];
+return ff_reverse[bitstream_read(>bc, 8 - w->shift)];
 else
 return base_value + ((v - 7) << w->shift);
 }
@@ -90,7 +90,7 @@ static int decode_frame(AVCodecContext *avctx,
 
 for (i = 8; i < buf_size; i++)
 rbuf[i] = ff_reverse[buf[i]];
-init_get_bits(>gb, rbuf + 8, (buf_size - 8) * 8);
+bitstream_init(>bc, rbuf + 8, (buf_size - 8) * 8);
 
 if (buf[2] >> 4 == 6)
 l->shift = 2;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] truespeech: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 10:32:31 2016 +0200| [8e4cadea5d20e463e9d6cf00fc58841f17c811e0] | committer: 
Diego Biurrun

truespeech: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e4cadea5d20e463e9d6cf00fc58841f17c811e0
---

 libavcodec/truespeech.c | 88 +
 1 file changed, 45 insertions(+), 43 deletions(-)

diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index b2195ba..48e2126 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -21,12 +21,14 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
+
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bswapdsp.h"
-#include "get_bits.h"
 #include "internal.h"
 
 #include "truespeech_data.h"
+
 /**
  * @file
  * TrueSpeech decoder.
@@ -77,50 +79,50 @@ static av_cold int truespeech_decode_init(AVCodecContext * 
avctx)
 
 static void truespeech_read_frame(TSContext *dec, const uint8_t *input)
 {
-GetBitContext gb;
+BitstreamContext bc;
 
 dec->bdsp.bswap_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8);
-init_get_bits(, dec->buffer, 32 * 8);
-
-dec->vector[7] = ts_codebook[7][get_bits(, 3)];
-dec->vector[6] = ts_codebook[6][get_bits(, 3)];
-dec->vector[5] = ts_codebook[5][get_bits(, 3)];
-dec->vector[4] = ts_codebook[4][get_bits(, 4)];
-dec->vector[3] = ts_codebook[3][get_bits(, 4)];
-dec->vector[2] = ts_codebook[2][get_bits(, 4)];
-dec->vector[1] = ts_codebook[1][get_bits(, 5)];
-dec->vector[0] = ts_codebook[0][get_bits(, 5)];
-dec->flag  = get_bits1();
-
-dec->offset1[0] = get_bits(, 4) << 4;
-dec->offset2[3] = get_bits(, 7);
-dec->offset2[2] = get_bits(, 7);
-dec->offset2[1] = get_bits(, 7);
-dec->offset2[0] = get_bits(, 7);
-
-dec->offset1[1]  = get_bits(, 4);
-dec->pulseval[1] = get_bits(, 14);
-dec->pulseval[0] = get_bits(, 14);
-
-dec->offset1[1] |= get_bits(, 4) << 4;
-dec->pulseval[3] = get_bits(, 14);
-dec->pulseval[2] = get_bits(, 14);
-
-dec->offset1[0] |= get_bits1();
-dec->pulsepos[0] = get_bits_long(, 27);
-dec->pulseoff[0] = get_bits(, 4);
-
-dec->offset1[0] |= get_bits1() << 1;
-dec->pulsepos[1] = get_bits_long(, 27);
-dec->pulseoff[1] = get_bits(, 4);
-
-dec->offset1[0] |= get_bits1() << 2;
-dec->pulsepos[2] = get_bits_long(, 27);
-dec->pulseoff[2] = get_bits(, 4);
-
-dec->offset1[0] |= get_bits1() << 3;
-dec->pulsepos[3] = get_bits_long(, 27);
-dec->pulseoff[3] = get_bits(, 4);
+bitstream_init(, dec->buffer, 32 * 8);
+
+dec->vector[7] = ts_codebook[7][bitstream_read(, 3)];
+dec->vector[6] = ts_codebook[6][bitstream_read(, 3)];
+dec->vector[5] = ts_codebook[5][bitstream_read(, 3)];
+dec->vector[4] = ts_codebook[4][bitstream_read(, 4)];
+dec->vector[3] = ts_codebook[3][bitstream_read(, 4)];
+dec->vector[2] = ts_codebook[2][bitstream_read(, 4)];
+dec->vector[1] = ts_codebook[1][bitstream_read(, 5)];
+dec->vector[0] = ts_codebook[0][bitstream_read(, 5)];
+dec->flag  = bitstream_read_bit();
+
+dec->offset1[0] = bitstream_read(, 4) << 4;
+dec->offset2[3] = bitstream_read(, 7);
+dec->offset2[2] = bitstream_read(, 7);
+dec->offset2[1] = bitstream_read(, 7);
+dec->offset2[0] = bitstream_read(, 7);
+
+dec->offset1[1]  = bitstream_read(, 4);
+dec->pulseval[1] = bitstream_read(, 14);
+dec->pulseval[0] = bitstream_read(, 14);
+
+dec->offset1[1] |= bitstream_read(, 4) << 4;
+dec->pulseval[3] = bitstream_read(, 14);
+dec->pulseval[2] = bitstream_read(, 14);
+
+dec->offset1[0] |= bitstream_read_bit();
+dec->pulsepos[0] = bitstream_read(, 27);
+dec->pulseoff[0] = bitstream_read(, 4);
+
+dec->offset1[0] |= bitstream_read_bit() << 1;
+dec->pulsepos[1] = bitstream_read(, 27);
+dec->pulseoff[1] = bitstream_read(, 4);
+
+dec->offset1[0] |= bitstream_read_bit() << 2;
+dec->pulsepos[2] = bitstream_read(, 27);
+dec->pulseoff[2] = bitstream_read(, 4);
+
+dec->offset1[0] |= bitstream_read_bit() << 3;
+dec->pulsepos[3] = bitstream_read(, 27);
+dec->pulseoff[3] = bitstream_read(, 4);
 }
 
 static void truespeech_correlate_filter(TSContext *dec)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vima: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Apr 
14 11:59:21 2016 +0200| [0536e7d78248d8c563f21271fa5ace0b4f38c727] | committer: 
Diego Biurrun

vima: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0536e7d78248d8c563f21271fa5ace0b4f38c727
---

 libavcodec/vima.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vima.c b/libavcodec/vima.c
index 6f539a8..0db1897 100644
--- a/libavcodec/vima.c
+++ b/libavcodec/vima.c
@@ -29,7 +29,7 @@
 
 #include "adpcm_data.h"
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 
 static int predict_table_init = 0;
@@ -118,7 +118,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 static int decode_frame(AVCodecContext *avctx, void *data,
 int *got_frame_ptr, AVPacket *pkt)
 {
-GetBitContext gb;
+BitstreamContext bc;
 AVFrame *frame = data;
 int16_t pcm_data[2];
 uint32_t samples;
@@ -129,19 +129,19 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 if (pkt->size < 13)
 return AVERROR_INVALIDDATA;
 
-if ((ret = init_get_bits8(, pkt->data, pkt->size)) < 0)
+if ((ret = bitstream_init8(, pkt->data, pkt->size)) < 0)
 return ret;
 
-samples = get_bits_long(, 32);
+samples = bitstream_read(, 32);
 if (samples == 0x) {
-skip_bits_long(, 32);
-samples = get_bits_long(, 32);
+bitstream_skip(, 32);
+samples = bitstream_read(, 32);
 }
 
 if (samples > pkt->size * 2)
 return AVERROR_INVALIDDATA;
 
-channel_hint[0] = get_sbits(, 8);
+channel_hint[0] = bitstream_read_signed(, 8);
 if (channel_hint[0] & 0x80) {
 channel_hint[0] = ~channel_hint[0];
 channels = 2;
@@ -149,10 +149,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 avctx->channels = channels;
 avctx->channel_layout = (channels == 2) ? AV_CH_LAYOUT_STEREO
 : AV_CH_LAYOUT_MONO;
-pcm_data[0] = get_sbits(, 16);
+pcm_data[0] = bitstream_read_signed(, 16);
 if (channels > 1) {
-channel_hint[1] = get_sbits(, 8);
-pcm_data[1] = get_sbits(, 16);
+channel_hint[1] = bitstream_read_signed(, 8);
+pcm_data[1] = bitstream_read_signed(, 16);
 }
 
 frame->nb_samples = samples;
@@ -170,7 +170,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 
 step_index  = av_clip(step_index, 0, 88);
 lookup_size = size_table[step_index];
-lookup  = get_bits(, lookup_size);
+lookup  = bitstream_read(, lookup_size);
 highbit = 1 << (lookup_size - 1);
 lowbits = highbit - 1;
 
@@ -180,7 +180,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 highbit = 0;
 
 if (lookup == lowbits) {
-output = get_sbits(, 16);
+output = bitstream_read_signed(, 16);
 } else {
 int predict_index, diff;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] sipr: Convert to the new bitstream reader

2017-04-04 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Wed Apr 
13 19:49:21 2016 +0200| [087bc8d70415b3b50db4dbf5adf49cf071281874] | committer: 
Diego Biurrun

sipr: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=087bc8d70415b3b50db4dbf5adf49cf071281874
---

 libavcodec/sipr.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index 686b3e2..cf29d3b 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -31,7 +31,7 @@
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "internal.h"
 #include "lsp.h"
 #include "acelp_vectors.h"
@@ -188,28 +188,28 @@ static void pitch_sharpening(int pitch_lag_int, float 
beta,
 /**
  * Extract decoding parameters from the input bitstream.
  * @param parms  parameters structure
- * @param pgbpointer to initialized GetBitContext structure
+ * @param bc pointer to initialized BitstreamContext structure
  */
-static void decode_parameters(SiprParameters* parms, GetBitContext *pgb,
+static void decode_parameters(SiprParameters* parms, BitstreamContext *bc,
   const SiprModeParam *p)
 {
 int i, j;
 
 if (p->ma_predictor_bits)
-parms->ma_pred_switch   = get_bits(pgb, p->ma_predictor_bits);
+parms->ma_pred_switch = bitstream_read(bc, p->ma_predictor_bits);
 
 for (i = 0; i < 5; i++)
-parms->vq_indexes[i]= get_bits(pgb, p->vq_indexes_bits[i]);
+parms->vq_indexes[i] = bitstream_read(bc, p->vq_indexes_bits[i]);
 
 for (i = 0; i < p->subframe_count; i++) {
-parms->pitch_delay[i]   = get_bits(pgb, p->pitch_delay_bits[i]);
+parms->pitch_delay[i] = bitstream_read(bc, p->pitch_delay_bits[i]);
 if (p->gp_index_bits)
-parms->gp_index[i]  = get_bits(pgb, p->gp_index_bits);
+parms->gp_index[i] = bitstream_read(bc, p->gp_index_bits);
 
 for (j = 0; j < p->number_of_fc_indexes; j++)
-parms->fc_indexes[i][j] = get_bits(pgb, p->fc_index_bits[j]);
+parms->fc_indexes[i][j] = bitstream_read(bc, p->fc_index_bits[j]);
 
-parms->gc_index[i]  = get_bits(pgb, p->gc_index_bits);
+parms->gc_index[i] = bitstream_read(bc, p->gc_index_bits);
 }
 }
 
@@ -527,7 +527,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void 
*data,
 const uint8_t *buf=avpkt->data;
 SiprParameters parm;
 const SiprModeParam *mode_par = [ctx->mode];
-GetBitContext gb;
+BitstreamContext bc;
 float *samples;
 int subframe_size = ctx->mode == MODE_16k ? L_SUBFR_16k : SUBFR_SIZE;
 int i, ret;
@@ -549,10 +549,10 @@ static int sipr_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 samples = (float *)frame->data[0];
 
-init_get_bits(, buf, mode_par->bits_per_frame);
+bitstream_init(, buf, mode_par->bits_per_frame);
 
 for (i = 0; i < mode_par->frames_per_packet; i++) {
-decode_parameters(, , mode_par);
+decode_parameters(, , mode_par);
 
 ctx->decode_frame(ctx, , samples);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] arm: vp9itxfm: Rename a macro parameter to fit better

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Nov 22 
13:52:55 2016 +0200| [79566ec8c77969d5f9be533de04b1349834cca62] | committer: 
Martin Storsjö

arm: vp9itxfm: Rename a macro parameter to fit better

Since the same parameter is used for both input and output,
the name inout is more fitting.

This matches the naming used below in the dmbutterfly macro.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79566ec8c77969d5f9be533de04b1349834cca62
---

 libavcodec/arm/vp9itxfm_neon.S | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/arm/vp9itxfm_neon.S b/libavcodec/arm/vp9itxfm_neon.S
index acb1c6d..01944bd 100644
--- a/libavcodec/arm/vp9itxfm_neon.S
+++ b/libavcodec/arm/vp9itxfm_neon.S
@@ -125,16 +125,16 @@ endconst
 vmlal.s16   \out4, \in4, \coef1
 .endm
 
-@ in1 = (in1 * coef1 - in2 * coef2 + (1 << 13)) >> 14
-@ in2 = (in1 * coef2 + in2 * coef1 + (1 << 13)) >> 14
-@ in are 2 d registers, tmp are 2 q registers
-.macro mbutterfly in1, in2, coef1, coef2, tmp1, tmp2, neg=0
-mbutterfly_l\tmp1, \tmp2, \in1, \in2, \coef1, \coef2
+@ inout1 = (inout1 * coef1 - inout2 * coef2 + (1 << 13)) >> 14
+@ inout2 = (inout1 * coef2 + inout2 * coef1 + (1 << 13)) >> 14
+@ inout are 2 d registers, tmp are 2 q registers
+.macro mbutterfly inout1, inout2, coef1, coef2, tmp1, tmp2, neg=0
+mbutterfly_l\tmp1, \tmp2, \inout1, \inout2, \coef1, \coef2
 .if \neg > 0
 vneg.s32\tmp2, \tmp2
 .endif
-vrshrn.s32  \in1, \tmp1,  #14
-vrshrn.s32  \in2, \tmp2,  #14
+vrshrn.s32  \inout1, \tmp1,  #14
+vrshrn.s32  \inout2, \tmp2,  #14
 .endm
 
 @ inout1,inout2 = (inout1,inout2 * coef1 - inout3,inout4 * coef2 + (1 << 13)) 
>> 14

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '79566ec8c77969d5f9be533de04b1349834cca62'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:42:18 
2017 -0300| [52febc687b23855c00103f91ded7aa888a066f16] | committer: James Almer

Merge commit '79566ec8c77969d5f9be533de04b1349834cca62'

* commit '79566ec8c77969d5f9be533de04b1349834cca62':
  arm: vp9itxfm: Rename a macro parameter to fit better

This commit is a noop, see f69dd26df55539072dc2fa340384f808b5b3d3e1

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52febc687b23855c00103f91ded7aa888a066f16
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] arm/aarch64: vp9itxfm: Fix indentation of macro arguments

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Nov 22 
11:32:25 2016 +0200| [721bc37522c5c1d6a8c3cea5e9c3fcde8d256c05] | committer: 
Martin Storsjö

arm/aarch64: vp9itxfm: Fix indentation of macro arguments

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=721bc37522c5c1d6a8c3cea5e9c3fcde8d256c05
---

 libavcodec/aarch64/vp9itxfm_neon.S | 16 
 libavcodec/arm/vp9itxfm_neon.S |  8 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/aarch64/vp9itxfm_neon.S 
b/libavcodec/aarch64/vp9itxfm_neon.S
index 65406b9..2dc6b75 100644
--- a/libavcodec/aarch64/vp9itxfm_neon.S
+++ b/libavcodec/aarch64/vp9itxfm_neon.S
@@ -969,14 +969,14 @@ function idct32_1d_8x32_pass1_neon
 st1 {v7.8h},  [x0], #16
 .endm
 
-store_rev 31, 23
-store_rev 30, 22
-store_rev 29, 21
-store_rev 28, 20
-store_rev 27, 19
-store_rev 26, 18
-store_rev 25, 17
-store_rev 24, 16
+store_rev   31, 23
+store_rev   30, 22
+store_rev   29, 21
+store_rev   28, 20
+store_rev   27, 19
+store_rev   26, 18
+store_rev   25, 17
+store_rev   24, 16
 .purgem store_rev
 ret
 endfunc
diff --git a/libavcodec/arm/vp9itxfm_neon.S b/libavcodec/arm/vp9itxfm_neon.S
index 5d73d84..acb1c6d 100644
--- a/libavcodec/arm/vp9itxfm_neon.S
+++ b/libavcodec/arm/vp9itxfm_neon.S
@@ -1017,10 +1017,10 @@ function idct32_1d_4x32_pass1_neon
 .endr
 .endm
 
-store_rev 31, 27, 23, 19
-store_rev 30, 26, 22, 18
-store_rev 29, 25, 21, 17
-store_rev 28, 24, 20, 16
+store_rev   31, 27, 23, 19
+store_rev   30, 26, 22, 18
+store_rev   29, 25, 21, 17
+store_rev   28, 24, 20, 16
 .purgem store_rev
 bx  lr
 endfunc

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '721bc37522c5c1d6a8c3cea5e9c3fcde8d256c05'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:38:15 
2017 -0300| [7283725a08c95df11ae7f09b1ad7cba0639e95df] | committer: James Almer

Merge commit '721bc37522c5c1d6a8c3cea5e9c3fcde8d256c05'

* commit '721bc37522c5c1d6a8c3cea5e9c3fcde8d256c05':
  arm/aarch64: vp9itxfm: Fix indentation of macro arguments

This commit is a noop.

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7283725a08c95df11ae7f09b1ad7cba0639e95df
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] checkasm: vp9dsp: benchmark all sub-IDCTs (but not WHT or ADST).

2017-04-04 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Fri Nov 18 
00:17:02 2016 +0200| [06fec74cacbb0ef7f3e5ea0e6c9ced1b6fd7565d] | committer: 
Martin Storsjö

checkasm: vp9dsp: benchmark all sub-IDCTs (but not WHT or ADST).

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06fec74cacbb0ef7f3e5ea0e6c9ced1b6fd7565d
---

 tests/checkasm/vp9dsp.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index 690e0cf..25f9dd1 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -269,14 +269,20 @@ static void check_itxfm(void)
 int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1;
 
 for (txtp = 0; txtp < n_txtps; txtp++) {
-if (check_func(dsp.itxfm_add[tx][txtp], "vp9_inv_%s_%dx%d_add",
-   tx == 4 ? "wht_wht" : txtp_types[txtp], sz, sz)) {
-randomize_buffers();
-ftx(coef, tx, txtp, sz, BIT_DEPTH);
-
-for (sub = (txtp == 0) ? 1 : 2; sub <= sz; sub <<= 1) {
+// skip testing sub-IDCTs for WHT or ADST since they don't
+// implement it in any of the SIMD functions. If they do,
+// consider changing this to ensure we have complete test
+// coverage
+for (sub = (txtp == 0 && tx < 4) ? 1 : sz; sub <= sz; sub <<= 1) {
+if (check_func(dsp.itxfm_add[tx][txtp],
+   "vp9_inv_%s_%dx%d_sub%d_add",
+   tx == 4 ? "wht_wht" : txtp_types[txtp],
+   sz, sz, sub)) {
 int eob;
 
+randomize_buffers();
+ftx(coef, tx, txtp, sz, BIT_DEPTH);
+
 if (sub < sz) {
 eob = copy_subcoefs(subcoef0, coef, tx, txtp,
 sz, sub, BIT_DEPTH);
@@ -294,8 +300,9 @@ static void check_itxfm(void)
 !iszero(subcoef0, sz * sz * SIZEOF_COEF) ||
 !iszero(subcoef1, sz * sz * SIZEOF_COEF))
 fail();
+
+bench_new(dst, sz * SIZEOF_PIXEL, coef, eob);
 }
-bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz);
 }
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'effc1430b2fe5997d9d55bf28dc507c27125eb27'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:26:18 
2017 -0300| [6747fc436e05c4005d0612a275c996c72b7c2736] | committer: James Almer

Merge commit 'effc1430b2fe5997d9d55bf28dc507c27125eb27'

* commit 'effc1430b2fe5997d9d55bf28dc507c27125eb27':
  Revert "checkasm: vp9dsp: Benchmark the dc-only version of idct_idct 
separately"

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6747fc436e05c4005d0612a275c996c72b7c2736
---

 tests/checkasm/vp9dsp.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index 337ab21..a91577b 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -368,12 +368,6 @@ static void check_itxfm(void)
 bench_new(dst, sz * SIZEOF_PIXEL, coef, eob);
 }
 }
-if (txtp == 0 && tx != 4) {
-if (check_func(dsp.itxfm_add[tx][txtp], 
"vp9_inv_%s_%dx%d_dc_add_%d",
-   txtp_types[txtp], sz, sz, bit_depth)) {
-bench_new(dst, sz * SIZEOF_PIXEL, coef, 1);
-}
-}
 }
 }
 }


==

diff --cc tests/checkasm/vp9dsp.c
index 337ab21,690e0cf..a91577b
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@@ -323,57 -262,40 +323,51 @@@ static void check_itxfm(void
  [ADST_DCT] = "dct_adst", [ADST_ADST] = "adst_adst"
  };
  
 -ff_vp9dsp_init();
 -
 -for (tx = TX_4X4; tx <= N_TXFM_SIZES /* 4 = lossless */; tx++) {
 -int sz = 4 << (tx & 3);
 -int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1;
 -
 -for (txtp = 0; txtp < n_txtps; txtp++) {
 -if (check_func(dsp.itxfm_add[tx][txtp], "vp9_inv_%s_%dx%d_add",
 -   tx == 4 ? "wht_wht" : txtp_types[txtp], sz, sz)) {
 -randomize_buffers();
 -ftx(coef, tx, txtp, sz, BIT_DEPTH);
 -
 -for (sub = (txtp == 0) ? 1 : 2; sub <= sz; sub <<= 1) {
 -int eob;
 +for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
 +ff_vp9dsp_init(, bit_depth, 0);
 +
 +for (tx = TX_4X4; tx <= N_TXFM_SIZES /* 4 = lossless */; tx++) {
 +int sz = 4 << (tx & 3);
 +int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1;
 +
 +for (txtp = 0; txtp < n_txtps; txtp++) {
 +// skip testing sub-IDCTs for WHT or ADST since they don't
 +// implement it in any of the SIMD functions. If they do,
 +// consider changing this to ensure we have complete test
 +// coverage. Test sub=1 for dc-only, then 2, 4, 8, 12, etc,
 +// since the arm version can distinguish them at that level.
 +for (sub = (txtp == 0 && tx < 4) ? 1 : sz; sub <= sz;
 + sub < 4 ? (sub <<= 1) : (sub += 4)) {
 +if (check_func(dsp.itxfm_add[tx][txtp],
 +   "vp9_inv_%s_%dx%d_sub%d_add_%d",
 +   tx == 4 ? "wht_wht" : txtp_types[txtp],
 +   sz, sz, sub, bit_depth)) {
 +int eob;
 +
 +randomize_buffers();
 +ftx(coef, tx, txtp, sz, bit_depth);
 +
 +if (sub < sz) {
 +eob = copy_subcoefs(subcoef0, coef, tx, txtp,
 +sz, sub, bit_depth);
 +} else {
 +eob = sz * sz;
 +memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF);
 +}
  
 -if (sub < sz) {
 -eob = copy_subcoefs(subcoef0, coef, tx, txtp,
 -sz, sub, BIT_DEPTH);
 -} else {
 -eob = sz * sz;
 -memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF);
 +memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL);
 +memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL);
 +memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF);
 +call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob);
 +call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob);
 +if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) ||
 +!iszero(subcoef0, sz * sz * SIZEOF_COEF) ||
 +!iszero(subcoef1, sz * sz * SIZEOF_COEF))
 +fail();
 +
 +bench_new(dst, sz * SIZEOF_PIXEL, coef, eob);
  }
 -
 -memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL);
 -memcpy(dst1, 

[FFmpeg-cvslog] Merge commit '06fec74cacbb0ef7f3e5ea0e6c9ced1b6fd7565d'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:28:56 
2017 -0300| [e386a2f2fe146051d97866472b92520d21be322f] | committer: James Almer

Merge commit '06fec74cacbb0ef7f3e5ea0e6c9ced1b6fd7565d'

* commit '06fec74cacbb0ef7f3e5ea0e6c9ced1b6fd7565d':
  checkasm: vp9dsp: benchmark all sub-IDCTs (but not WHT or ADST).

This commit is a noop, see 1c8fbd7b90469f69fe3a3f78ba7886195d97c34f

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e386a2f2fe146051d97866472b92520d21be322f
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Revert "checkasm: vp9dsp: Benchmark the dc-only version of idct_idct separately"

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Fri Nov 18 
10:09:12 2016 +0200| [effc1430b2fe5997d9d55bf28dc507c27125eb27] | committer: 
Martin Storsjö

Revert "checkasm: vp9dsp: Benchmark the dc-only version of idct_idct separately"

This reverts commit 81d7f0bbca837afda1f7e60d3ae52ab1360ab44b.

Instead of just benchmarking dc separately, test all relevant subparts
(in the next commit).

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=effc1430b2fe5997d9d55bf28dc507c27125eb27
---

 tests/checkasm/vp9dsp.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index b9d1c73..690e0cf 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -297,12 +297,6 @@ static void check_itxfm(void)
 }
 bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz);
 }
-if (txtp == 0 && tx != 4) {
-if (check_func(dsp.itxfm_add[tx][txtp], 
"vp9_inv_%s_%dx%d_dc_add",
-   txtp_types[txtp], sz, sz)) {
-bench_new(dst, sz * SIZEOF_PIXEL, coef, 1);
-}
-}
 }
 }
 report("itxfm");

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] matroska: use av_stream_add_side_data() for stereo3d side data

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Nov 22 15:50:28 
2016 -0500| [12ab667e219e7fbf8e9aef3731039b75c822df25] | committer: Vittorio 
Giovara

matroska: use av_stream_add_side_data() for stereo3d side data

Signed-off-by: James Almer 
Signed-off-by: Vittorio Giovara 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12ab667e219e7fbf8e9aef3731039b75c822df25
---

 libavformat/matroska.c | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 8842d7c..a8f5e98 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -115,26 +115,13 @@ const AVMetadataConv ff_mkv_metadata_conv[] = {
 
 int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode)
 {
-AVPacketSideData *sd, *tmp;
 AVStereo3D *stereo;
+int ret;
 
 stereo = av_stereo3d_alloc();
 if (!stereo)
 return AVERROR(ENOMEM);
 
-tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
-if (!tmp) {
-av_freep();
-return AVERROR(ENOMEM);
-}
-st->side_data = tmp;
-st->nb_side_data++;
-
-sd = >side_data[st->nb_side_data - 1];
-sd->type = AV_PKT_DATA_STEREO3D;
-sd->data = (uint8_t *)stereo;
-sd->size = sizeof(*stereo);
-
 // note: the missing breaks are intentional
 switch (stereo_mode) {
 case MATROSKA_VIDEO_STEREOMODE_TYPE_MONO:
@@ -172,5 +159,12 @@ int ff_mkv_stereo3d_conv(AVStream *st, 
MatroskaVideoStereoModeType stereo_mode)
 break;
 }
 
+ret = av_stream_add_side_data(st, AV_PKT_DATA_STEREO3D, (uint8_t *)stereo,
+  sizeof(*stereo));
+if (ret < 0) {
+av_freep();
+return ret;
+}
+
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] utils: Add av_stream_add_side_data()

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Nov 22 17:16:48 
2016 -0500| [79ff9935ae4ae90a4dd485bd9a3a440281d866b2] | committer: Vittorio 
Giovara

utils: Add av_stream_add_side_data()

Functionally similar to av_packet_add_side_data(). Allows the use of an
already allocated buffer as stream side data.

Signed-off-by: James Almer 
Signed-off-by: Vittorio Giovara 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79ff9935ae4ae90a4dd485bd9a3a440281d866b2
---

 doc/APIchanges |  3 +++
 libavformat/avformat.h | 15 +++
 libavformat/utils.c| 37 +++--
 libavformat/version.h  |  2 +-
 4 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6e0d27d..90c6500 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavf 57.10.0 - avformat.h
+  Add av_stream_add_side_data().
+
 2016-xx-xx - xxx - lavu 55.28.0 - pixfmt.h
   Add AV_PIX_FMT_GRAY12(LE/BE).
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 65c3d90..547b88b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1400,6 +1400,21 @@ const AVClass *avformat_get_class(void);
 AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c);
 
 /**
+ * Wrap an existing array as stream side data.
+ *
+ * @param st stream
+ * @param type side information type
+ * @param data the side data array. It must be allocated with the av_malloc()
+ * family of functions. The ownership of the data is transferred to
+ * st.
+ * @param size side information size
+ * @return zero on success, a negative AVERROR code on failure. On failure,
+ * the stream is unchanged and the data remains owned by the caller.
+ */
+int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
+uint8_t *data, size_t size);
+
+/**
  * Allocate new information from stream.
  *
  * @param stream stream
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 37ba5a8..8fa89eb 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3388,15 +3388,11 @@ uint8_t *av_stream_get_side_data(AVStream *st, enum 
AVPacketSideDataType type,
 return NULL;
 }
 
-uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
- int size)
+int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
+uint8_t *data, size_t size)
 {
 AVPacketSideData *sd, *tmp;
 int i;
-uint8_t *data = av_malloc(size);
-
-if (!data)
-return NULL;
 
 for (i = 0; i < st->nb_side_data; i++) {
 sd = >side_data[i];
@@ -3405,14 +3401,16 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum 
AVPacketSideDataType type,
 av_freep(>data);
 sd->data = data;
 sd->size = size;
-return sd->data;
+return 0;
 }
 }
 
-tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
+if ((unsigned) st->nb_side_data + 1 >= INT_MAX / sizeof(*st->side_data))
+return AVERROR(ERANGE);
+
+tmp = av_realloc(st->side_data, (st->nb_side_data + 1) * sizeof(*tmp));
 if (!tmp) {
-av_freep();
-return NULL;
+return AVERROR(ENOMEM);
 }
 
 st->side_data = tmp;
@@ -3422,6 +3420,25 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum 
AVPacketSideDataType type,
 sd->type = type;
 sd->data = data;
 sd->size = size;
+
+return 0;
+}
+
+uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
+ int size)
+{
+int ret;
+uint8_t *data = av_malloc(size);
+
+if (!data)
+return NULL;
+
+ret = av_stream_add_side_data(st, type, data, size);
+if (ret < 0) {
+av_freep();
+return NULL;
+}
+
 return data;
 }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index c329c2f..c6085f8 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 57
-#define LIBAVFORMAT_VERSION_MINOR  9
+#define LIBAVFORMAT_VERSION_MINOR 10
 #define LIBAVFORMAT_VERSION_MICRO  0
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '12ab667e219e7fbf8e9aef3731039b75c822df25'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:07:57 
2017 -0300| [caf3c5b27f031ee9d6ddaf2c7cc53d47f8f6b185] | committer: James Almer

Merge commit '12ab667e219e7fbf8e9aef3731039b75c822df25'

* commit '12ab667e219e7fbf8e9aef3731039b75c822df25':
  matroska: use av_stream_add_side_data() for stereo3d side data
  mov: Use av_stream_add_side_data() for displaymatrix side data
  utils: Add av_stream_add_side_data()

This is a noop, see
2ab50647ff653ab45d9d78203b6a671124609991
77f033eb98d0d7d05f3aa238409d87fb1f6096b3
2343f23e4d7e0d0f6adfd83d7d769a7a115dbd17

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=caf3c5b27f031ee9d6ddaf2c7cc53d47f8f6b185
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mov: Use av_stream_add_side_data() for displaymatrix side data

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Nov 21 18:54:29 
2016 -0500| [1893495e1d023365b4aa24e5e1bd1b24ad5d34fd] | committer: Vittorio 
Giovara

mov: Use av_stream_add_side_data() for displaymatrix side data

Signed-off-by: James Almer 
Signed-off-by: Vittorio Giovara 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1893495e1d023365b4aa24e5e1bd1b24ad5d34fd
---

 libavformat/mov.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index df29f2a..28adce7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3545,20 +3545,12 @@ static int mov_read_header(AVFormatContext *s)
 break;
 case AVMEDIA_TYPE_VIDEO:
 if (sc->display_matrix) {
-AVPacketSideData *sd, *tmp;
-
-tmp = av_realloc_array(st->side_data,
-   st->nb_side_data + 1, sizeof(*tmp));
-if (!tmp)
-return AVERROR(ENOMEM);
-
-st->side_data = tmp;
-st->nb_side_data++;
+err = av_stream_add_side_data(st, AV_PKT_DATA_DISPLAYMATRIX,
+  (uint8_t *)sc->display_matrix,
+  sizeof(int32_t) * 9);
+if (err < 0)
+return err;
 
-sd = >side_data[st->nb_side_data - 1];
-sd->type = AV_PKT_DATA_DISPLAYMATRIX;
-sd->size = sizeof(int32_t) * 9;
-sd->data = (uint8_t*)sc->display_matrix;
 sc->display_matrix = NULL;
 }
 break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] fate.sh: Allow setting other make flags for running tests

2017-04-04 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue May 21 
10:21:37 2013 +0300| [286ab878bd39b56008035638227b3ecb8ec5bbb7] | committer: 
Martin Storsjö

fate.sh: Allow setting other make flags for running tests

If makeopts_fate is set, these makeopts are used for running the
tests instead of the normal makeopts. If it isn't set, the normal
makeopts variable is used as before.

This is useful if remote testing on a lesser machine where a large
number of parallel jobs might be undesireable, while wanting to speed
up the build with many parallel processes.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=286ab878bd39b56008035638227b3ecb8ec5bbb7
---

 doc/fate.texi | 2 ++
 tests/fate.sh | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/fate.texi b/doc/fate.texi
index 9b8d953..9e654e7 100644
--- a/doc/fate.texi
+++ b/doc/fate.texi
@@ -159,6 +159,8 @@ extra_conf= # extra configure options not covered above
 
 #make=  # name of GNU make if not 'make'
 makeopts=   # extra options passed to 'make'
+#makeopts_fate= # extra options passed to 'make' when running tests,
+# defaulting to makeopts above if this is not set
 #tar=   # command to create a tar archive from its arguments on
 # stdout, defaults to 'tar c'
 @end example
diff --git a/tests/fate.sh b/tests/fate.sh
index b8ee1ae..f7ca891 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -73,7 +73,7 @@ compile()(
 fate()(
 test "$build_only" = "yes" && return
 cd ${build} || return
-${make} ${makeopts} -k fate
+${make} ${makeopts_fate-${makeopts}} -k fate
 )
 
 clean(){

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '286ab878bd39b56008035638227b3ecb8ec5bbb7'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 15:03:34 
2017 -0300| [22164971b0b1ef5c7628fc2ec1eafb768fa449ac] | committer: James Almer

Merge commit '286ab878bd39b56008035638227b3ecb8ec5bbb7'

* commit '286ab878bd39b56008035638227b3ecb8ec5bbb7':
  fate.sh: Allow setting other make flags for running tests

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22164971b0b1ef5c7628fc2ec1eafb768fa449ac
---

 doc/fate_config.sh.template | 2 ++
 tests/fate.sh   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/fate_config.sh.template b/doc/fate_config.sh.template
index 059a1f8..56acb26 100644
--- a/doc/fate_config.sh.template
+++ b/doc/fate_config.sh.template
@@ -26,5 +26,7 @@ extra_conf= # extra configure options not covered above
 
 #make=  # name of GNU make if not 'make'
 makeopts=   # extra options passed to 'make'
+#makeopts_fate= # extra options passed to 'make' when running tests,
+# defaulting to makeopts above if this is not set
 #tar=   # command to create a tar archive from its arguments on stdout,
 # defaults to 'tar c'
diff --git a/tests/fate.sh b/tests/fate.sh
index bbdc701..6fa631e 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -75,7 +75,7 @@ compile()(
 fate()(
 test "$build_only" = "yes" && return
 cd ${build} || return
-${make} ${makeopts} -k fate
+${make} ${makeopts_fate-${makeopts}} -k fate
 )
 
 clean(){


==

diff --cc doc/fate_config.sh.template
index 059a1f8,000..56acb26
mode 100644,00..100644
--- a/doc/fate_config.sh.template
+++ b/doc/fate_config.sh.template
@@@ -1,30 -1,0 +1,32 @@@
 +slot=# some unique identifier
 +repo=git://source.ffmpeg.org/ffmpeg.git  # the source repository
 +#branch=release/2.6   # the branch to test
 +samples= # path to samples directory
 +workdir= # directory in which to do all the 
work
 +#fate_recv="ssh -T f...@fate.ffmpeg.org" # command to submit report
 +comment= # optional description
 +build_only= # set to "yes" for a compile-only instance that skips tests
 +
 +# the following are optional and map to configure options
 +arch=
 +cpu=
 +cross_prefix=
 +as=
 +cc=
 +ld=
 +target_os=
 +sysroot=
 +target_exec=
 +target_path=
 +target_samples=
 +extra_cflags=
 +extra_ldflags=
 +extra_libs=
 +extra_conf= # extra configure options not covered above
 +
 +#make=  # name of GNU make if not 'make'
 +makeopts=   # extra options passed to 'make'
++#makeopts_fate= # extra options passed to 'make' when running tests,
++# defaulting to makeopts above if this is not set
 +#tar=   # command to create a tar archive from its arguments on 
stdout,
 +# defaults to 'tar c'

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avpacket: fix leak on realloc in av_packet_add_side_data()

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Nov 19 15:33:58 
2016 -0300| [aa498c3183236a93206b4a0e8225b9db0660b50d] | committer: Anton 
Khirnov

avpacket: fix leak on realloc in av_packet_add_side_data()

If realloc fails, the pointer is overwritten and the previously allocated buffer
is leaked, which goes against the expected functionality of keeping the packet
unchanged in case of error.

Signed-off-by: James Almer 
Signed-off-by: Anton Khirnov 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa498c3183236a93206b4a0e8225b9db0660b50d
---

 libavcodec/avpacket.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index f2b0a29..93e9eb6 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -240,16 +240,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
 int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
 uint8_t *data, size_t size)
 {
+AVPacketSideData *tmp;
 int elems = pkt->side_data_elems;
 
 if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
 return AVERROR(ERANGE);
 
-pkt->side_data = av_realloc(pkt->side_data,
-(elems + 1) * sizeof(*pkt->side_data));
-if (!pkt->side_data)
+tmp = av_realloc(pkt->side_data, (elems + 1) * sizeof(*tmp));
+if (!tmp)
 return AVERROR(ENOMEM);
 
+pkt->side_data = tmp;
 pkt->side_data[elems].data = data;
 pkt->side_data[elems].size = size;
 pkt->side_data[elems].type = type;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'aa498c3183236a93206b4a0e8225b9db0660b50d'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 14:51:46 
2017 -0300| [b20bf5584f7a420b000fbea87a507bf171f340c6] | committer: James Almer

Merge commit 'aa498c3183236a93206b4a0e8225b9db0660b50d'

* commit 'aa498c3183236a93206b4a0e8225b9db0660b50d':
  avpacket: fix leak on realloc in av_packet_add_side_data()

This commit is a noop, see 574929d8b6de32ae712fcca7ab09f01a3e4616be

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b20bf5584f7a420b000fbea87a507bf171f340c6
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '728ea23cce07467b732f538c87c13da13dd6dcf3'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 14:41:23 
2017 -0300| [52bce9a13ddca52921c8a32ffcdd2d97b15d0f4d] | committer: James Almer

Merge commit '728ea23cce07467b732f538c87c13da13dd6dcf3'

* commit '728ea23cce07467b732f538c87c13da13dd6dcf3':
  examples/decode_video: switch to the new decoding API

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52bce9a13ddca52921c8a32ffcdd2d97b15d0f4d
---

 doc/examples/decode_video.c | 45 +++--
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 980add3..5c1c42c 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -52,28 +52,31 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, 
AVPacket *pkt,
const char *filename)
 {
 char buf[1024];
-int ret, got_picture;
+int ret;
+
+ret = avcodec_send_packet(dec_ctx, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error sending a packet for decoding\n");
+exit(1);
+}
 
-while (pkt->size > 0) {
-ret = avcodec_decode_video2(dec_ctx, frame, _picture, pkt);
-if (ret < 0) {
-fprintf(stderr, "Error while decoding frame %d\n", 
dec_ctx->frame_number);
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "Error during decoding\n");
 exit(1);
 }
-if (got_picture) {
-printf("saving frame %3d\n", dec_ctx->frame_number);
-fflush(stdout);
-
-/* the picture is allocated by the decoder. no need to
-   free it */
-snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
-pgm_save(frame->data[0], frame->linesize[0],
- frame->width, frame->height, buf);
-}
-if (pkt->data) {
-pkt->size -= ret;
-pkt->data += ret;
-}
+
+printf("saving frame %3d\n", dec_ctx->frame_number);
+fflush(stdout);
+
+/* the picture is allocated by the decoder. no need to
+   free it */
+snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
+pgm_save(frame->data[0], frame->linesize[0],
+ frame->width, frame->height, buf);
 }
 }
 
@@ -170,9 +173,7 @@ int main(int argc, char **argv)
  }
 
 /* flush the decoder */
-avpkt.data = NULL;
-avpkt.size = 0;
-decode(c, frame, , outfilename);
+decode(c, frame, NULL, outfilename);
 
 fclose(f);
 


==

diff --cc doc/examples/decode_video.c
index 980add3,7414643..5c1c42c
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@@ -165,14 -161,12 +168,12 @@@ int main(int argc, char **argv
  data_size -= ret;
  
  if (avpkt.size)
 -decode(c, picture, , outfilename);
 -}
 -}
 +decode(c, frame, , outfilename);
 + }
 + }
  
  /* flush the decoder */
- avpkt.data = NULL;
- avpkt.size = 0;
- decode(c, frame, , outfilename);
 -decode(c, picture, NULL, outfilename);
++decode(c, frame, NULL, outfilename);
  
  fclose(f);
  

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/decode_video: allocate the packet dynamically

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Oct 20 
11:03:20 2016 +0200| [c7ab0eb3050acdd3b8cab2c55fc9c1b2e8610a65] | committer: 
Anton Khirnov

examples/decode_video: allocate the packet dynamically

AVPackets on stack are discouraged.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7ab0eb3050acdd3b8cab2c55fc9c1b2e8610a65
---

 doc/examples/decode_video.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 7414643..d6803ef 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
 uint8_t *data;
 size_t   data_size;
 int ret;
-AVPacket avpkt;
+AVPacket *pkt;
 
 if (argc <= 2) {
 fprintf(stderr, "Usage: %s  \n", argv[0]);
@@ -105,7 +105,9 @@ int main(int argc, char **argv)
 
 avcodec_register_all();
 
-av_init_packet();
+pkt = av_packet_alloc();
+if (!pkt)
+exit(1);
 
 /* set end of buffer to 0 (this ensures that no overreading happens for 
damaged MPEG streams) */
 memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
@@ -151,7 +153,7 @@ int main(int argc, char **argv)
 /* use the parser to split the data into frames */
 data = inbuf;
 while (data_size > 0) {
-ret = av_parser_parse2(parser, c, , ,
+ret = av_parser_parse2(parser, c, >data, >size,
data, data_size, AV_NOPTS_VALUE, 
AV_NOPTS_VALUE, 0);
 if (ret < 0) {
 fprintf(stderr, "Error while parsing\n");
@@ -160,8 +162,8 @@ int main(int argc, char **argv)
 data  += ret;
 data_size -= ret;
 
-if (avpkt.size)
-decode(c, picture, , outfilename);
+if (pkt->size)
+decode(c, picture, pkt, outfilename);
 }
 }
 
@@ -173,6 +175,7 @@ int main(int argc, char **argv)
 av_parser_close(parser);
 avcodec_free_context();
 av_frame_free();
+av_packet_free();
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/decode_video: use a parser for splitting the input

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [f78d360bba6dcfb585847a49a84e89c25950fbdb] | committer: 
Anton Khirnov

examples/decode_video: use a parser for splitting the input

Do not rely on the decoder handling this, as it's not guaranteed to
work.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f78d360bba6dcfb585847a49a84e89c25950fbdb
---

 doc/examples/decode_video.c | 113 ++--
 1 file changed, 56 insertions(+), 57 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 43819ec..4c1068b 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -50,16 +50,45 @@ static void pgm_save(unsigned char *buf, int wrap, int 
xsize, int ysize,
 fclose(f);
 }
 
+static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt,
+   const char *filename)
+{
+char buf[1024];
+int ret, got_picture;
+
+while (pkt->size > 0) {
+ret = avcodec_decode_video2(dec_ctx, frame, _picture, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error while decoding frame %d\n", 
dec_ctx->frame_number);
+exit(1);
+}
+if (got_picture) {
+printf("saving frame %3d\n", dec_ctx->frame_number);
+fflush(stdout);
+
+/* the picture is allocated by the decoder. no need to
+   free it */
+snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
+pgm_save(frame->data[0], frame->linesize[0],
+ frame->width, frame->height, buf);
+}
+pkt->size -= ret;
+pkt->data += ret;
+}
+}
+
 int main(int argc, char **argv)
 {
 const char *filename, *outfilename;
 const AVCodec *codec;
+AVCodecParserContext *parser;
 AVCodecContext *c= NULL;
-int frame, got_picture, len;
 FILE *f;
 AVFrame *picture;
 uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
-char buf[1024];
+uint8_t *data;
+size_t   data_size;
+int ret;
 AVPacket avpkt;
 
 if (argc <= 2) {
@@ -83,12 +112,15 @@ int main(int argc, char **argv)
 exit(1);
 }
 
+parser = av_parser_init(codec->id);
+if (!parser) {
+fprintf(stderr, "parser not found\n");
+exit(1);
+}
+
 c = avcodec_alloc_context3(codec);
 picture = av_frame_alloc();
 
-if (codec->capabilities & AV_CODEC_CAP_TRUNCATED)
-c->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames
-
 /* For some codecs, such as msmpeg4 and mpeg4, width and height
MUST be initialized there because this information is not
available in the bitstream. */
@@ -105,70 +137,37 @@ int main(int argc, char **argv)
 exit(1);
 }
 
-frame = 0;
-for(;;) {
-avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
-if (avpkt.size == 0)
+while (!feof(f)) {
+/* read raw data from the input file */
+data_size = fread(inbuf, 1, INBUF_SIZE, f);
+if (!data_size)
 break;
 
-/* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
-   and this is the only method to use them because you cannot
-   know the compressed data size before analysing it.
-
-   BUT some other codecs (msmpeg4, mpeg4) are inherently frame
-   based, so you must call them with all the data for one
-   frame exactly. You must also initialize 'width' and
-   'height' before initializing them. */
-
-/* NOTE2: some codecs allow the raw parameters (frame size,
-   sample rate) to be changed at any frame. We handle this, so
-   you should also take care of it */
-
-/* here, we use a stream based decoder (mpeg1video), so we
-   feed decoder and see if it could decode a frame */
-avpkt.data = inbuf;
-while (avpkt.size > 0) {
-len = avcodec_decode_video2(c, picture, _picture, );
-if (len < 0) {
-fprintf(stderr, "Error while decoding frame %d\n", frame);
+/* use the parser to split the data into frames */
+data = inbuf;
+while (data_size > 0) {
+ret = av_parser_parse2(parser, c, , ,
+   data, data_size, AV_NOPTS_VALUE, 
AV_NOPTS_VALUE, 0);
+if (ret < 0) {
+fprintf(stderr, "Error while parsing\n");
 exit(1);
 }
-if (got_picture) {
-printf("saving frame %3d\n", frame);
-fflush(stdout);
-
-/* the picture is allocated by the decoder. no need to
-   free it */
-snprintf(buf, sizeof(buf), outfilename, frame);
-pgm_save(picture->data[0], picture->linesize[0],
- c->width, c->height, buf);
-frame++;
-}
-avpkt.size 

[FFmpeg-cvslog] examples/decode_video: switch to the new decoding API

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [728ea23cce07467b732f538c87c13da13dd6dcf3] | committer: 
Anton Khirnov

examples/decode_video: switch to the new decoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=728ea23cce07467b732f538c87c13da13dd6dcf3
---

 doc/examples/decode_video.c | 43 +++
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 4c1068b..7414643 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -54,26 +54,31 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, 
AVPacket *pkt,
const char *filename)
 {
 char buf[1024];
-int ret, got_picture;
+int ret;
+
+ret = avcodec_send_packet(dec_ctx, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error sending a packet for decoding\n");
+exit(1);
+}
 
-while (pkt->size > 0) {
-ret = avcodec_decode_video2(dec_ctx, frame, _picture, pkt);
-if (ret < 0) {
-fprintf(stderr, "Error while decoding frame %d\n", 
dec_ctx->frame_number);
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "Error during decoding\n");
 exit(1);
 }
-if (got_picture) {
-printf("saving frame %3d\n", dec_ctx->frame_number);
-fflush(stdout);
-
-/* the picture is allocated by the decoder. no need to
-   free it */
-snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
-pgm_save(frame->data[0], frame->linesize[0],
- frame->width, frame->height, buf);
-}
-pkt->size -= ret;
-pkt->data += ret;
+
+printf("saving frame %3d\n", dec_ctx->frame_number);
+fflush(stdout);
+
+/* the picture is allocated by the decoder. no need to
+   free it */
+snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
+pgm_save(frame->data[0], frame->linesize[0],
+ frame->width, frame->height, buf);
 }
 }
 
@@ -161,9 +166,7 @@ int main(int argc, char **argv)
 }
 
 /* flush the decoder */
-avpkt.data = NULL;
-avpkt.size = 0;
-decode(c, picture, , outfilename);
+decode(c, picture, NULL, outfilename);
 
 fclose(f);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'f78d360bba6dcfb585847a49a84e89c25950fbdb'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 14:34:52 
2017 -0300| [fddd6af45cfdb228cd34c36210a8afd39757a6c8] | committer: James Almer

Merge commit 'f78d360bba6dcfb585847a49a84e89c25950fbdb'

* commit 'f78d360bba6dcfb585847a49a84e89c25950fbdb':
  examples/decode_video: use a parser for splitting the input

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fddd6af45cfdb228cd34c36210a8afd39757a6c8
---

 doc/examples/decode_video.c | 110 ++--
 1 file changed, 56 insertions(+), 54 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index dd1177b..980add3 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -48,43 +48,47 @@ static void pgm_save(unsigned char *buf, int wrap, int 
xsize, int ysize,
 fclose(f);
 }
 
-static int decode_write_frame(const char *outfilename, AVCodecContext *avctx,
-  AVFrame *frame, int *frame_count, AVPacket *pkt, 
int last)
+static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt,
+   const char *filename)
 {
-int len, got_frame;
 char buf[1024];
-
-len = avcodec_decode_video2(avctx, frame, _frame, pkt);
-if (len < 0) {
-fprintf(stderr, "Error while decoding frame %d\n", *frame_count);
-return len;
-}
-if (got_frame) {
-printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count);
-fflush(stdout);
-
-/* 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],
- frame->width, frame->height, buf);
-(*frame_count)++;
+int ret, got_picture;
+
+while (pkt->size > 0) {
+ret = avcodec_decode_video2(dec_ctx, frame, _picture, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error while decoding frame %d\n", 
dec_ctx->frame_number);
+exit(1);
+}
+if (got_picture) {
+printf("saving frame %3d\n", dec_ctx->frame_number);
+fflush(stdout);
+
+/* the picture is allocated by the decoder. no need to
+   free it */
+snprintf(buf, sizeof(buf), filename, dec_ctx->frame_number);
+pgm_save(frame->data[0], frame->linesize[0],
+ frame->width, frame->height, buf);
+}
+if (pkt->data) {
+pkt->size -= ret;
+pkt->data += ret;
+}
 }
-if (pkt->data) {
-pkt->size -= len;
-pkt->data += len;
-}
-return 0;
 }
 
 int main(int argc, char **argv)
 {
 const char *filename, *outfilename;
 const AVCodec *codec;
+AVCodecParserContext *parser;
 AVCodecContext *c= NULL;
-int frame_count;
 FILE *f;
 AVFrame *frame;
 uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
+uint8_t *data;
+size_t   data_size;
+int ret;
 AVPacket avpkt;
 
 if (argc <= 2) {
@@ -108,15 +112,18 @@ int main(int argc, char **argv)
 exit(1);
 }
 
+parser = av_parser_init(codec->id);
+if (!parser) {
+fprintf(stderr, "parser not found\n");
+exit(1);
+}
+
 c = avcodec_alloc_context3(codec);
 if (!c) {
 fprintf(stderr, "Could not allocate video codec context\n");
 exit(1);
 }
 
-if (codec->capabilities & AV_CODEC_CAP_TRUNCATED)
-c->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames
-
 /* For some codecs, such as msmpeg4 and mpeg4, width and height
MUST be initialized there because this information is not
available in the bitstream. */
@@ -139,42 +146,37 @@ int main(int argc, char **argv)
 exit(1);
 }
 
-frame_count = 0;
-for (;;) {
-avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
-if (avpkt.size == 0)
+while (!feof(f)) {
+/* read raw data from the input file */
+data_size = fread(inbuf, 1, INBUF_SIZE, f);
+if (!data_size)
 break;
 
-/* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
-   and this is the only method to use them because you cannot
-   know the compressed data size before analysing it.
-
-   BUT some other codecs (msmpeg4, mpeg4) are inherently frame
-   based, so you must call them with all the data for one
-   frame exactly. You must also initialize 'width' and
-   'height' before initializing them. */
-
-/* NOTE2: some codecs allow the raw parameters (frame size,
-   sample rate) to be changed at any frame. We handle this, so
-   you should also take care of it */
-
-/* here, we use a stream based decoder (mpeg1video), so we
-   feed decoder and see if it could decode a frame */
-avpkt.data = inbuf;
-

[FFmpeg-cvslog] Merge commit 'c7ab0eb3050acdd3b8cab2c55fc9c1b2e8610a65'

2017-04-04 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr  4 14:47:09 
2017 -0300| [81cc33adc68ef43a6de522042e0b1050b54c9d86] | committer: James Almer

Merge commit 'c7ab0eb3050acdd3b8cab2c55fc9c1b2e8610a65'

* commit 'c7ab0eb3050acdd3b8cab2c55fc9c1b2e8610a65':
  examples/decode_video: allocate the packet dynamically

Merged-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81cc33adc68ef43a6de522042e0b1050b54c9d86
---

 doc/examples/decode_video.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 5c1c42c..613bc5c 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
 uint8_t *data;
 size_t   data_size;
 int ret;
-AVPacket avpkt;
+AVPacket *pkt;
 
 if (argc <= 2) {
 fprintf(stderr, "Usage: %s  \n", argv[0]);
@@ -103,7 +103,9 @@ int main(int argc, char **argv)
 
 avcodec_register_all();
 
-av_init_packet();
+pkt = av_packet_alloc();
+if (!pkt)
+exit(1);
 
 /* set end of buffer to 0 (this ensures that no overreading happens for 
damaged MPEG streams) */
 memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
@@ -158,7 +160,7 @@ int main(int argc, char **argv)
 /* use the parser to split the data into frames */
 data = inbuf;
 while (data_size > 0) {
-ret = av_parser_parse2(parser, c, , ,
+ret = av_parser_parse2(parser, c, >data, >size,
data, data_size, AV_NOPTS_VALUE, 
AV_NOPTS_VALUE, 0);
 if (ret < 0) {
 fprintf(stderr, "Error while parsing\n");
@@ -167,10 +169,10 @@ int main(int argc, char **argv)
 data  += ret;
 data_size -= ret;
 
-if (avpkt.size)
-decode(c, frame, , outfilename);
- }
- }
+if (pkt->size)
+decode(c, frame, pkt, outfilename);
+}
+}
 
 /* flush the decoder */
 decode(c, frame, NULL, outfilename);
@@ -180,6 +182,7 @@ int main(int argc, char **argv)
 av_parser_close(parser);
 avcodec_free_context();
 av_frame_free();
+av_packet_free();
 
 return 0;
 }


==

diff --cc doc/examples/decode_video.c
index 5c1c42c,d6803ef..613bc5c
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@@ -167,19 -162,20 +169,20 @@@ int main(int argc, char **argv
  data  += ret;
  data_size -= ret;
  
- if (avpkt.size)
- decode(c, frame, , outfilename);
-  }
-  }
+ if (pkt->size)
 -decode(c, picture, pkt, outfilename);
++decode(c, frame, pkt, outfilename);
+ }
+ }
  
  /* flush the decoder */
 -decode(c, picture, NULL, outfilename);
 +decode(c, frame, NULL, outfilename);
  
  fclose(f);
  
  av_parser_close(parser);
  avcodec_free_context();
 -av_frame_free();
 +av_frame_free();
+ av_packet_free();
  
  return 0;
  }

___
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

2017-04-04 Thread Matthieu Bouron
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 = [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 = [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] doc/examples/extract_mvs: make pkt local to the main function

2017-04-04 Thread Matthieu Bouron
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, );
+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();
-
 /* read frames from the file */
 while (av_read_frame(fmt_ctx, ) >= 0) {
-ret = decode_packet();
+if (pkt.stream_index == video_stream_idx)
+ret = decode_packet();
 av_packet_unref();
 if (ret < 0)
 break;
 }
 
 /* flush cached frames */
-pkt.data = NULL;
-pkt.size = 0;
-decode_packet();
+decode_packet(NULL);
 
 end:
 avcodec_free_context(_dec_ctx);

___
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

2017-04-04 Thread Matthieu Bouron
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, );
+int ret = avcodec_send_packet(video_dec_ctx, );
 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 = [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 = [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.data = NULL;
-pkt.size = 0;
 
 /* read frames from the file */
 while (av_read_frame(fmt_ctx, ) >= 0) {
-AVPacket orig_pkt = pkt;
-do {
-ret = decode_packet(_frame, 0);
-if (ret < 0)
-break;
-pkt.data += ret;
-pkt.size -= ret;
-} while (pkt.size > 0);
-av_packet_unref(_pkt);
+ret = decode_packet();
+av_packet_unref();
+if (ret < 0)
+break;
 }
 
 /* flush cached frames */
 pkt.data = NULL;
 pkt.size = 0;
-do {
-decode_packet(_frame, 1);
-} while (got_frame);
+decode_packet();
 
 end:
 avcodec_free_context(_dec_ctx);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '59ab9e8ba1df7e3347a4cd2bd56c32e74aede802'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:48:23 2017 +0200| [6db36a0227656057b43ab562dcabc2aa3fb8686f] | committer: 
Clément Bœsch

Merge commit '59ab9e8ba1df7e3347a4cd2bd56c32e74aede802'

* commit '59ab9e8ba1df7e3347a4cd2bd56c32e74aede802':
  examples/encode_video: allocate the packet dynamically

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6db36a0227656057b43ab562dcabc2aa3fb8686f
---

 doc/examples/encode_video.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index f29e9fb..d2075c1 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
 int i, ret, x, y;
 FILE *f;
 AVFrame *frame;
-AVPacket pkt;
+AVPacket *pkt;
 uint8_t endcode[] = { 0, 0, 1, 0xb7 };
 
 if (argc <= 2) {
@@ -96,6 +96,10 @@ int main(int argc, char **argv)
 exit(1);
 }
 
+pkt = av_packet_alloc();
+if (!pkt)
+exit(1);
+
 /* put sample parameters */
 c->bit_rate = 40;
 /* resolution must be a multiple of two */
@@ -147,10 +151,6 @@ int main(int argc, char **argv)
 
 /* encode 1 second of video */
 for (i = 0; i < 25; i++) {
-av_init_packet();
-pkt.data = NULL;// packet data will be allocated by the encoder
-pkt.size = 0;
-
 fflush(stdout);
 
 /* make sure the frame data is writable */
@@ -177,11 +177,11 @@ int main(int argc, char **argv)
 frame->pts = i;
 
 /* encode the image */
-encode(c, frame, , f);
+encode(c, frame, pkt, f);
 }
 
 /* flush the encoder */
-encode(c, NULL, , f);
+encode(c, NULL, pkt, f);
 
 /* add sequence end code to have a real MPEG file */
 fwrite(endcode, 1, sizeof(endcode), f);
@@ -189,6 +189,7 @@ int main(int argc, char **argv)
 
 avcodec_free_context();
 av_frame_free();
+av_packet_free();
 
 return 0;
 }


==

diff --cc doc/examples/encode_video.c
index f29e9fb,cb12836..d2075c1
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@@ -70,12 -68,12 +70,12 @@@ int main(int argc, char **argv
  AVCodecContext *c= NULL;
  int i, ret, x, y;
  FILE *f;
 -AVFrame *picture;
 +AVFrame *frame;
- AVPacket pkt;
+ AVPacket *pkt;
  uint8_t endcode[] = { 0, 0, 1, 0xb7 };
  
 -if (argc <= 1) {
 -fprintf(stderr, "Usage: %s \n", argv[0]);
 +if (argc <= 2) {
 +fprintf(stderr, "Usage: %s  \n", argv[0]);
  exit(0);
  }
  filename = argv[1];
@@@ -91,11 -88,12 +91,15 @@@
  }
  
  c = avcodec_alloc_context3(codec);
 -picture = av_frame_alloc();
 +if (!c) {
 +fprintf(stderr, "Could not allocate video codec context\n");
 +exit(1);
 +}
  
+ pkt = av_packet_alloc();
+ if (!pkt)
+ exit(1);
+ 
  /* put sample parameters */
  c->bit_rate = 40;
  /* resolution must be a multiple of two */
@@@ -146,11 -130,7 +150,7 @@@
  }
  
  /* encode 1 second of video */
 -for(i=0;i<25;i++) {
 +for (i = 0; i < 25; i++) {
- av_init_packet();
- pkt.data = NULL;// packet data will be allocated by the encoder
- pkt.size = 0;
- 
  fflush(stdout);
  
  /* make sure the frame data is writable */
@@@ -174,10 -154,10 +174,10 @@@
  }
  }
  
 -picture->pts = i;
 +frame->pts = i;
  
  /* encode the image */
- encode(c, frame, , f);
 -encode(c, picture, pkt, f);
++encode(c, frame, pkt, f);
  }
  
  /* flush the encoder */
@@@ -188,7 -168,8 +188,8 @@@
  fclose(f);
  
  avcodec_free_context();
 -av_frame_free();
 +av_frame_free();
+ av_packet_free();
  
  return 0;
  }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/encode_video: allocate the packet dynamically

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Oct 20 
11:03:20 2016 +0200| [59ab9e8ba1df7e3347a4cd2bd56c32e74aede802] | committer: 
Anton Khirnov

examples/encode_video: allocate the packet dynamically

AVPackets on stack are discouraged.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59ab9e8ba1df7e3347a4cd2bd56c32e74aede802
---

 doc/examples/encode_video.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index 2ff6354..cb12836 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
 int i, ret, x, y;
 FILE *f;
 AVFrame *picture;
-AVPacket pkt;
+AVPacket *pkt;
 uint8_t endcode[] = { 0, 0, 1, 0xb7 };
 
 if (argc <= 1) {
@@ -90,6 +90,10 @@ int main(int argc, char **argv)
 c = avcodec_alloc_context3(codec);
 picture = av_frame_alloc();
 
+pkt = av_packet_alloc();
+if (!pkt)
+exit(1);
+
 /* put sample parameters */
 c->bit_rate = 40;
 /* resolution must be a multiple of two */
@@ -127,10 +131,6 @@ int main(int argc, char **argv)
 
 /* encode 1 second of video */
 for(i=0;i<25;i++) {
-av_init_packet();
-pkt.data = NULL;// packet data will be allocated by the encoder
-pkt.size = 0;
-
 fflush(stdout);
 
 /* make sure the frame data is writable */
@@ -157,11 +157,11 @@ int main(int argc, char **argv)
 picture->pts = i;
 
 /* encode the image */
-encode(c, picture, , f);
+encode(c, picture, pkt, f);
 }
 
 /* flush the encoder */
-encode(c, NULL, , f);
+encode(c, NULL, pkt, f);
 
 /* add sequence end code to have a real MPEG file */
 fwrite(endcode, 1, sizeof(endcode), f);
@@ -169,6 +169,7 @@ int main(int argc, char **argv)
 
 avcodec_free_context();
 av_frame_free();
+av_packet_free();
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/encode_video: switch to the new encoding API

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Oct 20 
11:03:20 2016 +0200| [5f102a9559099429826e84758b8b5182244c52db] | committer: 
Anton Khirnov

examples/encode_video: switch to the new encoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f102a9559099429826e84758b8b5182244c52db
---

 doc/examples/encode_video.c | 59 -
 1 file changed, 31 insertions(+), 28 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index 3fd2d56..2ff6354 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -34,12 +34,39 @@
 #include "libavutil/frame.h"
 #include "libavutil/imgutils.h"
 
+static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
+   FILE *outfile)
+{
+int ret;
+
+/* send the frame to the encoder */
+ret = avcodec_send_frame(enc_ctx, frame);
+if (ret < 0) {
+fprintf(stderr, "error sending a frame for encoding\n");
+exit(1);
+}
+
+while (ret >= 0) {
+ret = avcodec_receive_packet(enc_ctx, pkt);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "error during encoding\n");
+exit(1);
+}
+
+printf("encoded frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
+fwrite(pkt->data, 1, pkt->size, outfile);
+av_packet_unref(pkt);
+}
+}
+
 int main(int argc, char **argv)
 {
 const char *filename;
 const AVCodec *codec;
 AVCodecContext *c= NULL;
-int i, ret, x, y, got_output;
+int i, ret, x, y;
 FILE *f;
 AVFrame *picture;
 AVPacket pkt;
@@ -130,35 +157,11 @@ int main(int argc, char **argv)
 picture->pts = i;
 
 /* encode the image */
-ret = avcodec_encode_video2(c, , picture, _output);
-if (ret < 0) {
-fprintf(stderr, "error encoding frame\n");
-exit(1);
-}
-
-if (got_output) {
-printf("encoding frame %3d (size=%5d)\n", i, pkt.size);
-fwrite(pkt.data, 1, pkt.size, f);
-av_packet_unref();
-}
+encode(c, picture, , f);
 }
 
-/* get the delayed frames */
-for (got_output = 1; got_output; i++) {
-fflush(stdout);
-
-ret = avcodec_encode_video2(c, , NULL, _output);
-if (ret < 0) {
-fprintf(stderr, "error encoding frame\n");
-exit(1);
-}
-
-if (got_output) {
-printf("encoding frame %3d (size=%5d)\n", i, pkt.size);
-fwrite(pkt.data, 1, pkt.size, f);
-av_packet_unref();
-}
-}
+/* flush the encoder */
+encode(c, NULL, , f);
 
 /* add sequence end code to have a real MPEG file */
 fwrite(endcode, 1, sizeof(endcode), f);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '5f102a9559099429826e84758b8b5182244c52db'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:44:45 2017 +0200| [4ea942f2ceaafbfed43933895bd0e8aad043ca44] | committer: 
Clément Bœsch

Merge commit '5f102a9559099429826e84758b8b5182244c52db'

* commit '5f102a9559099429826e84758b8b5182244c52db':
  examples/encode_video: switch to the new encoding API

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ea942f2ceaafbfed43933895bd0e8aad043ca44
---

 doc/examples/encode_video.c | 59 -
 1 file changed, 31 insertions(+), 28 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index fc576e0..f29e9fb 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -36,12 +36,39 @@
 #include 
 #include 
 
+static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
+   FILE *outfile)
+{
+int ret;
+
+/* send the frame to the encoder */
+ret = avcodec_send_frame(enc_ctx, frame);
+if (ret < 0) {
+fprintf(stderr, "Error sending a frame for encoding\n");
+exit(1);
+}
+
+while (ret >= 0) {
+ret = avcodec_receive_packet(enc_ctx, pkt);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "Error during encoding\n");
+exit(1);
+}
+
+printf("Write frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
+fwrite(pkt->data, 1, pkt->size, outfile);
+av_packet_unref(pkt);
+}
+}
+
 int main(int argc, char **argv)
 {
 const char *filename, *codec_name;
 const AVCodec *codec;
 AVCodecContext *c= NULL;
-int i, ret, x, y, got_output;
+int i, ret, x, y;
 FILE *f;
 AVFrame *frame;
 AVPacket pkt;
@@ -150,35 +177,11 @@ int main(int argc, char **argv)
 frame->pts = i;
 
 /* encode the image */
-ret = avcodec_encode_video2(c, , frame, _output);
-if (ret < 0) {
-fprintf(stderr, "Error encoding frame\n");
-exit(1);
-}
-
-if (got_output) {
-printf("Write frame %3d (size=%5d)\n", i, pkt.size);
-fwrite(pkt.data, 1, pkt.size, f);
-av_packet_unref();
-}
+encode(c, frame, , f);
 }
 
-/* get the delayed frames */
-for (got_output = 1; got_output; i++) {
-fflush(stdout);
-
-ret = avcodec_encode_video2(c, , NULL, _output);
-if (ret < 0) {
-fprintf(stderr, "Error encoding frame\n");
-exit(1);
-}
-
-if (got_output) {
-printf("Write frame %3d (size=%5d)\n", i, pkt.size);
-fwrite(pkt.data, 1, pkt.size, f);
-av_packet_unref();
-}
-}
+/* flush the encoder */
+encode(c, NULL, , f);
 
 /* add sequence end code to have a real MPEG file */
 fwrite(endcode, 1, sizeof(endcode), f);


==

diff --cc doc/examples/encode_video.c
index fc576e0,2ff6354..f29e9fb
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@@ -31,19 -29,46 +31,46 @@@
  #include 
  #include 
  
 -#include "libavcodec/avcodec.h"
 +#include 
  
 -#include "libavutil/frame.h"
 -#include "libavutil/imgutils.h"
 +#include 
 +#include 
  
+ static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
+FILE *outfile)
+ {
+ int ret;
+ 
+ /* send the frame to the encoder */
+ ret = avcodec_send_frame(enc_ctx, frame);
+ if (ret < 0) {
 -fprintf(stderr, "error sending a frame for encoding\n");
++fprintf(stderr, "Error sending a frame for encoding\n");
+ exit(1);
+ }
+ 
+ while (ret >= 0) {
+ ret = avcodec_receive_packet(enc_ctx, pkt);
+ if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ return;
+ else if (ret < 0) {
 -fprintf(stderr, "error during encoding\n");
++fprintf(stderr, "Error during encoding\n");
+ exit(1);
+ }
+ 
 -printf("encoded frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
++printf("Write frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
+ fwrite(pkt->data, 1, pkt->size, outfile);
+ av_packet_unref(pkt);
+ }
+ }
+ 
  int main(int argc, char **argv)
  {
 -const char *filename;
 +const char *filename, *codec_name;
  const AVCodec *codec;
  AVCodecContext *c= NULL;
- int i, ret, x, y, got_output;
+ int i, ret, x, y;
  FILE *f;
 -AVFrame *picture;
 +AVFrame *frame;
  AVPacket pkt;
  uint8_t endcode[] = { 0, 0, 1, 0xb7 };
  
@@@ -147,38 -154,14 +174,14 @@@
  }
  }
  
 -picture->pts = i;
 +frame->pts = i;
  
  /* encode the image */
- ret = avcodec_encode_video2(c, , frame, _output);
- if 

[FFmpeg-cvslog] Merge commit 'fee0f1de2c6a9924acb74013436dbea8f2bd1ecb'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:40:34 2017 +0200| [dd0113da3cff8d49c6283d04314599279689cfe4] | committer: 
Clément Bœsch

Merge commit 'fee0f1de2c6a9924acb74013436dbea8f2bd1ecb'

* commit 'fee0f1de2c6a9924acb74013436dbea8f2bd1ecb':
  examples/decode_audio: flush the decoder

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd0113da3cff8d49c6283d04314599279689cfe4
---

 doc/examples/decode_audio.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index f66e577..fb9a9af 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -170,6 +170,11 @@ int main(int argc, char **argv)
 }
 }
 
+/* flush the decoder */
+pkt->data = NULL;
+pkt->size = 0;
+decode(c, pkt, decoded_frame, outfile);
+
 fclose(outfile);
 fclose(f);
 


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/decode_audio: flush the decoder

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [fee0f1de2c6a9924acb74013436dbea8f2bd1ecb] | committer: 
Anton Khirnov

examples/decode_audio: flush the decoder

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fee0f1de2c6a9924acb74013436dbea8f2bd1ecb
---

 doc/examples/decode_audio.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index e7b27d3..d952b49 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -179,6 +179,11 @@ int main(int argc, char **argv)
 }
 }
 
+/* flush the decoder */
+pkt->data = NULL;
+pkt->size = 0;
+decode(c, pkt, decoded_frame, outfile);
+
 fclose(outfile);
 fclose(f);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/decode_audio: allocate the packet dynamically

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [9a38184a143a1560814b084aebe628f8df46e666] | committer: 
Anton Khirnov

examples/decode_audio: allocate the packet dynamically

AVPackets on stack are discouraged now.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a38184a143a1560814b084aebe628f8df46e666
---

 doc/examples/decode_audio.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index c00d488..e7b27d3 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
 uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
 uint8_t *data;
 size_t   data_size;
-AVPacket avpkt;
+AVPacket *pkt;
 AVFrame *decoded_frame = NULL;
 
 if (argc <= 2) {
@@ -110,7 +110,7 @@ int main(int argc, char **argv)
 /* register all the codecs */
 avcodec_register_all();
 
-av_init_packet();
+pkt = av_packet_alloc();
 
 /* find the MPEG audio decoder */
 codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
 }
 }
 
-ret = av_parser_parse2(parser, c, , ,
+ret = av_parser_parse2(parser, c, >data, >size,
data, data_size,
AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
 if (ret < 0) {
@@ -166,8 +166,8 @@ int main(int argc, char **argv)
 data  += ret;
 data_size -= ret;
 
-if (avpkt.size)
-decode(c, , decoded_frame, outfile);
+if (pkt->size)
+decode(c, pkt, decoded_frame, outfile);
 
 if (data_size < AUDIO_REFILL_THRESH) {
 memmove(inbuf, data, data_size);
@@ -185,6 +185,7 @@ int main(int argc, char **argv)
 avcodec_free_context();
 av_parser_close(parser);
 av_frame_free(_frame);
+av_packet_free();
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '9a38184a143a1560814b084aebe628f8df46e666'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:38:56 2017 +0200| [d1105e8f436e0b40f8cb83b8c1da09320351c2d0] | committer: 
Clément Bœsch

Merge commit '9a38184a143a1560814b084aebe628f8df46e666'

* commit '9a38184a143a1560814b084aebe628f8df46e666':
  examples/decode_audio: allocate the packet dynamically

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1105e8f436e0b40f8cb83b8c1da09320351c2d0
---

 doc/examples/decode_audio.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index 47c878d..f66e577 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
 uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
 uint8_t *data;
 size_t   data_size;
-AVPacket avpkt;
+AVPacket *pkt;
 AVFrame *decoded_frame = NULL;
 
 if (argc <= 2) {
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
 /* register all the codecs */
 avcodec_register_all();
 
-av_init_packet();
+pkt = av_packet_alloc();
 
 /* find the MPEG audio decoder */
 codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
 }
 }
 
-ret = av_parser_parse2(parser, c, , ,
+ret = av_parser_parse2(parser, c, >data, >size,
data, data_size,
AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
 if (ret < 0) {
@@ -157,8 +157,8 @@ int main(int argc, char **argv)
 data  += ret;
 data_size -= ret;
 
-if (avpkt.size)
-decode(c, , decoded_frame, outfile);
+if (pkt->size)
+decode(c, pkt, decoded_frame, outfile);
 
 if (data_size < AUDIO_REFILL_THRESH) {
 memmove(inbuf, data, data_size);
@@ -176,6 +176,7 @@ int main(int argc, char **argv)
 avcodec_free_context();
 av_parser_close(parser);
 av_frame_free(_frame);
+av_packet_free();
 
 return 0;
 }


==


___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] examples/decode_audio: handle planar audio now produced by the MP2 decoder

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [45a1ce2ff7688656aacd53c27de5815a7ec13afe] | committer: 
Anton Khirnov

examples/decode_audio: handle planar audio now produced by the MP2 decoder

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45a1ce2ff7688656aacd53c27de5815a7ec13afe
---

 doc/examples/decode_audio.c | 30 +-
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index 5e128f8..c00d488 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/frame.h"
 #include "libavutil/mem.h"
 
@@ -40,7 +41,8 @@
 static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
FILE *outfile)
 {
-int ret, data_size;
+int16_t *interleave_buf;
+int ret, data_size, i;
 
 /* send the packet with the compressed data to the decoder */
 ret = avcodec_send_packet(dec_ctx, pkt);
@@ -59,10 +61,28 @@ static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, 
AVFrame *frame,
 exit(1);
 }
 
-data_size = av_samples_get_buffer_size(NULL, dec_ctx->channels,
-   frame->nb_samples,
-   dec_ctx->sample_fmt, 1);
-fwrite(frame->data[0], 1, data_size, outfile);
+/* the stream parameters may change at any time, check that they are
+ * what we expect */
+if (av_get_channel_layout_nb_channels(frame->channel_layout) != 2 ||
+frame->format != AV_SAMPLE_FMT_S16P) {
+fprintf(stderr, "Unsupported frame parameters\n");
+exit(1);
+}
+
+/* The decoded data is signed 16-bit planar -- each channel in its own
+ * buffer. We interleave the two channels manually here, but using
+ * libavresample is recommended instead. */
+data_size = sizeof(*interleave_buf) * 2 * frame->nb_samples;
+interleave_buf = av_malloc(data_size);
+if (!interleave_buf)
+exit(1);
+
+for (i = 0; i < frame->nb_samples; i++) {
+interleave_buf[2 * i] = ((int16_t*)frame->data[0])[i];
+interleave_buf[2 * i + 1] = ((int16_t*)frame->data[1])[i];
+}
+fwrite(interleave_buf, 1, data_size, outfile);
+av_freep(_buf);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '45a1ce2ff7688656aacd53c27de5815a7ec13afe'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:37:11 2017 +0200| [28fd79c9db712a2f73ebdbfafa3abbd3040b1a2f] | committer: 
Clément Bœsch

Merge commit '45a1ce2ff7688656aacd53c27de5815a7ec13afe'

* commit '45a1ce2ff7688656aacd53c27de5815a7ec13afe':
  examples/decode_audio: handle planar audio now produced by the MP2 decoder

This commit is a noop, we use a simpler and more generic method to write
the samples.

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28fd79c9db712a2f73ebdbfafa3abbd3040b1a2f
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '3d66717f7cb5555257244be8f5bce172ed3af7ac'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:33:04 2017 +0200| [3d12d106775a5a821b3cb3aaaeadd8cb48f19550] | committer: 
Clément Bœsch

Merge commit '3d66717f7cb257244be8f5bce172ed3af7ac'

* commit '3d66717f7cb257244be8f5bce172ed3af7ac':
  examples/decode_audio: use the new audio decoding API

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d12d106775a5a821b3cb3aaaeadd8cb48f19550
---

 doc/examples/decode_audio.c | 43 ---
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index 8ad9f06..47c878d 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -42,29 +42,34 @@
 static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
FILE *outfile)
 {
-int len, got_frame;
+int i, ch;
+int ret, data_size;
 
-while (pkt->size > 0) {
-len = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
-if (len < 0) {
-fprintf(stderr, "Error while decoding\n");
+/* send the packet with the compressed data to the decoder */
+ret = avcodec_send_packet(dec_ctx, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error submitting the packet to the decoder\n");
+exit(1);
+}
+
+/* read all the output frames (in general there may be any number of them 
*/
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "Error during decoding\n");
 exit(1);
 }
-if (got_frame) {
-int i, ch;
-/* if a frame has been decoded, output it */
-int data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
-if (data_size < 0) {
-/* This should not occur, checking just for paranoia */
-fprintf(stderr, "Failed to calculate data size\n");
-exit(1);
-}
-for (i = 0; i < frame->nb_samples; i++)
-for (ch = 0; ch < dec_ctx->channels; ch++)
-fwrite(frame->data[ch] + data_size*i, 1, data_size, 
outfile);
+data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
+if (data_size < 0) {
+/* This should not occur, checking just for paranoia */
+fprintf(stderr, "Failed to calculate data size\n");
+exit(1);
 }
-pkt->size -= len;
-pkt->data += len;
+for (i = 0; i < frame->nb_samples; i++)
+for (ch = 0; ch < dec_ctx->channels; ch++)
+fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
 }
 }
 


==

diff --cc doc/examples/decode_audio.c
index 8ad9f06,5e128f8..47c878d
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@@ -42,29 -40,29 +42,34 @@@
  static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
 FILE *outfile)
  {
- int len, got_frame;
++int i, ch;
+ int ret, data_size;
  
- while (pkt->size > 0) {
- len = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
- if (len < 0) {
- fprintf(stderr, "Error while decoding\n");
+ /* send the packet with the compressed data to the decoder */
+ ret = avcodec_send_packet(dec_ctx, pkt);
+ if (ret < 0) {
+ fprintf(stderr, "Error submitting the packet to the decoder\n");
+ exit(1);
+ }
+ 
+ /* read all the output frames (in general there may be any number of them 
*/
+ while (ret >= 0) {
+ ret = avcodec_receive_frame(dec_ctx, frame);
+ if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ return;
+ else if (ret < 0) {
+ fprintf(stderr, "Error during decoding\n");
  exit(1);
  }
- if (got_frame) {
- int i, ch;
- /* if a frame has been decoded, output it */
- int data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
- if (data_size < 0) {
- /* This should not occur, checking just for paranoia */
- fprintf(stderr, "Failed to calculate data size\n");
- exit(1);
- }
- for (i = 0; i < frame->nb_samples; i++)
- for (ch = 0; ch < dec_ctx->channels; ch++)
- fwrite(frame->data[ch] + data_size*i, 1, data_size, 
outfile);
 -
 -data_size = av_samples_get_buffer_size(NULL, dec_ctx->channels,
 -   frame->nb_samples,
 -   dec_ctx->sample_fmt, 1);
 -fwrite(frame->data[0], 1, data_size, outfile);
++data_size = 

[FFmpeg-cvslog] examples/decode_audio: use the new audio decoding API

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [3d66717f7cb257244be8f5bce172ed3af7ac] | committer: 
Anton Khirnov

examples/decode_audio: use the new audio decoding API

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d66717f7cb257244be8f5bce172ed3af7ac
---

 doc/examples/decode_audio.c | 34 --
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index d2150a6..5e128f8 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -40,23 +40,29 @@
 static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
FILE *outfile)
 {
-int len, got_frame;
+int ret, data_size;
 
-while (pkt->size > 0) {
-len = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
-if (len < 0) {
-fprintf(stderr, "Error while decoding\n");
+/* send the packet with the compressed data to the decoder */
+ret = avcodec_send_packet(dec_ctx, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error submitting the packet to the decoder\n");
+exit(1);
+}
+
+/* read all the output frames (in general there may be any number of them 
*/
+while (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return;
+else if (ret < 0) {
+fprintf(stderr, "Error during decoding\n");
 exit(1);
 }
-if (got_frame) {
-/* if a frame has been decoded, output it */
-int data_size = av_samples_get_buffer_size(NULL, dec_ctx->channels,
-   frame->nb_samples,
-   dec_ctx->sample_fmt, 1);
-fwrite(frame->data[0], 1, data_size, outfile);
-}
-pkt->size -= len;
-pkt->data += len;
+
+data_size = av_samples_get_buffer_size(NULL, dec_ctx->channels,
+   frame->nb_samples,
+   dec_ctx->sample_fmt, 1);
+fwrite(frame->data[0], 1, data_size, outfile);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '0946c754d99c05413e813ee515039adcf0f9232a'

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:27:37 2017 +0200| [87e16e2b44584fdb4397b59cf59274e68a58fb7c] | committer: 
Clément Bœsch

Merge commit '0946c754d99c05413e813ee515039adcf0f9232a'

* commit '0946c754d99c05413e813ee515039adcf0f9232a':
  examples/decode_audio: use a parser for splitting the input

Merged-by: Clément Bœsch 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87e16e2b44584fdb4397b59cf59274e68a58fb7c
---

 doc/examples/decode_audio.c | 96 -
 1 file changed, 60 insertions(+), 36 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index 9cad373..8ad9f06 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -39,14 +39,46 @@
 #define AUDIO_INBUF_SIZE 20480
 #define AUDIO_REFILL_THRESH 4096
 
+static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
+   FILE *outfile)
+{
+int len, got_frame;
+
+while (pkt->size > 0) {
+len = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
+if (len < 0) {
+fprintf(stderr, "Error while decoding\n");
+exit(1);
+}
+if (got_frame) {
+int i, ch;
+/* if a frame has been decoded, output it */
+int data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
+if (data_size < 0) {
+/* This should not occur, checking just for paranoia */
+fprintf(stderr, "Failed to calculate data size\n");
+exit(1);
+}
+for (i = 0; i < frame->nb_samples; i++)
+for (ch = 0; ch < dec_ctx->channels; ch++)
+fwrite(frame->data[ch] + data_size*i, 1, data_size, 
outfile);
+}
+pkt->size -= len;
+pkt->data += len;
+}
+}
+
 int main(int argc, char **argv)
 {
 const char *outfilename, *filename;
 const AVCodec *codec;
 AVCodecContext *c= NULL;
-int len;
+AVCodecParserContext *parser = NULL;
+int len, ret;
 FILE *f, *outfile;
 uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
+uint8_t *data;
+size_t   data_size;
 AVPacket avpkt;
 AVFrame *decoded_frame = NULL;
 
@@ -69,6 +101,12 @@ int main(int argc, char **argv)
 exit(1);
 }
 
+parser = av_parser_init(codec->id);
+if (!parser) {
+fprintf(stderr, "Parser not found\n");
+exit(1);
+}
+
 c = avcodec_alloc_context3(codec);
 if (!c) {
 fprintf(stderr, "Could not allocate audio codec context\n");
@@ -93,12 +131,10 @@ int main(int argc, char **argv)
 }
 
 /* decode until eof */
-avpkt.data = inbuf;
-avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
-
-while (avpkt.size > 0) {
-int got_frame = 0;
+data  = inbuf;
+data_size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
 
+while (data_size > 0) {
 if (!decoded_frame) {
 if (!(decoded_frame = av_frame_alloc())) {
 fprintf(stderr, "Could not allocate audio frame\n");
@@ -106,39 +142,26 @@ int main(int argc, char **argv)
 }
 }
 
-len = avcodec_decode_audio4(c, decoded_frame, _frame, );
-if (len < 0) {
-fprintf(stderr, "Error while decoding\n");
+ret = av_parser_parse2(parser, c, , ,
+   data, data_size,
+   AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
+if (ret < 0) {
+fprintf(stderr, "Error while parsing\n");
 exit(1);
 }
-if (got_frame) {
-int i, ch;
-/* if a frame has been decoded, output it */
-int data_size = av_get_bytes_per_sample(c->sample_fmt);
-if (data_size < 0) {
-/* This should not occur, checking just for paranoia */
-fprintf(stderr, "Failed to calculate data size\n");
-exit(1);
-}
-for (i=0; inb_samples; i++)
-for (ch=0; chchannels; ch++)
-fwrite(decoded_frame->data[ch] + data_size*i, 1, 
data_size, outfile);
-}
-avpkt.size -= len;
-avpkt.data += len;
-avpkt.dts =
-avpkt.pts = AV_NOPTS_VALUE;
-if (avpkt.size < AUDIO_REFILL_THRESH) {
-/* Refill the input buffer, to avoid trying to decode
- * incomplete frames. Instead of this, one could also use
- * a parser, or use a proper container format through
- * libavformat. */
-memmove(inbuf, avpkt.data, avpkt.size);
-avpkt.data = inbuf;
-len = fread(avpkt.data + avpkt.size, 1,
-AUDIO_INBUF_SIZE - avpkt.size, f);
+data  += ret;
+data_size -= ret;
+
+if (avpkt.size)
+decode(c, , decoded_frame, outfile);
+
+if (data_size < 

[FFmpeg-cvslog] examples/decode_audio: use a parser for splitting the input

2017-04-04 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct 19 
21:56:22 2016 +0200| [0946c754d99c05413e813ee515039adcf0f9232a] | committer: 
Anton Khirnov

examples/decode_audio: use a parser for splitting the input

Do not rely on the decoder handling this, as it's not guaranteed to
work.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0946c754d99c05413e813ee515039adcf0f9232a
---

 doc/examples/decode_audio.c | 82 +
 1 file changed, 54 insertions(+), 28 deletions(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index b56a5ee..d2150a6 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -37,14 +37,40 @@
 #define AUDIO_INBUF_SIZE 20480
 #define AUDIO_REFILL_THRESH 4096
 
+static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
+   FILE *outfile)
+{
+int len, got_frame;
+
+while (pkt->size > 0) {
+len = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
+if (len < 0) {
+fprintf(stderr, "Error while decoding\n");
+exit(1);
+}
+if (got_frame) {
+/* if a frame has been decoded, output it */
+int data_size = av_samples_get_buffer_size(NULL, dec_ctx->channels,
+   frame->nb_samples,
+   dec_ctx->sample_fmt, 1);
+fwrite(frame->data[0], 1, data_size, outfile);
+}
+pkt->size -= len;
+pkt->data += len;
+}
+}
+
 int main(int argc, char **argv)
 {
 const char *outfilename, *filename;
 const AVCodec *codec;
 AVCodecContext *c= NULL;
-int len;
+AVCodecParserContext *parser = NULL;
+int len, ret;
 FILE *f, *outfile;
 uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
+uint8_t *data;
+size_t   data_size;
 AVPacket avpkt;
 AVFrame *decoded_frame = NULL;
 
@@ -67,6 +93,12 @@ int main(int argc, char **argv)
 exit(1);
 }
 
+parser = av_parser_init(codec->id);
+if (!parser) {
+fprintf(stderr, "parser not found\n");
+exit(1);
+}
+
 c = avcodec_alloc_context3(codec);
 
 /* open it */
@@ -87,12 +119,10 @@ int main(int argc, char **argv)
 }
 
 /* decode until eof */
-avpkt.data = inbuf;
-avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
-
-while (avpkt.size > 0) {
-int got_frame = 0;
+data  = inbuf;
+data_size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
 
+while (data_size > 0) {
 if (!decoded_frame) {
 if (!(decoded_frame = av_frame_alloc())) {
 fprintf(stderr, "out of memory\n");
@@ -100,31 +130,26 @@ int main(int argc, char **argv)
 }
 }
 
-len = avcodec_decode_audio4(c, decoded_frame, _frame, );
-if (len < 0) {
-fprintf(stderr, "Error while decoding\n");
+ret = av_parser_parse2(parser, c, , ,
+   data, data_size,
+   AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
+if (ret < 0) {
+fprintf(stderr, "Error while parsing\n");
 exit(1);
 }
-if (got_frame) {
-/* if a frame has been decoded, output it */
-int data_size = av_samples_get_buffer_size(NULL, c->channels,
-   
decoded_frame->nb_samples,
-   c->sample_fmt, 1);
-fwrite(decoded_frame->data[0], 1, data_size, outfile);
-}
-avpkt.size -= len;
-avpkt.data += len;
-if (avpkt.size < AUDIO_REFILL_THRESH) {
-/* Refill the input buffer, to avoid trying to decode
- * incomplete frames. Instead of this, one could also use
- * a parser, or use a proper container format through
- * libavformat. */
-memmove(inbuf, avpkt.data, avpkt.size);
-avpkt.data = inbuf;
-len = fread(avpkt.data + avpkt.size, 1,
-AUDIO_INBUF_SIZE - avpkt.size, f);
+data  += ret;
+data_size -= ret;
+
+if (avpkt.size)
+decode(c, , decoded_frame, outfile);
+
+if (data_size < AUDIO_REFILL_THRESH) {
+memmove(inbuf, data, data_size);
+data = inbuf;
+len = fread(data + data_size, 1,
+AUDIO_INBUF_SIZE - data_size, f);
 if (len > 0)
-avpkt.size += len;
+data_size += len;
 }
 }
 
@@ -132,6 +157,7 @@ int main(int argc, char **argv)
 fclose(f);
 
 avcodec_free_context();
+av_parser_close(parser);
 av_frame_free(_frame);
 
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org

[FFmpeg-cvslog] examples/decode_audio: reduce the scope of 2 variables

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
11:17:35 2017 +0200| [34ec327f693ac1ad17c522e89ebff2b8c57d9b34] | committer: 
Clément Bœsch

examples/decode_audio: reduce the scope of 2 variables

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34ec327f693ac1ad17c522e89ebff2b8c57d9b34
---

 doc/examples/decode_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index add0e31..9cad373 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -97,7 +97,6 @@ int main(int argc, char **argv)
 avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
 
 while (avpkt.size > 0) {
-int i, ch;
 int got_frame = 0;
 
 if (!decoded_frame) {
@@ -113,6 +112,7 @@ int main(int argc, char **argv)
 exit(1);
 }
 if (got_frame) {
+int i, ch;
 /* if a frame has been decoded, output it */
 int data_size = av_get_bytes_per_sample(c->sample_fmt);
 if (data_size < 0) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavc: add AV_ prefix to CODEC_CAP_DELAY in doxy

2017-04-04 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Tue Apr  4 
09:58:29 2017 +0200| [8c5c6871ba677fee59808fa9231e7f39a1cd75f0] | committer: 
Clément Bœsch

lavc: add AV_ prefix to CODEC_CAP_DELAY in doxy

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c5c6871ba677fee59808fa9231e7f39a1cd75f0
---

 libavcodec/avcodec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 377aa53..4b7c3f1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4902,13 +4902,13 @@ int avcodec_decode_video2(AVCodecContext *avctx, 
AVFrame *picture,
  * and reusing a get_buffer written for video codecs would probably perform 
badly
  * due to a potentially very different allocation pattern.
  *
- * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between 
input
  * and output. This means that for some packets they will not immediately
  * produce decoded output and need to be flushed at the end of decoding to get
  * all the decoded data. Flushing is done by calling this function with packets
  * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
  * returning subtitles. It is safe to flush even those decoders that are not
- * marked with CODEC_CAP_DELAY, then no subtitles will be returned.
+ * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
  *
  * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  * before packets may be fed to the decoder.

___
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

2017-04-04 Thread Matthieu Bouron
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] stdatomic/win32: only include the lean windows headers to avoid conflicts

2017-04-04 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Apr  4 
09:33:23 2017 +0200| [9ac1e884365314765f75517e91563be0351f6bd1] | committer: 
Hendrik Leppkes

stdatomic/win32: only include the lean windows headers to avoid conflicts

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ac1e884365314765f75517e91563be0351f6bd1
---

 compat/atomics/win32/stdatomic.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h
index fa7ef51..092f453 100644
--- a/compat/atomics/win32/stdatomic.h
+++ b/compat/atomics/win32/stdatomic.h
@@ -19,6 +19,7 @@
 #ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
 #define COMPAT_ATOMICS_WIN32_STDATOMIC_H
 
+#define WIN32_LEAN_AND_MEAN
 #include 
 #include 
 #include 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] doc/muxers: fix default value for image2 option start_number.

2017-04-04 Thread Nicolas George
ffmpeg | branch: master | Nicolas George  | Mon Apr  3 
12:13:30 2017 +0200| [0c20f9fcab41fe7468a898919d2e3cf7bb6b432a] | committer: 
Nicolas George

doc/muxers: fix default value for image2 option start_number.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c20f9fcab41fe7468a898919d2e3cf7bb6b432a
---

 doc/muxers.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 166c929..844bbce 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -794,7 +794,7 @@ ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 
"%Y-%m-%d_%H-%M-%S.jpg"
 
 @table @option
 @item start_number
-Start the sequence from the specified number. Default value is 0.
+Start the sequence from the specified number. Default value is 1.
 
 @item update
 If set to 1, the filename will always be interpreted as just a

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] ffprobe: port to new decode API

2017-04-04 Thread wm4
ffmpeg | branch: master | wm4  | Thu Mar 30 16:58:04 
2017 +0200| [2a88ebd096f3c748a2d99ed1b60b22879b3c567c] | committer: wm4

ffprobe: port to new decode API

Not sure if it behaves ideally in presence of decoding errors.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a88ebd096f3c748a2d99ed1b60b22879b3c567c
---

 ffprobe.c | 42 +-
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 3567468..0a9ba14 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2130,7 +2130,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 
 static av_always_inline int process_frame(WriterContext *w,
   InputFile *ifile,
-  AVFrame *frame, AVPacket *pkt)
+  AVFrame *frame, AVPacket *pkt,
+  int *packet_new)
 {
 AVFormatContext *fmt_ctx = ifile->fmt_ctx;
 AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
@@ -2142,24 +2143,39 @@ static av_always_inline int process_frame(WriterContext 
*w,
 if (dec_ctx && dec_ctx->codec) {
 switch (par->codec_type) {
 case AVMEDIA_TYPE_VIDEO:
-ret = avcodec_decode_video2(dec_ctx, frame, _frame, pkt);
-break;
-
 case AVMEDIA_TYPE_AUDIO:
-ret = avcodec_decode_audio4(dec_ctx, frame, _frame, pkt);
+if (*packet_new) {
+ret = avcodec_send_packet(dec_ctx, pkt);
+if (ret == AVERROR(EAGAIN)) {
+ret = 0;
+} else if (ret >= 0 || ret == AVERROR_EOF) {
+ret = 0;
+*packet_new = 0;
+}
+}
+if (ret >= 0) {
+ret = avcodec_receive_frame(dec_ctx, frame);
+if (ret >= 0) {
+got_frame = 1;
+} else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
+ret = 0;
+}
+}
 break;
 
 case AVMEDIA_TYPE_SUBTITLE:
 ret = avcodec_decode_subtitle2(dec_ctx, , _frame, pkt);
+*packet_new = 0;
 break;
+default:
+*packet_new = 0;
 }
+} else {
+*packet_new = 0;
 }
 
 if (ret < 0)
 return ret;
-ret = FFMIN(ret, pkt->size); /* guard against bogus return values */
-pkt->data += ret;
-pkt->size -= ret;
 if (got_frame) {
 int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
 nb_streams_frames[pkt->stream_index]++;
@@ -2171,7 +2187,7 @@ static av_always_inline int process_frame(WriterContext 
*w,
 if (is_sub)
 avsubtitle_free();
 }
-return got_frame;
+return got_frame || *packet_new;
 }
 
 static void log_read_interval(const ReadInterval *interval, void *log_ctx, int 
log_level)
@@ -2202,7 +2218,7 @@ static int read_interval_packets(WriterContext *w, 
InputFile *ifile,
  const ReadInterval *interval, int64_t *cur_ts)
 {
 AVFormatContext *fmt_ctx = ifile->fmt_ctx;
-AVPacket pkt, pkt1;
+AVPacket pkt;
 AVFrame *frame = NULL;
 int ret = 0, i = 0, frame_count = 0;
 int64_t start = -INT64_MAX, end = interval->end;
@@ -2279,8 +2295,8 @@ static int read_interval_packets(WriterContext *w, 
InputFile *ifile,
 nb_streams_packets[pkt.stream_index]++;
 }
 if (do_read_frames) {
-pkt1 = pkt;
-while (pkt1.size && process_frame(w, ifile, frame, ) > 0);
+int packet_new = 1;
+while (process_frame(w, ifile, frame, , _new) > 0);
 }
 }
 av_packet_unref();
@@ -2292,7 +2308,7 @@ static int read_interval_packets(WriterContext *w, 
InputFile *ifile,
 for (i = 0; i < fmt_ctx->nb_streams; i++) {
 pkt.stream_index = i;
 if (do_read_frames)
-while (process_frame(w, ifile, frame, ) > 0);
+while (process_frame(w, ifile, frame, , &(int){1}) > 0);
 }
 
 end:

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog