Hi,
On Wed, Dec 21, 2011 at 8:06 AM, Yordan Makariev <[email protected]> wrote:
> @@ -69,7 +73,8 @@ double ff_timefilter_update(TimeFilter *self, double
> system_time, double period)
[..]
> /// update loop
> - self->cycle_time += FFMAX(self->feedback2_factor,
> 1.0/(self->count)) * loop_error;
> + self->cycle_time += FFMAX(self->feedback2_factor,
> + 1.0 / (self->count)) * loop_error;
"1.0" should vertically align with "self", given its context.
> -int main(void)
> +int main(void)
?
> + for (i = 0; i < SAMPLES; i++) {
> + ideal[i] = 10 + i + n1 * i / (1000);
> samples[i] = ideal[i] + n0 * (av_lfg_get(&prng) - LFG_MAX / 2)
> / (LFG_MAX * 10LL);
/ should go on previous line.
> + for (par0 = bestpar0 * 0.8; par0 <= bestpar0 * 1.21;
> + par0 += bestpar0 * 0.05) {
> + for(par1 = bestpar1 * 0.8; par1 <= bestpar1 * 1.21;
> + par1 += bestpar1 * 0.05) {
for (, note the space.
> + printf("%f %f %f %f\n", i - samples[i] + 10,
> + filtered - samples[i],
> + samples[FFMAX(i, 1)] - samples[FFMAX(i-1,
> 0)],
> + filtered - lastfil);
Vertically align each line with the first " on the first line.
> - c = (c>>1)^(poly & (-(c&1)));
> + c = (c >> 1) ^(poly & (-(c & 1)));
Spaces around ^.
> - c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );
> + c = (c << 1) ^((poly << (32 - bits)) & (((int32_t)c) >>
> 31));
Same.
> + for (j = 0; j < 3; j++)
> + ctx[256 *(j + 1) + i] =
> + (ctx[256 * j + i] >> 8) ^ctx[ctx[256 * j + i] & 0xFF];
Spaces around * in second line, and around ^ in third line.
> if (av_crc_init(av_crc_table[crc_id],
> - av_crc_table_params[crc_id].le,
> - av_crc_table_params[crc_id].bits,
> - av_crc_table_params[crc_id].poly,
> - sizeof(av_crc_table[crc_id])) < 0)
> + av_crc_table_params[crc_id].le,
> + av_crc_table_params[crc_id].bits,
> + av_crc_table_params[crc_id].poly,
> + sizeof(av_crc_table[crc_id])) < 0)
This was good originally.
> +uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
> + const uint8_t *buffer, size_t length)
[..]
> + if (!ctx[256]) {
> + while (((intptr_t) buffer & 3) && buffer < end)
> + crc = ctx[((uint8_t)crc) ^ *buffer++] ^(crc >> 8);
Spaces around ^.
> + while (buffer < end - 3) {
> + crc ^= av_le2ne32(*(const uint32_t*)buffer); buffer += 4;
> + crc = ctx[3 * 256 + ( crc & 0xFF)]
> + ^ ctx[2 * 256 + ((crc >> 8 ) & 0xFF)]
> + ^ ctx[1 * 256 + ((crc >> 16) & 0xFF)]
> + ^ ctx[0 * 256 + ((crc >> 24) )];
^ goes on previous line.
> - while(buffer<end)
> - crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
> + while (buffer<end)
Spaces around <.
> + crc = ctx[((uint8_t)crc) ^ *buffer++] ^(crc >> 8);
Space between cast and value ("((uint8t_t) crc)"), and around ^.
> diff --git a/libavutil/log.c b/libavutil/log.c
[..]
> +static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 9, 9 };
> +#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4,
> color[x]&15)
Spaces around &.
> +const char *av_default_item_name(void *ptr)
> +{
> return (*(AVClass**)ptr)->class_name;
Space between cast and value, and space between elementary type and
pointer indicator in cast, i.e. "(*(AVClass **) ptr)".
> + AVClass** parent = * (AVClass ***) (( (uint8_t *) ptr) +
Remove the space between 2 "("s.
> + avc->parent_log_context_offset);
> + if (parent && *parent) {
> + snprintf(line, sizeof(line), "[%s @ %p] ",
> + ( *parent )->item_name(parent), parent);
Vertically align "(*parent)" of second lines with "line" of first
line. Also remove spaces there.
> + level += *( int* )(( (uint8_t *) avcl) +
> avc->log_level_offset_offset);
Same.
> diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
[..]
> + if (last_t && fabs(t - last_t) > s || t == (clock_t) - 1) {
No space in negator, i.e. "(clock_t) -1".
> diff --git a/libavutil/rational.c b/libavutil/rational.c
[..]
> +int av_reduce (int *dst_num, int *dst_den,
> + int64_t num, int64_t den, int64_t max)
No space in function declaration ("int av_reduce(..").
> + if (den* (2 * x * a1.den + a0.den) > num * a1.den)
> + a1 = (AVRational) {x * a1.num + a0.num, x * a1.den + a0.den};
Space before last }.
> +AVRational av_mul_q(AVRational b, AVRational c)
> +{
> + av_reduce(&b.num, &b.den,
> + b.num * (int64_t)c.num,
> + b.den * (int64_t)c.den, INT_MAX);
Space between cast and value.
> +AVRational av_add_q(AVRational b, AVRational c) {
> + av_reduce(&b.num, &b.den,
> + b.num * (int64_t)c.den +
> + c.num * (int64_t)b.den,
> + b.den * (int64_t)c.den, INT_MAX);
Same.
> if (isinf(d))
> - return (AVRational){ d<0 ? -1:1, 0 };
> + return (AVRational) { d<0 ? -1 : 1, 0 };
Spaces around '<'.
> +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list)
[..]
> - for(i=0; q_list[i].den; i++)
> - if (av_nearer_q(q, q_list[i], q_list[nearest_q_idx]) > 0)
> + for(i = 0; q_list[i].den; i++)
> + if (av_nearer_q(q, q_list[i], q_list[nearest_q_idx]) > 0)f
f?
> diff --git a/libavutil/tree.c b/libavutil/tree.c
[..]
> +void *av_tree_insert(AVTreeNode **tp, void *key, int ( *cmp )(void *key,
> + const void *b), AVTreeNode **next)
"int (*cmp)(..)", and try to keep that on one line or at least
vertically aligned, e.g.:
void *av_tree_insert(AVTreeNode **tp, void *key,
int (*cmp)(void *key, const void *b),
AVTreeNode **next)
> /* The following code is equivalent to
> if((*child)->state*2 == -t->state)
Spaces around *.
> rotate(child, i^1);
Spaces around ^.
> + *tp = ( *child )->child[i ^ 1];
Remove spaces in (*child), same below (also for "(*tp)").
> + ( *child )->child[i ^ 1] = ( *tp )->child[i];
> + ( *tp )->child[i] = *child;
> + *child = ( *tp )->child[i ^ 1];
> + ( *tp )->child[i ^ 1] = t;
> +
> + ( *tp )->child[0]->state = -(( * tp)->state > 0);
> + ( *tp )->child[1]->state = ( * tp)->state < 0;
> + ( *tp )->state = 0;
> + } else {
> + *tp = *child;
> + *child = ( *child )->child[i ^ 1];
> + ( *tp )->child[i ^ 1] = t;
> + if (( *tp )->state) t->state = 0;
> + else t->state >> = 1;
> + ( *tp )->state = -t->state;
See above.
> - if(!(*tp)->state ^ !!*next)
> + if (!( *tp )->state ^ !!*next)
Same.
> + if ( *tp ) {
> + ( *tp )->elem = key;
See above.
> +void av_tree_enumerate(AVTreeNode *t, void *opaque,
> + int ( *cmp )(void *opaque, void *elem),
> + int ( *enu )(void *opaque, void *elem))
Remove spaces in "*cmp) and (*enu).
> - if(left>999 || right>999)
> + if (left>999 || right>999)
Spaces around >.
> - if(t->state>1 || t->state<-1)
> + if (t->state>1 || t->state<-1)
Same.
> +int main (void)
[..]
> - if(!node)
> - node= av_mallocz(av_tree_node_size);
> - av_tree_insert(&root, (void*)(j+1), cmp, &node);
> + if (!node)
> + node = av_mallocz(av_tree_node_size);
> + av_tree_insert(&root, ( void* )(j + 1), cmp, &node);
(void *) (j + 1).
> diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
[..]
> + uint8_t *srcBuffer = ( uint8_t* )av_malloc(SIZE);
> + uint8_t *dstBuffer = ( uint8_t* )av_malloc(SIZE);
Remove spaces in (uint8_t *) except between elementary type and
pointer indicator.
> - void (*func)(const uint8_t *src, uint8_t *dst, int src_size);
> + void ( *func )(const uint8_t *src, uint8_t *dst, int src_size);
(*func).
> diff --git a/libswscale/sparc/yuv2rgb_vis.c b/libswscale/sparc/yuv2rgb_vis.c
[..]
> @@ -122,11 +123,14 @@ static int vis_420P_ARGB32(SwsContext *c, uint8_t*
> src[], int srcStride[], int s
> "subcc %4, 8, %4 \n\t"
> "bne 1b \n\t"
> "add %3, 32, %3 \n\t" //delay slot
> - : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r"
> (out5), "=r" (out6)
> - : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1"
> (src[1]+((y+srcSliceY)>>1)*srcStride[1]),
> - "2" (src[2]+((y+srcSliceY)>>1)*srcStride[2]), "3"
> (dst[0]+(y+srcSliceY)*dstStride[0]),
> - "4" (c->dstW),
> - "5" (c->sparc_coeffs)
> + : "=r" (out1), "=r" (out2), "=r" (out3),
> + "=r" (out4), "=r" (out5), "=r" (out6)
> + : "0" (src[0] + (y + srcSliceY) * srcStride[0]),
> + "1" (src[1] + ((y + srcSliceY)>>1) * srcStride[1]),
> + "2" (src[2] + ((y + srcSliceY)>>1) * srcStride[2]),
Spaces around >>.
> +SwsFunc ff_yuv2rgb_init_vis(SwsContext *c)
[..]
> + c->sparc_coeffs[0] = (((int16_t)c->yOffset * (int16_t)c->yCoeff >>11) &
> + 0xffff) * 0x0001000100010001ULL;
Spaces right of >>. Same below.
> + c->sparc_coeffs[1] = (((int16_t)c->uOffset * (int16_t)c->ubCoeff>>11) &
> + 0xffff) * 0x0001000100010001ULL;
> + c->sparc_coeffs[2] = (((int16_t)c->uOffset * (int16_t)c->ugCoeff>>11) &
> + 0xffff) * 0x0001000100010001ULL;
> + c->sparc_coeffs[3] = (((int16_t)c->vOffset * (int16_t)c->vgCoeff>>11) &
> + 0xffff) * 0x0001000100010001ULL;
> + c->sparc_coeffs[4] = (((int16_t)c->vOffset * (int16_t)c->vrCoeff>>11) &
> + 0xffff) * 0x0001000100010001ULL;
See above. Also this looks quite weird, maybe break line at = instead of &?
> +
> + if (c->dstFormat == PIX_FMT_RGB32 &&
> + c->srcFormat == PIX_FMT_YUV422P &&
> + (c->dstW & 7) == 0) {
One more space indentation.
> - else if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat ==
> PIX_FMT_YUV420P && (c->dstW & 7)==0) {
> - av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV420P -> RGB32
> (WARNING: alpha value is wrong)\n");
> + else if (c->dstFormat == PIX_FMT_RGB32 &&
> + c->srcFormat == PIX_FMT_YUV420P &&
> + (c->dstW & 7) == 0) {
Same.
> + av_log(c, AV_LOG_INFO,
> + "SPARC VIS accelerated YUV420P -> RGB32"
> + "(WARNING: alpha value is wrong)\n");
> return vis_420P_ARGB32;
Vertically align string with "c" in first line.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel