[FFmpeg-devel] [PATCH 1/1] Flip h.263 video stream for GEOX fourcc.

Jai Menon jmenon86
Sat May 22 19:23:06 CEST 2010


---
 libavcodec/h263dec.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index f5df556..da79cdc 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -36,10 +36,22 @@
 #include "vdpau_internal.h"
 #include "flv.h"
 #include "mpeg4video.h"
+#include "libavutil/pixdesc.h"
 
 //#define DEBUG
 //#define PRINT_FRAME_TIME
 
+static void flip(AVCodecContext *avctx, AVFrame *picture)
+{
+    int h = -((-avctx->height) >> av_pix_fmt_descriptors[avctx->pix_fmt].log2_chroma_h);
+    picture->data[0] += picture->linesize[0] * (avctx->height-1);
+    picture->data[1] += picture->linesize[1] * (h-1);
+    picture->data[2] += picture->linesize[2] * (h-1);
+    picture->linesize[0] *= -1;
+    picture->linesize[1] *= -1;
+    picture->linesize[2] *= -1;
+}
+
 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 {
     MpegEncContext *s = avctx->priv_data;
@@ -722,6 +734,9 @@ assert(s->current_picture.pict_type == s->pict_type);
 av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
 #endif
 
+    if (avctx->codec_tag == AV_RL32("GEOX")) {
+        flip(avctx, pict);
+    }
     return get_consumed_bytes(s, buf_size);
 }
 
-- 
1.7.0.5




More information about the ffmpeg-devel mailing list