On Fri, Jan 06, 2012 at 10:51:20PM -0600, Daniel Huang wrote:
> From 94791d26215d00780e01897ef3208258e0431a22 Mon Sep 17 00:00:00 2001
> From: Daniel Huang <[email protected]>
> Date: Fri, 6 Jan 2012 22:34:40 -0600
> Subject: [PATCH] mjpegdec K&R cosmetics cleanup
mjpegdec: K&R formatting cosmetics
You have trailing whitespace in your patch. Remove it.
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -140,19 +141,18 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
>
> //XXX FIXME finetune, and perhaps add dc too
> - s->qscale[index]= FFMAX(
> + s->qscale[index] = FFMAX(
> s->quant_matrixes[index][s->scantable.permutated[1]],
> s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
That line should not be broken after the '('.
> @@ -196,15 +196,15 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
>
> - if(class>0){
> + if (class > 0) {
> free_vlc(&s->vlcs[2][index]);
> - if(build_vlc(&s->vlcs[2][index], bits_table, val_table, code_max
> + 1, 0, 0) < 0){
> - return -1;
> - }
> + if (build_vlc(&s->vlcs[2][index], bits_table, val_table,
> + code_max + 1, 0, 0) < 0)
Indentation is off.
> @@ -216,12 +216,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
>
> /* XXX: verify len field validity */
> len = get_bits(&s->gb, 16);
> - s->bits= get_bits(&s->gb, 8);
> + s->bits = get_bits(&s->gb, 8);
align
> - if(s->pegasus_rct) s->bits=9;
> - if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
> + if (s->pegasus_rct)
> + s->bits = 9;
> + if (s->bits == 9 && !s->pegasus_rct)
> + s->rct = 1; //FIXME ugly
space after //
> @@ -230,25 +232,26 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
> return -1;
> - if (s->ls && !(s->bits <= 8 || nb_components == 1)){
> - av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component or 16-bit
> gray accepted for JPEG-LS\n");
> + if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
> + av_log(s->avctx, AV_LOG_ERROR,
> + "only <= 8 bits/component or 16-bit gray accepted for
> JPEG-LS\n");
Indentation is off.
> @@ -261,16 +264,17 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
> if (s->quant_index[i] >= 4)
> return -1;
> - av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d
> quant:%d\n", i, s->h_count[i],
> - s->v_count[i], s->component_id[i], s->quant_index[i]);
> + av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d
> quant:%d\n",
> + i, s->h_count[i], s->v_count[i], s->component_id[i],
> s->quant_index[i]);
ditto
> @@ -294,12 +298,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
>
> - s->qscale_table= av_mallocz((s->width+15)/16);
> + s->qscale_table = av_mallocz((s->width + 15)/16);
spaces around /
> @@ -338,42 +342,39 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
> - s->picture_ptr->pict_type= AV_PICTURE_TYPE_I;
> - s->picture_ptr->key_frame= 1;
> + s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
> + s->picture_ptr->key_frame = 1;
> s->got_picture = 1;
align
> // printf("%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0],
> s->linesize[1], s->interlaced, s->avctx->height);
Break this line.
> /* totally blank picture as progressive JPEG will only add details to it
> */
> - if(s->progressive){
> + if (s->progressive) {
> int bw = (width + s->h_max*8-1) / (s->h_max*8);
> int bh = (height + s->v_max*8-1) / (s->v_max*8);
spaces around operators
> @@ -390,14 +391,13 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext
> *s, int dc_index)
> {
> int code;
> code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);
> - if (code < 0)
> - {
> - av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d
> (%p)\n", 0, dc_index,
> - &s->vlcs[0][dc_index]);
> + if (code < 0) {
> + av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d
> (%p)\n",
> + 0, dc_index, &s->vlcs[0][dc_index]);
indentation
> @@ -427,13 +427,13 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM
> *block,
>
> i += ((unsigned)code) >> 4;
> code &= 0xf;
> - if(code){
> - if(code > MIN_CACHE_BITS - 16){
> + if (code) {
> + if (code > MIN_CACHE_BITS - 16) {
> UPDATE_CACHE(re, &s->gb);
> }
> {
> - int cache=GET_CACHE(re,&s->gb);
> - int sign=(~cache)>>31;
> + int cache = GET_CACHE(re, &s->gb);
> + int sign = (~cache) >> 31;
> level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
align
> @@ -530,52 +530,52 @@ static int decode_block_progressive(MJpegDecodeContext
> *s, DCTELEM *block, uint8
>
> #define ZERO_RUN \
> -for(;;i++) {\
> - if(i > last) {\
> +for (; ; i++) {\
> + if (i > last) {\
> i += run;\
> - if(i > se) {\
> + if (i > se) {\
> av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);\
> return -1;\
> }\
> break;\
> }\
> j = s->scantable.permutated[i];\
> - if(block[j])\
> + if (block[j])\
> REFINE_BIT(j)\
> - else if(run-- == 0)\
> + else if (run-- == 0)\
> break;\
> }
Vertically align the \ to the right of this macro
> @@ -624,43 +624,45 @@ static int decode_block_refinement(MJpegDecodeContext
> *s, DCTELEM *block, uint8_
>
> -static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int
> point_transform){
> +static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int
> point_transform)
> +{
This line is too long, break it. There are more.
> - topleft[i]= top[i];
> - top[i]= buffer[mb_x][i];
> + topleft[i] = top[i];
> + top[i] = buffer[mb_x][i];
align
> @@ -669,20 +671,20 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s,
> int predictor, int point
>
> - if(s->rct){
> - for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
> - ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] +
> buffer[mb_x][2] - 0x200)>>2);
> + if (s->rct) {
> + for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
> + ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] +
> buffer[mb_x][2] - 0x200) >> 2);
> ptr[4*mb_x+0] = buffer[mb_x][1] + ptr[4*mb_x+1];
> ptr[4*mb_x+2] = buffer[mb_x][2] + ptr[4*mb_x+1];
spaces around operators
You get the idea. Review the rest of the file for similar mistakes
yourself, then send another fresh patch.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel