Quoting Vittorio Giovara (2014-10-30 01:51:54)
> Add one extra element to allow space for the insert.
> 
> CC: [email protected]
> Bug-Id: CID 732253 / CID 732254
> ---
>  libavcodec/motion_est_template.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/motion_est_template.c 
> b/libavcodec/motion_est_template.c
> index 01936c6..d125151 100644
> --- a/libavcodec/motion_est_template.c
> +++ b/libavcodec/motion_est_template.c
> @@ -255,10 +255,10 @@ static int qpel_motion_search(MpegEncContext * s,
>          const int r= score_map[(index+ 1                 )&(ME_MAP_SIZE-1)];
>          const int b= score_map[(index+(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];
>          const int c= score_map[(index                    )&(ME_MAP_SIZE-1)];
> -        int best[8];
> -        int best_pos[8][2];
> +        int best[9];
> +        int best_pos[9][2];
>  
> -        memset(best, 64, sizeof(int)*8);
> +        memset(best, 64, sizeof(int) * FF_ARRAY_ELEMS(best));
>          if(s->me.dia_size>=2){
>              const int tl= 
> score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
>              const int bl= 
> score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
> @@ -281,7 +281,7 @@ static int qpel_motion_search(MpegEncContext * s,
>  //                    if(nx&1) score-=1024*c->penalty_factor;
>  //                    if(ny&1) score-=1024*c->penalty_factor;
>  
> -                    for(i=0; i<8; i++){
> +                    for (i = 0; i < FF_ARRAY_ELEMS(best) - 1; i++) {
>                          if(score < best[i]){
>                              memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
>                              memmove(&best_pos[i+1][0], &best_pos[i][0], 
> sizeof(int)*2*(7-i));
> @@ -328,7 +328,7 @@ static int qpel_motion_search(MpegEncContext * s,
>  //                    if(nx&1) score-=32*c->penalty_factor;
>    //                  if(ny&1) score-=32*c->penalty_factor;
>  
> -                    for(i=0; i<8; i++){
> +                    for (i = 0; i < FF_ARRAY_ELEMS(best) - 1; i++) {
>                          if(score < best[i]){
>                              memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
>                              memmove(&best_pos[i+1][0], &best_pos[i][0], 
> sizeof(int)*2*(7-i));
> -- 
> 1.9.3 (Apple Git-50)
> 

Eh? Space for what? When i == 7, the memmove size is 0, so it's a no-op.

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

Reply via email to