#include "idctdsp.h"
#include "mpeg12.h"
#include "mpegvideo.h"
+#include "mpegvideodata.h"
#include "h261.h"
#include "h263.h"
+#include "h263data.h"
#include "mjpegenc_common.h"
#include "mathops.h"
#include "mpegutils.h"
#include "mpeg4video.h"
#include "internal.h"
#include "bytestream.h"
+#include "wmv2.h"
+#include "rv10.h"
#include <limits.h>
#define QUANT_BIAS_SHIFT 8
s->inter_quant_bias = -(1 << (QUANT_BIAS_SHIFT - 2));
}
- if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
+#if FF_API_QUANT_BIAS
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (s->intra_quant_bias == FF_DEFAULT_QUANT_BIAS &&
+ avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
s->intra_quant_bias = avctx->intra_quant_bias;
- if (avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
+ if (s->inter_quant_bias == FF_DEFAULT_QUANT_BIAS &&
+ avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
s->inter_quant_bias = avctx->inter_quant_bias;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (avctx->codec_id == AV_CODEC_ID_MPEG4 &&
s->avctx->time_base.den > (1 << 16) - 1) {
ff_pixblockdsp_init(&s->pdsp, avctx);
ff_qpeldsp_init(&s->qdsp);
- s->avctx->coded_frame = s->current_picture.f;
-
if (s->msmpeg4_version) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
2 * 2 * (MAX_LEVEL + 1) *
return acc;
}
+static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
+{
+ return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1,
+ s->chroma_x_shift, s->chroma_y_shift, s->out_format,
+ s->mb_stride, s->mb_height, s->b8_stride,
+ &s->linesize, &s->uvlinesize);
+}
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
ff_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize);
- i = ff_find_unused_picture(s, direct);
+ i = ff_find_unused_picture(s->avctx, s->picture, direct);
if (i < 0)
return i;
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
}
- ret = ff_alloc_picture(s, pic, direct);
+ ret = alloc_picture(s, pic, direct);
if (ret < 0)
return ret;
// one & ensure that the shared one is reuseable
Picture *pic;
- int i = ff_find_unused_picture(s, 0);
+ int i = ff_find_unused_picture(s->avctx, s->picture, 0);
if (i < 0)
return i;
pic = &s->picture[i];
pic->reference = s->reordered_input_picture[0]->reference;
- if (ff_alloc_picture(s, pic, 0) < 0) {
+ if (alloc_picture(s, pic, 0) < 0) {
return -1;
}
}
}
- s->avctx->coded_frame = s->current_picture_ptr->f;
-
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
static void update_noise_reduction(MpegEncContext *s)
/* output? */
if (s->new_picture.f->data[0]) {
+ uint8_t *sd;
if (!pkt->data &&
(ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0)
return ret;
frame_end(s);
+ sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR,
+ sizeof(int));
+ if (!sd)
+ return AVERROR(ENOMEM);
+ *(int *)sd = s->current_picture.f->quality;
+
if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
(mb_y * mb_block_height * wrap_c) + mb_x * 8;
if (mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) {
- uint8_t *ebuf = s->edge_emu_buffer + 32;
+ uint8_t *ebuf = s->sc.edge_emu_buffer + 32;
s->vdsp.emulated_edge_mc(ebuf, ptr_y,
wrap_y, wrap_y,
16, 16, mb_x * 16, mb_y * 16,
if(*next_block){
memcpy(dest_backup, s->dest, sizeof(s->dest));
- s->dest[0] = s->rd_scratchpad;
- s->dest[1] = s->rd_scratchpad + 16*s->linesize;
- s->dest[2] = s->rd_scratchpad + 16*s->linesize + 8;
+ s->dest[0] = s->sc.rd_scratchpad;
+ s->dest[1] = s->sc.rd_scratchpad + 16*s->linesize;
+ s->dest[2] = s->sc.rd_scratchpad + 16*s->linesize + 8;
assert(s->linesize >= 32); //FIXME
}
ff_h263_update_motion_val(s);
if(next_block==0){ //FIXME 16 vs linesize16
- s->hdsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16);
- s->hdsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8);
- s->hdsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
+ s->hdsp.put_pixels_tab[0][0](s->dest[0], s->sc.rd_scratchpad , s->linesize ,16);
+ s->hdsp.put_pixels_tab[1][0](s->dest[1], s->sc.rd_scratchpad + 16*s->linesize , s->uvlinesize, 8);
+ s->hdsp.put_pixels_tab[1][0](s->dest[2], s->sc.rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
}
if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
return last_non_zero;
}
+/**
+ * Permute an 8x8 block according to permuatation.
+ * @param block the block which will be permuted according to
+ * the given permutation vector
+ * @param permutation the permutation vector
+ * @param last the last non zero coefficient in scantable order, used to
+ * speed the permutation up
+ * @param scantable the used scantable, this is only used to speed the
+ * permutation up, the block is not (inverse) permutated
+ * to scantable order!
+ */
+static void block_permute(int16_t *block, uint8_t *permutation,
+ const uint8_t *scantable, int last)
+{
+ int i;
+ int16_t temp[64];
+
+ if (last <= 0)
+ return;
+ //FIXME it is ok but not clean and might fail for some permutations
+ // if (permutation[1] == 1)
+ // return;
+
+ for (i = 0; i <= last; i++) {
+ const int j = scantable[i];
+ temp[j] = block[j];
+ block[j] = 0;
+ }
+
+ for (i = 0; i <= last; i++) {
+ const int j = scantable[i];
+ const int perm_j = permutation[j];
+ block[perm_j] = temp[j];
+ }
+}
+
int ff_dct_quantize_c(MpegEncContext *s,
int16_t *block, int n,
int qscale, int *overflow)
/* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
if (s->idsp.perm_type != FF_IDCT_PERM_NONE)
- ff_block_permute(block, s->idsp.idct_permutation,
- scantable, last_non_zero);
+ block_permute(block, s->idsp.idct_permutation,
+ scantable, last_non_zero);
return last_non_zero;
}
.priv_class = &h263p_class,
};
-FF_MPV_GENERIC_CLASS(msmpeg4v2)
+static const AVClass msmpeg4v2_class = {
+ .class_name = "msmpeg4v2 encoder",
+ .item_name = av_default_item_name,
+ .option = ff_mpv_generic_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVCodec ff_msmpeg4v2_encoder = {
.name = "msmpeg4v2",
.priv_class = &msmpeg4v2_class,
};
-FF_MPV_GENERIC_CLASS(msmpeg4v3)
+static const AVClass msmpeg4v3_class = {
+ .class_name = "msmpeg4v3 encoder",
+ .item_name = av_default_item_name,
+ .option = ff_mpv_generic_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVCodec ff_msmpeg4v3_encoder = {
.name = "msmpeg4",
.priv_class = &msmpeg4v3_class,
};
-FF_MPV_GENERIC_CLASS(wmv1)
+static const AVClass wmv1_class = {
+ .class_name = "wmv1 encoder",
+ .item_name = av_default_item_name,
+ .option = ff_mpv_generic_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVCodec ff_wmv1_encoder = {
.name = "wmv1",