Commit 552ec4c9 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  get_bits: remove A32 variant
  avconv: support stream specifiers in -metadata and -map_metadata
  wavpack: Fix 32-bit clipping
  wavpack: Clip samples after shifting
  h264: don't drop B-frames after next keyframe on POC reset.
  get_bits: remove useless pointer casts
  configure: refactor lists of tests and components into variables
  rv40: NEON optimised weak loop filter
  mpegts: replace some magic numbers with the existing define
  swscale: add unscaled packed 16 bit per component endianess conversion

Conflicts:
	libavcodec/get_bits.h
	libavcodec/h264.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6d8e6fe9 a1e98f19
This diff is collapsed.
......@@ -1882,6 +1882,20 @@ INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
ALL_COMPONENTS="
$BSF_LIST
$DECODER_LIST
$DEMUXER_LIST
$ENCODER_LIST
$FILTER_LIST
$HWACCEL_LIST
$INDEV_LIST
$MUXER_LIST
$OUTDEV_LIST
$PARSER_LIST
$PROTOCOL_LIST
"
find_tests(){
map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
}
......@@ -1892,6 +1906,8 @@ LAVF_TESTS=$(find_tests lavf)
LAVFI_TESTS=$(find_tests lavfi)
SEEK_TESTS=$(find_tests seek seek_)
ALL_TESTS="$ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
for n in $COMPONENT_LIST; do
......@@ -1900,7 +1916,7 @@ for n in $COMPONENT_LIST; do
eval ${n}_if_any="\$$v"
done
enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
enable $ARCH_EXT_LIST $ALL_TESTS
die_unknown(){
echo "Unknown option \"$1\"."
......@@ -3310,22 +3326,8 @@ enabled_any $THREADS_LIST && enable threads
check_deps $CONFIG_LIST \
$CONFIG_EXTRA \
$HAVE_LIST \
$DECODER_LIST \
$ENCODER_LIST \
$HWACCEL_LIST \
$PARSER_LIST \
$BSF_LIST \
$DEMUXER_LIST \
$MUXER_LIST \
$FILTER_LIST \
$INDEV_LIST \
$OUTDEV_LIST \
$PROTOCOL_LIST \
$ACODEC_TESTS \
$VCODEC_TESTS \
$LAVF_TESTS \
$LAVFI_TESTS \
$SEEK_TESTS \
$ALL_COMPONENTS \
$ALL_TESTS \
enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
......@@ -3606,17 +3608,7 @@ print_config ARCH_ "$config_files" $ARCH_LIST
print_config HAVE_ "$config_files" $HAVE_LIST
print_config CONFIG_ "$config_files" $CONFIG_LIST \
$CONFIG_EXTRA \
$DECODER_LIST \
$ENCODER_LIST \
$HWACCEL_LIST \
$PARSER_LIST \
$BSF_LIST \
$DEMUXER_LIST \
$MUXER_LIST \
$FILTER_LIST \
$PROTOCOL_LIST \
$INDEV_LIST \
$OUTDEV_LIST \
$ALL_COMPONENTS \
cat >>config.mak <<EOF
ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
......
......@@ -173,9 +173,9 @@ For example, for setting the title in the output file:
avconv -i in.avi -metadata title="my title" out.flv
@end example
To set the language of the second stream:
To set the language of the first audio stream:
@example
avconv -i INPUT -metadata:s:1 language=eng OUTPUT
avconv -i INPUT -metadata:s:a:0 language=eng OUTPUT
@end example
@item -target @var{type} (@emph{output})
......@@ -680,14 +680,28 @@ avconv -i INPUT -map 0 -map -0:a:1 OUTPUT
Note that using this option disables the default mappings for this output file.
@item -map_metadata[:@var{metadata_type}][:@var{index}] @var{infile}[:@var{metadata_type}][:@var{index}] (@emph{output,per-metadata})
@item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata})
Set metadata information of the next output file from @var{infile}. Note that
those are file indices (zero-based), not filenames.
Optional @var{metadata_type} parameters specify, which metadata to copy - (g)lobal
(i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
per-(p)rogram. All metadata specifiers other than global must be followed by the
stream/chapter/program index. If metadata specifier is omitted, it defaults to
global.
Optional @var{metadata_spec_in/out} parameters specify, which metadata to copy.
A metadata specifier can have the following forms:
@table @option
@item @var{g}
global metadata, i.e. metadata that applies to the whole file
@item @var{s}[:@var{stream_spec}]
per-stream metadata. @var{stream_spec} is a stream specifier as described
in the @ref{Stream specifiers} chapter. In an input metadata specifier, the first
matching stream is copied from. In an output metadata specifier, all matching
streams are copied to.
@item @var{c}:@var{chapter_index}
per-chapter metadata. @var{chapter_index} is the zero-based chapter index.
@item @var{p}:@var{program_index}
per-program metadata. @var{program_index} is the zero-based program index.
@end table
If metadata specifier is omitted, it defaults to global.
By default, global metadata is copied from the first input file,
per-stream and per-chapter metadata is copied along with streams/chapters. These
......@@ -699,6 +713,14 @@ of the output file:
@example
avconv -i in.ogg -map_metadata 0:s:0 out.mp3
@end example
To do the reverse, i.e. copy global metadata to all audio streams:
@example
avconv -i in.mkv -map_metadata:s:a 0:g out.mkv
@end example
Note that simple @code{0} would work as well in this example, since global
metadata is assumed by default.
@item -map_chapters @var{input_file_index} (@emph{output})
Copy chapters from input file with index @var{input_file_index} to the next
output file. If no chapter mapping is specified, then chapters are copied from
......
......@@ -11,6 +11,7 @@ corresponding value to true. They can be set to false by prefixing
with "no" the option name, for example using "-nofoo" in the
command line will set to false the boolean option with name "foo".
@anchor{Stream specifiers}
@section Stream specifiers
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
are used to precisely specify which stream(s) does a given option belong to.
......
This diff is collapsed.
......@@ -61,6 +61,13 @@ int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, int stride,
int beta, int beta2, int edge,
int *p1, int *q1);
void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
int filter_q1, int alpha, int beta,
int lim_p0q0, int lim_q1, int lim_p1);
void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
int filter_q1, int alpha, int beta,
int lim_p0q0, int lim_q1, int lim_p1);
void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
{
c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon;
......@@ -126,4 +133,6 @@ void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon;
c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon;
c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon;
c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon;
}
......@@ -808,3 +808,113 @@ function ff_rv40_v_loop_filter_strength_neon, export=1
vmov.u16 r0, d0[0]
bx lr
endfunc
.macro rv40_weak_loop_filter
vdup.16 d30, r2 @ filter_p1
vdup.16 d31, r3 @ filter_q1
ldrd r2, r3, [sp]
vdup.16 d28, r2 @ alpha
vdup.16 d29, r3 @ beta
ldr r12, [sp, #8]
vdup.16 d25, r12 @ lim_p0q0
ldrd r2, r3, [sp, #12]
vsubl.u8 q9, d5, d4 @ x, t
vabdl.u8 q8, d5, d4 @ x, abs(t)
vneg.s16 q15, q15
vceq.i16 d16, d19, #0 @ !t
vshl.s16 d19, d19, #2 @ t << 2
vmul.u16 d18, d17, d28 @ alpha * abs(t)
vand d24, d30, d31 @ filter_p1 & filter_q1
vsubl.u8 q1, d0, d4 @ p1p2, p1p0
vsubl.u8 q3, d1, d5 @ q1q2, q1q0
vmov.i16 d22, #3
vshr.u16 d18, d18, #7
vadd.i16 d22, d22, d24 @ 3 - (filter_p1 & filter_q1)
vsubl.u8 q10, d0, d1 @ src[-2] - src[1]
vcle.u16 d18, d18, d22
vand d20, d20, d24
vneg.s16 d23, d25 @ -lim_p0q0
vadd.s16 d19, d19, d20
vbic d16, d18, d16 @ t && u <= 3 - (fp1 & fq1)
vtrn.32 d4, d5 @ -3, 2, -1, 0
vrshr.s16 d19, d19, #3
vmov d28, d29 @ beta
vswp d3, d6 @ q1q2, p1p0
vmin.s16 d19, d19, d25
vand d30, d30, d16
vand d31, d31, d16
vadd.s16 q10, q1, q3 @ p1p2 + p1p0, q1q2 + q1q0
vmax.s16 d19, d19, d23 @ diff
vabs.s16 q1, q1 @ abs(p1p2), abs(q1q2)
vand d18, d19, d16 @ diff
vcle.u16 q1, q1, q14
vneg.s16 d19, d18 @ -diff
vdup.16 d26, r3 @ lim_p1
vaddw.u8 q2, q9, d5 @ src[-1]+diff, src[0]-diff
vhsub.s16 q11, q10, q9
vand q1, q1, q15
vqmovun.s16 d4, q2 @ -1, 0
vand q9, q11, q1
vdup.16 d27, r2 @ lim_q1
vneg.s16 q9, q9
vneg.s16 q14, q13
vmin.s16 q9, q9, q13
vtrn.32 d0, d1 @ -2, 1, -2, 1
vmax.s16 q9, q9, q14
vaddw.u8 q3, q9, d0
vqmovun.s16 d5, q3 @ -2, 1
.endm
function ff_rv40_h_weak_loop_filter_neon, export=1
sub r0, r0, r1, lsl #1
sub r0, r0, r1
vld1.32 {d4[]}, [r0,:32], r1
vld1.32 {d0[]}, [r0,:32], r1
vld1.32 {d4[1]}, [r0,:32], r1
vld1.32 {d5[]}, [r0,:32], r1
vld1.32 {d1[]}, [r0,:32], r1
vld1.32 {d5[0]}, [r0,:32]
sub r0, r0, r1, lsl #2
rv40_weak_loop_filter
vst1.32 {d5[0]}, [r0,:32], r1
vst1.32 {d4[0]}, [r0,:32], r1
vst1.32 {d4[1]}, [r0,:32], r1
vst1.32 {d5[1]}, [r0,:32], r1
bx lr
endfunc
function ff_rv40_v_weak_loop_filter_neon, export=1
sub r12, r0, #3
sub r0, r0, #2
vld1.8 {d4}, [r12], r1
vld1.8 {d5}, [r12], r1
vld1.8 {d2}, [r12], r1
vld1.8 {d3}, [r12], r1
vtrn.16 q2, q1
vtrn.8 d4, d5
vtrn.8 d2, d3
vrev64.32 d5, d5
vtrn.32 q2, q1
vdup.32 d0, d3[0]
vdup.32 d1, d2[0]
rv40_weak_loop_filter
vtrn.32 q2, q3
vswp d4, d5
vst4.8 {d4[0],d5[0],d6[0],d7[0]}, [r0], r1
vst4.8 {d4[1],d5[1],d6[1],d7[1]}, [r0], r1
vst4.8 {d4[2],d5[2],d6[2],d7[2]}, [r0], r1
vst4.8 {d4[3],d5[3],d6[3],d7[3]}, [r0], r1
bx lr
endfunc
......@@ -37,7 +37,7 @@
* @file
* DV codec.
*/
#define ALT_BITSTREAM_READER
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "dsputil.h"
......
......@@ -133,12 +133,12 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# ifdef ALT_BITSTREAM_READER_LE
# define UPDATE_CACHE(name, gb) \
name##_cache = AV_RL32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) >> (name##_index&0x07)
name##_cache = AV_RL32((gb)->buffer+(name##_index>>3)) >> (name##_index&0x07)
# define SKIP_CACHE(name, gb, num) name##_cache >>= (num)
# else
# define UPDATE_CACHE(name, gb) \
name##_cache = AV_RB32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) << (name##_index&0x07)
name##_cache = AV_RB32((gb)->buffer+(name##_index>>3)) << (name##_index&0x07)
# define SKIP_CACHE(name, gb, num) name##_cache <<= (num)
# endif
......
......@@ -35,7 +35,6 @@
#include <stddef.h>
#include <stdio.h>
#define ALT_BITSTREAM_READER
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
......
......@@ -28,7 +28,7 @@
* @see http://wiki.multimedia.cx/index.php?title=Apple_ProRes
*/
#define A32_BITSTREAM_READER // some ProRes vlc codes require up to 28 bits to be read at once
#define LONG_BITSTREAM_READER // some ProRes vlc codes require up to 28 bits to be read at once
#include <stdint.h>
......
......@@ -405,12 +405,12 @@ static inline int wv_get_value_integer(WavpackFrameContext *s, uint32_t *crc, in
}
bit = (S & s->and) | s->or;
bit = (((S + bit) << s->shift) - bit);
bit = (((S + bit) << s->shift) - bit) << s->post_shift;
if(s->hybrid)
bit = av_clip(bit, -s->hybrid_maxclip, s->hybrid_maxclip - 1);
bit = av_clip(bit, -s->hybrid_maxclip - 1, s->hybrid_maxclip);
return bit << s->post_shift;
return bit;
}
static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
......@@ -798,7 +798,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->joint = s->frame_flags & WV_JOINT_STEREO;
s->hybrid = s->frame_flags & WV_HYBRID_MODE;
s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;
s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1);
s->hybrid_maxclip = (1LL << ((((s->frame_flags & 0x03) + 1) << 3) - 1)) - 1;
s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f);
s->CRC = AV_RL32(buf); buf += 4;
if(wc->mkv_mode)
......
......@@ -665,7 +665,7 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
pkt->size = pes->data_index;
if(pes->total_size != MAX_PES_PAYLOAD &&
pes->pes_header_size + pes->data_index != pes->total_size + 6) {
pes->pes_header_size + pes->data_index != pes->total_size + PES_START_SIZE) {
av_log(pes->stream, AV_LOG_WARNING, "PES packet size mismatch\n");
pes->flags |= AV_PKT_FLAG_CORRUPT;
}
......@@ -948,9 +948,9 @@ static int mpegts_push_data(MpegTSFilter *filter,
* decreases demuxer delay for infrequent packets like subtitles from
* a couple of seconds to milliseconds for properly muxed files.
* total_size is the number of bytes following pes_packet_length
* in the pes header, i.e. not counting the first 6 bytes */
* in the pes header, i.e. not counting the first PES_START_SIZE bytes */
if (!ts->stop_parse && pes->total_size < MAX_PES_PAYLOAD &&
pes->pes_header_size + pes->data_index == pes->total_size + 6) {
pes->pes_header_size + pes->data_index == pes->total_size + PES_START_SIZE) {
ts->stop_parse = 1;
new_pes_packet(pes, ts->pkt);
}
......
......@@ -210,6 +210,27 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, c
}
}
static int packed_16bpc_bswap(SwsContext *c, const uint8_t* src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t* dst[], int dstStride[])
{
int i, j;
int srcstr = srcStride[0] >> 1;
int dststr = dstStride[0] >> 1;
uint16_t *dstPtr = (uint16_t *)dst[0];
const uint16_t *srcPtr = (const uint16_t *)src[0];
for (i = 0; i < srcSliceH; i++) {
for (j = 0; j < srcstr; j++) {
dstPtr[j] = av_bswap16(srcPtr[j]);
}
srcPtr += srcstr;
dstPtr += dststr;
}
return srcSliceH;
}
static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
......@@ -676,6 +697,15 @@ void ff_get_unscaled_swscale(SwsContext *c)
if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
c->swScale= bgr24ToYv12Wrapper;
/* bswap 16 bits per component packed formats */
if ((srcFormat == PIX_FMT_RGB48LE && dstFormat == PIX_FMT_RGB48BE) ||
(srcFormat == PIX_FMT_RGB48BE && dstFormat == PIX_FMT_RGB48LE) ||
(srcFormat == PIX_FMT_BGR48LE && dstFormat == PIX_FMT_BGR48BE) ||
(srcFormat == PIX_FMT_BGR48BE && dstFormat == PIX_FMT_BGR48LE) ||
(srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
(srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE))
c->swScale = packed_16bpc_bswap;
/* RGB/BGR -> RGB/BGR (no dither needed forms) */
if ( isAnyRGB(srcFormat)
&& isAnyRGB(dstFormat)
......
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