[FFmpeg-cvslog] imgconvert: avoid mixed declarations and code.

Clément Bœsch git at videolan.org
Thu Sep 1 20:26:44 CEST 2011


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Sep  1 02:01:54 2011 +0200| [f067d8a6186a3c2de43400295ac2978170e5b19d] | committer: Clément Bœsch

imgconvert: avoid mixed declarations and code.

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

 libavcodec/imgconvert.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 66ce9de..13c2cde 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -359,15 +359,17 @@ static int get_pix_fmt_depth(int *min, int *max, enum PixelFormat pix_fmt)
 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
                              int has_alpha)
 {
-    if (dst_pix_fmt>=PIX_FMT_NB || dst_pix_fmt<=PIX_FMT_NONE)
-        return ~0;
-
     const PixFmtInfo *pf, *ps;
-    const AVPixFmtDescriptor *src_desc = &av_pix_fmt_descriptors[src_pix_fmt];
-    const AVPixFmtDescriptor *dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt];
+    const AVPixFmtDescriptor *src_desc;
+    const AVPixFmtDescriptor *dst_desc;
     int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
     int ret, loss;
 
+    if (dst_pix_fmt >= PIX_FMT_NB || dst_pix_fmt <= PIX_FMT_NONE)
+        return ~0;
+
+    src_desc = &av_pix_fmt_descriptors[src_pix_fmt];
+    dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt];
     ps = &pix_fmt_info[src_pix_fmt];
 
     /* compute loss */



More information about the ffmpeg-cvslog mailing list