Hi,

On Fri, Dec 23, 2011 at 7:58 AM, Konstantin Todorov <[email protected]>wrote:
> +void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
[..]
> +        for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
>              int mb_x;
> -            for(mb_x=0; mb_x<s->mb_width; mb_x++){
> -                const int mb_index= mb_x + mb_y*s->mb_stride;
> -                if (s->avctx->debug_mv && pict->motion_val) {
> -                  int type;
> -                  for(type=0; type<3; type++){
> -                    int direction = 0;
> -                    switch (type) {
> -                      case 0: if
((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) ||
(pict->pict_type!=AV_PICTURE_TYPE_P))

Note how the indenting in the above is screwed up (2 spaces instead of 4),
and you're (good!) trying to fix that here:

> +            for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
> +                const int mb_index = mb_x + mb_y * s->mb_stride;
> +                if ((s->avctx->debug_mv) && pict->motion_val) {
> +                    int type;
> +                    for (type = 0; type < 3; type++) {
> +                        int direction = 0;
> +                        switch (type) {
> +                        case 0:
> +                            if ((!(s->avctx->debug_mv &
FF_DEBUG_VIS_MV_P_FOR)) ||
> +                                (pict->pict_type!= AV_PICTURE_TYPE_P))
>                                  continue;
> -                              direction = 0;
> -                              break;
> -                      case 1: if
((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_FOR)) ||
(pict->pict_type!=AV_PICTURE_TYPE_B))
> +                            direction = 0;
> +                            break;
> +                        case 1:
> +                            if ((!(s->avctx->debug_mv &
FF_DEBUG_VIS_MV_B_FOR)) ||
> +                                (pict->pict_type!= AV_PICTURE_TYPE_B))
>                                  continue;
> -                              direction = 0;
> -                              break;
> -                      case 2: if
((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_BACK)) ||
(pict->pict_type!=AV_PICTURE_TYPE_B))
> +                            direction = 0;
> +                            break;
> +                        case 2:
> +                            if ((!(s->avctx->debug_mv &
FF_DEBUG_VIS_MV_B_BACK)) ||
> +                                (pict->pict_type!= AV_PICTURE_TYPE_B))
>                                  continue;
> -                              direction = 1;
> -                              break;
> +                            direction = 1;
> +                            break;

Up until here all is good (I think). Now the next line:

>                      }

I don't think this is right. I'm pretty sure this is the closing bracket
for the "switch {" above, so it needs 4 more spaces, just like you added 4
more spaces to the "switch {" and everything in it. That also means that
everything after it needs 4 more spaces also:

> -                    if(!USES_LIST(pict->mb_type[mb_index], direction))
> +                    if (!USES_LIST(pict->mb_type[mb_index], direction))
>                          continue;
>
> -                    if(IS_8X8(pict->mb_type[mb_index])){
> -                      int i;
> -                      for(i=0; i<4; i++){
> -                        int sx= mb_x*16 + 4 + 8*(i&1);
> -                        int sy= mb_y*16 + 4 + 8*(i>>1);
> -                        int xy= (mb_x*2 + (i&1) + (mb_y*2 +
(i>>1))*mv_stride) << (mv_sample_log2-1);
> -                        int mx=
(pict->motion_val[direction][xy][0]>>shift) + sx;
> -                        int my=
(pict->motion_val[direction][xy][1]>>shift) + sy;
> -                        draw_arrow(ptr, sx, sy, mx, my, width, height,
s->linesize, 100);
> +                    if (IS_8X8(pict->mb_type[mb_index])) {
> +                        int i;
> +                        for (i = 0; i < 4; i++) {
> +                            int sx = mb_x * 16 + 4 + 8 * (i & 1);
> +                            int sy = mb_y * 16 + 4 + 8 * (i >> 1);
> +                            int xy = (mb_x * 2 + (i & 1) +
> +                                      (mb_y * 2 + (i >> 1)) * mv_stride)
<< (mv_sample_log2 - 1);
> +                            int mx = (pict->motion_val[direction][xy][0]
>> shift) + sx;
> +                            int my = (pict->motion_val[direction][xy][1]
>> shift) + sy;
> +                            draw_arrow(ptr, sx, sy, mx, my, width,
> +                                       height, s->linesize, 100);
>                        }
[etc.]
> +                    } else {
> +                          int sx = mb_x * 16 + 8;
> +                          int sy = mb_y * 16 + 8;
> +                          int xy = (mb_x + mb_y * mv_stride) <<
mv_sample_log2;
> +                          int mx = pict->motion_val[direction][xy][0] >>
shift + sx;
> +                          int my = pict->motion_val[direction][xy][1] >>
shift + sy;
> +                          draw_arrow(ptr, sx, sy, mx, my, width, height,
s->linesize, 100);
>                      }
>                    }
>                  }

All the way up until here, so that the closing brackets are like the
opening ones, with 4 spaces added per level.

The rest of the patch is roughly OK, except the beginning (which seems like
a rebasing issue), which I'll fix for you when I commit.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to