Skip to content
Permalink
Browse files

Add A64 support

  • Loading branch information...
jemk committed Feb 29, 2016
1 parent 4e27c99 commit cba127cf8457a7e4a2e02832f0b653e85f2c97c7
Showing with 16 additions and 10 deletions.
  1. +1 −1 README
  2. +2 −2 decoder.c
  3. +2 −2 h264.c
  4. +2 −2 mpeg12.c
  5. +2 −2 mpeg4.c
  6. +3 −1 surface_video.c
  7. +4 −0 tiled_yuv.S
2 README
@@ -1,7 +1,7 @@
This is an experimental VDPAU implementation for sunxi SoCs.

It supports decoding of MPEG1 and MPEG2, some limited MPEG4 types,
H.264 and on the H3 SoC it also decodes H.265.
H.264 and on H3/A64 it also decodes H.265.


Requirements:
@@ -71,7 +71,7 @@ VdpStatus vdp_decoder_create(VdpDevice device,
break;

case VDP_DECODER_PROFILE_HEVC_MAIN:
if (cedrus_get_ve_version(dec->device->cedrus) == 0x1680)
if (cedrus_get_ve_version(dec->device->cedrus) >= 0x1680)
ret = new_decoder_h265(dec);
else
ret = VDP_STATUS_INVALID_DECODER_PROFILE;
@@ -204,7 +204,7 @@ VdpStatus vdp_decoder_query_capabilities(VdpDevice device,
break;
case VDP_DECODER_PROFILE_HEVC_MAIN:
*max_level = VDP_DECODER_LEVEL_HEVC_5;
if (cedrus_get_ve_version(dev->cedrus) == 0x1680)
if (cedrus_get_ve_version(dev->cedrus) >= 0x1680)
*is_supported = VDP_TRUE;
else
*is_supported = VDP_FALSE;
4 h264.c
@@ -804,7 +804,7 @@ static VdpStatus h264_decode(decoder_ctx_t *decoder,

// sdctrl
writel(0x00000000, c->regs + VE_H264_SDROT_CTRL);
if (cedrus_get_ve_version(decoder->device->cedrus) == 0x1680)
if (cedrus_get_ve_version(decoder->device->cedrus) >= 0x1680)
{
writel(cedrus_mem_get_bus_addr(c->output->yuv->data), c->regs + VE_H264_SDROT_LUMA);
writel(cedrus_mem_get_bus_addr(c->output->yuv->data) + c->output->luma_size, c->regs + VE_H264_SDROT_CHROMA);
@@ -834,7 +834,7 @@ static VdpStatus h264_decode(decoder_ctx_t *decoder,
}

// Enable startcode detect and ??
writel((0x1 << 25) | (0x1 << 10) | ((cedrus_get_ve_version(decoder->device->cedrus) == 0x1680) << 9), c->regs + VE_H264_CTRL);
writel((0x1 << 25) | (0x1 << 10) | ((cedrus_get_ve_version(decoder->device->cedrus) >= 0x1680) << 9), c->regs + VE_H264_CTRL);

// input buffer
writel((len - pos) * 8, c->regs + VE_H264_VLD_LEN);
@@ -116,8 +116,8 @@ static VdpStatus mpeg12_decode(decoder_ctx_t *decoder,
writel(pic_header, ve_regs + VE_MPEG_PIC_HDR);

// ??
writel(0x80000138 | ((cedrus_get_ve_version(decoder->device->cedrus) != 0x1680) << 7), ve_regs + VE_MPEG_CTRL);
if (cedrus_get_ve_version(decoder->device->cedrus) == 0x1680)
writel(0x80000138 | ((cedrus_get_ve_version(decoder->device->cedrus) < 0x1680) << 7), ve_regs + VE_MPEG_CTRL);
if (cedrus_get_ve_version(decoder->device->cedrus) >= 0x1680)
writel((0x2 << 30) | (0x1 << 28) | (output->chroma_size / 2), ve_regs + VE_EXTRA_OUT_FMT_OFFSET);

// set forward/backward predicion buffers
@@ -191,7 +191,7 @@ static VdpStatus mpeg4_decode(decoder_ctx_t *decoder,

// ??
writel(0x40620000, ve_regs + VE_MPEG_SDROT_CTRL);
if (cedrus_get_ve_version(decoder->device->cedrus) == 0x1680)
if (cedrus_get_ve_version(decoder->device->cedrus) >= 0x1680)
writel((0x2 << 30) | (0x1 << 28) | (output->chroma_size / 2), ve_regs + VE_EXTRA_OUT_FMT_OFFSET);

// set vop header
@@ -218,7 +218,7 @@ static VdpStatus mpeg4_decode(decoder_ctx_t *decoder,
writel(0x0, ve_regs + VE_MPEG_MBA);

// enable interrupt, unknown control flags
writel(0x80084118 | ((cedrus_get_ve_version(decoder->device->cedrus) != 0x1680) << 7) | ((hdr.vop_coding_type == VOP_P ? 0x1 : 0x0) << 12), ve_regs + VE_MPEG_CTRL);
writel(0x80084118 | ((cedrus_get_ve_version(decoder->device->cedrus) < 0x1680) << 7) | ((hdr.vop_coding_type == VOP_P ? 0x1 : 0x0) << 12), ve_regs + VE_MPEG_CTRL);

// set quantization parameter
writel(hdr.vop_quant, ve_regs + VE_MPEG_QP_INPUT);
@@ -70,7 +70,7 @@ VdpStatus yuv_prepare(video_surface_ctx_t *video_surface)

VdpStatus rec_prepare(video_surface_ctx_t *video_surface)
{
if (cedrus_get_ve_version(video_surface->device->cedrus) == 0x1680)
if (cedrus_get_ve_version(video_surface->device->cedrus) >= 0x1680)
{
if (!video_surface->rec)
{
@@ -192,6 +192,7 @@ VdpStatus vdp_video_surface_get_bits_y_cb_cr(VdpVideoSurface surface,
if (destination_pitches[0] < vs->width || destination_pitches[1] < vs->width / 2)
return VDP_STATUS_ERROR;

#ifndef __aarch64__
switch (destination_ycbcr_format)
{
case VDP_YCBCR_FORMAT_NV12:
@@ -206,6 +207,7 @@ VdpStatus vdp_video_surface_get_bits_y_cb_cr(VdpVideoSurface surface,
tiled_deinterleave_to_planar(cedrus_mem_get_pointer(vs->yuv->data) + vs->luma_size, destination_data[2], destination_data[1], destination_pitches[1], vs->width, vs->height / 2);
return VDP_STATUS_OK;
}
#endif

return VDP_STATUS_ERROR;
}
@@ -21,6 +21,8 @@
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
#endif

#ifndef __aarch64__

.text
.syntax unified
.arch armv7-a
@@ -173,3 +175,5 @@ thumb_function tiled_deinterleave_to_planar
bne 6b
b 7b
end_function tiled_deinterleave_to_planar

#endif

0 comments on commit cba127c

Please sign in to comment.
You can’t perform that action at this time.