Commit 4a73fbd9 authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

vp3/5: move put_no_rnd_pixels_l2 from dsputil to VP3DSPContext.

The function is only used in VP3 and VP5, so no need to have it in
DSPContext.
parent 4f56e773
......@@ -2765,7 +2765,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\
c->put_no_rnd_pixels_l2 = FUNCC(put_no_rnd_pixels8_l2 , depth);\
\
c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\
c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\
......
......@@ -291,8 +291,6 @@ typedef struct DSPContext {
*/
op_pixels_func avg_no_rnd_pixels_tab[4][4];
void (*put_no_rnd_pixels_l2)(uint8_t *block/*align 8*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
/**
* Thirdpel motion compensation with rounding (a+b+1)>>1.
* this is an array[12] of motion compensation functions for the 9 thirdpe
......
......@@ -582,10 +582,6 @@ PIXOP2(put, op_put)
#define put_no_rnd_pixels8_c put_pixels8_c
#define put_no_rnd_pixels16_c put_pixels16_c
static void FUNCC(put_no_rnd_pixels8_l2)(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
FUNC(put_no_rnd_pixels8_l2)(dst, a, b, stride, stride, stride, h);
}
#define H264_CHROMA_MC(OPNAME, OP)\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
......
......@@ -1564,7 +1564,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
motion_source, stride, 8);
}else{
int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1
s->dsp.put_no_rnd_pixels_l2(
s->vp3dsp.put_no_rnd_pixels_l2(
output_plane + first_pixel,
motion_source - d,
motion_source + stride + 1 + d,
......
......@@ -274,8 +274,27 @@ static void vp3_h_loop_filter_c(uint8_t *first_pixel, int stride,
}
}
static void put_no_rnd_pixels_l2(uint8_t *dst, const uint8_t *src1,
const uint8_t *src2, ptrdiff_t stride, int h)
{
int i;
for (i = 0; i < h; i++) {
uint32_t a, b;
a = AV_RN32A(&src1[i * stride]);
b = AV_RN32A(&src2[i * stride]);
AV_WN32A(&dst[i * stride], no_rnd_avg32(a, b));
a = AV_RN32A(&src1[i * stride + 4]);
b = AV_RN32A(&src2[i * stride + 4]);
AV_WN32A(&dst[i * stride + 4], no_rnd_avg32(a, b));
}
}
av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
{
c->put_no_rnd_pixels_l2 = put_no_rnd_pixels_l2;
c->idct_put = vp3_idct_put_c;
c->idct_add = vp3_idct_add_c;
c->idct_dc_add = vp3_idct_dc_add_c;
......
......@@ -19,10 +19,26 @@
#ifndef AVCODEC_VP3DSP_H
#define AVCODEC_VP3DSP_H
#include <stddef.h>
#include <stdint.h>
#include "dsputil.h"
typedef struct VP3DSPContext {
/**
* Copy 8xH pixels from source to destination buffer using a bilinear
* filter with no rounding (i.e. *dst = (*a + *b) >> 1).
*
* @param dst destination buffer, aligned by 8
* @param a first source buffer, no alignment
* @param b second source buffer, no alignment
* @param stride distance between two lines in source/dest buffers
* @param h height
*/
void (*put_no_rnd_pixels_l2)(uint8_t *dst,
const uint8_t *a,
const uint8_t *b,
ptrdiff_t stride, int h);
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_dc_add)(uint8_t *dest, int line_size, DCTELEM *block);
......
......@@ -373,9 +373,9 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
stride, s->mv[b], mask, s->filter_selection, b<4);
else
s->dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
src_block+src_offset+overlap_offset,
stride, 8);
s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
src_block+src_offset+overlap_offset,
stride, 8);
} else {
s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);
}
......
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