aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-08-24 11:52:10 +0200
committerDiego Biurrun <diego@biurrun.de>2016-08-26 11:50:21 +0200
commit3fd22538bc0e0de84b31335266b4b1577d3d609e (patch)
tree97b7aed8f03aa6a1352934ca9407da515bfd574c
parentf81be06cf614919d71ded29b8f595bef40123ad8 (diff)
downloadffmpeg-3fd22538bc0e0de84b31335266b4b1577d3d609e.tar.gz
prores: Change type of stride parameters to ptrdiff_t
This avoids SIMD-optimized functions having to sign-extend their line size argument manually to be able to do pointer arithmetic. Also adjust parameter names to be "linesize" everywhere.
-rw-r--r--libavcodec/proresdsp.c6
-rw-r--r--libavcodec/proresdsp.h3
-rw-r--r--libavcodec/proresenc.c19
-rw-r--r--libavcodec/x86/proresdsp.asm3
-rw-r--r--libavcodec/x86/proresdsp_init.c6
5 files changed, 19 insertions, 18 deletions
diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 3af2f0b9bb..f782c907c0 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -36,11 +36,11 @@
/**
* Add bias value, clamp and output pixels of a slice
*/
-static void put_pixels(uint16_t *dst, int stride, const int16_t *in)
+static void put_pixels(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
{
int x, y, src_offset, dst_offset;
- for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += stride) {
+ for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += linesize) {
for (x = 0; x < 8; x++) {
src_offset = (y << 3) + x;
@@ -49,7 +49,7 @@ static void put_pixels(uint16_t *dst, int stride, const int16_t *in)
}
}
-static void prores_idct_put_c(uint16_t *out, int linesize, int16_t *block, const int16_t *qmat)
+static void prores_idct_put_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat)
{
ff_prores_idct(block, qmat);
put_pixels(out, linesize >> 1, block);
diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h
index e8a3ea96a7..7f06494daf 100644
--- a/libavcodec/proresdsp.h
+++ b/libavcodec/proresdsp.h
@@ -23,6 +23,7 @@
#ifndef AVCODEC_PRORESDSP_H
#define AVCODEC_PRORESDSP_H
+#include <stddef.h>
#include <stdint.h>
#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder
@@ -30,7 +31,7 @@
typedef struct ProresDSPContext {
int idct_permutation_type;
uint8_t idct_permutation[64];
- void (* idct_put) (uint16_t *out, int linesize, int16_t *block, const int16_t *qmat);
+ void (*idct_put)(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat);
} ProresDSPContext;
void ff_proresdsp_init(ProresDSPContext *dsp);
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index 0564b12ae2..e4842d2993 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -192,7 +192,7 @@ typedef struct ProresContext {
const uint8_t *scantable;
void (*fdct)(FDCTDSPContext *fdsp, const uint16_t *src,
- int linesize, int16_t *block);
+ ptrdiff_t linesize, int16_t *block);
FDCTDSPContext fdsp;
const AVFrame *pic;
@@ -223,13 +223,13 @@ typedef struct ProresContext {
} ProresContext;
static void get_slice_data(ProresContext *ctx, const uint16_t *src,
- int linesize, int x, int y, int w, int h,
+ ptrdiff_t linesize, int x, int y, int w, int h,
int16_t *blocks, uint16_t *emu_buf,
int mbs_per_slice, int blocks_per_mb, int is_chroma)
{
const uint16_t *esrc;
const int mb_width = 4 * blocks_per_mb;
- int elinesize;
+ ptrdiff_t elinesize;
int i, j, k;
for (i = 0; i < mbs_per_slice; i++, src += mb_width) {
@@ -294,7 +294,7 @@ static void get_slice_data(ProresContext *ctx, const uint16_t *src,
}
static void get_alpha_data(ProresContext *ctx, const uint16_t *src,
- int linesize, int x, int y, int w, int h,
+ ptrdiff_t linesize, int x, int y, int w, int h,
int16_t *blocks, int mbs_per_slice, int abits)
{
const int slice_width = 16 * mbs_per_slice;
@@ -417,7 +417,7 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks,
}
static int encode_slice_plane(ProresContext *ctx, PutBitContext *pb,
- const uint16_t *src, int linesize,
+ const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int16_t *blocks,
int blocks_per_mb, int plane_size_factor,
const int16_t *qmat)
@@ -511,7 +511,8 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
int total_size = 0;
const uint16_t *src;
int slice_width_factor = av_log2(mbs_per_slice);
- int num_cblocks, pwidth, linesize, line_add;
+ int num_cblocks, pwidth, line_add;
+ ptrdiff_t linesize;
int plane_factor, is_chroma;
uint16_t *qmat;
@@ -667,7 +668,7 @@ static int estimate_acs(int *error, int16_t *blocks, int blocks_per_slice,
}
static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,
- const uint16_t *src, int linesize,
+ const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice,
int blocks_per_mb, int plane_size_factor,
const int16_t *qmat, ProresThreadData *td)
@@ -701,7 +702,7 @@ static int est_alpha_diff(int cur, int prev, int abits)
}
static int estimate_alpha_plane(ProresContext *ctx, int *error,
- const uint16_t *src, int linesize,
+ const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int quant,
int16_t *blocks)
{
@@ -1112,7 +1113,7 @@ static av_cold int encode_close(AVCodecContext *avctx)
}
static void prores_fdct(FDCTDSPContext *fdsp, const uint16_t *src,
- int linesize, int16_t *block)
+ ptrdiff_t linesize, int16_t *block)
{
int x, y;
const uint16_t *tsrc = src;
diff --git a/libavcodec/x86/proresdsp.asm b/libavcodec/x86/proresdsp.asm
index 5a329cb898..9613fa1448 100644
--- a/libavcodec/x86/proresdsp.asm
+++ b/libavcodec/x86/proresdsp.asm
@@ -326,11 +326,10 @@ SECTION .text
SUMSUB_SHPK m2, m3, m4, m5, m6, m7, %2
%endmacro
-; void ff_prores_idct_put_10_<opt>(uint8_t *pixels, int stride,
+; void ff_prores_idct_put_10_<opt>(uint8_t *pixels, ptrdiff_t linesize,
; int16_t *block, const int16_t *qmat);
%macro idct_put_fn 1
cglobal prores_idct_put_10, 4, 4, %1
- movsxd r1, r1d
pxor m15, m15 ; zero
; for (i = 0; i < 8; i++)
diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c
index e82dac0448..ff4d39836b 100644
--- a/libavcodec/x86/proresdsp_init.c
+++ b/libavcodec/x86/proresdsp_init.c
@@ -25,11 +25,11 @@
#include "libavcodec/idctdsp.h"
#include "libavcodec/proresdsp.h"
-void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
+void ff_prores_idct_put_10_sse2(uint16_t *dst, ptrdiff_t linesize,
int16_t *block, const int16_t *qmat);
-void ff_prores_idct_put_10_sse4(uint16_t *dst, int linesize,
+void ff_prores_idct_put_10_sse4(uint16_t *dst, ptrdiff_t linesize,
int16_t *block, const int16_t *qmat);
-void ff_prores_idct_put_10_avx (uint16_t *dst, int linesize,
+void ff_prores_idct_put_10_avx (uint16_t *dst, ptrdiff_t linesize,
int16_t *block, const int16_t *qmat);
av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp)