mirror of https://github.com/FFmpeg/FFmpeg.git
Compare commits
No commits in common. "9b348aa60b0f1b45a6cfbae5451bf1544fc6fd93" and "cb7b962a4addabc441189b35703a3ef62d687212" have entirely different histories.
9b348aa60b
...
cb7b962a4a
|
|
@ -2349,6 +2349,7 @@ HEADERS_LIST="
|
|||
linux_dma_buf_h
|
||||
linux_perf_event_h
|
||||
malloc_h
|
||||
opencv2_core_core_c_h
|
||||
poll_h
|
||||
pthread_np_h
|
||||
sys_hwprobe_h
|
||||
|
|
@ -7202,8 +7203,10 @@ enabled libnpp && { test_cpp_condition "$(cd "$source_path"; pwd)/lib
|
|||
die "ERROR: libnpp support is deprecated, version 13.0 and up are not supported"; }
|
||||
enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
|
||||
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
|
||||
enabled libopencv && { check_pkg_config libopencv opencv4 opencv2/core/core_c.h cvCreateImageHeader ||
|
||||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; }
|
||||
enabled libopencv && { check_headers opencv2/core/core_c.h &&
|
||||
{ check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
|
||||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
|
||||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
|
||||
enabled libopenh264 && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion
|
||||
enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
|
||||
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
|
||||
|
|
|
|||
|
|
@ -1282,59 +1282,14 @@ int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void unchoke_for_stream(Scheduler *sch, SchedulerNode src);
|
||||
|
||||
// Unchoke any filter graphs that are downstream of this node, to prevent it
|
||||
// from getting stuck trying to push data to a full queue
|
||||
static void unchoke_downstream(Scheduler *sch, SchedulerNode *dst)
|
||||
{
|
||||
SchFilterGraph *fg;
|
||||
SchDec *dec;
|
||||
SchEnc *enc;
|
||||
switch (dst->type) {
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
dec = &sch->dec[dst->idx];
|
||||
for (int i = 0; i < dec->nb_outputs; i++)
|
||||
unchoke_downstream(sch, dec->outputs[i].dst);
|
||||
break;
|
||||
case SCH_NODE_TYPE_ENC:
|
||||
enc = &sch->enc[dst->idx];
|
||||
for (int i = 0; i < enc->nb_dst; i++)
|
||||
unchoke_downstream(sch, &enc->dst[i]);
|
||||
break;
|
||||
case SCH_NODE_TYPE_MUX:
|
||||
// muxers are never choked
|
||||
break;
|
||||
case SCH_NODE_TYPE_FILTER_IN:
|
||||
fg = &sch->filters[dst->idx];
|
||||
if (fg->best_input == fg->nb_inputs) {
|
||||
fg->waiter.choked_next = 0;
|
||||
} else {
|
||||
// ensure that this filter graph is not stuck waiting for
|
||||
// input from a different upstream demuxer
|
||||
unchoke_for_stream(sch, fg->inputs[fg->best_input].src);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_unreachable("Invalid destination node type?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unchoke_for_stream(Scheduler *sch, SchedulerNode src)
|
||||
{
|
||||
while (1) {
|
||||
SchFilterGraph *fg;
|
||||
SchDemux *demux;
|
||||
switch (src.type) {
|
||||
case SCH_NODE_TYPE_DEMUX:
|
||||
// fed directly by a demuxer (i.e. not through a filtergraph)
|
||||
demux = &sch->demux[src.idx];
|
||||
if (demux->waiter.choked_next == 0)
|
||||
return; // prevent infinite loop
|
||||
demux->waiter.choked_next = 0;
|
||||
for (int i = 0; i < demux->nb_streams; i++)
|
||||
unchoke_downstream(sch, demux->streams[i].dst);
|
||||
sch->demux[src.idx].waiter.choked_next = 0;
|
||||
return;
|
||||
case SCH_NODE_TYPE_DEC:
|
||||
src = sch->dec[src.idx].src;
|
||||
|
|
|
|||
|
|
@ -917,7 +917,6 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext
|
|||
sh->short_term_ref_pic_set_size = 0;
|
||||
sh->short_term_rps = NULL;
|
||||
sh->long_term_ref_pic_set_size = 0;
|
||||
sh->long_term_rps.nb_refs = 0;
|
||||
sh->slice_temporal_mvp_enabled_flag = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -626,8 +626,10 @@ int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps,
|
|||
ret += !!(rps->used & (1 << i));
|
||||
}
|
||||
|
||||
for (i = 0; i < long_rps->nb_refs; i++)
|
||||
ret += !!long_rps->used[i];
|
||||
if (long_rps) {
|
||||
for (i = 0; i < long_rps->nb_refs; i++)
|
||||
ret += !!long_rps->used[i];
|
||||
}
|
||||
|
||||
if (sh->inter_layer_pred) {
|
||||
av_assert0(pps->sps->vps->num_direct_ref_layers[layer_idx] < 2);
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ static int osq_decode_block(AVCodecContext *avctx, AVFrame *frame)
|
|||
int32_t *src = s->decode_buffer[ch] + OFFSET;
|
||||
|
||||
for (int n = 0; n < nb_samples; n++)
|
||||
dst[n] = av_clip_uint8(src[n] + 0x80ll);
|
||||
dst[n] = av_clip_uint8(src[n] + 0x80);
|
||||
}
|
||||
break;
|
||||
case AV_SAMPLE_FMT_S16P:
|
||||
|
|
|
|||
|
|
@ -311,7 +311,6 @@ static int update_dimensions_clear_info(RV60Context *s, int width, int height)
|
|||
return ret;
|
||||
|
||||
memset(s->pu_info, 0, s->pu_stride * (s->cu_height << 3) * sizeof(s->pu_info[0]));
|
||||
memset(s->blk_info, 0, s->blk_stride * (s->cu_height << 4) * sizeof(s->blk_info[0]));
|
||||
|
||||
for (int j = 0; j < s->cu_height << 4; j++)
|
||||
for (int i = 0; i < s->cu_width << 4; i++)
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ static void restore_median_planar_il(UtvideoContext *c, uint8_t *src, ptrdiff_t
|
|||
// second line - first element has top prediction, the rest uses median
|
||||
C = bsrc[-stride2];
|
||||
bsrc[0] += C;
|
||||
A = B = bsrc[0];
|
||||
A = bsrc[0];
|
||||
for (i = 1; i < FFMIN(width, 16); i++) { /* scalar loop (DSP need align 16) */
|
||||
B = bsrc[i - stride2];
|
||||
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void main(void)
|
|||
uint chroma_shift = comp != 0 ? log2_chroma_w : 0;
|
||||
bool act = gid.x < mb_width << (4 - chroma_shift);
|
||||
|
||||
/* Coalesced load of DCT coeffs in shared memory, inverse quantization */
|
||||
/* Coalesced load of DCT coeffs in shared memory, second part of inverse quantization */
|
||||
if (act) {
|
||||
/**
|
||||
* According to spec indexing an array in push constant memory with
|
||||
|
|
@ -95,14 +95,9 @@ void main(void)
|
|||
* so copy the whole matrix locally.
|
||||
*/
|
||||
uint8_t[64] qmat = comp == 0 ? qmat_luma : qmat_chroma;
|
||||
|
||||
/* Table 15 */
|
||||
uint8_t qidx = quant_idx[(gid.y >> 1) * mb_width + (gid.x >> 4)];
|
||||
int qscale = qidx > 128 ? (qidx - 96) << 2 : qidx;
|
||||
|
||||
[[unroll]] for (uint i = 0; i < 8; ++i) {
|
||||
int v = sign_extend(int(get_px(comp, ivec2(gid.x, (gid.y << 3) + i))), 16);
|
||||
blocks[block][i * 9 + idx] = float(v * qscale * int(qmat[(i << 3) + idx]));
|
||||
int v = sign_extend(int(get_px(comp, ivec2(gid.x, (gid.y << 3) | i))), 16);
|
||||
blocks[block][i * 9 + idx] = float(v * int(qmat[(i << 3) + idx]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +117,7 @@ void main(void)
|
|||
if (act) {
|
||||
[[unroll]] for (uint i = 0; i < 8; ++i) {
|
||||
float v = blocks[block][i * 9 + idx] * fact + off;
|
||||
put_px(comp, ivec2(gid.x, (gid.y << 3) + i), clamp(int(v), 0, maxv));
|
||||
put_px(comp, ivec2(gid.x, (gid.y << 3) | i), clamp(int(v), 0, maxv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
void put_px(uint tex_idx, ivec2 pos, uint v)
|
||||
{
|
||||
#ifndef INTERLACED
|
||||
imageStore(dst[tex_idx], pos, uvec4(uint16_t(v)));
|
||||
imageStore(dst[tex_idx], pos, uvec4(v));
|
||||
#else
|
||||
imageStore(dst[tex_idx], ivec2(pos.x, (pos.y << 1) + bottom_field), uvec4(uint16_t(v)));
|
||||
imageStore(dst[tex_idx], ivec2(pos.x, (pos.y << 1) + bottom_field), uvec4(v));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ uint decode_codeword(inout GetBitContext gb, int codebook)
|
|||
}
|
||||
}
|
||||
|
||||
void decode_comp(in GetBitContext gb, uvec2 mb_pos, uint mb_count)
|
||||
void decode_comp(in GetBitContext gb, uvec2 mb_pos, uint mb_count, uint qscale)
|
||||
{
|
||||
uvec3 gid = gl_GlobalInvocationID;
|
||||
uint is_luma = uint(gid.z == 0);
|
||||
|
|
@ -70,7 +70,7 @@ void decode_comp(in GetBitContext gb, uvec2 mb_pos, uint mb_count)
|
|||
{
|
||||
/* First coeff */
|
||||
uint c = to_signed(decode_codeword(gb, 0x650));
|
||||
put_px(gid.z, base_pos, c);
|
||||
put_px(gid.z, base_pos, c * qscale & 0xffff);
|
||||
|
||||
/**
|
||||
* Table 9, encoded as (last_rice_q << 0) | (krice or kexp << 4) | ((kexp or kexp + 1) << 8)
|
||||
|
|
@ -89,7 +89,7 @@ void decode_comp(in GetBitContext gb, uvec2 mb_pos, uint mb_count)
|
|||
int s = int(prev_dc_diff) >> 31;
|
||||
c += prev_dc_diff = (to_signed(cw) ^ s) - s;
|
||||
|
||||
put_px(gid.z, base_pos + pos_to_block(i, is_luma), c);
|
||||
put_px(gid.z, base_pos + pos_to_block(i, is_luma), c * qscale & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ void decode_comp(in GetBitContext gb, uvec2 mb_pos, uint mb_count)
|
|||
ivec2 bpos = ivec2(scan & 0xf, scan >> 4);
|
||||
|
||||
uint c = ((level + 1) ^ -s) + s;
|
||||
put_px(gid.z, base_pos + spos + bpos, c);
|
||||
put_px(gid.z, base_pos + spos + bpos, c * qscale & 0xffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ void decode_alpha(in GetBitContext gb, uvec2 mb_pos, uint mb_count)
|
|||
*/
|
||||
uint val = (alpha << alpha_rescale_lshift) | (alpha >> alpha_rescale_rshift);
|
||||
for (uint end = pos + run; pos < end; ++pos)
|
||||
put_px(3, base_pos + ivec2(pos & block_mask, pos >> block_shift), val);
|
||||
put_px(3, base_pos + ivec2(pos & block_mask, pos >> block_shift), val & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,8 +235,13 @@ void main(void)
|
|||
u8buf bs = u8buf(slice_data + slice_off);
|
||||
|
||||
/* Decode slice header */
|
||||
uint hdr_size, qidx, y_size, u_size, v_size, a_size;
|
||||
hdr_size = bs[0].v >> 3, qidx = clamp(bs[1].v, 1, 224);
|
||||
uint hdr_size, y_size, u_size, v_size, a_size;
|
||||
hdr_size = bs[0].v >> 3;
|
||||
|
||||
/* Table 15 */
|
||||
uint qidx = clamp(bs[1].v, 1, 224),
|
||||
qscale = qidx > 128 ? (qidx - 96) << 2 : qidx;
|
||||
|
||||
y_size = (uint(bs[2].v) << 8) | bs[3].v;
|
||||
u_size = (uint(bs[4].v) << 8) | bs[5].v;
|
||||
|
||||
|
|
@ -303,17 +308,10 @@ void main(void)
|
|||
uint mb_count = 1 << log2_width;
|
||||
|
||||
if (gid.z < 3) {
|
||||
/* Color entropy decoding, inverse scanning */
|
||||
decode_comp(gb, uvec2(mb_x, mb_y), mb_count);
|
||||
/* Color entropy decoding, inverse scanning, first part of inverse quantization */
|
||||
decode_comp(gb, uvec2(mb_x, mb_y), mb_count, qscale);
|
||||
} else {
|
||||
/* Alpha entropy decoding */
|
||||
decode_alpha(gb, uvec2(mb_x, mb_y), mb_count);
|
||||
}
|
||||
|
||||
/* Forward the quantization index to the IDCT shader */
|
||||
if (gid.z == 0) {
|
||||
uint base = mb_y * mb_width + mb_x;
|
||||
for (uint i = 0; i < mb_count; ++i)
|
||||
quant_idx[base + i] = uint8_t(qidx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,11 @@ const FFVulkanDecodeDescriptor ff_vk_dec_prores_desc = {
|
|||
typedef struct ProresVulkanDecodePicture {
|
||||
FFVulkanDecodePicture vp;
|
||||
|
||||
AVBufferRef *metadata_buf;
|
||||
AVBufferRef *slice_offset_buf;
|
||||
uint32_t slice_num;
|
||||
|
||||
uint32_t bitstream_start;
|
||||
uint32_t bitstream_size;
|
||||
uint32_t slice_num;
|
||||
|
||||
uint32_t slice_offsets_sz, mb_params_sz;
|
||||
} ProresVulkanDecodePicture;
|
||||
|
||||
typedef struct ProresVulkanDecodeContext {
|
||||
|
|
@ -53,7 +51,7 @@ typedef struct ProresVulkanDecodeContext {
|
|||
FFVulkanShader idct;
|
||||
} shaders[2]; /* Progressive/interlaced */
|
||||
|
||||
AVBufferPool *metadata_pool;
|
||||
AVBufferPool *slice_offset_pool;
|
||||
} ProresVulkanDecodeContext;
|
||||
|
||||
typedef struct ProresVkParameters {
|
||||
|
|
@ -90,9 +88,6 @@ static int vk_prores_start_frame(AVCodecContext *avctx,
|
|||
|
||||
int err;
|
||||
|
||||
pp->slice_offsets_sz = (pr->slice_count + 1) * sizeof(uint32_t);
|
||||
pp->mb_params_sz = pr->mb_width * pr->mb_height * sizeof(uint8_t);
|
||||
|
||||
/* Host map the input slices data if supported */
|
||||
if (!vp->slices_buf && ctx->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY)
|
||||
RET(ff_vk_host_map_buffer(&ctx->s, &vp->slices_buf, buffer_ref->data,
|
||||
|
|
@ -101,10 +96,11 @@ static int vk_prores_start_frame(AVCodecContext *avctx,
|
|||
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT));
|
||||
|
||||
/* Allocate slice offsets buffer */
|
||||
RET(ff_vk_get_pooled_buffer(&ctx->s, &pv->metadata_pool,
|
||||
&pp->metadata_buf,
|
||||
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
|
||||
NULL, pp->slice_offsets_sz + pp->mb_params_sz,
|
||||
RET(ff_vk_get_pooled_buffer(&ctx->s, &pv->slice_offset_pool,
|
||||
&pp->slice_offset_buf,
|
||||
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
|
||||
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
|
||||
NULL, (pr->slice_count + 1) * sizeof(uint32_t),
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT));
|
||||
|
||||
|
|
@ -127,7 +123,7 @@ static int vk_prores_decode_slice(AVCodecContext *avctx,
|
|||
ProresVulkanDecodePicture *pp = pr->hwaccel_picture_private;
|
||||
FFVulkanDecodePicture *vp = &pp->vp;
|
||||
|
||||
FFVkBuffer *slice_offset = (FFVkBuffer *)pp->metadata_buf->data;
|
||||
FFVkBuffer *slice_offset = (FFVkBuffer *)pp->slice_offset_buf->data;
|
||||
FFVkBuffer *slices_buf = vp->slices_buf ? (FFVkBuffer *)vp->slices_buf->data : NULL;
|
||||
|
||||
/* Skip picture header */
|
||||
|
|
@ -162,7 +158,7 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
FFVulkanDecodePicture *vp = &pp->vp;
|
||||
|
||||
ProresVkParameters pd;
|
||||
FFVkBuffer *slice_data, *metadata;
|
||||
FFVkBuffer *slice_data, *slice_offsets;
|
||||
struct ProresVulkanShaderVariants *shaders;
|
||||
VkImageMemoryBarrier2 img_bar[AV_NUM_DATA_POINTERS];
|
||||
VkBufferMemoryBarrier2 buf_bar[2];
|
||||
|
|
@ -176,8 +172,8 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
if (!pix_desc)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
slice_data = (FFVkBuffer *)vp->slices_buf->data;
|
||||
metadata = (FFVkBuffer *)pp->metadata_buf->data;
|
||||
slice_data = (FFVkBuffer *)vp->slices_buf->data;
|
||||
slice_offsets = (FFVkBuffer *)pp->slice_offset_buf->data;
|
||||
|
||||
shaders = &pv->shaders[pr->frame_type != 0];
|
||||
|
||||
|
|
@ -213,13 +209,13 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
pr->frame));
|
||||
|
||||
RET(ff_vk_exec_add_dep_buf(&ctx->s, exec,
|
||||
(AVBufferRef *[]){ vp->slices_buf, pp->metadata_buf, },
|
||||
(AVBufferRef *[]){ vp->slices_buf, pp->slice_offset_buf },
|
||||
2, 0));
|
||||
|
||||
/* Transfer ownership to the exec context */
|
||||
vp->slices_buf = pp->metadata_buf = NULL;
|
||||
vp->slices_buf = pp->slice_offset_buf = NULL;
|
||||
|
||||
/* Input barrier */
|
||||
/* Input frame barrier */
|
||||
ff_vk_frame_barrier(&ctx->s, exec, pr->frame, img_bar, &nb_img_bar,
|
||||
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
|
||||
VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
|
||||
|
|
@ -227,21 +223,6 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_QUEUE_FAMILY_IGNORED);
|
||||
|
||||
buf_bar[nb_buf_bar++] = (VkBufferMemoryBarrier2) {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
|
||||
.srcStageMask = metadata->stage,
|
||||
.dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
|
||||
.srcAccessMask = metadata->access,
|
||||
.dstAccessMask = VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.buffer = metadata->buf,
|
||||
.offset = pp->slice_offsets_sz,
|
||||
.size = pp->mb_params_sz,
|
||||
};
|
||||
metadata->stage = buf_bar[0].dstStageMask;
|
||||
metadata->access = buf_bar[0].dstAccessMask;
|
||||
|
||||
vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
|
||||
.pBufferMemoryBarriers = buf_bar,
|
||||
|
|
@ -286,17 +267,12 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
/* Entropy decode */
|
||||
ff_vk_shader_update_desc_buffer(&ctx->s, exec, &shaders->vld,
|
||||
0, 0, 0,
|
||||
metadata, 0,
|
||||
pp->slice_offsets_sz,
|
||||
VK_FORMAT_UNDEFINED);
|
||||
ff_vk_shader_update_desc_buffer(&ctx->s, exec, &shaders->vld,
|
||||
0, 1, 0,
|
||||
metadata, pp->slice_offsets_sz,
|
||||
pp->mb_params_sz,
|
||||
slice_offsets,
|
||||
0, (pp->slice_num + 1) * sizeof(uint32_t),
|
||||
VK_FORMAT_UNDEFINED);
|
||||
ff_vk_shader_update_img_array(&ctx->s, exec, &shaders->vld,
|
||||
pr->frame, vp->view.out,
|
||||
0, 2,
|
||||
0, 1,
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_NULL_HANDLE);
|
||||
|
||||
|
|
@ -310,6 +286,7 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
3 + !!pr->alpha_info);
|
||||
|
||||
/* Synchronize vld and idct shaders */
|
||||
nb_img_bar = 0;
|
||||
ff_vk_frame_barrier(&ctx->s, exec, pr->frame, img_bar, &nb_img_bar,
|
||||
VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
|
||||
VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
|
||||
|
|
@ -317,21 +294,6 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_QUEUE_FAMILY_IGNORED);
|
||||
|
||||
buf_bar[nb_buf_bar++] = (VkBufferMemoryBarrier2) {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
|
||||
.srcStageMask = metadata->stage,
|
||||
.dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
|
||||
.srcAccessMask = metadata->access,
|
||||
.dstAccessMask = VK_ACCESS_2_SHADER_STORAGE_READ_BIT,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.buffer = metadata->buf,
|
||||
.offset = pp->slice_offsets_sz,
|
||||
.size = pp->mb_params_sz,
|
||||
};
|
||||
metadata->stage = buf_bar[0].dstStageMask;
|
||||
metadata->access = buf_bar[0].dstAccessMask;
|
||||
|
||||
vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
|
||||
.pBufferMemoryBarriers = buf_bar,
|
||||
|
|
@ -342,14 +304,9 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
|||
nb_img_bar = nb_buf_bar = 0;
|
||||
|
||||
/* Inverse transform */
|
||||
ff_vk_shader_update_desc_buffer(&ctx->s, exec, &shaders->idct,
|
||||
0, 0, 0,
|
||||
metadata, pp->slice_offsets_sz,
|
||||
pp->mb_params_sz,
|
||||
VK_FORMAT_UNDEFINED);
|
||||
ff_vk_shader_update_img_array(&ctx->s, exec, &shaders->idct,
|
||||
pr->frame, vp->view.out,
|
||||
0, 1,
|
||||
0, 0,
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_NULL_HANDLE);
|
||||
|
||||
|
|
@ -449,23 +406,23 @@ static void vk_decode_prores_uninit(FFVulkanDecodeShared *ctx)
|
|||
ff_vk_shader_free(&ctx->s, &pv->shaders[i].idct);
|
||||
}
|
||||
|
||||
av_buffer_pool_uninit(&pv->metadata_pool);
|
||||
av_buffer_pool_uninit(&pv->slice_offset_pool);
|
||||
|
||||
av_freep(&pv);
|
||||
}
|
||||
|
||||
static int vk_decode_prores_init(AVCodecContext *avctx)
|
||||
{
|
||||
FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
|
||||
FFVulkanDecodeShared *ctx = NULL;
|
||||
FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
|
||||
FFVulkanDecodeShared *ctx = NULL;
|
||||
|
||||
AVHWFramesContext *out_frames_ctx;
|
||||
ProresVulkanDecodeContext *pv;
|
||||
FFVkSPIRVCompiler *spv;
|
||||
FFVulkanDescriptorSetBinding *desc_set;
|
||||
int max_num_mbs, i, err;
|
||||
int max_num_slices, i, err;
|
||||
|
||||
max_num_mbs = (avctx->coded_width >> 4) * (avctx->coded_height >> 4);
|
||||
max_num_slices = (avctx->coded_width >> 4) * (avctx->coded_height >> 4);
|
||||
|
||||
spv = ff_vk_spirv_init();
|
||||
if (!spv) {
|
||||
|
|
@ -514,15 +471,7 @@ static int vk_decode_prores_init(AVCodecContext *avctx)
|
|||
.stages = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
.mem_quali = "readonly",
|
||||
.buf_content = "uint32_t slice_offsets",
|
||||
.buf_elems = max_num_mbs + 1,
|
||||
},
|
||||
{
|
||||
.name = "quant_idx_buf",
|
||||
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.stages = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
.mem_quali = "writeonly",
|
||||
.buf_content = "uint8_t quant_idx",
|
||||
.buf_elems = max_num_mbs,
|
||||
.buf_elems = max_num_slices + 1,
|
||||
},
|
||||
{
|
||||
.name = "dst",
|
||||
|
|
@ -536,18 +485,10 @@ static int vk_decode_prores_init(AVCodecContext *avctx)
|
|||
},
|
||||
};
|
||||
RET(init_shader(avctx, &ctx->s, &ctx->exec_pool, spv, &shaders->vld,
|
||||
"prores_dec_vld", "main", desc_set, 3,
|
||||
"prores_dec_vld", "main", desc_set, 2,
|
||||
ff_source_prores_vld_comp, 0x080801, i));
|
||||
|
||||
desc_set = (FFVulkanDescriptorSetBinding []) {
|
||||
{
|
||||
.name = "quant_idx_buf",
|
||||
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.stages = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
.mem_quali = "readonly",
|
||||
.buf_content = "uint8_t quant_idx",
|
||||
.buf_elems = max_num_mbs,
|
||||
},
|
||||
{
|
||||
.name = "dst",
|
||||
.type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
|
||||
|
|
@ -559,7 +500,7 @@ static int vk_decode_prores_init(AVCodecContext *avctx)
|
|||
},
|
||||
};
|
||||
RET(init_shader(avctx, &ctx->s, &ctx->exec_pool, spv, &shaders->idct,
|
||||
"prores_dec_idct", "main", desc_set, 2,
|
||||
"prores_dec_idct", "main", desc_set, 1,
|
||||
ff_source_prores_idct_comp, 0x200201, i));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -950,7 +950,7 @@ static const AVOption colorspace_options[] = {
|
|||
|
||||
{ "primaries", "Output color primaries",
|
||||
OFFSET(user_prm), AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_EXT_NB - 1, FLAGS, .unit = "prm" },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, .unit = "prm" },
|
||||
ENUM("bt709", AVCOL_PRI_BT709, "prm"),
|
||||
ENUM("bt470m", AVCOL_PRI_BT470M, "prm"),
|
||||
ENUM("bt470bg", AVCOL_PRI_BT470BG, "prm"),
|
||||
|
|
@ -963,11 +963,10 @@ static const AVOption colorspace_options[] = {
|
|||
ENUM("bt2020", AVCOL_PRI_BT2020, "prm"),
|
||||
ENUM("jedec-p22", AVCOL_PRI_JEDEC_P22, "prm"),
|
||||
ENUM("ebu3213", AVCOL_PRI_EBU3213, "prm"),
|
||||
ENUM("vgamut", AVCOL_PRI_V_GAMUT, "prm"),
|
||||
|
||||
{ "trc", "Output transfer characteristics",
|
||||
OFFSET(user_trc), AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
|
||||
AVCOL_TRC_RESERVED0, AVCOL_TRC_EXT_NB - 1, FLAGS, .unit = "trc" },
|
||||
AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, .unit = "trc" },
|
||||
ENUM("bt709", AVCOL_TRC_BT709, "trc"),
|
||||
ENUM("bt470m", AVCOL_TRC_GAMMA22, "trc"),
|
||||
ENUM("gamma22", AVCOL_TRC_GAMMA22, "trc"),
|
||||
|
|
@ -982,7 +981,6 @@ static const AVOption colorspace_options[] = {
|
|||
ENUM("iec61966-2-4", AVCOL_TRC_IEC61966_2_4, "trc"),
|
||||
ENUM("bt2020-10", AVCOL_TRC_BT2020_10, "trc"),
|
||||
ENUM("bt2020-12", AVCOL_TRC_BT2020_12, "trc"),
|
||||
ENUM("vlog", AVCOL_TRC_V_LOG, "trc"),
|
||||
|
||||
{ "format", "Output pixel format",
|
||||
OFFSET(user_format), AV_OPT_TYPE_INT, { .i64 = AV_PIX_FMT_NONE },
|
||||
|
|
@ -1032,10 +1030,10 @@ static const AVOption colorspace_options[] = {
|
|||
AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, .unit = "rng" },
|
||||
{ "iprimaries", "Input color primaries",
|
||||
OFFSET(user_iprm), AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_EXT_NB - 1, FLAGS, .unit = "prm" },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, .unit = "prm" },
|
||||
{ "itrc", "Input transfer characteristics",
|
||||
OFFSET(user_itrc), AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
|
||||
AVCOL_TRC_RESERVED0, AVCOL_TRC_EXT_NB - 1, FLAGS, .unit = "trc" },
|
||||
AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, .unit = "trc" },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||
in = in2;
|
||||
}
|
||||
|
||||
s->update(s->instance, in->pts * av_q2d(inlink->time_base),
|
||||
s->update(s->instance, in->pts * av_q2d(inlink->time_base) * 1000,
|
||||
(const uint32_t *)in->data[0],
|
||||
(uint32_t *)out->data[0]);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,13 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_OPENCV2_CORE_CORE_C_H
|
||||
#include <opencv2/core/core_c.h>
|
||||
#include <opencv2/imgproc/imgproc_c.h>
|
||||
#else
|
||||
#include <opencv/cv.h>
|
||||
#include <opencv/cxcore.h>
|
||||
#endif
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/file.h"
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ OBJS-$(CONFIG_CONCAT_DEMUXER) += concatdec.o
|
|||
OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
|
||||
OBJS-$(CONFIG_DATA_DEMUXER) += rawdec.o
|
||||
OBJS-$(CONFIG_DATA_MUXER) += rawenc.o
|
||||
OBJS-$(CONFIG_DASH_MUXER) += dash.o dashenc.o hlsplaylist.o codecstring.o
|
||||
OBJS-$(CONFIG_DASH_MUXER) += dash.o dashenc.o hlsplaylist.o
|
||||
OBJS-$(CONFIG_DASH_DEMUXER) += dash.o dashdec.o
|
||||
OBJS-$(CONFIG_DAUD_DEMUXER) += dauddec.o
|
||||
OBJS-$(CONFIG_DAUD_MUXER) += daudenc.o
|
||||
|
|
@ -267,7 +267,7 @@ OBJS-$(CONFIG_HEVC_MUXER) += rawenc.o
|
|||
OBJS-$(CONFIG_EVC_DEMUXER) += evcdec.o rawdec.o
|
||||
OBJS-$(CONFIG_EVC_MUXER) += rawenc.o
|
||||
OBJS-$(CONFIG_HLS_DEMUXER) += hls.o hls_sample_encryption.o
|
||||
OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o codecstring.o
|
||||
OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o
|
||||
OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o
|
||||
OBJS-$(CONFIG_HXVS_DEMUXER) += hxvs.o
|
||||
OBJS-$(CONFIG_IAMF_DEMUXER) += iamfdec.o
|
||||
|
|
|
|||
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2014 Martin Storsjo
|
||||
* Copyright (c) 2018 Akamai Technologies, Inc.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/rational.h"
|
||||
|
||||
#include "av1.h"
|
||||
#include "avc.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
#include "nal.h"
|
||||
#include "vpcc.h"
|
||||
|
||||
static const struct codec_string {
|
||||
enum AVCodecID id;
|
||||
char str[8];
|
||||
} codecs[] = {
|
||||
{ AV_CODEC_ID_VP8, "vp8" },
|
||||
{ AV_CODEC_ID_VP9, "vp9" },
|
||||
{ AV_CODEC_ID_VORBIS, "vorbis" },
|
||||
{ AV_CODEC_ID_OPUS, "opus" },
|
||||
{ AV_CODEC_ID_FLAC, "flac" },
|
||||
{ AV_CODEC_ID_NONE }
|
||||
};
|
||||
|
||||
static void set_vp9_codec_str(void *logctx, const AVCodecParameters *par,
|
||||
const AVRational *frame_rate, AVBPrint *out)
|
||||
{
|
||||
VPCC vpcc;
|
||||
int ret = ff_isom_get_vpcc_features(logctx, par, NULL, 0, frame_rate, &vpcc);
|
||||
if (ret == 0) {
|
||||
av_bprintf(out, "vp09.%02d.%02d.%02d",
|
||||
vpcc.profile, vpcc.level, vpcc.bitdepth);
|
||||
} else {
|
||||
// Default to just vp9 in case of error while finding out profile or level
|
||||
av_log(logctx, AV_LOG_WARNING, "Could not find VP9 profile and/or level\n");
|
||||
av_bprintf(out, "vp9");
|
||||
}
|
||||
}
|
||||
|
||||
int ff_make_codec_str(void *logctx, const AVCodecParameters *par,
|
||||
const AVRational *frame_rate, struct AVBPrint *out)
|
||||
{
|
||||
int i;
|
||||
|
||||
// common Webm codecs are not part of RFC 6381
|
||||
for (i = 0; codecs[i].id != AV_CODEC_ID_NONE; i++)
|
||||
if (codecs[i].id == par->codec_id) {
|
||||
if (codecs[i].id == AV_CODEC_ID_VP9) {
|
||||
set_vp9_codec_str(logctx, par, frame_rate, out);
|
||||
} else {
|
||||
av_bprintf(out, "%s", codecs[i].str);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (par->codec_id == AV_CODEC_ID_H264) {
|
||||
// RFC 6381
|
||||
uint8_t *data = par->extradata;
|
||||
if (data) {
|
||||
const uint8_t *p;
|
||||
|
||||
if (AV_RB32(data) == 0x01 && (data[4] & 0x1F) == 7)
|
||||
p = &data[5];
|
||||
else if (AV_RB24(data) == 0x01 && (data[3] & 0x1F) == 7)
|
||||
p = &data[4];
|
||||
else if (data[0] == 0x01) /* avcC */
|
||||
p = &data[1];
|
||||
else
|
||||
return AVERROR(EINVAL);
|
||||
av_bprintf(out, "avc1.%02x%02x%02x", p[0], p[1], p[2]);
|
||||
} else {
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
} else if (par->codec_id == AV_CODEC_ID_HEVC) {
|
||||
// 3GPP TS 26.244
|
||||
uint8_t *data = par->extradata;
|
||||
int profile = AV_PROFILE_UNKNOWN;
|
||||
uint32_t profile_compatibility = AV_PROFILE_UNKNOWN;
|
||||
char tier = 0;
|
||||
int level = AV_LEVEL_UNKNOWN;
|
||||
char constraints[8] = "";
|
||||
|
||||
if (par->profile != AV_PROFILE_UNKNOWN)
|
||||
profile = par->profile;
|
||||
if (par->level != AV_LEVEL_UNKNOWN)
|
||||
level = par->level;
|
||||
|
||||
/* check the boundary of data which from current position is small than extradata_size */
|
||||
while (data && (data - par->extradata + 19) < par->extradata_size) {
|
||||
/* get HEVC SPS NAL and seek to profile_tier_level */
|
||||
if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x7E) == 0x42)) {
|
||||
uint8_t *rbsp_buf;
|
||||
int remain_size = 0;
|
||||
int rbsp_size = 0;
|
||||
uint32_t profile_compatibility_flags = 0;
|
||||
uint8_t high_nibble = 0;
|
||||
/* skip start code + nalu header */
|
||||
data += 6;
|
||||
/* process by reference General NAL unit syntax */
|
||||
remain_size = par->extradata_size - (data - par->extradata);
|
||||
rbsp_buf = ff_nal_unit_extract_rbsp(data, remain_size, &rbsp_size, 0);
|
||||
if (!rbsp_buf)
|
||||
return AVERROR(EINVAL);
|
||||
if (rbsp_size < 13) {
|
||||
av_freep(&rbsp_buf);
|
||||
break;
|
||||
}
|
||||
/* skip sps_video_parameter_set_id u(4),
|
||||
* sps_max_sub_layers_minus1 u(3),
|
||||
* and sps_temporal_id_nesting_flag u(1)
|
||||
*
|
||||
* TIER represents the general_tier_flag, with 'L' indicating the flag is 0,
|
||||
* and 'H' indicating the flag is 1
|
||||
*/
|
||||
tier = (rbsp_buf[1] & 0x20) == 0 ? 'L' : 'H';
|
||||
profile = rbsp_buf[1] & 0x1f;
|
||||
/* PROFILE_COMPATIBILITY is general_profile_compatibility_flags, but in reverse bit order,
|
||||
* in a hexadecimal representation (leading zeroes may be omitted).
|
||||
*/
|
||||
profile_compatibility_flags = AV_RB32(rbsp_buf + 2);
|
||||
/* revise these bits to get the profile compatibility value */
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x55555555U) << 1) | ((profile_compatibility_flags >> 1) & 0x55555555U);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x33333333U) << 2) | ((profile_compatibility_flags >> 2) & 0x33333333U);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x0F0F0F0FU) << 4) | ((profile_compatibility_flags >> 4) & 0x0F0F0F0FU);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x00FF00FFU) << 8) | ((profile_compatibility_flags >> 8) & 0x00FF00FFU);
|
||||
profile_compatibility = (profile_compatibility_flags << 16) | (profile_compatibility_flags >> 16);
|
||||
/* skip 8 + 8 + 32
|
||||
* CONSTRAINTS is a hexadecimal representation of the general_constraint_indicator_flags.
|
||||
* each byte is separated by a '.', and trailing zero bytes may be omitted.
|
||||
* drop the trailing zero bytes refer to ISO/IEC14496-15.
|
||||
*/
|
||||
high_nibble = rbsp_buf[7] >> 4;
|
||||
snprintf(constraints, sizeof(constraints),
|
||||
high_nibble ? "%02x.%x" : "%02x",
|
||||
rbsp_buf[6], high_nibble);
|
||||
/* skip 8 + 8 + 32 + 4 + 43 + 1 bit */
|
||||
level = rbsp_buf[12];
|
||||
av_freep(&rbsp_buf);
|
||||
break;
|
||||
}
|
||||
data++;
|
||||
}
|
||||
if (par->codec_tag == MKTAG('h','v','c','1') &&
|
||||
profile != AV_PROFILE_UNKNOWN &&
|
||||
profile_compatibility != AV_PROFILE_UNKNOWN &&
|
||||
tier != 0 &&
|
||||
level != AV_LEVEL_UNKNOWN &&
|
||||
constraints[0] != '\0') {
|
||||
av_bprintf(out, "%s.%d.%x.%c%d.%s",
|
||||
av_fourcc2str(par->codec_tag), profile,
|
||||
profile_compatibility, tier, level, constraints);
|
||||
} else
|
||||
return AVERROR(EINVAL);
|
||||
} else if (par->codec_id == AV_CODEC_ID_AV1) {
|
||||
// https://aomediacodec.github.io/av1-isobmff/#codecsparam
|
||||
AV1SequenceParameters seq;
|
||||
int err;
|
||||
if (!par->extradata_size)
|
||||
return AVERROR(EINVAL);
|
||||
if ((err = ff_av1_parse_seq_header(&seq, par->extradata, par->extradata_size)) < 0)
|
||||
return err;
|
||||
|
||||
av_bprintf(out, "av01.%01u.%02u%s.%02u",
|
||||
seq.profile, seq.level, seq.tier ? "H" : "M", seq.bitdepth);
|
||||
if (seq.color_description_present_flag)
|
||||
av_bprintf(out, ".%01u.%01u%01u%01u.%02u.%02u.%02u.%01u",
|
||||
seq.monochrome,
|
||||
seq.chroma_subsampling_x, seq.chroma_subsampling_y, seq.chroma_sample_position,
|
||||
seq.color_primaries, seq.transfer_characteristics, seq.matrix_coefficients,
|
||||
seq.color_range);
|
||||
} else if (par->codec_id == AV_CODEC_ID_MPEG4) {
|
||||
// RFC 6381
|
||||
av_bprintf(out, "mp4v.20");
|
||||
// Unimplemented, should output ProfileLevelIndication as a decimal number
|
||||
av_log(logctx, AV_LOG_WARNING, "Incomplete RFC 6381 codec string for mp4v\n");
|
||||
} else if (par->codec_id == AV_CODEC_ID_MP2) {
|
||||
av_bprintf(out, "mp4a.40.33");
|
||||
} else if (par->codec_id == AV_CODEC_ID_MP3) {
|
||||
av_bprintf(out, "mp4a.40.34");
|
||||
} else if (par->codec_id == AV_CODEC_ID_AAC) {
|
||||
// RFC 6381
|
||||
int aot = 2;
|
||||
if (par->extradata_size >= 2) {
|
||||
aot = par->extradata[0] >> 3;
|
||||
if (aot == 31)
|
||||
aot = ((AV_RB16(par->extradata) >> 5) & 0x3f) + 32;
|
||||
} else if (par->profile != AV_PROFILE_UNKNOWN)
|
||||
aot = par->profile + 1;
|
||||
av_bprintf(out, "mp4a.40.%d", aot);
|
||||
} else if (par->codec_id == AV_CODEC_ID_AC3) {
|
||||
av_bprintf(out, "ac-3");
|
||||
} else if (par->codec_id == AV_CODEC_ID_EAC3) {
|
||||
av_bprintf(out, "ec-3");
|
||||
} else {
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
#include "av1.h"
|
||||
#include "avc.h"
|
||||
#include "avformat.h"
|
||||
#include "avio_internal.h"
|
||||
#include "hlsplaylist.h"
|
||||
|
|
@ -49,9 +51,11 @@
|
|||
#include "http.h"
|
||||
#endif
|
||||
#include "internal.h"
|
||||
#include "isom.h"
|
||||
#include "mux.h"
|
||||
#include "os_support.h"
|
||||
#include "url.h"
|
||||
#include "vpcc.h"
|
||||
#include "dash.h"
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -202,6 +206,18 @@ typedef struct DASHContext {
|
|||
int64_t update_period;
|
||||
} DASHContext;
|
||||
|
||||
static const struct codec_string {
|
||||
enum AVCodecID id;
|
||||
const char str[8];
|
||||
} codecs[] = {
|
||||
{ AV_CODEC_ID_VP8, "vp8" },
|
||||
{ AV_CODEC_ID_VP9, "vp9" },
|
||||
{ AV_CODEC_ID_VORBIS, "vorbis" },
|
||||
{ AV_CODEC_ID_OPUS, "opus" },
|
||||
{ AV_CODEC_ID_FLAC, "flac" },
|
||||
{ AV_CODEC_ID_NONE }
|
||||
};
|
||||
|
||||
static int dashenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
|
||||
AVDictionary **options) {
|
||||
DASHContext *c = s->priv_data;
|
||||
|
|
@ -311,6 +327,117 @@ static int init_segment_types(AVFormatContext *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void set_vp9_codec_str(AVFormatContext *s, AVCodecParameters *par,
|
||||
AVRational *frame_rate, char *str, int size) {
|
||||
VPCC vpcc;
|
||||
int ret = ff_isom_get_vpcc_features(s, par, NULL, 0, frame_rate, &vpcc);
|
||||
if (ret == 0) {
|
||||
av_strlcatf(str, size, "vp09.%02d.%02d.%02d",
|
||||
vpcc.profile, vpcc.level, vpcc.bitdepth);
|
||||
} else {
|
||||
// Default to just vp9 in case of error while finding out profile or level
|
||||
av_log(s, AV_LOG_WARNING, "Could not find VP9 profile and/or level\n");
|
||||
av_strlcpy(str, "vp9", size);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
|
||||
AVRational *frame_rate, char *str, int size)
|
||||
{
|
||||
const AVCodecTag *tags[2] = { NULL, NULL };
|
||||
uint32_t tag;
|
||||
int i;
|
||||
|
||||
// common Webm codecs are not part of RFC 6381
|
||||
for (i = 0; codecs[i].id != AV_CODEC_ID_NONE; i++)
|
||||
if (codecs[i].id == par->codec_id) {
|
||||
if (codecs[i].id == AV_CODEC_ID_VP9) {
|
||||
set_vp9_codec_str(s, par, frame_rate, str, size);
|
||||
} else {
|
||||
av_strlcpy(str, codecs[i].str, size);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// for codecs part of RFC 6381
|
||||
if (par->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
tags[0] = ff_codec_movvideo_tags;
|
||||
else if (par->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
tags[0] = ff_codec_movaudio_tags;
|
||||
else
|
||||
return;
|
||||
|
||||
tag = par->codec_tag;
|
||||
if (!tag)
|
||||
tag = av_codec_get_tag(tags, par->codec_id);
|
||||
if (!tag)
|
||||
return;
|
||||
if (size < 5)
|
||||
return;
|
||||
|
||||
AV_WL32(str, tag);
|
||||
str[4] = '\0';
|
||||
if (!strcmp(str, "mp4a") || !strcmp(str, "mp4v")) {
|
||||
uint32_t oti;
|
||||
tags[0] = ff_mp4_obj_type;
|
||||
oti = av_codec_get_tag(tags, par->codec_id);
|
||||
if (oti)
|
||||
av_strlcatf(str, size, ".%02"PRIx32, oti);
|
||||
else
|
||||
return;
|
||||
|
||||
if (tag == MKTAG('m', 'p', '4', 'a')) {
|
||||
if (par->extradata_size >= 2) {
|
||||
int aot = par->extradata[0] >> 3;
|
||||
if (aot == 31)
|
||||
aot = ((AV_RB16(par->extradata) >> 5) & 0x3f) + 32;
|
||||
av_strlcatf(str, size, ".%d", aot);
|
||||
}
|
||||
} else if (tag == MKTAG('m', 'p', '4', 'v')) {
|
||||
// Unimplemented, should output ProfileLevelIndication as a decimal number
|
||||
av_log(s, AV_LOG_WARNING, "Incomplete RFC 6381 codec string for mp4v\n");
|
||||
}
|
||||
} else if (!strcmp(str, "avc1")) {
|
||||
uint8_t *tmpbuf = NULL;
|
||||
uint8_t *extradata = par->extradata;
|
||||
int extradata_size = par->extradata_size;
|
||||
if (!extradata_size)
|
||||
return;
|
||||
if (extradata[0] != 1) {
|
||||
AVIOContext *pb;
|
||||
if (avio_open_dyn_buf(&pb) < 0)
|
||||
return;
|
||||
if (ff_isom_write_avcc(pb, extradata, extradata_size) < 0) {
|
||||
ffio_free_dyn_buf(&pb);
|
||||
return;
|
||||
}
|
||||
extradata_size = avio_close_dyn_buf(pb, &extradata);
|
||||
tmpbuf = extradata;
|
||||
}
|
||||
|
||||
if (extradata_size >= 4)
|
||||
av_strlcatf(str, size, ".%02x%02x%02x",
|
||||
extradata[1], extradata[2], extradata[3]);
|
||||
av_free(tmpbuf);
|
||||
} else if (!strcmp(str, "av01")) {
|
||||
AV1SequenceParameters seq;
|
||||
if (!par->extradata_size)
|
||||
return;
|
||||
if (ff_av1_parse_seq_header(&seq, par->extradata, par->extradata_size) < 0)
|
||||
return;
|
||||
|
||||
av_strlcatf(str, size, ".%01u.%02u%s.%02u",
|
||||
seq.profile, seq.level, seq.tier ? "H" : "M", seq.bitdepth);
|
||||
if (seq.color_description_present_flag)
|
||||
av_strlcatf(str, size, ".%01u.%01u%01u%01u.%02u.%02u.%02u.%01u",
|
||||
seq.monochrome,
|
||||
seq.chroma_subsampling_x, seq.chroma_subsampling_y, seq.chroma_sample_position,
|
||||
seq.color_primaries, seq.transfer_characteristics, seq.matrix_coefficients,
|
||||
seq.color_range);
|
||||
}
|
||||
}
|
||||
|
||||
static int flush_dynbuf(DASHContext *c, OutputStream *os, int *range_length)
|
||||
{
|
||||
uint8_t *buffer;
|
||||
|
|
@ -1361,7 +1488,6 @@ static int dash_init(AVFormatContext *s)
|
|||
AVStream *st;
|
||||
AVDictionary *opts = NULL;
|
||||
char filename[1024];
|
||||
AVBPrint buffer;
|
||||
|
||||
os->bit_rate = s->streams[i]->codecpar->bit_rate;
|
||||
if (!os->bit_rate) {
|
||||
|
|
@ -1575,8 +1701,8 @@ static int dash_init(AVFormatContext *s)
|
|||
c->has_video = 1;
|
||||
}
|
||||
|
||||
av_bprint_init_for_buffer(&buffer, os->codec_str, sizeof(os->codec_str));
|
||||
ff_make_codec_str(s, st->codecpar, &st->avg_frame_rate, &buffer);
|
||||
set_codec_str(s, st->codecpar, &st->avg_frame_rate, os->codec_str,
|
||||
sizeof(os->codec_str));
|
||||
os->first_pts = AV_NOPTS_VALUE;
|
||||
os->max_pts = AV_NOPTS_VALUE;
|
||||
os->last_dts = AV_NOPTS_VALUE;
|
||||
|
|
@ -1698,7 +1824,6 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
|
|||
uint8_t *extradata;
|
||||
size_t extradata_size;
|
||||
int ret;
|
||||
AVBPrint buffer;
|
||||
|
||||
if (par->extradata_size)
|
||||
return 0;
|
||||
|
|
@ -1713,8 +1838,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
|
|||
|
||||
memcpy(par->extradata, extradata, extradata_size);
|
||||
|
||||
av_bprint_init_for_buffer(&buffer, os->codec_str, sizeof(os->codec_str));
|
||||
ff_make_codec_str(s, par, frame_rate, &buffer);
|
||||
set_codec_str(s, par, frame_rate, os->codec_str, sizeof(os->codec_str));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,13 @@
|
|||
|
||||
#include "avformat.h"
|
||||
#include "avio_internal.h"
|
||||
#include "avc.h"
|
||||
#if CONFIG_HTTP_PROTOCOL
|
||||
#include "http.h"
|
||||
#endif
|
||||
#include "hlsplaylist.h"
|
||||
#include "internal.h"
|
||||
#include "nal.h"
|
||||
#include "mux.h"
|
||||
#include "os_support.h"
|
||||
#include "url.h"
|
||||
|
|
@ -350,18 +352,124 @@ static void write_codec_attr(AVStream *st, VariantStream *vs)
|
|||
{
|
||||
int codec_strlen = strlen(vs->codec_attr);
|
||||
char attr[32];
|
||||
AVBPrint buffer;
|
||||
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
|
||||
return;
|
||||
if (vs->attr_status == CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN)
|
||||
return;
|
||||
|
||||
av_bprint_init_for_buffer(&buffer, attr, sizeof(attr));
|
||||
if (ff_make_codec_str(vs->avf, st->codecpar, &st->avg_frame_rate,
|
||||
&buffer) < 0)
|
||||
goto fail;
|
||||
if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
|
||||
uint8_t *data = st->codecpar->extradata;
|
||||
if (data) {
|
||||
const uint8_t *p;
|
||||
|
||||
if (AV_RB32(data) == 0x01 && (data[4] & 0x1F) == 7)
|
||||
p = &data[5];
|
||||
else if (AV_RB24(data) == 0x01 && (data[3] & 0x1F) == 7)
|
||||
p = &data[4];
|
||||
else if (data[0] == 0x01) /* avcC */
|
||||
p = &data[1];
|
||||
else
|
||||
goto fail;
|
||||
snprintf(attr, sizeof(attr),
|
||||
"avc1.%02x%02x%02x", p[0], p[1], p[2]);
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
|
||||
uint8_t *data = st->codecpar->extradata;
|
||||
int profile = AV_PROFILE_UNKNOWN;
|
||||
uint32_t profile_compatibility = AV_PROFILE_UNKNOWN;
|
||||
char tier = 0;
|
||||
int level = AV_LEVEL_UNKNOWN;
|
||||
char constraints[8] = "";
|
||||
|
||||
if (st->codecpar->profile != AV_PROFILE_UNKNOWN)
|
||||
profile = st->codecpar->profile;
|
||||
if (st->codecpar->level != AV_LEVEL_UNKNOWN)
|
||||
level = st->codecpar->level;
|
||||
|
||||
/* check the boundary of data which from current position is small than extradata_size */
|
||||
while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) {
|
||||
/* get HEVC SPS NAL and seek to profile_tier_level */
|
||||
if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x7E) == 0x42)) {
|
||||
uint8_t *rbsp_buf;
|
||||
int remain_size = 0;
|
||||
int rbsp_size = 0;
|
||||
uint32_t profile_compatibility_flags = 0;
|
||||
uint8_t high_nibble = 0;
|
||||
/* skip start code + nalu header */
|
||||
data += 6;
|
||||
/* process by reference General NAL unit syntax */
|
||||
remain_size = st->codecpar->extradata_size - (data - st->codecpar->extradata);
|
||||
rbsp_buf = ff_nal_unit_extract_rbsp(data, remain_size, &rbsp_size, 0);
|
||||
if (!rbsp_buf)
|
||||
return;
|
||||
if (rbsp_size < 13) {
|
||||
av_freep(&rbsp_buf);
|
||||
break;
|
||||
}
|
||||
/* skip sps_video_parameter_set_id u(4),
|
||||
* sps_max_sub_layers_minus1 u(3),
|
||||
* and sps_temporal_id_nesting_flag u(1)
|
||||
*
|
||||
* TIER represents the general_tier_flag, with 'L' indicating the flag is 0,
|
||||
* and 'H' indicating the flag is 1
|
||||
*/
|
||||
tier = (rbsp_buf[1] & 0x20) == 0 ? 'L' : 'H';
|
||||
profile = rbsp_buf[1] & 0x1f;
|
||||
/* PROFILE_COMPATIBILITY is general_profile_compatibility_flags, but in reverse bit order,
|
||||
* in a hexadecimal representation (leading zeroes may be omitted).
|
||||
*/
|
||||
profile_compatibility_flags = AV_RB32(rbsp_buf + 2);
|
||||
/* revise these bits to get the profile compatibility value */
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x55555555U) << 1) | ((profile_compatibility_flags >> 1) & 0x55555555U);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x33333333U) << 2) | ((profile_compatibility_flags >> 2) & 0x33333333U);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x0F0F0F0FU) << 4) | ((profile_compatibility_flags >> 4) & 0x0F0F0F0FU);
|
||||
profile_compatibility_flags = ((profile_compatibility_flags & 0x00FF00FFU) << 8) | ((profile_compatibility_flags >> 8) & 0x00FF00FFU);
|
||||
profile_compatibility = (profile_compatibility_flags << 16) | (profile_compatibility_flags >> 16);
|
||||
/* skip 8 + 8 + 32
|
||||
* CONSTRAINTS is a hexadecimal representation of the general_constraint_indicator_flags.
|
||||
* each byte is separated by a '.', and trailing zero bytes may be omitted.
|
||||
* drop the trailing zero bytes refer to ISO/IEC14496-15.
|
||||
*/
|
||||
high_nibble = rbsp_buf[7] >> 4;
|
||||
snprintf(constraints, sizeof(constraints),
|
||||
high_nibble ? "%02x.%x" : "%02x",
|
||||
rbsp_buf[6], high_nibble);
|
||||
/* skip 8 + 8 + 32 + 4 + 43 + 1 bit */
|
||||
level = rbsp_buf[12];
|
||||
av_freep(&rbsp_buf);
|
||||
break;
|
||||
}
|
||||
data++;
|
||||
}
|
||||
if (st->codecpar->codec_tag == MKTAG('h','v','c','1') &&
|
||||
profile != AV_PROFILE_UNKNOWN &&
|
||||
profile_compatibility != AV_PROFILE_UNKNOWN &&
|
||||
tier != 0 &&
|
||||
level != AV_LEVEL_UNKNOWN &&
|
||||
constraints[0] != '\0') {
|
||||
snprintf(attr, sizeof(attr), "%s.%d.%x.%c%d.%s", av_fourcc2str(st->codecpar->codec_tag), profile, profile_compatibility, tier, level, constraints);
|
||||
} else
|
||||
goto fail;
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
|
||||
snprintf(attr, sizeof(attr), "mp4a.40.33");
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_MP3) {
|
||||
snprintf(attr, sizeof(attr), "mp4a.40.34");
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
|
||||
if (st->codecpar->profile != AV_PROFILE_UNKNOWN)
|
||||
snprintf(attr, sizeof(attr), "mp4a.40.%d", st->codecpar->profile+1);
|
||||
else
|
||||
// This is for backward compatibility with the previous implementation.
|
||||
snprintf(attr, sizeof(attr), "mp4a.40.2");
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
|
||||
snprintf(attr, sizeof(attr), "ac-3");
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
|
||||
snprintf(attr, sizeof(attr), "ec-3");
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
// Don't write the same attribute multiple times
|
||||
if (!av_stristr(vs->codec_attr, attr)) {
|
||||
snprintf(vs->codec_attr + codec_strlen,
|
||||
|
|
|
|||
|
|
@ -661,18 +661,4 @@ int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestam
|
|||
*/
|
||||
int ff_parse_opts_from_query_string(void *obj, const char *str, int allow_unkown);
|
||||
|
||||
/**
|
||||
* Make a RFC 4281/6381 like string describing a codec.
|
||||
*
|
||||
* @param logctx a context for potential log messages
|
||||
* @param par pointer to an AVCodecParameters struct describing the codec
|
||||
* @param frame_rate an optional pointer to AVRational for the frame rate,
|
||||
* for deciding the right profile for video codecs
|
||||
* @param str the output string buffer
|
||||
* @param size the size of the string pointed to by str
|
||||
* @return <0 on error
|
||||
*/
|
||||
int ff_make_codec_str(void *logctx, const AVCodecParameters *par,
|
||||
const AVRational *frame_rate, struct AVBPrint *out);
|
||||
|
||||
#endif /* AVFORMAT_INTERNAL_H */
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
|||
if (pkt->data && pkt->size >= 4) {
|
||||
MPADecodeHeader mpah;
|
||||
int ret;
|
||||
av_unused int base;
|
||||
uint32_t h;
|
||||
|
||||
h = AV_RB32(pkt->data);
|
||||
|
|
@ -338,7 +339,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
|||
|
||||
#ifdef FILTER_VBR_HEADERS
|
||||
/* filter out XING and INFO headers. */
|
||||
int base = 4 + xing_offtbl[mpah.lsf == 1][mpah.nb_channels == 1];
|
||||
base = 4 + xing_offtbl[mpah.lsf == 1][mpah.nb_channels == 1];
|
||||
|
||||
if (base + 4 <= pkt->size) {
|
||||
uint32_t v = AV_RB32(pkt->data + base);
|
||||
|
|
|
|||
|
|
@ -237,10 +237,8 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial, char *magic,
|
|||
os->serial = serial;
|
||||
os->lastpts = 0;
|
||||
os->lastdts = 0;
|
||||
os->flags = 0;
|
||||
os->start_trimming = 0;
|
||||
os->end_trimming = 0;
|
||||
os->replace = 1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
@ -881,11 +879,6 @@ retry:
|
|||
os->end_trimming = 0;
|
||||
}
|
||||
|
||||
if (os->replace) {
|
||||
os->replace = 0;
|
||||
pkt->dts = pkt->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
if (os->new_metadata) {
|
||||
ret = av_packet_add_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA,
|
||||
os->new_metadata, os->new_metadata_size);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ struct ogg_stream {
|
|||
int nb_header; ///< set to the number of parsed headers
|
||||
int start_trimming; ///< set the number of packets to drop from the start
|
||||
int end_trimming; ///< set the number of packets to drop from the end
|
||||
int replace; // < set to 1 after initializing a new chained stream
|
||||
uint8_t *new_metadata;
|
||||
size_t new_metadata_size;
|
||||
uint8_t *new_extradata;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ enum VPX_CHROMA_SUBSAMPLING
|
|||
VPX_SUBSAMPLING_444 = 3,
|
||||
};
|
||||
|
||||
static int get_vpx_chroma_subsampling(void *logctx,
|
||||
static int get_vpx_chroma_subsampling(AVFormatContext *s,
|
||||
enum AVPixelFormat pixel_format,
|
||||
enum AVChromaLocation chroma_location)
|
||||
{
|
||||
|
|
@ -51,15 +51,15 @@ static int get_vpx_chroma_subsampling(void *logctx,
|
|||
return VPX_SUBSAMPLING_444;
|
||||
}
|
||||
}
|
||||
av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format);
|
||||
av_log(s, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_bit_depth(void *logctx, enum AVPixelFormat pixel_format)
|
||||
static int get_bit_depth(AVFormatContext *s, enum AVPixelFormat pixel_format)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_format);
|
||||
if (desc == NULL) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
|
||||
av_log(s, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
|
||||
pixel_format);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -72,9 +72,7 @@ static int get_vpx_video_full_range_flag(enum AVColorRange color_range)
|
|||
}
|
||||
|
||||
// Find approximate VP9 level based on the Luma's Sample rate and Picture size.
|
||||
static int get_vp9_level(const AVCodecParameters *par,
|
||||
const AVRational *frame_rate)
|
||||
{
|
||||
static int get_vp9_level(AVCodecParameters *par, AVRational *frame_rate) {
|
||||
int picture_size = par->width * par->height;
|
||||
int64_t sample_rate;
|
||||
|
||||
|
|
@ -152,16 +150,16 @@ static void parse_bitstream(GetBitContext *gb, int *profile, int *bit_depth) {
|
|||
*bit_depth = *profile <= 1 ? 8 : 10 + get_bits1(gb) * 2;
|
||||
}
|
||||
|
||||
int ff_isom_get_vpcc_features(void *logctx, const AVCodecParameters *par,
|
||||
int ff_isom_get_vpcc_features(AVFormatContext *s, AVCodecParameters *par,
|
||||
const uint8_t *data, int len,
|
||||
const AVRational *frame_rate, VPCC *vpcc)
|
||||
AVRational *frame_rate, VPCC *vpcc)
|
||||
{
|
||||
int profile = par->profile;
|
||||
int level = par->level == AV_LEVEL_UNKNOWN ?
|
||||
get_vp9_level(par, frame_rate) : par->level;
|
||||
int bit_depth = get_bit_depth(logctx, par->format);
|
||||
int bit_depth = get_bit_depth(s, par->format);
|
||||
int vpx_chroma_subsampling =
|
||||
get_vpx_chroma_subsampling(logctx, par->format, par->chroma_location);
|
||||
get_vpx_chroma_subsampling(s, par->format, par->chroma_location);
|
||||
int vpx_video_full_range_flag =
|
||||
get_vpx_video_full_range_flag(par->color_range);
|
||||
|
||||
|
|
@ -188,7 +186,7 @@ int ff_isom_get_vpcc_features(void *logctx, const AVCodecParameters *par,
|
|||
}
|
||||
|
||||
if (profile == AV_PROFILE_UNKNOWN || !bit_depth)
|
||||
av_log(logctx, AV_LOG_WARNING, "VP9 profile and/or bit depth not set or could not be derived\n");
|
||||
av_log(s, AV_LOG_WARNING, "VP9 profile and/or bit depth not set or could not be derived\n");
|
||||
|
||||
vpcc->profile = profile;
|
||||
vpcc->level = level;
|
||||
|
|
@ -199,14 +197,14 @@ int ff_isom_get_vpcc_features(void *logctx, const AVCodecParameters *par,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ff_isom_write_vpcc(void *logctx, AVIOContext *pb,
|
||||
int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb,
|
||||
const uint8_t *data, int len,
|
||||
const AVCodecParameters *par)
|
||||
AVCodecParameters *par)
|
||||
{
|
||||
VPCC vpcc;
|
||||
int ret;
|
||||
|
||||
ret = ff_isom_get_vpcc_features(logctx, par, data, len, NULL, &vpcc);
|
||||
ret = ff_isom_get_vpcc_features(s, par, data, len, NULL, &vpcc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "libavutil/rational.h"
|
||||
#include "libavcodec/codec_par.h"
|
||||
#include "avio.h"
|
||||
#include "avformat.h"
|
||||
|
||||
typedef struct VPCC {
|
||||
int profile;
|
||||
|
|
@ -42,7 +43,7 @@ typedef struct VPCC {
|
|||
/**
|
||||
* Writes VP codec configuration to the provided AVIOContext.
|
||||
*
|
||||
* @param logctx opaque pointer for logging.
|
||||
* @param s address of the AVFormatContext for the logging context.
|
||||
* @param pb address of the AVIOContext where the vpcC shall be written.
|
||||
* @param data address of a data array which contains coded bitstream data from
|
||||
* which codec information can be extracted. May be NULL.
|
||||
|
|
@ -51,12 +52,12 @@ typedef struct VPCC {
|
|||
* @return >=0 in case of success, a negative value corresponding to an AVERROR
|
||||
* code in case of failure
|
||||
*/
|
||||
int ff_isom_write_vpcc(void *logctx, AVIOContext *pb,
|
||||
int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb,
|
||||
const uint8_t *data, int len,
|
||||
const AVCodecParameters *par);
|
||||
AVCodecParameters *par);
|
||||
|
||||
int ff_isom_get_vpcc_features(void *logctx, const AVCodecParameters *par,
|
||||
int ff_isom_get_vpcc_features(AVFormatContext *s, AVCodecParameters *par,
|
||||
const uint8_t *data, int len,
|
||||
const AVRational *frame_rate, VPCC *vpcc);
|
||||
AVRational *frame_rate, VPCC *vpcc);
|
||||
|
||||
#endif /* AVFORMAT_VPCC_H */
|
||||
|
|
|
|||
|
|
@ -1592,8 +1592,8 @@ static int create_rtp_muxer(AVFormatContext *s)
|
|||
* therefore, we deactivate the extradata detection for the RTP muxer.
|
||||
*/
|
||||
if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_H264) {
|
||||
av_freep(&rtp_ctx->streams[0]->codecpar->extradata);
|
||||
rtp_ctx->streams[0]->codecpar->extradata_size = 0;
|
||||
av_freep(&rtp_ctx->streams[i]->codecpar->extradata);
|
||||
rtp_ctx->streams[i]->codecpar->extradata_size = 0;
|
||||
}
|
||||
|
||||
buffer = av_malloc(buffer_size);
|
||||
|
|
|
|||
|
|
@ -1815,7 +1815,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
|
|||
"Failed to get DRM device info for device %d.\n", n);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
drmFreeVersion(info);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1827,7 +1826,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
|
|||
drmFreeDevice(&device);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
drmFreeVersion(info);
|
||||
continue;
|
||||
}
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
|
||||
|
|
@ -1835,7 +1833,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
|
|||
"with matching vendor id (%s).\n",
|
||||
n, vendor_id->value);
|
||||
drmFreeDevice(&device);
|
||||
drmFreeVersion(info);
|
||||
break;
|
||||
}
|
||||
drmFreeVersion(info);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
# define _GNU_SOURCE
|
||||
#endif
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/riscv/cpu.h"
|
||||
#include "libavutil/cpu_internal.h"
|
||||
#include "libavutil/macros.h"
|
||||
#include "libavutil/log.h"
|
||||
|
|
@ -65,21 +64,6 @@ int ff_get_cpu_flags_riscv(void)
|
|||
if (pairs[1].value & RISCV_HWPROBE_IMA_V)
|
||||
ret |= AV_CPU_FLAG_RVV_I32 | AV_CPU_FLAG_RVV_I64
|
||||
| AV_CPU_FLAG_RVV_F32 | AV_CPU_FLAG_RVV_F64;
|
||||
#ifdef RISCV_HWPROBE_EXT_ZVE32X
|
||||
else if ((pairs[1].value & RISCV_HWPROBE_EXT_ZVE32X) &&
|
||||
ff_get_rv_vlenb() >= 16) { // runtime detect assumes 128+ bits
|
||||
ret |= AV_CPU_FLAG_RVV_I32;
|
||||
|
||||
if (pairs[1].value & RISCV_HWPROBE_EXT_ZVE32F)
|
||||
ret |= AV_CPU_FLAG_RVV_F32;
|
||||
if (pairs[1].value & RISCV_HWPROBE_EXT_ZVE64X) {
|
||||
ret |= AV_CPU_FLAG_RVV_I64;
|
||||
|
||||
if (pairs[1].value & RISCV_HWPROBE_EXT_ZVE64D)
|
||||
ret |= AV_CPU_FLAG_RVV_F64;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef RISCV_HWPROBE_EXT_ZBB
|
||||
if (pairs[1].value & RISCV_HWPROBE_EXT_ZBB)
|
||||
|
|
|
|||
|
|
@ -720,13 +720,14 @@ int attribute_align_arg swr_convert(struct SwrContext *s,
|
|||
{
|
||||
AudioData * in= &s->in;
|
||||
AudioData *out= &s->out;
|
||||
av_unused int max_output;
|
||||
|
||||
if (!swr_is_initialized(s)) {
|
||||
av_log(s, AV_LOG_ERROR, "Context has not been initialized\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >1
|
||||
int max_output = swr_get_out_samples(s, in_count);
|
||||
max_output = swr_get_out_samples(s, in_count);
|
||||
#endif
|
||||
|
||||
while(s->drop_output > 0){
|
||||
|
|
|
|||
|
|
@ -546,8 +546,7 @@ int sws_test_colorspace(enum AVColorSpace csp, int output)
|
|||
|
||||
int sws_test_primaries(enum AVColorPrimaries prim, int output)
|
||||
{
|
||||
return ((prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB) ||
|
||||
(prim >= AVCOL_PRI_EXT_BASE && prim < AVCOL_PRI_EXT_NB)) &&
|
||||
return prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB &&
|
||||
prim != AVCOL_PRI_RESERVED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -717,10 +717,6 @@ $(FATE_FILTER_VSYNTH-yes): SRC = $(TARGET_PATH)/tests/vsynth1/%02d.pgm
|
|||
|
||||
FATE_FFMPEG += $(FATE_FILTER_VSYNTH-yes)
|
||||
|
||||
FATE_FILTER_FREI0R-$(call FILTERFRAMECRC, TESTSRC2, FREI0R_FILTER) = fate-filter-frei0r-filter
|
||||
fate-filter-frei0r-filter: CMD = framecrc -lavfi "testsrc2=r=1:d=5,frei0r=enable=gte(n\,3):filter_name=distort0r"
|
||||
FATE_FFMPEG += $(FATE_FILTER_FREI0R-yes)
|
||||
|
||||
#
|
||||
# Metadata tests
|
||||
#
|
||||
|
|
|
|||
|
|
@ -303,11 +303,6 @@ FATE_HEVC-$(call FRAMECRC, HEVC, HEVC, SCALE_FILTER CONCAT_PROTOCOL) += fate-hev
|
|||
fate-hevc-mv-position: CMD = framecrc -i $(TARGET_SAMPLES)/hevc/multiview.mov -map 0:v:vpos:left -map 0:v:vpos:right
|
||||
FATE_HEVC-$(call FRAMECRC, MOV, HEVC) += fate-hevc-mv-position
|
||||
|
||||
# The sample is from PICO VR. It use long term ref.
|
||||
# Check long term ref being reset in IDR frame.
|
||||
fate-hevc-mv-ltr: CMD = framecrc -i $(TARGET_SAMPLES)/hevc/pico-mv-hevc.mp4 -map 0:vidx:1
|
||||
FATE_HEVC-$(call FRAMECRC, MOV, HEVC) += fate-hevc-mv-ltr
|
||||
|
||||
fate-hevc-alpha: CMD = framecrc -i $(TARGET_SAMPLES)/hevc/alpha.mp4
|
||||
FATE_HEVC-$(call FRAMECRC, MOV, HEVC) += fate-hevc-alpha
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
#tb 0: 1/1
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
#dimensions 0: 320x240
|
||||
#sar 0: 1/1
|
||||
0, 0, 0, 1, 307200, 0x30630897
|
||||
0, 1, 1, 1, 307200, 0xd08784dd
|
||||
0, 2, 2, 1, 307200, 0xe94387a0
|
||||
0, 3, 3, 1, 307200, 0x5df7a70e
|
||||
0, 4, 4, 1, 307200, 0x9c203210
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
#tb 0: 1/60
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
#dimensions 0: 2048x1536
|
||||
#sar 0: 0/1
|
||||
0, 0, 0, 1, 4718592, 0xa201f61d
|
||||
0, 1, 1, 1, 4718592, 0x63438b04
|
||||
0, 2, 2, 1, 4718592, 0xb2ef2022
|
||||
0, 3, 3, 1, 4718592, 0x9bcd7e4e
|
||||
0, 4, 4, 1, 4718592, 0x7d84b453
|
||||
0, 5, 5, 1, 4718592, 0xe1825fd9
|
||||
0, 6, 6, 1, 4718592, 0x4d3fa47e
|
||||
0, 7, 7, 1, 4718592, 0x3717852e
|
||||
0, 8, 8, 1, 4718592, 0x3b894106
|
||||
0, 9, 9, 1, 4718592, 0x94b23d4d
|
||||
0, 10, 10, 1, 4718592, 0x813ef53f
|
||||
0, 11, 11, 1, 4718592, 0xa4fd9eb2
|
||||
0, 12, 12, 1, 4718592, 0x719308ab
|
||||
0, 13, 13, 1, 4718592, 0xcc53abdb
|
||||
0, 14, 14, 1, 4718592, 0x69a1fbad
|
||||
0, 15, 15, 1, 4718592, 0xb1dee2e6
|
||||
0, 16, 16, 1, 4718592, 0x8892b11a
|
||||
0, 17, 17, 1, 4718592, 0xeea14ec7
|
||||
0, 18, 18, 1, 4718592, 0x1c8351a2
|
||||
0, 19, 19, 1, 4718592, 0x616a56d6
|
||||
0, 20, 20, 1, 4718592, 0x166e9329
|
||||
0, 21, 21, 1, 4718592, 0xe62a5ada
|
||||
0, 22, 22, 1, 4718592, 0x7ad680b9
|
||||
0, 23, 23, 1, 4718592, 0xa6c5d534
|
||||
0, 24, 24, 1, 4718592, 0xfbfbfd9a
|
||||
0, 25, 25, 1, 4718592, 0x30c3a53f
|
||||
0, 26, 26, 1, 4718592, 0x7229cad1
|
||||
0, 27, 27, 1, 4718592, 0x2703bd48
|
||||
0, 28, 28, 1, 4718592, 0xc46880e9
|
||||
0, 29, 29, 1, 4718592, 0x9480ac78
|
||||
0, 30, 30, 1, 4718592, 0xc9410aa9
|
||||
0, 31, 31, 1, 4718592, 0x7094d03d
|
||||
0, 32, 32, 1, 4718592, 0x63b02bce
|
||||
0, 33, 33, 1, 4718592, 0x5b7bf9c5
|
||||
0, 34, 34, 1, 4718592, 0x99af0869
|
||||
0, 35, 35, 1, 4718592, 0x54b382b6
|
||||
0, 36, 36, 1, 4718592, 0xc2511916
|
||||
0, 37, 37, 1, 4718592, 0x9833e473
|
||||
0, 38, 38, 1, 4718592, 0x91062ed4
|
||||
0, 39, 39, 1, 4718592, 0x47669bea
|
||||
0, 40, 40, 1, 4718592, 0x0bde1655
|
||||
0, 41, 41, 1, 4718592, 0x0c638749
|
||||
0, 42, 42, 1, 4718592, 0x4d5c380a
|
||||
0, 43, 43, 1, 4718592, 0x1780c529
|
||||
0, 44, 44, 1, 4718592, 0xe16a41da
|
||||
0, 45, 45, 1, 4718592, 0xfc265995
|
||||
0, 46, 46, 1, 4718592, 0x4fa62cc5
|
||||
0, 47, 47, 1, 4718592, 0x3c1263dc
|
||||
0, 48, 48, 1, 4718592, 0x43e21353
|
||||
0, 49, 49, 1, 4718592, 0x81a20ca5
|
||||
0, 50, 50, 1, 4718592, 0x74a6065b
|
||||
0, 51, 51, 1, 4718592, 0x5305f734
|
||||
0, 52, 52, 1, 4718592, 0xe287f597
|
||||
0, 53, 53, 1, 4718592, 0xc7c5dd6b
|
||||
0, 54, 54, 1, 4718592, 0x5b173885
|
||||
0, 55, 55, 1, 4718592, 0xb146d1f2
|
||||
0, 56, 56, 1, 4718592, 0x9c462f75
|
||||
0, 57, 57, 1, 4718592, 0x5214a211
|
||||
0, 58, 58, 1, 4718592, 0x473dd1c2
|
||||
0, 59, 59, 1, 4718592, 0x85efaa75
|
||||
0, 60, 60, 1, 4718592, 0x0885206c
|
||||
0, 61, 61, 1, 4718592, 0xe591f7c0
|
||||
0, 62, 62, 1, 4718592, 0xecd67225
|
||||
|
|
@ -4,8 +4,8 @@ Stream ID: 0, new metadata: encoder=Lavc61.19.100 flac:title=First Stream
|
|||
Stream ID: 0, frame PTS: 0, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
||||
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 8820, packet DTS: 8820
|
||||
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
||||
Stream ID: 0, new metadata: encoder=Lavc61.19.100 flac:title=Second Stream
|
||||
Stream ID: 0, frame PTS: 8820, metadata: encoder=Lavc61.19.100 flac:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 13428, packet DTS: 13428
|
||||
Stream ID: 0, frame PTS: 13428, metadata: N/A
|
||||
Stream ID: 0, frame PTS: 0, metadata: encoder=Lavc61.19.100 flac:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
||||
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@ Stream ID: 0, packet PTS: 3528, packet DTS: 3528
|
|||
Stream ID: 0, frame PTS: 3528, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 4488, packet DTS: 4488
|
||||
Stream ID: 0, frame PTS: 4488, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 4800, packet DTS: 4800
|
||||
Stream ID: 0, packet PTS: -312, packet DTS: -312
|
||||
Stream ID: 0, new metadata: encoder=Lavc61.19.100 libopus:title=Second Stream
|
||||
Stream ID: 0, frame PTS: 4800, metadata: encoder=Lavc61.19.100 libopus:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 5760, packet DTS: 5760
|
||||
Stream ID: 0, frame PTS: 5760, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 6720, packet DTS: 6720
|
||||
Stream ID: 0, frame PTS: 6720, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 7680, packet DTS: 7680
|
||||
Stream ID: 0, frame PTS: 7680, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 8640, packet DTS: 8640
|
||||
Stream ID: 0, frame PTS: 8640, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 9600, packet DTS: 9600
|
||||
Stream ID: 0, frame PTS: 9600, metadata: N/A
|
||||
Stream ID: 0, frame PTS: -312, metadata: encoder=Lavc61.19.100 libopus:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 648, packet DTS: 648
|
||||
Stream ID: 0, frame PTS: 648, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 1608, packet DTS: 1608
|
||||
Stream ID: 0, frame PTS: 1608, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 2568, packet DTS: 2568
|
||||
Stream ID: 0, frame PTS: 2568, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 3528, packet DTS: 3528
|
||||
Stream ID: 0, frame PTS: 3528, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 4488, packet DTS: 4488
|
||||
Stream ID: 0, frame PTS: 4488, metadata: N/A
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ Stream ID: 0, packet PTS: 128, packet DTS: 128
|
|||
Stream ID: 0, frame PTS: 128, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 704, packet DTS: 704
|
||||
Stream ID: 0, frame PTS: 704, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 1323, packet DTS: 1323
|
||||
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
||||
Stream ID: 0, new metadata: encoder=Lavc61.19.100 libvorbis:title=Second Stream
|
||||
Stream ID: 0, frame PTS: 1323, metadata: encoder=Lavc61.19.100 libvorbis:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 1451, packet DTS: 1451
|
||||
Stream ID: 0, frame PTS: 1451, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 2027, packet DTS: 2027
|
||||
Stream ID: 0, frame PTS: 2027, metadata: N/A
|
||||
Stream ID: 0, frame PTS: 0, metadata: encoder=Lavc61.19.100 libvorbis:title=Second Stream
|
||||
Stream ID: 0, packet PTS: 128, packet DTS: 128
|
||||
Stream ID: 0, frame PTS: 128, metadata: N/A
|
||||
Stream ID: 0, packet PTS: 704, packet DTS: 704
|
||||
Stream ID: 0, frame PTS: 704, metadata: N/A
|
||||
|
|
|
|||
Loading…
Reference in New Issue