diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-28 11:11:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-28 11:18:23 +0100 |
commit | b1064dd783b25b80ec0790876877bc886c2ec449 (patch) | |
tree | 23481a59a22165e21b6926bc6d096b0a47b1cd50 | |
parent | 7609d42d0f4682ccccbebe0c70613af189134a33 (diff) | |
parent | 1db6a080bddd14fed6b29140ecd2e21e42b1c022 (diff) | |
download | ffmpeg-b1064dd783b25b80ec0790876877bc886c2ec449.tar.gz |
Merge commit '1db6a080bddd14fed6b29140ecd2e21e42b1c022'
* commit '1db6a080bddd14fed6b29140ecd2e21e42b1c022':
dca: Move ff_dca_convert_bitstream() to the DCA common code
vdpau: wrap codec specific functions in appropiate #ifs
Conflicts:
libavcodec/Makefile
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/Makefile | 2 | ||||
-rw-r--r-- | libavcodec/dca.c | 37 | ||||
-rw-r--r-- | libavcodec/dca.h | 6 | ||||
-rw-r--r-- | libavcodec/dca_parser.c | 37 | ||||
-rw-r--r-- | libavcodec/dca_parser.h | 36 | ||||
-rw-r--r-- | libavcodec/dcadec.c | 1 | ||||
-rw-r--r-- | libavcodec/mpeg12.c | 3 | ||||
-rw-r--r-- | libavcodec/vdpau.c | 12 |
8 files changed, 58 insertions, 76 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index bbb7083452..1529e3405d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -156,7 +156,7 @@ OBJS-$(CONFIG_CPIA_DECODER) += cpia.o OBJS-$(CONFIG_CSCD_DECODER) += cscd.o OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadsp.o \ - dca_parser.o synth_filter.o + synth_filter.o OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dca.o OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o \ dirac_arith.o mpeg12data.o dirac_dwt.o diff --git a/libavcodec/dca.c b/libavcodec/dca.c index bbe1f10768..1c1c080350 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -23,7 +23,9 @@ */ #include <stdint.h> +#include <string.h> +#include "put_bits.h" #include "dca.h" const uint32_t avpriv_dca_sample_rates[16] = @@ -31,3 +33,38 @@ const uint32_t avpriv_dca_sample_rates[16] = 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000 }; + +int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, + int max_size) +{ + uint32_t mrk; + int i, tmp; + const uint16_t *ssrc = (const uint16_t *) src; + uint16_t *sdst = (uint16_t *) dst; + PutBitContext pb; + + if ((unsigned) src_size > (unsigned) max_size) + src_size = max_size; + + mrk = AV_RB32(src); + switch (mrk) { + case DCA_MARKER_RAW_BE: + memcpy(dst, src, src_size); + return src_size; + case DCA_MARKER_RAW_LE: + for (i = 0; i < (src_size + 1) >> 1; i++) + *sdst++ = av_bswap16(*ssrc++); + return src_size; + case DCA_MARKER_14B_BE: + case DCA_MARKER_14B_LE: + init_put_bits(&pb, dst, max_size); + for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { + tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; + put_bits(&pb, 14, tmp); + } + flush_put_bits(&pb); + return (put_bits_count(&pb) + 7) >> 3; + default: + return AVERROR_INVALIDDATA; + } +} diff --git a/libavcodec/dca.h b/libavcodec/dca.h index 3da93aa4d4..d60b28207a 100644 --- a/libavcodec/dca.h +++ b/libavcodec/dca.h @@ -39,4 +39,10 @@ extern av_export const uint32_t avpriv_dca_sample_rates[16]; +/** + * Convert bitstream to one representation based on sync marker + */ +int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, + int max_size); + #endif /* AVCODEC_DCA_H */ diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 266520f36c..c10426845f 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -24,9 +24,7 @@ #include "parser.h" #include "dca.h" -#include "dca_parser.h" #include "get_bits.h" -#include "put_bits.h" typedef struct DCAParseContext { ParseContext pc; @@ -101,41 +99,6 @@ static av_cold int dca_parse_init(AVCodecParserContext * s) return 0; } -int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - int max_size) -{ - uint32_t mrk; - int i, tmp; - const uint16_t *ssrc = (const uint16_t *) src; - uint16_t *sdst = (uint16_t *) dst; - PutBitContext pb; - - if ((unsigned) src_size > (unsigned) max_size) - src_size = max_size; - - mrk = AV_RB32(src); - switch (mrk) { - case DCA_MARKER_RAW_BE: - memcpy(dst, src, src_size); - return src_size; - case DCA_MARKER_RAW_LE: - for (i = 0; i < (src_size + 1) >> 1; i++) - *sdst++ = av_bswap16(*ssrc++); - return src_size; - case DCA_MARKER_14B_BE: - case DCA_MARKER_14B_LE: - init_put_bits(&pb, dst, max_size); - for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { - tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; - put_bits(&pb, 14, tmp); - } - flush_put_bits(&pb); - return (put_bits_count(&pb) + 7) >> 3; - default: - return AVERROR_INVALIDDATA; - } -} - static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, int *sample_rate) { diff --git a/libavcodec/dca_parser.h b/libavcodec/dca_parser.h deleted file mode 100644 index f480eab7ce..0000000000 --- a/libavcodec/dca_parser.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * DCA parser - * Copyright (C) 2004 Gildas Bazin - * Copyright (C) 2004 Benjamin Zores - * Copyright (C) 2006 Benjamin Larsson - * Copyright (C) 2007 Konstantin Shishkov - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCA_PARSER_H -#define AVCODEC_DCA_PARSER_H - -#include <stdint.h> - -/** - * Convert bitstream to one representation based on sync marker - */ -int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - int max_size); - -#endif /* AVCODEC_DCA_PARSER_H */ diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index cf4412c5cc..8265c0fb38 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -40,7 +40,6 @@ #include "dcadata.h" #include "dcahuff.h" #include "dca.h" -#include "dca_parser.h" #include "mathops.h" #include "synth_filter.h" #include "dcadsp.h" diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 4047731426..7a629c66b9 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2304,7 +2304,8 @@ static int decode_chunks(AVCodecContext *avctx, s2->er.error_count += s2->thread_context[i]->er.error_count; } - if (CONFIG_VDPAU && uses_vdpau(avctx)) + if ((CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER) + && uses_vdpau(avctx)) ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); ret = slice_end(avctx, picture); diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 5606902984..b9a07cd6ce 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -48,6 +48,9 @@ int ff_vdpau_common_start_frame(AVCodecContext *avctx, return 0; } +#if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \ + CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ + CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) { AVVDPAUContext *hwctx = avctx->hwaccel_context; @@ -62,6 +65,7 @@ int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) return 0; } +#endif int ff_vdpau_add_buffer(AVCodecContext *avctx, const uint8_t *buf, uint32_t size) @@ -170,6 +174,7 @@ void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size) render->bitstream_buffers_used++; } +#if CONFIG_H264_VDPAU_DECODER void ff_vdpau_h264_picture_start(H264Context *h) { struct vdpau_render_state *render; @@ -230,7 +235,9 @@ void ff_vdpau_h264_picture_complete(H264Context *h) ff_h264_draw_horiz_band(h, 0, h->avctx->height); render->bitstream_buffers_used = 0; } +#endif /* CONFIG_H264_VDPAU_DECODER */ +#if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count) { @@ -287,7 +294,9 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); render->bitstream_buffers_used = 0; } +#endif /* CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER */ +#if CONFIG_VC1_VDPAU_DECODER void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size) { @@ -356,7 +365,9 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); render->bitstream_buffers_used = 0; } +#endif /* (CONFIG_VC1_VDPAU_DECODER */ +#if CONFIG_MPEG4_VDPAU_DECODER void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size) { @@ -410,5 +421,6 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); render->bitstream_buffers_used = 0; } +#endif /* CONFIG_MPEG4_VDPAU_DECODER */ /* @}*/ |