Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-14 17:31:43 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-08-14 17:34:39 +0400
commit7427d1ca4ab202def24fc3cefc4401a351d7248c (patch)
treebe2cd06e1e5457daad74966a0155e86baa5e9086 /libavcodec/vda_h264.c
parent0e05908c954ff64ef2fcb2a97ed083bc285282c1 (diff)
parent0d230e9312a676266bd6fa3478032db4860221a7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: g723.1: simplify scale_vector() g723.1: simplify normalize_bits() vda: cosmetics: fix Doxygen comment formatting vda: better frame allocation vda: Merge implementation into one file vda: support synchronous decoding vda: Reuse the bitstream buffer and reallocate it only if needed build: Factor out mpegvideo encoding dependencies to CONFIG_MPEGVIDEOENC avprobe: Include libm.h for the log2 fallback proresenc: use the edge emulation buffer rtmp: handle bytes read reports configure: Fix typo in mpeg2video/svq1 decoder dependency declaration Use log2(x) instead of log(x) / log(2) x86: swscale: fix fragile memory accesses x86: swscale: remove disabled code x86: yadif: fix asm with suncc x86: cabac: allow building with suncc x86: mlpdsp: avoid taking address of void ARM: intmath: use native-size return types for clipping functions Conflicts: configure ffprobe.c libavcodec/Makefile libavcodec/g723_1.c libavcodec/v210dec.h libavcodec/vda.h libavcodec/vda_h264.c libavcodec/x86/cabac.h libavfilter/x86/yadif_template.c libswscale/x86/rgb2rgb_template.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vda_h264.c')
-rw-r--r--libavcodec/vda_h264.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index 8643701735..78a32245da 100644
--- a/libavcodec/vda_h264.c
+++ b/libavcodec/vda_h264.c
@@ -130,7 +130,7 @@ static void vda_decoder_callback (void *vda_hw_ctx,
uint32_t infoFlags,
CVImageBufferRef image_buffer)
{
- struct vda_context *vda_ctx = (struct vda_context*)vda_hw_ctx;
+ struct vda_context *vda_ctx = vda_hw_ctx;
if (!image_buffer)
return;
@@ -140,8 +140,7 @@ static void vda_decoder_callback (void *vda_hw_ctx,
if (vda_ctx->use_sync_decoding) {
vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer);
- }
- else {
+ } else {
vda_frame *new_frame;
vda_frame *queue_walker;
@@ -188,8 +187,8 @@ static int vda_sync_decode(struct vda_context *vda_ctx)
uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames
coded_frame = CFDataCreate(kCFAllocatorDefault,
- vda_ctx->bitstream,
- vda_ctx->bitstream_size);
+ vda_ctx->priv_bitstream,
+ vda_ctx->priv_bitstream_size);
status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);
@@ -210,7 +209,7 @@ static int start_frame(AVCodecContext *avctx,
if (!vda_ctx->decoder)
return -1;
- vda_ctx->bitstream_size = 0;
+ vda_ctx->priv_bitstream_size = 0;
return 0;
}
@@ -225,38 +224,38 @@ static int decode_slice(AVCodecContext *avctx,
if (!vda_ctx->decoder)
return -1;
- tmp = av_fast_realloc(vda_ctx->bitstream,
- &vda_ctx->ref_size,
- vda_ctx->bitstream_size+size+4);
+ tmp = av_fast_realloc(vda_ctx->priv_bitstream,
+ &vda_ctx->priv_allocated_size,
+ vda_ctx->priv_bitstream_size + size + 4);
if (!tmp)
return AVERROR(ENOMEM);
- vda_ctx->bitstream = tmp;
+ vda_ctx->priv_bitstream = tmp;
- AV_WB32(vda_ctx->bitstream+vda_ctx->bitstream_size, size);
- memcpy(vda_ctx->bitstream+vda_ctx->bitstream_size+4, buffer, size);
+ AV_WB32(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size, size);
+ memcpy(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size + 4, buffer, size);
- vda_ctx->bitstream_size += size + 4;
+ vda_ctx->priv_bitstream_size += size + 4;
return 0;
}
static int end_frame(AVCodecContext *avctx)
{
- H264Context *h = avctx->priv_data;
- struct vda_context *vda_ctx = avctx->hwaccel_context;
- AVFrame *frame = &h->s.current_picture_ptr->f;
+ H264Context *h = avctx->priv_data;
+ struct vda_context *vda_ctx = avctx->hwaccel_context;
+ AVFrame *frame = &h->s.current_picture_ptr->f;
int status;
- if (!vda_ctx->decoder || !vda_ctx->bitstream)
+ if (!vda_ctx->decoder || !vda_ctx->priv_bitstream)
return -1;
if (vda_ctx->use_sync_decoding) {
status = vda_sync_decode(vda_ctx);
frame->data[3] = (void*)vda_ctx->cv_buffer;
} else {
- status = vda_decoder_decode(vda_ctx, vda_ctx->bitstream,
- vda_ctx->bitstream_size,
+ status = vda_decoder_decode(vda_ctx, vda_ctx->priv_bitstream,
+ vda_ctx->priv_bitstream_size,
frame->reordered_opaque);
}
@@ -280,8 +279,8 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
CFMutableDictionaryRef io_surface_properties;
CFNumberRef cv_pix_fmt;
- vda_ctx->bitstream = NULL;
- vda_ctx->ref_size = 0;
+ vda_ctx->priv_bitstream = NULL;
+ vda_ctx->priv_allocated_size = 0;
#if FF_API_VDA_ASYNC
pthread_mutex_init(&vda_ctx->queue_mutex, NULL);
@@ -341,7 +340,7 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
status = VDADecoderCreate(config_info,
buffer_attributes,
- (VDADecoderOutputCallback *)vda_decoder_callback,
+ vda_decoder_callback,
vda_ctx,
&vda_ctx->decoder);
@@ -368,8 +367,7 @@ int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
vda_clear_queue(vda_ctx);
pthread_mutex_destroy(&vda_ctx->queue_mutex);
#endif
- if (vda_ctx->bitstream)
- av_freep(&vda_ctx->bitstream);
+ av_freep(&vda_ctx->priv_bitstream);
return status;
}