Originally committed as revision 23940 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -36,7 +36,7 @@ |
| 36 | 36 |
#include "libswscale/swscale.h" |
| 37 | 37 |
#include "libavcodec/opt.h" |
| 38 | 38 |
#include "libavcodec/audioconvert.h" |
| 39 |
-#include "libavcodec/colorspace.h" |
|
| 39 |
+#include "libavutil/colorspace.h" |
|
| 40 | 40 |
#include "libavutil/fifo.h" |
| 41 | 41 |
#include "libavutil/pixdesc.h" |
| 42 | 42 |
#include "libavutil/avstring.h" |
| ... | ... |
@@ -24,12 +24,12 @@ |
| 24 | 24 |
#include <math.h> |
| 25 | 25 |
#include <limits.h> |
| 26 | 26 |
#include "libavutil/avstring.h" |
| 27 |
+#include "libavutil/colorspace.h" |
|
| 27 | 28 |
#include "libavutil/pixdesc.h" |
| 28 | 29 |
#include "libavformat/avformat.h" |
| 29 | 30 |
#include "libavdevice/avdevice.h" |
| 30 | 31 |
#include "libswscale/swscale.h" |
| 31 | 32 |
#include "libavcodec/audioconvert.h" |
| 32 |
-#include "libavcodec/colorspace.h" |
|
| 33 | 33 |
#include "libavcodec/opt.h" |
| 34 | 34 |
#include "libavcodec/avfft.h" |
| 35 | 35 |
|
| ... | ... |
@@ -31,7 +31,7 @@ |
| 31 | 31 |
|
| 32 | 32 |
#define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 | 33 |
#define LIBAVCODEC_VERSION_MINOR 78 |
| 34 |
-#define LIBAVCODEC_VERSION_MICRO 0 |
|
| 34 |
+#define LIBAVCODEC_VERSION_MICRO 1 |
|
| 35 | 35 |
|
| 36 | 36 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 37 | 37 |
LIBAVCODEC_VERSION_MINOR, \ |
| 38 | 38 |
deleted file mode 100644 |
| ... | ... |
@@ -1,111 +0,0 @@ |
| 1 |
-/* |
|
| 2 |
- * Colorspace conversion defines |
|
| 3 |
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard |
|
| 4 |
- * |
|
| 5 |
- * This file is part of FFmpeg. |
|
| 6 |
- * |
|
| 7 |
- * FFmpeg is free software; you can redistribute it and/or |
|
| 8 |
- * modify it under the terms of the GNU Lesser General Public |
|
| 9 |
- * License as published by the Free Software Foundation; either |
|
| 10 |
- * version 2.1 of the License, or (at your option) any later version. |
|
| 11 |
- * |
|
| 12 |
- * FFmpeg is distributed in the hope that it will be useful, |
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 15 |
- * Lesser General Public License for more details. |
|
| 16 |
- * |
|
| 17 |
- * You should have received a copy of the GNU Lesser General Public |
|
| 18 |
- * License along with FFmpeg; if not, write to the Free Software |
|
| 19 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 20 |
- */ |
|
| 21 |
- |
|
| 22 |
-/** |
|
| 23 |
- * @file |
|
| 24 |
- * Various defines for YUV<->RGB conversion |
|
| 25 |
- */ |
|
| 26 |
- |
|
| 27 |
-#ifndef AVCODEC_COLORSPACE_H |
|
| 28 |
-#define AVCODEC_COLORSPACE_H |
|
| 29 |
- |
|
| 30 |
-#define SCALEBITS 10 |
|
| 31 |
-#define ONE_HALF (1 << (SCALEBITS - 1)) |
|
| 32 |
-#define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) |
|
| 33 |
- |
|
| 34 |
-#define YUV_TO_RGB1_CCIR(cb1, cr1)\ |
|
| 35 |
-{\
|
|
| 36 |
- cb = (cb1) - 128;\ |
|
| 37 |
- cr = (cr1) - 128;\ |
|
| 38 |
- r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\ |
|
| 39 |
- g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \ |
|
| 40 |
- ONE_HALF;\ |
|
| 41 |
- b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\ |
|
| 42 |
-} |
|
| 43 |
- |
|
| 44 |
-#define YUV_TO_RGB2_CCIR(r, g, b, y1)\ |
|
| 45 |
-{\
|
|
| 46 |
- y = ((y1) - 16) * FIX(255.0/219.0);\ |
|
| 47 |
- r = cm[(y + r_add) >> SCALEBITS];\ |
|
| 48 |
- g = cm[(y + g_add) >> SCALEBITS];\ |
|
| 49 |
- b = cm[(y + b_add) >> SCALEBITS];\ |
|
| 50 |
-} |
|
| 51 |
- |
|
| 52 |
-#define YUV_TO_RGB1(cb1, cr1)\ |
|
| 53 |
-{\
|
|
| 54 |
- cb = (cb1) - 128;\ |
|
| 55 |
- cr = (cr1) - 128;\ |
|
| 56 |
- r_add = FIX(1.40200) * cr + ONE_HALF;\ |
|
| 57 |
- g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\ |
|
| 58 |
- b_add = FIX(1.77200) * cb + ONE_HALF;\ |
|
| 59 |
-} |
|
| 60 |
- |
|
| 61 |
-#define YUV_TO_RGB2(r, g, b, y1)\ |
|
| 62 |
-{\
|
|
| 63 |
- y = (y1) << SCALEBITS;\ |
|
| 64 |
- r = cm[(y + r_add) >> SCALEBITS];\ |
|
| 65 |
- g = cm[(y + g_add) >> SCALEBITS];\ |
|
| 66 |
- b = cm[(y + b_add) >> SCALEBITS];\ |
|
| 67 |
-} |
|
| 68 |
- |
|
| 69 |
-#define Y_CCIR_TO_JPEG(y)\ |
|
| 70 |
- cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS] |
|
| 71 |
- |
|
| 72 |
-#define Y_JPEG_TO_CCIR(y)\ |
|
| 73 |
- (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) |
|
| 74 |
- |
|
| 75 |
-#define C_CCIR_TO_JPEG(y)\ |
|
| 76 |
- cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS] |
|
| 77 |
- |
|
| 78 |
-/* NOTE: the clamp is really necessary! */ |
|
| 79 |
-static inline int C_JPEG_TO_CCIR(int y) {
|
|
| 80 |
- y = (((y - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS); |
|
| 81 |
- if (y < 16) |
|
| 82 |
- y = 16; |
|
| 83 |
- return y; |
|
| 84 |
-} |
|
| 85 |
- |
|
| 86 |
- |
|
| 87 |
-#define RGB_TO_Y(r, g, b) \ |
|
| 88 |
-((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \ |
|
| 89 |
- FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS) |
|
| 90 |
- |
|
| 91 |
-#define RGB_TO_U(r1, g1, b1, shift)\ |
|
| 92 |
-(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + \ |
|
| 93 |
- FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 94 |
- |
|
| 95 |
-#define RGB_TO_V(r1, g1, b1, shift)\ |
|
| 96 |
-(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \ |
|
| 97 |
- FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 98 |
- |
|
| 99 |
-#define RGB_TO_Y_CCIR(r, g, b) \ |
|
| 100 |
-((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \ |
|
| 101 |
- FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) |
|
| 102 |
- |
|
| 103 |
-#define RGB_TO_U_CCIR(r1, g1, b1, shift)\ |
|
| 104 |
-(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \ |
|
| 105 |
- FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 106 |
- |
|
| 107 |
-#define RGB_TO_V_CCIR(r1, g1, b1, shift)\ |
|
| 108 |
-(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \ |
|
| 109 |
- FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 110 |
- |
|
| 111 |
-#endif /* AVCODEC_COLORSPACE_H */ |
| ... | ... |
@@ -27,7 +27,7 @@ |
| 27 | 27 |
#include "avfilter.h" |
| 28 | 28 |
#include "parseutils.h" |
| 29 | 29 |
#include "libavutil/pixdesc.h" |
| 30 |
-#include "libavcodec/colorspace.h" |
|
| 30 |
+#include "libavutil/colorspace.h" |
|
| 31 | 31 |
|
| 32 | 32 |
typedef struct {
|
| 33 | 33 |
int w, h; ///< output dimensions, a value of 0 will result in the input size |
| ... | ... |
@@ -41,7 +41,7 @@ |
| 41 | 41 |
|
| 42 | 42 |
#define LIBAVUTIL_VERSION_MAJOR 50 |
| 43 | 43 |
#define LIBAVUTIL_VERSION_MINOR 19 |
| 44 |
-#define LIBAVUTIL_VERSION_MICRO 0 |
|
| 44 |
+#define LIBAVUTIL_VERSION_MICRO 1 |
|
| 45 | 45 |
|
| 46 | 46 |
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 47 | 47 |
LIBAVUTIL_VERSION_MINOR, \ |
| 48 | 48 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,111 @@ |
| 0 |
+/* |
|
| 1 |
+ * Colorspace conversion defines |
|
| 2 |
+ * Copyright (c) 2001, 2002, 2003 Fabrice Bellard |
|
| 3 |
+ * |
|
| 4 |
+ * This file is part of FFmpeg. |
|
| 5 |
+ * |
|
| 6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
| 7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
| 8 |
+ * License as published by the Free Software Foundation; either |
|
| 9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
| 10 |
+ * |
|
| 11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
| 12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 14 |
+ * Lesser General Public License for more details. |
|
| 15 |
+ * |
|
| 16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
| 17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
| 18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 19 |
+ */ |
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * @file |
|
| 23 |
+ * Various defines for YUV<->RGB conversion |
|
| 24 |
+ */ |
|
| 25 |
+ |
|
| 26 |
+#ifndef AVUTIL_COLORSPACE_H |
|
| 27 |
+#define AVUTIL_COLORSPACE_H |
|
| 28 |
+ |
|
| 29 |
+#define SCALEBITS 10 |
|
| 30 |
+#define ONE_HALF (1 << (SCALEBITS - 1)) |
|
| 31 |
+#define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) |
|
| 32 |
+ |
|
| 33 |
+#define YUV_TO_RGB1_CCIR(cb1, cr1)\ |
|
| 34 |
+{\
|
|
| 35 |
+ cb = (cb1) - 128;\ |
|
| 36 |
+ cr = (cr1) - 128;\ |
|
| 37 |
+ r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\ |
|
| 38 |
+ g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \ |
|
| 39 |
+ ONE_HALF;\ |
|
| 40 |
+ b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\ |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+#define YUV_TO_RGB2_CCIR(r, g, b, y1)\ |
|
| 44 |
+{\
|
|
| 45 |
+ y = ((y1) - 16) * FIX(255.0/219.0);\ |
|
| 46 |
+ r = cm[(y + r_add) >> SCALEBITS];\ |
|
| 47 |
+ g = cm[(y + g_add) >> SCALEBITS];\ |
|
| 48 |
+ b = cm[(y + b_add) >> SCALEBITS];\ |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+#define YUV_TO_RGB1(cb1, cr1)\ |
|
| 52 |
+{\
|
|
| 53 |
+ cb = (cb1) - 128;\ |
|
| 54 |
+ cr = (cr1) - 128;\ |
|
| 55 |
+ r_add = FIX(1.40200) * cr + ONE_HALF;\ |
|
| 56 |
+ g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\ |
|
| 57 |
+ b_add = FIX(1.77200) * cb + ONE_HALF;\ |
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+#define YUV_TO_RGB2(r, g, b, y1)\ |
|
| 61 |
+{\
|
|
| 62 |
+ y = (y1) << SCALEBITS;\ |
|
| 63 |
+ r = cm[(y + r_add) >> SCALEBITS];\ |
|
| 64 |
+ g = cm[(y + g_add) >> SCALEBITS];\ |
|
| 65 |
+ b = cm[(y + b_add) >> SCALEBITS];\ |
|
| 66 |
+} |
|
| 67 |
+ |
|
| 68 |
+#define Y_CCIR_TO_JPEG(y)\ |
|
| 69 |
+ cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS] |
|
| 70 |
+ |
|
| 71 |
+#define Y_JPEG_TO_CCIR(y)\ |
|
| 72 |
+ (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) |
|
| 73 |
+ |
|
| 74 |
+#define C_CCIR_TO_JPEG(y)\ |
|
| 75 |
+ cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS] |
|
| 76 |
+ |
|
| 77 |
+/* NOTE: the clamp is really necessary! */ |
|
| 78 |
+static inline int C_JPEG_TO_CCIR(int y) {
|
|
| 79 |
+ y = (((y - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS); |
|
| 80 |
+ if (y < 16) |
|
| 81 |
+ y = 16; |
|
| 82 |
+ return y; |
|
| 83 |
+} |
|
| 84 |
+ |
|
| 85 |
+ |
|
| 86 |
+#define RGB_TO_Y(r, g, b) \ |
|
| 87 |
+((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \ |
|
| 88 |
+ FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS) |
|
| 89 |
+ |
|
| 90 |
+#define RGB_TO_U(r1, g1, b1, shift)\ |
|
| 91 |
+(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + \ |
|
| 92 |
+ FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 93 |
+ |
|
| 94 |
+#define RGB_TO_V(r1, g1, b1, shift)\ |
|
| 95 |
+(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \ |
|
| 96 |
+ FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 97 |
+ |
|
| 98 |
+#define RGB_TO_Y_CCIR(r, g, b) \ |
|
| 99 |
+((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \ |
|
| 100 |
+ FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) |
|
| 101 |
+ |
|
| 102 |
+#define RGB_TO_U_CCIR(r1, g1, b1, shift)\ |
|
| 103 |
+(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \ |
|
| 104 |
+ FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 105 |
+ |
|
| 106 |
+#define RGB_TO_V_CCIR(r1, g1, b1, shift)\ |
|
| 107 |
+(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \ |
|
| 108 |
+ FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) |
|
| 109 |
+ |
|
| 110 |
+#endif /* AVUTIL_COLORSPACE_H */ |