Hi.
On Sat, Dec 17, 2011 at 6:23 PM, Nathan Maxson <[email protected]>wrote:
> [..]
> #define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
> #define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
So these can also be changed - please put spaces around all operands, and
also a space between "(int)" and the "(..." behind it.
> -static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int
num_pixels, const uint8_t *palette)
> +static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int
num_pixels,
> + const uint8_t *palette)
> {
> int i;
> - for (i=0; i<num_pixels; i++)
> - ((uint32_t *) dst)[i] = ((const uint32_t *)palette)[src[i<<1]] |
(src[(i<<1)+1] << 24);
> + for (i = 0; i < num_pixels; i++)
> + ((uint32_t *) dst)[i] = ((const uint32_t *)palette)[src[i << 1]]
| (src[(i << 1) + 1] << 24);
> }
"((const uint32_T *) palette)[...", i.e. space between cast and variable.
> -static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int
num_pixels, const uint8_t *palette)
> +static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int
num_pixels,
> + const uint8_t *palette)
> {
> int i;
>
> - for (i=0; i<num_pixels; i++)
> - ((uint32_t *) dst)[i] = ((const uint32_t *)palette)[src[i<<1]] |
src[(i<<1)+1];
> + for (i = 0; i < num_pixels; i++)
> + ((uint32_t *) dst)[i] = ((const uint32_t *)palette)[src[i << 1]]
| src[(i << 1) + 1];
> }
Same.
> +static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int
srcStride[],
> + int srcSliceY, int srcSliceH, uint8_t *dst[],
> + int dstStride[])
[..]
> - uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
> - const uint8_t *srcPtr= src[0];
> + uint8_t * dstPtr = dst[0] + dstStride[0] * srcSliceY;
No space between "*" and variable name.
> +static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int
srcStride[],
> + int srcSliceY, int srcSliceH, uint8_t *dst[],
> + int dstStride[])
[..]
> + switch(srcId | (dstId << 4)) {
Space between "switch" and "(".
> - } else if ( (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
> + } else if ( (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
> || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
} else if ((isBGRInInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
> + switch(srcId | (dstId << 4)) {
Space between "switch" and "(".
> +static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t *src[],
> + int srcStride[], int srcSliceY, int
srcSliceH,
> + uint8_t *dst[], int dstStride[])
[..]
> - dst[0]+ srcSliceY *dstStride[0],
> - dst[1]+(srcSliceY>>1)*dstStride[1],
> - dst[2]+(srcSliceY>>1)*dstStride[2],
> + dst[0]+ srcSliceY * dstStride[0],
> + dst[1]+(srcSliceY>>1) * dstStride[1],
> + dst[2]+(srcSliceY>>1) * dstStride[2],
Spaces around "+" and ">>".
> +static int packedCopyWrapper(SwsContext *c, const uint8_t *src[],
> + int srcStride[], int srcSliceY, int
srcSliceH,
> + uint8_t *dst[], int dstStride[])
[..]
> while(length+c->srcW <= FFABS(dstStride[0])
> - && length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW;
> - assert(length!=0);
> + && length+c->srcW <= FFABS(srcStride[0])) length += c->srcW;
while (length + c->srcW <= FFABS(dstStride[0]) &&
length + c->srcW <= FFABS(srcStride[0]))
length += c->srcW;
> +static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
> + int srcStride[], int srcSliceY, int
srcSliceH,
> + uint8_t *dst[], int dstStride[])
[..]
> - const int src_depth =
av_pix_fmt_descriptors[c->srcFormat].comp[plane].depth_minus1+1;
> - const int dst_depth =
av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1+1;
> - const uint16_t *srcPtr2 = (const uint16_t*)srcPtr;
> + const int src_depth =
av_pix_fmt_descriptors[c->srcFormat].comp[plane].depth_minus1 + 1;
> + const int dst_depth =
av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1 + 1;
> + const uint16_t *srcPtr2 = (const uint16_t *)srcPtr;
Space between cast and variable name.
> - uint16_t *dstPtr2 = (uint16_t*)dstPtr;
> + uint16_t *dstPtr2 = (uint16_t *)dstPtr;
Same.
> #define COPY9_OR_10TO16(rfunc, wfunc) \
> for (i = 0; i < height; i++) { \
> for (j = 0; j < length; j++) { \
> int srcpx = rfunc(&srcPtr2[j]); \
> - wfunc(&dstPtr2[j], (srcpx<<(16-src_depth)) |
(srcpx>>(2*src_depth-16))); \
> + wfunc(&dstPtr2[j], (srcpx << (16-src_depth))
| (srcpx>>(2 * src_depth-16))); \
Spaces around ">>".
> } else if (is9_OR_10BPS(c->dstFormat)) {
> - uint16_t *dstPtr2 = (uint16_t*)dstPtr;
> + uint16_t *dstPtr2 = (uint16_t *)dstPtr;
Space between cast and variable name.
> } else if(is9_OR_10BPS(c->dstFormat)) {
> - const int dst_depth =
av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1+1;
> - uint16_t *dstPtr2 = (uint16_t*)dstPtr;
> + const int dst_depth =
av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1 + 1;
> + uint16_t *dstPtr2 = (uint16_t *)dstPtr;
Space between cast and variable name.
> if (is16BPS(c->srcFormat)) {
> - const uint16_t *srcPtr2 = (const uint16_t*)srcPtr;
> + const uint16_t *srcPtr2 = (const uint16_t *)srcPtr;
Space between cast and variable name.
> @@ -630,9 +662,9 @@ static int planarCopyWrapper(SwsContext *c, const
uint8_t* src[], int srcStride[
> for (i = 0; i < height; i++) { \
> for (j = 0; j < length; j++) { \
> const int srcpx = srcPtr[j]; \
> - wfunc(&dstPtr2[j], (srcpx<<(dst_depth-8)) |
(srcpx >> (16-dst_depth))); \
> + wfunc(&dstPtr2[j], (srcpx << (dst_depth-8))
| (srcpx >> (16-dst_depth))); \
Spaces around "-".
} \
> } else if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) {
> - const uint16_t *srcPtr2 = (const uint16_t*)srcPtr;
> + const uint16_t *srcPtr2 = (const uint16_t *)srcPtr;
Space between cast and variable name.
> } else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)
> - && isBE(c->srcFormat) != isBE(c->dstFormat)) {
> + && isBE(c->srcFormat) != isBE(c->dstFormat)) {
&& goes a line above, see earlier comments.
> - for (i=0; i<height; i++) {
> - for (j=0; j<length; j++)
> - ((uint16_t*)dstPtr)[j] = av_bswap16(((const
uint16_t*)srcPtr)[j]);
> - srcPtr+= srcStride[plane];
> - dstPtr+= dstStride[plane];
> + for (i = 0; i < height; i++) {
> + for (j = 0; j < length; j++)
> + ((uint16_t *)dstPtr)[j] = av_bswap16(((const
uint16_t *)srcPtr)[j]);
Space between cast and variable name.
> /* yv12_to_nv12 */
> - if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P)
&& (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
> - c->swScale= planarToNv12Wrapper;
> + if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P)
> + && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
&& goes a line above.
> /* yuv2bgr */
> - if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P ||
srcFormat==PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
> - && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
> - c->swScale= ff_yuv2rgb_get_func_ptr(c);
> + if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUV422P
> + || srcFormat == PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
> + && !(flags & SWS_ACCURATE_RND) && !(dstH & 1)) {
See above.
> - if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P ||
dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
> - c->swScale= yvu9ToYv12Wrapper;
> + if (srcFormat == PIX_FMT_YUV410P
> + && (dstFormat == PIX_FMT_YUV420P || dstFormat ==
PIX_FMT_YUVA420P)
> + && !(flags & SWS_BITEXACT)) {
See above.
> - if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P ||
dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
> - c->swScale= bgr24ToYv12Wrapper;
> + if (srcFormat == PIX_FMT_BGR24
> + && (dstFormat == PIX_FMT_YUV420P || dstFormat ==
PIX_FMT_YUVA420P)
> + && !(flags & SWS_ACCURATE_RND))
See above.
> - if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P ||
dstFormat == PIX_FMT_YUVA420P))
> - c->swScale= yuyvToYuv420Wrapper;
> - if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P ||
dstFormat == PIX_FMT_YUVA420P))
> - c->swScale= uyvyToYuv420Wrapper;
> + if(srcFormat == PIX_FMT_YUYV422
> + && (dstFormat == PIX_FMT_YUV420P || dstFormat ==
PIX_FMT_YUVA420P))
> + c->swScale = yuyvToYuv420Wrapper;
> + if(srcFormat == PIX_FMT_UYVY422
> + && (dstFormat == PIX_FMT_YUV420P || dstFormat ==
PIX_FMT_YUVA420P))
See above for each.
> /* simple copy */
> - if ( srcFormat == dstFormat
> + if ( srcFormat == dstFormat
> || (srcFormat == PIX_FMT_YUVA420P && dstFormat ==
PIX_FMT_YUV420P)
> || (srcFormat == PIX_FMT_YUV420P && dstFormat ==
PIX_FMT_YUVA420P)
> || (isPlanarYUV(srcFormat) && isGray(dstFormat))
|| goes a line above.
> && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
&& above.
> +int attribute_align_arg sws_scale(struct SwsContext *c,
> + const uint8_t * const srcSlice[],
> + const int srcStride[], int srcSliceY,
> + int srcSliceH, uint8_t *const dst[],
> + const int dstStride[])
> {
> int i;
> - const uint8_t* src2[4]= {srcSlice[0], srcSlice[1], srcSlice[2],
srcSlice[3]};
> - uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
> + const uint8_t *src2[4]= {srcSlice[0], srcSlice[1], srcSlice[2],
srcSlice[3]};
> + uint8_t *dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
{ dst[0], dst[1], dst[2], dst[3] };
> - p=((const uint32_t*)(srcSlice[1]))[i];
> - r= (p>>16)&0xFF;
> - g= (p>> 8)&0xFF;
> - b= p &0xFF;
> + p = ((const uint32_t *)(srcSlice[1]))[i];
> + r = (p >> 16)&0xFF;
> + g = (p >> 8)&0xFF;
> + b = p &0xFF;
Spaces around "&".
> - r= (i>>5 )*36;
> - g= ((i>>2)&7)*36;
> - b= (i&3 )*85;
> + r = (i >> 5 ) * 36;
> + g = ((i >> 2)&7) * 36;
> + b = (i&3 ) * 85;
Spaces around "&", and try to vertically align the "i" and "&". Same for
the rest in this function.
> - y= av_clip_uint8((RY*r + GY*g + BY*b + (
33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
> - u= av_clip_uint8((RU*r + GU*g + BU*b +
(257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
> - v= av_clip_uint8((RV*r + GV*g + BV*b +
(257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
> - c->pal_yuv[i]= y + (u<<8) + (v<<16);
> + y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33 <<
(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT);
> + u = av_clip_uint8((RU * r + GU * g + BU * b + (257 <<
(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT);
> + v = av_clip_uint8((RV * r + GV * g + BV * b + (257 <<
(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT);
Spaces around "-".
> - int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2],
srcStride[3]};
> - int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2],
dstStride[3]};
> + int srcStride2[4] = {srcStride[0], srcStride[1], srcStride[2],
> + srcStride[3]};
> + int dstStride2[4] = {dstStride[0], dstStride[1], dstStride[2],
> + dstStride[3]};
Space between { and variable name.
> - reset_ptr((const uint8_t**)dst2, c->dstFormat);
> + reset_ptr((const uint8_t **)dst2, c->dstFormat);
Space between cast and variable name.
> - int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2],
-srcStride[3]};
> - int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2],
-dstStride[3]};
> + int srcStride2[4] = {-srcStride[0], -srcStride[1], -srcStride[2],
> + -srcStride[3]};
> + int dstStride2[4] = {-dstStride[0], -dstStride[1], -dstStride[2],
> + -dstStride[3]};
See above.
> - src2[0] += (srcSliceH-1)*srcStride[0];
> + src2[0] += (srcSliceH-1) * srcStride[0];
Spaces around '-'.
> if (!usePal(c->srcFormat))
> - src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1];
> - src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2];
> - src2[3] += (srcSliceH-1)*srcStride[3];
> - dst2[0] += ( c->dstH -1)*dstStride[0];
> - dst2[1] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1];
> - dst2[2] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2];
> - dst2[3] += ( c->dstH -1)*dstStride[3];
> + src2[1] += ((srcSliceH>>c->chrSrcVSubSample) -1) *
srcStride[1];
Spaces around '>>', and space after '-'. Same below:
> + src2[2] += ((srcSliceH>>c->chrSrcVSubSample) -1) * srcStride[2];
> + src2[3] += (srcSliceH -1) * srcStride[3];
> + dst2[0] += ( c->dstH -1) * dstStride[0];
> + dst2[1] += ((c->dstH>>c->chrDstVSubSample)-1) * dstStride[1];
> + dst2[2] += ((c->dstH>>c->chrDstVSubSample)-1) * dstStride[2];
> + dst2[3] += ( c->dstH -1) * dstStride[3];
[..]
> - reset_ptr((const uint8_t**)dst2, c->dstFormat);
> + reset_ptr((const uint8_t **)dst2, c->dstFormat);
Space between cast and variable name.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel