summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-05-17 00:52:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-05-17 00:52:29 +0000
commita2df5a50ae1076b2e6225789c1f34fcaa555591c (patch)
treeffa1b46f13f08be1ec3d215bb215572520f374c5 /libavcodec/vp3.c
parent1cf9f514dc4d866af1d768e1600a469b1af2567a (diff)
clear blocks after each idct instead of per picture
dont store the all zero coefficients of skiped blocks Originally committed as revision 4253 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index fc850bb40a..7202388f39 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -135,7 +135,7 @@ static inline void debug_idct(const char *format, ...) { }
#endif
typedef struct Vp3Fragment {
- DCTELEM coeffs[64];
+ DCTELEM *coeffs;
int coding_method;
int coeff_count;
int last_coeff;
@@ -246,6 +246,7 @@ typedef struct Vp3DecodeContext {
int fragment_height;
Vp3Fragment *all_fragments;
+ DCTELEM *coeffs;
int u_fragment_start;
int v_fragment_start;
@@ -825,11 +826,12 @@ static void unpack_token(GetBitContext *gb, int token, int *zero_run,
static void init_frame(Vp3DecodeContext *s, GetBitContext *gb)
{
int i;
+ static const DCTELEM zero_block[64];
/* zero out all of the fragment information */
s->coded_fragment_list_index = 0;
for (i = 0; i < s->fragment_count; i++) {
- memset(s->all_fragments[i].coeffs, 0, 64 * sizeof(DCTELEM));
+ s->all_fragments[i].coeffs = zero_block;
s->all_fragments[i].coeff_count = 0;
s->all_fragments[i].last_coeff = 0;
s->all_fragments[i].motion_x = 0xbeef;
@@ -1278,6 +1280,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
* the next phase */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
+ s->all_fragments[current_fragment].coeffs= s->coeffs + 64*s->coded_fragment_list_index;
s->coded_fragment_list[s->coded_fragment_list_index] =
current_fragment;
if ((current_fragment >= s->u_fragment_start) &&
@@ -1307,6 +1310,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
* coding will be determined in next step */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
+ s->all_fragments[current_fragment].coeffs= s->coeffs + 64*s->coded_fragment_list_index;
s->coded_fragment_list[s->coded_fragment_list_index] =
current_fragment;
if ((current_fragment >= s->u_fragment_start) &&
@@ -2187,6 +2191,7 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x,
dequantizer,
s->all_fragments[i].coeff_count,
output_samples);
+ memset(s->all_fragments[i].coeffs, 0, 64*sizeof(DCTELEM));
if (s->all_fragments[i].coding_method == MODE_INTRA) {
s->dsp.put_signed_pixels_clamped(output_samples,
output_plane + s->all_fragments[i].first_pixel,
@@ -2542,6 +2547,7 @@ static int vp3_decode_init(AVCodecContext *avctx)
s->v_fragment_start);
s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
+ s->coeffs = av_malloc(s->fragment_count * sizeof(DCTELEM) * 64);
s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int));
s->pixel_addresses_inited = 0;
@@ -2809,6 +2815,7 @@ static int vp3_decode_end(AVCodecContext *avctx)
Vp3DecodeContext *s = avctx->priv_data;
av_free(s->all_fragments);
+ av_free(s->coeffs);
av_free(s->coded_fragment_list);
av_free(s->superblock_fragments);
av_free(s->superblock_macroblocks);