Documentation ¶
Overview ¶
Package encoding contains common code to interact with the video encode accelerator test binary.
Index ¶
- func CompareFiles(ctx context.Context, decoder Decoder, yuvFile, encodedFile, outDir string, ...) (psnr, ssim float64, err error)
- func CreatePublicTempFile(prefix string) (*os.File, error)
- func CreateStreamDataArg(params StreamParams, profile videotype.CodecProfile, ...) string
- func ParseQualityPerfMetrics(metricsPath, scalabilityMode string, p *perf.Values) error
- func ParseUncappedPerfMetrics(metricsPath string, p *perf.Values, metricPrefix string) error
- func PrepareYUV(ctx context.Context, webMFile string, pixelFormat videotype.PixelFormat, ...) (string, error)
- func PrepareYUVJSON(ctx context.Context, yuvPath, jsonPath string) (string, error)
- type Decoder
- type StreamParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareFiles ¶
func CompareFiles(ctx context.Context, decoder Decoder, yuvFile, encodedFile, outDir string, size coords.Size) (psnr, ssim float64, err error)
CompareFiles decodes encodedFile using decoder and compares it with yuvFile using tiny_ssim. PSNR and SSIM are returned on success. Caveats: This creates text files in outDir and writes them. Calling twice overwrites the files.
func CreatePublicTempFile ¶
CreatePublicTempFile creates a world-readable temporary file. A caller should close and remove the file in the end.
func CreateStreamDataArg ¶
func CreateStreamDataArg(params StreamParams, profile videotype.CodecProfile, pixelFormat videotype.PixelFormat, dataPath, outFile string) string
CreateStreamDataArg creates an argument of video_encode_accelerator_unittest from profile, dataPath and outFile.
func ParseQualityPerfMetrics ¶
ParseQualityPerfMetrics parses the JSON log file generated by the MeasureProducedBitstreamQuality test.
func ParseUncappedPerfMetrics ¶
ParseUncappedPerfMetrics parses the JSON log file generated by the MeasureUncappedPerformance test.
func PrepareYUV ¶
func PrepareYUV(ctx context.Context, webMFile string, pixelFormat videotype.PixelFormat, size coords.Size) (string, error)
PrepareYUV decodes webMFile and creates the associated YUV file for test whose pixel format is pixelFormat. The returned value is the path of the created YUV file. It must be removed in the end of test, because its size is expected to be large. The input WebM files are vp9 codec. They are generated from raw YUV data by libvpx like "vpxenc foo.yuv -o foo.webm --codec=vp9 -w <width> -h <height> --lossless=1" Please use "--lossless=1" option. Lossless compression is required to ensure we are testing streams at the same quality as original raw streams, to test encoder capabilities (performance, bitrate convergence, etc.) correctly and with sufficient complexity/PSNR. TODO(b/177856221): Removes the functionality of producing NV12 format, so that this always produces an I420 file.
Types ¶
type Decoder ¶
type Decoder string
Decoder is a command line decoder that can be used in CompareFiles.
const ( // OpenH264Decoder is an H264 decoder built from https://github.com/cisco/openh264. OpenH264Decoder Decoder = "openh264dec" // LibvpxDecoder is a VP8 and VP9 decoder built from https://chromium.googlesource.com/webm/libvpx/. LibvpxDecoder Decoder = "vpxdec" )
type StreamParams ¶
type StreamParams struct { // Name is the name of input raw data file. Name string // Size is the width and height of YUV image in the input raw data. Size coords.Size // Bitrate is the requested bitrate in bits per second. VideoEncodeAccelerator is forced to output // encoded video in expected range around the bitrate. Bitrate int // FrameRate is the initial frame rate in the test. This value is optional, and will be set to // 30 if unspecified. FrameRate int // SubseqBitrate is the bitrate to switch to in the middle of the stream in some test cases in // video_encode_accelerator_unittest. This value is optional, and will be set to two times of Bitrate if unspecified. SubseqBitrate int // SubseqFrameRate is the frame rate to switch to in the middle of the stream in some test cases in // video_encode_accelerator_unittest. This value is optional, and will be set to 30 if unspecified. SubseqFrameRate int // Level is the requested output level. This value is optional and currently only used by the H264 codec. The value // should be aligned with the H264LevelIDC enum in https://cs.chromium.org/chromium/src/media/video/h264_parser.h, // as well as level_idc(u8) definition of sequence parameter set data in official H264 spec. Level int }
StreamParams is the parameter for video_encode_accelerator_unittest.