Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On Tue, 20 Sep 2016, Diego Biurrun wrote: ptrdiff_t is the correct type for array strides and similar. --- libavcodec/svq3.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) Ok // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On 22/09/16 19:24, Diego Biurrun wrote: > On Tue, Sep 20, 2016 at 10:21:40PM +0100, Mark Thompson wrote: >> On 20/09/16 22:07, Diego Biurrun wrote: >>> On Tue, Sep 20, 2016 at 09:22:06PM +0100, Mark Thompson wrote: On 20/09/16 19:36, Diego Biurrun wrote: > ptrdiff_t is the correct type for array strides and similar. > --- a/libavcodec/svq3.c > +++ b/libavcodec/svq3.c > @@ -118,8 +118,8 @@ typedef struct SVQ3Context { > int mb_x, mb_y; > int mb_xy; > int mb_width, mb_height; > -int mb_stride, mb_num; > -int b_stride; > +int mb_num; > +ptrdiff_t mb_stride, b_stride; mb_stride should stay an int. >>> >>> Why? >> >> It's used as: >> >> (a) an offset against the current macroblock for prediction modes. >> >> (b) a multiplier for y offsets to macroblock lines. >> >> (c) a size for macroblock lines. >> >> All of the other things there are ints (well, last one could be size_t), and >> have nothing to do with pointers. > > All of the above sounds stride-ish to me and we seem to use ptrdiff_t > for such variables elsewhere. Ame I wrong? Probably, I think Mark is the second person finding wrong using ptrdiff there. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On Tue, Sep 20, 2016 at 10:21:40PM +0100, Mark Thompson wrote: > On 20/09/16 22:07, Diego Biurrun wrote: > > On Tue, Sep 20, 2016 at 09:22:06PM +0100, Mark Thompson wrote: > >> On 20/09/16 19:36, Diego Biurrun wrote: > >>> ptrdiff_t is the correct type for array strides and similar. > >>> --- a/libavcodec/svq3.c > >>> +++ b/libavcodec/svq3.c > >>> @@ -118,8 +118,8 @@ typedef struct SVQ3Context { > >>> int mb_x, mb_y; > >>> int mb_xy; > >>> int mb_width, mb_height; > >>> -int mb_stride, mb_num; > >>> -int b_stride; > >>> +int mb_num; > >>> +ptrdiff_t mb_stride, b_stride; > >> > >> mb_stride should stay an int. > > > > Why? > > It's used as: > > (a) an offset against the current macroblock for prediction modes. > > (b) a multiplier for y offsets to macroblock lines. > > (c) a size for macroblock lines. > > All of the other things there are ints (well, last one could be size_t), and > have nothing to do with pointers. All of the above sounds stride-ish to me and we seem to use ptrdiff_t for such variables elsewhere. Ame I wrong? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On 20/09/16 22:07, Diego Biurrun wrote: > On Tue, Sep 20, 2016 at 09:22:06PM +0100, Mark Thompson wrote: >> On 20/09/16 19:36, Diego Biurrun wrote: >>> ptrdiff_t is the correct type for array strides and similar. >>> --- a/libavcodec/svq3.c >>> +++ b/libavcodec/svq3.c >>> @@ -118,8 +118,8 @@ typedef struct SVQ3Context { >>> int mb_x, mb_y; >>> int mb_xy; >>> int mb_width, mb_height; >>> -int mb_stride, mb_num; >>> -int b_stride; >>> +int mb_num; >>> +ptrdiff_t mb_stride, b_stride; >> >> mb_stride should stay an int. > > Why? It's used as: (a) an offset against the current macroblock for prediction modes. (b) a multiplier for y offsets to macroblock lines. (c) a size for macroblock lines. All of the other things there are ints (well, last one could be size_t), and have nothing to do with pointers. - Mark ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On Tue, Sep 20, 2016 at 09:22:06PM +0100, Mark Thompson wrote: > On 20/09/16 19:36, Diego Biurrun wrote: > > ptrdiff_t is the correct type for array strides and similar. > > --- a/libavcodec/svq3.c > > +++ b/libavcodec/svq3.c > > @@ -118,8 +118,8 @@ typedef struct SVQ3Context { > > int mb_x, mb_y; > > int mb_xy; > > int mb_width, mb_height; > > -int mb_stride, mb_num; > > -int b_stride; > > +int mb_num; > > +ptrdiff_t mb_stride, b_stride; > > mb_stride should stay an int. Why? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/14] svq3: Change type of array stride parameters to ptrdiff_t
On 20/09/16 19:36, Diego Biurrun wrote: > ptrdiff_t is the correct type for array strides and similar. > --- > libavcodec/svq3.c | 18 +- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c > index aa85e7c..bd83731 100644 > --- a/libavcodec/svq3.c > +++ b/libavcodec/svq3.c > @@ -118,8 +118,8 @@ typedef struct SVQ3Context { > int mb_x, mb_y; > int mb_xy; > int mb_width, mb_height; > -int mb_stride, mb_num; > -int b_stride; > +int mb_num; > +ptrdiff_t mb_stride, b_stride; mb_stride should stay an int. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel