[FFmpeg-devel] [PATCH 1/4] Doxygen sws_getColorspaceDetails(), and use saner names for the used tables.
Stefano Sabatini
stefano.sabatini-lala
Sun May 23 12:06:42 CEST 2010
---
swscale.h | 22 +++++++++++++++++-----
utils.c | 18 +++++++++---------
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/swscale.h b/swscale.h
index f6e0ccf..888973c 100644
--- a/swscale.h
+++ b/swscale.h
@@ -205,12 +205,24 @@ int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
#endif
/**
- * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
- * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
- * @return -1 if not supported
+ * Sets the colorspace conversion coefficients to use for RGB to YUV
+ * and RGB to YUV conversion, and the filtering values applied to the
+ * output image.
+ *
+ * @param context the scaling context previously created with
+ * sws_getContext()
+ * @param yuvToRgbTable the YUV to RGB conversion coefficients, normally ff_yuv2rgb_coeffs[x].
+ You can get these coefficients also using sws_getCoefficients().
+ * @param srcRange if 1 then the luma range of the source format is 0..255, if 0 it is 16..235.
+ * This parameter is used only if the source format is in the YUV colorspace.
+ * @param rgbToYuvTable the RGB to YUV conversion coefficients
+ * @param dstRange if 1 then the luma range of the destination format is 0..255, if 0 it is 16..235.
+ * This parameter is used only if the source format is in the YUV colorspace.
+ * @return 0 in case of success, a negative error corresponding to an AVERROR code otherwise
*/
-int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
- int srcRange, const int table[4], int dstRange,
+int sws_setColorspaceDetails(struct SwsContext *context,
+ const int rgbToYuvTable[4], int srcRange,
+ const int yuvToRgbTable[4], int dstRange,
int brightness, int contrast, int saturation);
/**
diff --git a/utils.c b/utils.c
index 1755b14..804536c 100644
--- a/utils.c
+++ b/utils.c
@@ -679,17 +679,17 @@ static uint16_t roundToInt16(int64_t f)
else return r;
}
-int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
+int sws_setColorspaceDetails(SwsContext *c, const int yuvToRgbTable[4], int srcRange, const int rgbToYuvTable[4], int dstRange, int brightness, int contrast, int saturation)
{
- int64_t crv = inv_table[0];
- int64_t cbu = inv_table[1];
- int64_t cgu = -inv_table[2];
- int64_t cgv = -inv_table[3];
+ int64_t crv = yuvToRgbTable[0];
+ int64_t cbu = yuvToRgbTable[1];
+ int64_t cgu = -yuvToRgbTable[2];
+ int64_t cgv = -yuvToRgbTable[3];
int64_t cy = 1<<16;
int64_t oy = 0;
- memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
- memcpy(c->dstColorspaceTable, table, sizeof(int)*4);
+ memcpy(c->srcColorspaceTable, yuvToRgbTable, sizeof(int)*4);
+ memcpy(c->dstColorspaceTable, rgbToYuvTable, sizeof(int)*4);
c->brightness= brightness;
c->contrast = contrast;
@@ -733,12 +733,12 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
- ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
+ ff_yuv2rgb_c_init_tables(c, yuvToRgbTable, srcRange, brightness, contrast, saturation);
//FIXME factorize
#if HAVE_ALTIVEC
if (c->flags & SWS_CPU_CAPS_ALTIVEC)
- ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation);
+ ff_yuv2rgb_init_tables_altivec(c, yuvToRgbTable, brightness, contrast, saturation);
#endif
return 0;
}
--
1.7.1
More information about the ffmpeg-devel
mailing list