#include "get_bits.h"
#include "vp3data.h"
+#include "vp3dsp.h"
#include "xiph.h"
#include "thread.h"
AVFrame current_frame;
int keyframe;
DSPContext dsp;
+ VP3DSPContext vp3dsp;
int flipped_image;
int last_slice_end;
int skip_loop_filter;
return 0;
for (i = 0; i < 16; i++) {
- free_vlc(&s->dc_vlc[i]);
- free_vlc(&s->ac_vlc_1[i]);
- free_vlc(&s->ac_vlc_2[i]);
- free_vlc(&s->ac_vlc_3[i]);
- free_vlc(&s->ac_vlc_4[i]);
+ ff_free_vlc(&s->dc_vlc[i]);
+ ff_free_vlc(&s->ac_vlc_1[i]);
+ ff_free_vlc(&s->ac_vlc_2[i]);
+ ff_free_vlc(&s->ac_vlc_3[i]);
+ ff_free_vlc(&s->ac_vlc_4[i]);
}
- free_vlc(&s->superblock_run_length_vlc);
- free_vlc(&s->fragment_run_length_vlc);
- free_vlc(&s->mode_code_vlc);
- free_vlc(&s->motion_vector_vlc);
+ ff_free_vlc(&s->superblock_run_length_vlc);
+ ff_free_vlc(&s->fragment_run_length_vlc);
+ ff_free_vlc(&s->mode_code_vlc);
+ ff_free_vlc(&s->motion_vector_vlc);
/* release all frames */
vp3_decode_flush(avctx);
int value;
filter_limit = s->filter_limit_values[s->qps[0]];
+ assert(filter_limit < 128);
/* set up the bounding values */
memset(s->bounding_values_array, 0, 256 * sizeof(int));
{
/* do not perform left edge filter for left columns frags */
if (x > 0) {
- s->dsp.vp3_h_loop_filter(
+ s->vp3dsp.h_loop_filter(
plane_data + 8*x,
stride, bounding_values);
}
/* do not perform top edge filter for top row fragments */
if (y > 0) {
- s->dsp.vp3_v_loop_filter(
+ s->vp3dsp.v_loop_filter(
plane_data + 8*x,
stride, bounding_values);
}
* 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(
+ s->vp3dsp.h_loop_filter(
plane_data + 8*x + 8,
stride, bounding_values);
}
* 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(
+ s->vp3dsp.v_loop_filter(
plane_data + 8*x + 8*stride,
stride, bounding_values);
}
index = vp3_dequant(s, s->all_fragments + i, plane, 0, block);
if (index > 63)
continue;
- if(s->avctx->idct_algo!=FF_IDCT_VP3)
- block[0] += 128<<3;
- s->dsp.idct_put(
+ s->vp3dsp.idct_put(
output_plane + first_pixel,
stride,
block);
if (index > 63)
continue;
if (index > 0) {
- s->dsp.idct_add(
+ s->vp3dsp.idct_add(
output_plane + first_pixel,
stride,
block);
} else {
- s->dsp.vp3_idct_dc_add(output_plane + first_pixel, stride, block);
+ s->vp3dsp.idct_dc_add(output_plane + first_pixel, stride, block);
}
}
} else {
if (avctx->pix_fmt == PIX_FMT_NONE)
avctx->pix_fmt = PIX_FMT_YUV420P;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
- if(avctx->idct_algo==FF_IDCT_AUTO)
- avctx->idct_algo=FF_IDCT_VP3;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
+ ff_init_scantable_permutation(s->dsp.idct_permutation, s->vp3dsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
/* initialize to an impossible value which will force a recalculation
return -1;
}
token = get_bits(gb, 5);
- //av_log(avctx, AV_LOG_DEBUG, "hti %d hbits %x token %d entry : %d size %d\n", s->hti, s->hbits, token, s->entries, s->huff_code_size);
+ av_dlog(avctx, "hti %d hbits %x token %d entry : %d size %d\n",
+ s->hti, s->hbits, token, s->entries, s->huff_code_size);
s->huffman_table[s->hti][token][0] = s->hbits;
s->huffman_table[s->hti][token][1] = s->huff_code_size;
s->entries++;
}
AVCodec ff_theora_decoder = {
- .name = "theora",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_THEORA,
- .priv_data_size = sizeof(Vp3DecodeContext),
- .init = theora_decode_init,
- .close = vp3_decode_end,
- .decode = vp3_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .flush = vp3_decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("Theora"),
+ .name = "theora",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_THEORA,
+ .priv_data_size = sizeof(Vp3DecodeContext),
+ .init = theora_decode_init,
+ .close = vp3_decode_end,
+ .decode = vp3_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = vp3_decode_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Theora"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
};
#endif
AVCodec ff_vp3_decoder = {
- .name = "vp3",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP3,
- .priv_data_size = sizeof(Vp3DecodeContext),
- .init = vp3_decode_init,
- .close = vp3_decode_end,
- .decode = vp3_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .flush = vp3_decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
+ .name = "vp3",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP3,
+ .priv_data_size = sizeof(Vp3DecodeContext),
+ .init = vp3_decode_init,
+ .close = vp3_decode_end,
+ .decode = vp3_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = vp3_decode_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
- .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
+ .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context),
};