[FFmpeg-cvslog] r15551 - in trunk/libavcodec: dsputil.c dsputil.h vp3.c vp3dsp.c
conrad
subversion
Sat Oct 4 12:26:17 CEST 2008
Author: conrad
Date: Sat Oct 4 12:26:17 2008
New Revision: 15551
Log:
Move VP3 loop filter to DSPContext
Modified:
trunk/libavcodec/dsputil.c
trunk/libavcodec/dsputil.h
trunk/libavcodec/vp3.c
trunk/libavcodec/vp3dsp.c
Modified: trunk/libavcodec/dsputil.c
==============================================================================
--- trunk/libavcodec/dsputil.c (original)
+++ trunk/libavcodec/dsputil.c Sat Oct 4 12:26:17 2008
@@ -4471,6 +4471,11 @@ void dsputil_init(DSPContext* c, AVCodec
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
+ if (ENABLE_VP3_DECODER || ENABLE_THEORA_DECODER) {
+ c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
+ c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
+ }
+
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
Modified: trunk/libavcodec/dsputil.h
==============================================================================
--- trunk/libavcodec/dsputil.h (original)
+++ trunk/libavcodec/dsputil.h Sat Oct 4 12:26:17 2008
@@ -86,6 +86,9 @@ void ff_vp3_idct_c(DCTELEM *block/* alig
void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
+void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
+void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
+
/* 1/2^n downscaling functions from imgconvert.c */
void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
@@ -359,6 +362,9 @@ typedef struct DSPContext {
void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
+ void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
+ void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
+
/* assume len is a multiple of 4, and arrays are 16-byte aligned */
void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
Modified: trunk/libavcodec/vp3.c
==============================================================================
--- trunk/libavcodec/vp3.c (original)
+++ trunk/libavcodec/vp3.c Sat Oct 4 12:26:17 2008
@@ -1283,12 +1283,6 @@ static void reverse_dc_prediction(Vp3Dec
}
}
-
-static void horizontal_filter(unsigned char *first_pixel, int stride,
- int *bounding_values);
-static void vertical_filter(unsigned char *first_pixel, int stride,
- int *bounding_values);
-
/*
* Perform the final rendering for a particular slice of data.
* The slice number ranges from 0..(macroblock_height - 1).
@@ -1495,39 +1489,6 @@ static void render_slice(Vp3DecodeContex
emms_c();
}
-static void horizontal_filter(unsigned char *first_pixel, int stride,
- int *bounding_values)
-{
- unsigned char *end;
- int filter_value;
-
- for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) {
- filter_value =
- (first_pixel[-2] - first_pixel[ 1])
- +3*(first_pixel[ 0] - first_pixel[-1]);
- filter_value = bounding_values[(filter_value + 4) >> 3];
- first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value);
- first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
- }
-}
-
-static void vertical_filter(unsigned char *first_pixel, int stride,
- int *bounding_values)
-{
- unsigned char *end;
- int filter_value;
- const int nstride= -stride;
-
- for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
- filter_value =
- (first_pixel[2 * nstride] - first_pixel[ stride])
- +3*(first_pixel[0 ] - first_pixel[nstride]);
- filter_value = bounding_values[(filter_value + 4) >> 3];
- first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value);
- first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value);
- }
-}
-
static void apply_loop_filter(Vp3DecodeContext *s)
{
int plane;
@@ -1569,7 +1530,7 @@ static void apply_loop_filter(Vp3DecodeC
/* do not perform left edge filter for left columns frags */
if ((x > 0) &&
(s->all_fragments[fragment].coding_method != MODE_COPY)) {
- horizontal_filter(
+ s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
@@ -1577,7 +1538,7 @@ static void apply_loop_filter(Vp3DecodeC
/* do not perform top edge filter for top row fragments */
if ((y > 0) &&
(s->all_fragments[fragment].coding_method != MODE_COPY)) {
- vertical_filter(
+ s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
@@ -1588,7 +1549,7 @@ static void apply_loop_filter(Vp3DecodeC
if ((x < width - 1) &&
(s->all_fragments[fragment].coding_method != MODE_COPY) &&
(s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
- horizontal_filter(
+ s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment + 1].first_pixel,
stride, bounding_values);
}
@@ -1599,7 +1560,7 @@ static void apply_loop_filter(Vp3DecodeC
if ((y < height - 1) &&
(s->all_fragments[fragment].coding_method != MODE_COPY) &&
(s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
- vertical_filter(
+ s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment + width].first_pixel,
stride, bounding_values);
}
Modified: trunk/libavcodec/vp3dsp.c
==============================================================================
--- trunk/libavcodec/vp3dsp.c (original)
+++ trunk/libavcodec/vp3dsp.c Sat Oct 4 12:26:17 2008
@@ -222,3 +222,34 @@ void ff_vp3_idct_put_c(uint8_t *dest/*al
void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
idct(dest, line_size, block, 2);
}
+
+void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
+{
+ unsigned char *end;
+ int filter_value;
+ const int nstride= -stride;
+
+ for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
+ filter_value =
+ (first_pixel[2 * nstride] - first_pixel[ stride])
+ +3*(first_pixel[0 ] - first_pixel[nstride]);
+ filter_value = bounding_values[(filter_value + 4) >> 3];
+ first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value);
+ first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value);
+ }
+}
+
+void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
+{
+ unsigned char *end;
+ int filter_value;
+
+ for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) {
+ filter_value =
+ (first_pixel[-2] - first_pixel[ 1])
+ +3*(first_pixel[ 0] - first_pixel[-1]);
+ filter_value = bounding_values[(filter_value + 4) >> 3];
+ first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value);
+ first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
+ }
+}
More information about the ffmpeg-cvslog
mailing list