Commit 77aafadc authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'db7f1c7c'

* commit 'db7f1c7c':
  h264: Move start code search functions into separate source files.

Conflicts:
	libavcodec/arm/Makefile
	libavcodec/arm/h264dsp_init_arm.c
	libavcodec/h264_parser.c
	libavcodec/h264dsp.c
	libavcodec/startcode.c
	libavcodec/startcode.h

See: 270cede3Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents de417982 db7f1c7c
......@@ -1853,6 +1853,7 @@ CONFIG_EXTRA="
rtpdec
rtpenc_chain
sinewin
startcode
tpeldsp
videodsp
vp3dsp
......@@ -2095,7 +2096,7 @@ h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpel
h263_encoder_select="aandcttables h263dsp mpegvideoenc"
h263i_decoder_select="h263_decoder"
h263p_encoder_select="h263_encoder"
h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp"
h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
h264_decoder_suggest="error_resilience"
hevc_decoder_select="bswapdsp cabac golomb videodsp"
huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
......
......@@ -54,7 +54,7 @@ OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \
OBJS-$(CONFIG_GOLOMB) += golomb.o
OBJS-$(CONFIG_H263DSP) += h263dsp.o
OBJS-$(CONFIG_H264CHROMA) += h264chroma.o
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o startcode.o
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o
OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
......@@ -91,6 +91,7 @@ RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
OBJS-$(CONFIG_SHARED) += log2_tab.o
OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_STARTCODE) += startcode.o
OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
OBJS-$(CONFIG_VAAPI) += vaapi.o
OBJS-$(CONFIG_VDA) += vda.o
......
......@@ -54,7 +54,6 @@ ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \
ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
ARMV6-OBJS-$(CONFIG_H264DSP) += arm/startcode_armv6.o
ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \
arm/hpeldsp_armv6.o
ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \
......@@ -66,6 +65,7 @@ ARMV6-OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_armv6.o
ARMV6-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_armv6.o
ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o
ARMV6-OBJS-$(CONFIG_STARTCODE) += arm/startcode_armv6.o
ARMV6-OBJS-$(CONFIG_VC1_DECODER) += arm/startcode_armv6.o
ARMV6-OBJS-$(CONFIG_VC1_PARSER) += arm/startcode_armv6.o
ARMV6-OBJS-$(CONFIG_VP7_DECODER) += arm/vp8_armv6.o \
......
......@@ -23,8 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/arm/cpu.h"
#include "libavcodec/h264dsp.h"
int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size);
#include "libavcodec/arm/startcode.h"
void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
int beta, int8_t *tc0);
......@@ -109,7 +108,7 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
int cpu_flags = av_get_cpu_flags();
if (have_setend(cpu_flags))
c->h264_find_start_code_candidate = ff_startcode_find_candidate_armv6;
c->startcode_find_candidate = ff_startcode_find_candidate_armv6;
if (have_neon(cpu_flags))
h264dsp_init_neon(c, bit_depth, chroma_format_idc);
}
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_ARM_STARTCODE_H
#define AVCODEC_ARM_STARTCODE_H
#include <stdint.h>
int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size);
#endif /* AVCODEC_ARM_STARTCODE_H */
......@@ -66,7 +66,7 @@ static int h264_find_frame_end(H264Context *h, const uint8_t *buf,
}
if (state == 7) {
i += h->h264dsp.h264_find_start_code_candidate(buf + i, next_avc - i);
i += h->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
if (i < next_avc)
state = 2;
} else if (state <= 2) {
......
......@@ -151,7 +151,7 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
H264_DSP(8);
break;
}
c->h264_find_start_code_candidate = ff_startcode_find_candidate_c;
c->startcode_find_candidate = ff_startcode_find_candidate_c;
if (ARCH_AARCH64) ff_h264dsp_init_aarch64(c, bit_depth, chroma_format_idc);
if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
......
......@@ -113,7 +113,7 @@ typedef struct H264DSPContext {
* one or more further zero bytes and a one byte. Better still, filter
* out any bytes that form the trailing_zero_8bits syntax element too.
*/
int (*h264_find_start_code_candidate)(const uint8_t *buf, int size);
int (*startcode_find_candidate)(const uint8_t *buf, int size);
} H264DSPContext;
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
......
......@@ -36,19 +36,19 @@ int ff_startcode_find_candidate_c(const uint8_t *buf, int size)
* simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE
* bytes at the end.
*/
# if HAVE_FAST_64BIT
#if HAVE_FAST_64BIT
while (i < size &&
!((~*(const uint64_t *)(buf + i) &
(*(const uint64_t *)(buf + i) - 0x0101010101010101ULL)) &
0x8080808080808080ULL))
i += 8;
# else
#else
while (i < size &&
!((~*(const uint32_t *)(buf + i) &
(*(const uint32_t *)(buf + i) - 0x01010101U)) &
0x80808080U))
i += 4;
# endif
#endif
#endif
for (; i < size; i++)
if (!buf[i])
......
/*
* Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
......@@ -22,7 +20,6 @@
* @file
* Accelerated start code search function for start codes common to
* MPEG-1/2/4 video, VC-1, H.264/5
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#ifndef AVCODEC_STARTCODE_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment