diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-15 15:41:01 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-15 15:55:24 +0200 |
commit | 9e89bc37edfcd1b4b0a22c096c6546df4a9d1c0b (patch) | |
tree | de31fc8aa5b32d28a0143aff2477b4c3ada40318 /libavcodec | |
parent | aee7b88cc0675fb668e39e8f4a50f2b1bd9305d4 (diff) | |
parent | 635ac8e1be91e941908f85642e4bbb609e48193f (diff) | |
download | ffmpeg-9e89bc37edfcd1b4b0a22c096c6546df4a9d1c0b.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
rtmp: Add support for SWFVerification
api-example: use new video encoding API.
x86: avcodec: Appropriately name files containing only init functions
mpegvideo_mmx_template: drop some commented-out cruft
libavresample: add mix level normalization option
w32pthreads: Add missing #includes to make header compile standalone
rtmp: Gracefully ignore _checkbw errors by tracking them
rtmp: Do not send _checkbw calls as notifications
prores: interlaced ProRes encoding
Conflicts:
doc/examples/decoding_encoding.c
libavcodec/proresenc_kostya.c
libavcodec/w32pthreads.h
libavcodec/x86/Makefile
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/proresenc_kostya.c | 51 | ||||
-rw-r--r-- | libavcodec/w32pthreads.h | 2 | ||||
-rw-r--r-- | libavcodec/x86/Makefile | 8 | ||||
-rw-r--r-- | libavcodec/x86/ac3dsp_init.c (renamed from libavcodec/x86/ac3dsp_mmx.c) | 0 | ||||
-rw-r--r-- | libavcodec/x86/fft_init.c (renamed from libavcodec/x86/fft.c) | 0 | ||||
-rw-r--r-- | libavcodec/x86/fmtconvert_init.c (renamed from libavcodec/x86/fmtconvert_mmx.c) | 0 | ||||
-rw-r--r-- | libavcodec/x86/h264dsp_init.c (renamed from libavcodec/x86/h264dsp_mmx.c) | 0 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideo_mmx_template.c | 8 |
8 files changed, 37 insertions, 32 deletions
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 440f2548fe..d69892d14f 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -406,10 +406,15 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int total_size = 0; const uint16_t *src; int slice_width_factor = av_log2(mbs_per_slice); - int num_cblocks, pwidth, linesize, line_offset; + int num_cblocks, pwidth, linesize, line_add; int plane_factor, is_chroma; uint16_t *qmat; + if (ctx->pictures_per_frame == 1) + line_add = 0; + else + line_add = ctx->cur_picture_idx ^ !pic->top_field_first; + if (ctx->force_quant) { qmat = ctx->quants[0]; } else if (quant < MAX_STORED_Q) { @@ -437,15 +442,14 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, pwidth = avctx->width >> 1; } - line_offset = ((ctx->cur_picture_idx ^ !pic->top_field_first) & - (ctx->pictures_per_frame - 1)) * pic->linesize[i]; linesize = pic->linesize[i] * ctx->pictures_per_frame; - src = (const uint16_t*)(pic->data[i] + yp * linesize + line_offset) + xp; + src = (const uint16_t*)(pic->data[i] + yp * linesize + + line_add * pic->linesize[i]) + xp; get_slice_data(ctx, src, linesize, xp, yp, pwidth, avctx->height / ctx->pictures_per_frame, - ctx->blocks[0], ctx->emu_buf, mbs_per_slice, - num_cblocks, is_chroma); + ctx->blocks[0], ctx->emu_buf, + mbs_per_slice, num_cblocks, is_chroma); sizes[i] = encode_slice_plane(ctx, pb, src, linesize, mbs_per_slice, ctx->blocks[0], num_cblocks, plane_factor, @@ -579,8 +583,12 @@ static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic, int slice_bits[TRELLIS_WIDTH], slice_score[TRELLIS_WIDTH]; int overquant; uint16_t *qmat; - int linesize[4], line_offset; + int linesize[4], line_add; + if (ctx->pictures_per_frame == 1) + line_add = 0; + else + line_add = ctx->cur_picture_idx ^ !pic->top_field_first; mbs = x + mbs_per_slice; for (i = 0; i < ctx->num_planes; i++) { @@ -600,15 +608,14 @@ static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic, pwidth = avctx->width >> 1; } - line_offset = ((ctx->cur_picture_idx ^ !pic->top_field_first) & - (ctx->pictures_per_frame - 1)) * pic->linesize[i]; linesize[i] = pic->linesize[i] * ctx->pictures_per_frame; - src = (const uint16_t*)(pic->data[i] + yp * linesize[i] + line_offset) + xp; + src = (const uint16_t*)(pic->data[i] + yp * linesize[i] + + line_add * pic->linesize[i]) + xp; get_slice_data(ctx, src, linesize[i], xp, yp, pwidth, avctx->height / ctx->pictures_per_frame, - td->blocks[i], td->emu_buf, mbs_per_slice, - num_cblocks[i], is_chroma[i]); + td->blocks[i], td->emu_buf, + mbs_per_slice, num_cblocks[i], is_chroma[i]); } for (q = min_quant; q < max_quant + 2; q++) { @@ -767,9 +774,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_be16 (&buf, avctx->height); frame_flags = ctx->chroma_factor << 6; - if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) { + if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) frame_flags |= pic->top_field_first ? 0x04 : 0x08; - } bytestream_put_byte (&buf, frame_flags); bytestream_put_byte (&buf, 0); // reserved @@ -791,7 +797,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } bytestream_put_be16 (&tmp, buf - orig_buf); // write back frame header size - for (ctx->cur_picture_idx = 0; ctx->cur_picture_idx < ctx->pictures_per_frame; ++ctx->cur_picture_idx) { + for (ctx->cur_picture_idx = 0; + ctx->cur_picture_idx < ctx->pictures_per_frame; + ctx->cur_picture_idx++) { // picture header picture_size_pos = buf + 1; bytestream_put_byte (&buf, 0x40); // picture header size (in bits) @@ -845,7 +853,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, frame_size = buf - orig_buf; bytestream_put_be32(&orig_buf, frame_size); - pkt->size = frame_size; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; @@ -927,7 +934,8 @@ static av_cold int encode_init(AVCodecContext *avctx) if (!ctx->force_quant) { if (!ctx->bits_per_mb) { for (i = 0; i < NUM_MB_LIMITS - 1; i++) - if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height * ctx->pictures_per_frame) + if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height * + ctx->pictures_per_frame) break; ctx->bits_per_mb = ctx->profile_info->br_tab[i]; } else if (ctx->bits_per_mb < 128) { @@ -991,12 +999,15 @@ static av_cold int encode_init(AVCodecContext *avctx) ctx->frame_size_upper_bound = ctx->pictures_per_frame * ctx->slices_per_picture * (2 + 2 * ctx->num_planes + - (mps * ctx->bits_per_mb) / 8) + 200; + (mps * ctx->bits_per_mb) / 8) + + 200; avctx->codec_tag = ctx->profile_info->tag; - av_log(avctx, AV_LOG_DEBUG, "profile %d, %d slices/pic, %d pics/frame, %d bits per MB\n", - ctx->profile, ctx->slices_per_picture, ctx->pictures_per_frame, ctx->bits_per_mb); + av_log(avctx, AV_LOG_DEBUG, + "profile %d, %d slices, interlacing: %s, %d bits per MB\n", + ctx->profile, ctx->slices_per_picture * ctx->pictures_per_frame, + interlaced ? "yes" : "no", ctx->bits_per_mb); av_log(avctx, AV_LOG_DEBUG, "frame size upper bound: %d\n", ctx->frame_size_upper_bound); diff --git a/libavcodec/w32pthreads.h b/libavcodec/w32pthreads.h index fbc183a645..c4bbb9a51b 100644 --- a/libavcodec/w32pthreads.h +++ b/libavcodec/w32pthreads.h @@ -40,6 +40,8 @@ #include <process.h> #include "libavutil/common.h" +#include "libavutil/internal.h" +#include "libavutil/mem.h" typedef struct { void *handle; diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index e01454a1b7..0ad3457738 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -5,7 +5,7 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o MMX-OBJS += x86/dsputil_mmx.o \ x86/fdct_mmx.o \ - x86/fmtconvert_mmx.o \ + x86/fmtconvert_init.o \ x86/idct_mmx_xvid.o \ x86/idct_sse2_xvid.o \ x86/motion_est_mmx.o \ @@ -13,15 +13,15 @@ MMX-OBJS += x86/dsputil_mmx.o \ x86/simple_idct_mmx.o \ MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o -MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o +MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \ x86/dwt.o MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o -MMX-OBJS-$(CONFIG_FFT) += x86/fft.o +MMX-OBJS-$(CONFIG_FFT) += x86/fft_init.o MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o -MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o +MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_init.c index cf1d7db8a4..cf1d7db8a4 100644 --- a/libavcodec/x86/ac3dsp_mmx.c +++ b/libavcodec/x86/ac3dsp_init.c diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft_init.c index 852c6b8d1e..852c6b8d1e 100644 --- a/libavcodec/x86/fft.c +++ b/libavcodec/x86/fft_init.c diff --git a/libavcodec/x86/fmtconvert_mmx.c b/libavcodec/x86/fmtconvert_init.c index 361ac85faf..361ac85faf 100644 --- a/libavcodec/x86/fmtconvert_mmx.c +++ b/libavcodec/x86/fmtconvert_init.c diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_init.c index ea71515079..ea71515079 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_init.c diff --git a/libavcodec/x86/mpegvideo_mmx_template.c b/libavcodec/x86/mpegvideo_mmx_template.c index 82e4ffa558..d538a39919 100644 --- a/libavcodec/x86/mpegvideo_mmx_template.c +++ b/libavcodec/x86/mpegvideo_mmx_template.c @@ -360,13 +360,5 @@ static int RENAME(dct_quantize)(MpegEncContext *s, block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: -/* - for(i=0; i<last_non_zero_p1; i++) - { - int j= zigzag_direct_noperm[i]; - block[block_permute_op(j)]= temp_block[j]; - } -*/ - return last_non_zero_p1 - 1; } |