*/
/**
- * @file libavcodec/svq1enc.c
+ * @file
* Sorenson Vector Quantizer #1 (SVQ1) video codec.
* For more information of the SVQ1 algorithm, visit:
* http://www.pcisys.net/~melanson/codecs/
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
+#include "h263.h"
+#include "internal.h"
#include "svq1.h"
#include "svq1enc_cb.h"
/* output 5 unknown bits (2 + 2 + 1) */
put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
- for (i = 0; i < 7; i++)
- {
- if ((ff_svq1_frame_size_table[i].width == s->frame_width) &&
- (ff_svq1_frame_size_table[i].height == s->frame_height))
- {
- put_bits(&s->pb, 3, i);
- break;
- }
- }
+ i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
+ put_bits(&s->pb, 3, i);
if (i == 7)
{
- put_bits(&s->pb, 3, 7);
put_bits(&s->pb, 12, s->frame_width);
put_bits(&s->pb, 12, s->frame_height);
}
int block_width, block_height;
int level;
int threshold[6];
+ uint8_t *src = s->scratchbuf + stride * 16;
const int lambda= (s->picture.quality*s->picture.quality) >> (2*FF_LAMBDA_SHIFT);
/* figure out the acceptable level thresholds in advance */
s->m.me.dia_size= s->avctx->dia_size;
s->m.first_slice_line=1;
for (y = 0; y < block_height; y++) {
- uint8_t src[stride*16];
-
s->m.new_picture.data[0]= src - y*16*stride; //ugly
s->m.mb_y= y;
s->m.first_slice_line=1;
for (y = 0; y < block_height; y++) {
- uint8_t src[stride*16];
-
for(i=0; i<16 && i + 16*y<height; i++){
memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
for(x=width; x<16*block_width; x++)
if(!s->current_picture.data[0]){
avctx->get_buffer(avctx, &s->current_picture);
avctx->get_buffer(avctx, &s->last_picture);
- s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16);
+ s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16 * 2);
}
temp= s->current_picture;
AVCodec svq1_encoder = {
"svq1",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_SVQ1,
sizeof(SVQ1Context),
svq1_encode_init,
svq1_encode_frame,
svq1_encode_end,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1"),
+ .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
};