Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Schlaile <peter@schlaile.de>2013-04-14 17:44:04 +0400
committerPeter Schlaile <peter@schlaile.de>2013-04-14 17:44:04 +0400
commit1166609cd36af1ab43a1f5004afaac34bcc9d94a (patch)
tree1f8619732e620d78b5a3b1148cbddfdd96b1c0e3 /intern/ffmpeg/ffmpeg_compat.h
parent456f3b318aa6ce4af2f12844bd89532eabea3374 (diff)
== FFMPEG / Canon DSLR footage workaround ==
The latest ffmpeg versions include a workaround to deal with a certain pecularity in Canon DSLR footage: instead of decoding pictures with the proper resolution of 1920x1080 they decode it with 1920x1088 and add a black bar at the bottom. Needless to say, that this screws up things in a lot of areas within blender (proxy indices, mask animations etc.) Since all blender versions besides Linux x86 32bit seem still to include older ffmpeg versions which still contain this bug, this patch adds a workaround for older versions until we have all versions on all platforms up to date. See also: http://git.libav.org/?p=libav.git;a=commit;h=30f515091c323da59c0f1b533703dedca2f4b95d
Diffstat (limited to 'intern/ffmpeg/ffmpeg_compat.h')
-rw-r--r--intern/ffmpeg/ffmpeg_compat.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index aaedbe2dccd..cd56e3b28d2 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -72,11 +72,43 @@
#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
#endif
+#if ((LIBAVCODEC_VERSION_MAJOR > 54) || (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR > 14))
+#define FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
+#endif
+
#if ((LIBAVUTIL_VERSION_MAJOR > 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR >= 32))
#define FFMPEG_FFV1_ALPHA_SUPPORTED
#define FFMPEG_SAMPLE_FMT_S16P_SUPPORTED
#endif
+static inline
+int av_get_cropped_height_from_codec(AVCodecContext *pCodecCtx)
+{
+ int y = pCodecCtx->height;
+
+#ifndef FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
+/* really bad hack to remove this dreadfull black bar at the bottom
+ with Canon footage and old ffmpeg versions.
+ (to fix this properly in older ffmpeg versions one has to write a new
+ demuxer...)
+
+ see the actual fix here for reference:
+
+ http://git.libav.org/?p=libav.git;a=commit;h=30f515091c323da59c0f1b533703dedca2f4b95d
+
+ We do our best to apply this only to matching footage.
+*/
+ if (pCodecCtx->width == 1920 &&
+ pCodecCtx->height == 1088 &&
+ pCodecCtx->pix_fmt == PIX_FMT_YUVJ420P &&
+ pCodecCtx->codec_id == CODEC_ID_H264 ) {
+ y = 1080;
+ }
+#endif
+
+ return y;
+}
+
#if ((LIBAVUTIL_VERSION_MAJOR < 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR < 22))
static inline
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)