Commit 6eb75e7d authored by Clément Bœsch's avatar Clément Bœsch

Merge commit '3281d823'

* commit '3281d823':
  intrax8: Change type of array stride parameters to ptrdiff_t
Merged-by: 's avatarClément Bœsch <u@pkh.me>
parents 51b5672f 3281d823
......@@ -544,7 +544,7 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction,
}
static void dsp_x8_put_solidcolor(const uint8_t pix, uint8_t *dst,
const int linesize)
const ptrdiff_t linesize)
{
int k;
for (k = 0; k < 8; k++) {
......@@ -696,7 +696,7 @@ block_placed:
if (w->loopfilter) {
uint8_t *ptr = w->dest[chroma];
int linesize = w->frame->linesize[!!chroma];
ptrdiff_t linesize = w->frame->linesize[!!chroma];
if (!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4)))
w->dsp.h_loop_filter(ptr, linesize, w->quant);
......@@ -712,8 +712,8 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
{
// not parent codec linesize as this would be wrong for field pics
// not that IntraX8 has interlacing support ;)
const int linesize = frame->linesize[0];
const int uvlinesize = frame->linesize[1];
const ptrdiff_t linesize = frame->linesize[0];
const ptrdiff_t uvlinesize = frame->linesize[1];
w->dest[0] = frame->data[0];
w->dest[1] = frame->data[1];
......
......@@ -63,8 +63,8 @@
4 - mb_x>= (mb_width-1) last block in the row, interpolate area #5;
-*/
static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
int linesize, int *range, int *psum,
int edges)
ptrdiff_t stride, int *range,
int *psum, int edges)
{
uint8_t *ptr;
int sum;
......@@ -98,12 +98,12 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
max_pix = FFMAX(max_pix, c);
dst[area2 + i] = c;
ptr += linesize;
ptr += stride;
}
}
if (!(edges & 2)) { // (mb_y != 0) // there is row above
ptr = src - linesize; // top line
ptr = src - stride; // top line
for (i = 0; i < 8; i++) {
c = *(ptr + i);
sum += c;
......@@ -117,7 +117,7 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
memcpy(dst + area4, ptr, 16); // both area4 and 5
}
// area6 always present in the above block
memcpy(dst + area6, ptr - linesize, 8);
memcpy(dst + area6, ptr - stride, 8);
}
// now calculate the stuff we need
if (edges & 3) { // mb_x ==0 || mb_y == 0) {
......@@ -131,7 +131,7 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
sum += avg * 9;
} else {
// the edge pixel, in the top line and left column
uint8_t c = *(src - 1 - linesize);
uint8_t c = *(src - 1 - stride);
dst[area3] = c;
sum += c;
// edge pixel is not part of min/max
......@@ -160,7 +160,7 @@ static const uint16_t zero_prediction_weights[64 * 2] = {
317, 846, 366, 731, 458, 611, 499, 499,
};
static void spatial_compensation_0(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_0(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int i, j;
int x, y;
......@@ -208,55 +208,55 @@ static void spatial_compensation_0(uint8_t *src, uint8_t *dst, int linesize)
dst[x] = ((uint32_t) top_sum[0][x] * zero_prediction_weights[y * 16 + x * 2 + 0] +
(uint32_t) left_sum[0][y] * zero_prediction_weights[y * 16 + x * 2 + 1] +
0x8000) >> 16;
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_1(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_1(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = src[area4 + FFMIN(2 * y + x + 2, 15)];
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_2(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_2(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = src[area4 + 1 + y + x];
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_3(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_3(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = src[area4 + ((y + 1) >> 1) + x];
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_4(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_4(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = (src[area4 + x] + src[area6 + x] + 1) >> 1;
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_5(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_5(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
......@@ -267,22 +267,22 @@ static void spatial_compensation_5(uint8_t *src, uint8_t *dst, int linesize)
else
dst[x] = src[area4 + x - ((y + 1) >> 1)];
}
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_6(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_6(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = src[area3 + x - y];
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_7(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_7(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
......@@ -293,55 +293,56 @@ static void spatial_compensation_7(uint8_t *src, uint8_t *dst, int linesize)
else
dst[x] = src[area2 + 8 - y + (x >> 1)];
}
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_8(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_8(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = (src[area1 + 7 - y] + src[area2 + 7 - y] + 1) >> 1;
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_9(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_9(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = src[area2 + 6 - FFMIN(x + y, 6)];
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_10(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_10(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = (src[area2 + 7 - y] * (8 - x) + src[area4 + x] * x + 4) >> 3;
dst += linesize;
dst += stride;
}
}
static void spatial_compensation_11(uint8_t *src, uint8_t *dst, int linesize)
static void spatial_compensation_11(uint8_t *src, uint8_t *dst, ptrdiff_t stride)
{
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
dst[x] = (src[area2 + 7 - y] * y + src[area4 + x] * (8 - y) + 4) >> 3;
dst += linesize;
dst += stride;
}
}
static void x8_loop_filter(uint8_t *ptr, const int a_stride, const int b_stride, int quant)
static void x8_loop_filter(uint8_t *ptr, const ptrdiff_t a_stride,
const ptrdiff_t b_stride, int quant)
{
int i, t;
int p0, p1, p2, p3, p4, p5, p6, p7, p8, p9;
......@@ -434,12 +435,12 @@ static void x8_loop_filter(uint8_t *ptr, const int a_stride, const int b_stride,
}
}
static void x8_h_loop_filter(uint8_t *src, int stride, int qscale)
static void x8_h_loop_filter(uint8_t *src, ptrdiff_t stride, int qscale)
{
x8_loop_filter(src, stride, 1, qscale);
}
static void x8_v_loop_filter(uint8_t *src, int stride, int qscale)
static void x8_v_loop_filter(uint8_t *src, ptrdiff_t stride, int qscale)
{
x8_loop_filter(src, 1, stride, qscale);
}
......
......@@ -19,15 +19,18 @@
#ifndef AVCODEC_INTRAX8DSP_H
#define AVCODEC_INTRAX8DSP_H
#include <stddef.h>
#include <stdint.h>
typedef struct IntraX8DSPContext {
void (*v_loop_filter)(uint8_t *src, int stride, int qscale);
void (*h_loop_filter)(uint8_t *src, int stride, int qscale);
void (*v_loop_filter)(uint8_t *src, ptrdiff_t stride, int qscale);
void (*h_loop_filter)(uint8_t *src, ptrdiff_t stride, int qscale);
void (*spatial_compensation[12])(uint8_t *src, uint8_t *dst, int linesize);
void (*setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
int *range, int *sum, int edges);
void (*spatial_compensation[12])(uint8_t *src, uint8_t *dst,
ptrdiff_t stride);
void (*setup_spatial_compensation)(uint8_t *src, uint8_t *dst,
ptrdiff_t stride, int *range,
int *sum, int edges);
} IntraX8DSPContext;
void ff_intrax8dsp_init(IntraX8DSPContext *dsp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment