diff options
author | Diego Biurrun <diego@biurrun.de> | 2016-09-01 22:18:22 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2016-09-29 17:54:23 +0200 |
commit | ba479f3daafc7e4359ec1212164569ebe59f0bb7 (patch) | |
tree | 872f7656fad3dd5e271b87642862f3baf59c2852 | |
parent | e4a94d8b36c48d95a7d412c40d7b558422ff659c (diff) | |
download | ffmpeg-streaming-ba479f3daafc7e4359ec1212164569ebe59f0bb7.zip ffmpeg-streaming-ba479f3daafc7e4359ec1212164569ebe59f0bb7.tar.gz |
hevc: Change type of array stride parameters to ptrdiff_t
ptrdiff_t is the correct type for array strides and similar.
-rw-r--r-- | libavcodec/hevc.c | 12 | ||||
-rw-r--r-- | libavcodec/hevc_filter.c | 4 | ||||
-rw-r--r-- | libavcodec/hevcdsp_template.c | 36 | ||||
-rw-r--r-- | tests/checkasm/hevc_mc.c | 16 |
4 files changed, 34 insertions, 34 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 961991f..e38d367 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -1437,11 +1437,11 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) HEVCLocalContext *lc = &s->HEVClc; GetBitContext gb; int cb_size = 1 << log2_cb_size; - int stride0 = s->frame->linesize[0]; + ptrdiff_t stride0 = s->frame->linesize[0]; + ptrdiff_t stride1 = s->frame->linesize[1]; + ptrdiff_t stride2 = s->frame->linesize[2]; uint8_t *dst0 = &s->frame->data[0][y0 * stride0 + (x0 << s->ps.sps->pixel_shift)]; - int stride1 = s->frame->linesize[1]; uint8_t *dst1 = &s->frame->data[1][(y0 >> s->ps.sps->vshift[1]) * stride1 + ((x0 >> s->ps.sps->hshift[1]) << s->ps.sps->pixel_shift)]; - int stride2 = s->frame->linesize[2]; uint8_t *dst2 = &s->frame->data[2][(y0 >> s->ps.sps->vshift[2]) * stride2 + ((x0 >> s->ps.sps->hshift[2]) << s->ps.sps->pixel_shift)]; int length = cb_size * cb_size * s->ps.sps->pcm.bit_depth + ((cb_size * cb_size) >> 1) * s->ps.sps->pcm.bit_depth_chroma; @@ -1520,7 +1520,7 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride, if (x_off < extra_left || y_off < extra_top || x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] || y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) { - const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; + const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset = extra_top * srcstride + (extra_left << s->ps.sps->pixel_shift); int buf_offset = extra_top * edge_emu_stride + (extra_left << s->ps.sps->pixel_shift); @@ -1575,7 +1575,7 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER || x_off >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) { - const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; + const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); @@ -1687,7 +1687,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, RefPicList *refPicList = s->ref->refPicList; HEVCFrame *ref0, *ref1; - int tmpstride = MAX_PB_SIZE * sizeof(int16_t); + ptrdiff_t tmpstride = MAX_PB_SIZE * sizeof(int16_t); uint8_t *dst0 = POS(0, x0, y0); uint8_t *dst1 = POS(1, x0, y0); diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 39ac4ee..5037dae 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -172,7 +172,7 @@ static int get_qPy(HEVCContext *s, int xC, int yC) } static void copy_CTB(uint8_t *dst, uint8_t *src, - int width, int height, int stride) + int width, int height, ptrdiff_t stride) { int i; @@ -273,7 +273,7 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) int chroma = c_idx ? 1 : 0; int x0 = x >> chroma; int y0 = y >> chroma; - int stride = s->frame->linesize[c_idx]; + ptrdiff_t stride = s->frame->linesize[c_idx]; int ctb_size = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx]; int width = FFMIN(ctb_size, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0); diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 076b251..cd55571 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -396,7 +396,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, if (sao_eo_class != SAO_EO_VERT) { if (borders[0]) { int offset_val = sao_offset_val[0]; - int y_stride = 0; + ptrdiff_t y_stride = 0; for (y = 0; y < height; y++) { dst[y_stride] = av_clip_pixel(src[y_stride] + offset_val); y_stride += stride; @@ -405,7 +405,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, } if (borders[2]) { int offset_val = sao_offset_val[0]; - int x_stride = width - 1; + ptrdiff_t x_stride = width - 1; for (x = 0; x < height; x++) { dst[x_stride] = av_clip_pixel(src[x_stride] + offset_val); x_stride += stride; @@ -422,21 +422,21 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, } if (borders[3]) { int offset_val = sao_offset_val[0]; - int y_stride = stride * (height - 1); + ptrdiff_t y_stride = stride * (height - 1); for (x = init_x; x < width; x++) dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val); height--; } } { - int y_stride = init_y * stride; + ptrdiff_t y_stride = init_y * stride; int pos_0_0 = pos[sao_eo_class][0][0]; int pos_0_1 = pos[sao_eo_class][0][1]; int pos_1_0 = pos[sao_eo_class][1][0]; int pos_1_1 = pos[sao_eo_class][1][1]; - int y_stride_0_1 = (init_y + pos_0_1) * stride; - int y_stride_1_1 = (init_y + pos_1_1) * stride; + ptrdiff_t y_stride_0_1 = (init_y + pos_0_1) * stride; + ptrdiff_t y_stride_1_1 = (init_y + pos_1_1) * stride; for (y = init_y; y < height; y++) { for (x = init_x; x < width; x++) { int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]); @@ -503,7 +503,7 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, if (sao_eo_class != SAO_EO_VERT) { if (borders[0]) { int offset_val = sao_offset_val[0]; - int y_stride = 0; + ptrdiff_t y_stride = 0; for (y = 0; y < height; y++) { dst[y_stride] = av_clip_pixel(src[y_stride] + offset_val); y_stride += stride; @@ -512,7 +512,7 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, } if (borders[2]) { int offset_val = sao_offset_val[0]; - int x_stride = width - 1; + ptrdiff_t x_stride = width - 1; for (x = 0; x < height; x++) { dst[x_stride] = av_clip_pixel(src[x_stride] + offset_val); x_stride += stride; @@ -521,14 +521,14 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, } } { - int y_stride = init_y * stride; + ptrdiff_t y_stride = init_y * stride; int pos_0_0 = pos[sao_eo_class][0][0]; int pos_0_1 = pos[sao_eo_class][0][1]; int pos_1_0 = pos[sao_eo_class][1][0]; int pos_1_1 = pos[sao_eo_class][1][1]; - int y_stride_0_1 = (init_y + pos_0_1) * stride; - int y_stride_1_1 = (init_y + pos_1_1) * stride; + ptrdiff_t y_stride_0_1 = (init_y + pos_0_1) * stride; + ptrdiff_t y_stride_1_1 = (init_y + pos_1_1) * stride; for (y = init_y; y < height; y++) { for (x = init_x; x < width; x++) { int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]); @@ -601,21 +601,21 @@ static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src, } if (borders[3]) { int offset_val = sao_offset_val[0]; - int y_stride = stride * (height - 1); + ptrdiff_t y_stride = stride * (height - 1); for (x = init_x; x < width; x++) dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val); height--; } } { - int y_stride = init_y * stride; + ptrdiff_t y_stride = init_y * stride; int pos_0_0 = pos[sao_eo_class][0][0]; int pos_0_1 = pos[sao_eo_class][0][1]; int pos_1_0 = pos[sao_eo_class][1][0]; int pos_1_1 = pos[sao_eo_class][1][1]; - int y_stride_0_1 = (init_y + pos_0_1) * stride; - int y_stride_1_1 = (init_y + pos_1_1) * stride; + ptrdiff_t y_stride_0_1 = (init_y + pos_0_1) * stride; + ptrdiff_t y_stride_1_1 = (init_y + pos_1_1) * stride; for (y = init_y; y < height; y++) { for (x = init_x; x < width; x++) { int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]); @@ -681,14 +681,14 @@ static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src, init_y = init_x = 0; { - int y_stride = init_y * stride; + ptrdiff_t y_stride = init_y * stride; int pos_0_0 = pos[sao_eo_class][0][0]; int pos_0_1 = pos[sao_eo_class][0][1]; int pos_1_0 = pos[sao_eo_class][1][0]; int pos_1_1 = pos[sao_eo_class][1][1]; - int y_stride_0_1 = (init_y + pos_0_1) * stride; - int y_stride_1_1 = (init_y + pos_1_1) * stride; + ptrdiff_t y_stride_0_1 = (init_y + pos_0_1) * stride; + ptrdiff_t y_stride_1_1 = (init_y + pos_1_1) * stride; for (y = init_y; y < height; y++) { for (x = init_x; x < width; x++) { diff --git a/tests/checkasm/hevc_mc.c b/tests/checkasm/hevc_mc.c index 385c33e..70f35ce 100644 --- a/tests/checkasm/hevc_mc.c +++ b/tests/checkasm/hevc_mc.c @@ -105,8 +105,8 @@ static void check_unweighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst for (i = 0; i < FF_ARRAY_ELEMS(pred_widths); i++) { const int width = pred_widths[i]; - const int srcstride = FFALIGN(width, 16) * sizeof(*src0); - const int dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth); + const ptrdiff_t srcstride = FFALIGN(width, 16) * sizeof(*src0); + const ptrdiff_t dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth); { declare_func(void, uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height); @@ -177,8 +177,8 @@ static void check_weighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1, for (i = 0; i < FF_ARRAY_ELEMS(pred_widths); i++) { const int width = pred_widths[i]; - const int srcstride = FFALIGN(width, 16) * sizeof(*src0); - const int dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth); + const ptrdiff_t srcstride = FFALIGN(width, 16) * sizeof(*src0); + const ptrdiff_t dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth); { declare_func(void, uint8_t denom, int16_t weight, int16_t offset, @@ -216,8 +216,8 @@ static void check_epel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1, for (j = 0; j < 2; j++) { for (k = 0; k < FF_ARRAY_ELEMS(h->put_hevc_epel[i][j]); k++) { int width = pred_widths[k] / 2; - int dststride = FFALIGN(width, 16) * sizeof(*dst0); - int srcstride = FFALIGN(width + 3, 8) * PIXEL_SIZE(bit_depth); + ptrdiff_t dststride = FFALIGN(width, 16) * sizeof(*dst0); + ptrdiff_t srcstride = FFALIGN(width + 3, 8) * PIXEL_SIZE(bit_depth); if (!check_func(h->put_hevc_epel[i][j][k], "epel_%s_%d_%d", interp_names[i][j], width, bit_depth)) continue; @@ -261,8 +261,8 @@ static void check_qpel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1, for (j = 0; j < 2; j++) { for (k = 0; k < FF_ARRAY_ELEMS(h->put_hevc_qpel[i][j]); k++) { int width = pred_widths[k]; - int dststride = FFALIGN(width, 16) * sizeof(*dst0); - int srcstride = FFALIGN(width + 7, 8) * PIXEL_SIZE(bit_depth); + ptrdiff_t dststride = FFALIGN(width, 16) * sizeof(*dst0); + ptrdiff_t srcstride = FFALIGN(width + 7, 8) * PIXEL_SIZE(bit_depth); if (!check_func(h->put_hevc_qpel[i][j][k], "qpel_%s_%d_%d", interp_names[i][j], width, bit_depth)) continue; |