Commit d05a1ae2 authored by conrad's avatar conrad

Move apply_loop_filter above render_slice, it'll be used by the latter soon

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21777 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ef642060
...@@ -1389,6 +1389,70 @@ static void reverse_dc_prediction(Vp3DecodeContext *s, ...@@ -1389,6 +1389,70 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
} }
} }
static void apply_loop_filter(Vp3DecodeContext *s)
{
int plane;
int x, y;
int *bounding_values= s->bounding_values_array+127;
for (plane = 0; plane < 3; plane++) {
int width = s->fragment_width >> !!plane;
int height = s->fragment_height >> !!plane;
int fragment = s->fragment_start [plane];
int stride = s->current_frame.linesize[plane];
uint8_t *plane_data = s->current_frame.data [plane];
if (!s->flipped_image) stride = -stride;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
/* This code basically just deblocks on the edges of coded blocks.
* However, it has to be much more complicated because of the
* braindamaged deblock ordering used in VP3/Theora. Order matters
* because some pixels get filtered twice. */
if( s->all_fragments[fragment].coding_method != MODE_COPY )
{
/* do not perform left edge filter for left columns frags */
if (x > 0) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
/* do not perform top edge filter for top row fragments */
if (y > 0) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
/* do not perform right edge filter for right column
* fragments or if right fragment neighbor is also coded
* in this frame (it will be filtered in next iteration) */
if ((x < width - 1) &&
(s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment + 1].first_pixel,
stride, bounding_values);
}
/* do not perform bottom edge filter for bottom row
* fragments or if bottom fragment neighbor is also coded
* in this frame (it will be filtered in the next row) */
if ((y < height - 1) &&
(s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment + width].first_pixel,
stride, bounding_values);
}
}
fragment++;
}
}
}
}
/* /*
* Perform the final rendering for a particular slice of data. * Perform the final rendering for a particular slice of data.
* The slice number ranges from 0..(macroblock_height - 1). * The slice number ranges from 0..(macroblock_height - 1).
...@@ -1562,70 +1626,6 @@ static void render_slice(Vp3DecodeContext *s, int slice) ...@@ -1562,70 +1626,6 @@ static void render_slice(Vp3DecodeContext *s, int slice)
emms_c(); emms_c();
} }
static void apply_loop_filter(Vp3DecodeContext *s)
{
int plane;
int x, y;
int *bounding_values= s->bounding_values_array+127;
for (plane = 0; plane < 3; plane++) {
int width = s->fragment_width >> !!plane;
int height = s->fragment_height >> !!plane;
int fragment = s->fragment_start [plane];
int stride = s->current_frame.linesize[plane];
uint8_t *plane_data = s->current_frame.data [plane];
if (!s->flipped_image) stride = -stride;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
/* This code basically just deblocks on the edges of coded blocks.
* However, it has to be much more complicated because of the
* braindamaged deblock ordering used in VP3/Theora. Order matters
* because some pixels get filtered twice. */
if( s->all_fragments[fragment].coding_method != MODE_COPY )
{
/* do not perform left edge filter for left columns frags */
if (x > 0) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
/* do not perform top edge filter for top row fragments */
if (y > 0) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
/* do not perform right edge filter for right column
* fragments or if right fragment neighbor is also coded
* in this frame (it will be filtered in next iteration) */
if ((x < width - 1) &&
(s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment + 1].first_pixel,
stride, bounding_values);
}
/* do not perform bottom edge filter for bottom row
* fragments or if bottom fragment neighbor is also coded
* in this frame (it will be filtered in the next row) */
if ((y < height - 1) &&
(s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment + width].first_pixel,
stride, bounding_values);
}
}
fragment++;
}
}
}
}
/* /*
* This function computes the first pixel addresses for each fragment. * This function computes the first pixel addresses for each fragment.
* This function needs to be invoked after the first frame is allocated * This function needs to be invoked after the first frame is allocated
......
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