mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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.
This commit is contained in:
parent
f81be06cf6
commit
3fd22538bc
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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++)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user