Documentation ¶
Index ¶
- func MakeHandle(devbuff, pinnedbuff uint) (*nvjpeg.Handle, error)
- type Channel
- type Decoder
- func (d *Decoder) BatchPhaseInitialize(r []io.Reader, maxCputhreads int, frmt nvjpeg.OutputFormat, ...) (data [][]byte, dests []*Image, err error)
- func (d *Decoder) BatchedPhase1(data []byte, imgidx, threadidx int) error
- func (d *Decoder) BatchedPhase3(dest []*Image) error
- func (d *Decoder) BatchedPhse2() error
- func (d *Decoder) DecodeAIO(r io.Reader, frmt nvjpeg.OutputFormat, allocator gocu.Allocator) (*Image, error)
- func (d *Decoder) DecodeBatchedAIO(r []io.Reader, maxCPUthreads int, frmt nvjpeg.OutputFormat, ...) ([]*Image, error)
- func (d *Decoder) Phase1(data []byte, frmt nvjpeg.OutputFormat) error
- func (d *Decoder) Phase2() error
- func (d *Decoder) Phase3(dest *Image) error
- type Encoder
- func (e *Encoder) EncodeImage(src *nvjpeg.Image, fmt nvjpeg.InputFormat, swidth, sheight int32) error
- func (e *Encoder) EncodeYUV(src *nvjpeg.Image, srcChroma nvjpeg.ChromaSubsampling, swidth, sheight int32) error
- func (e *Encoder) GetBufferSize(width, height int32) (maxStreamLength uint, err error)
- func (e *Encoder) GetByteSize() (uint, error)
- func (e *Encoder) Read(p []byte) (n int, err error)
- func (e *Encoder) SetOptimizedHuffman(optimized bool) error
- func (e *Encoder) SetQuality(quality int32) error
- func (e *Encoder) SetSamplingFactors(factor nvjpeg.ChromaSubsampling) error
- type Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel contains a pointer to cuda memory along with Pitch and Height
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes jpegs int nvjpeg.Images
func CreateDecoder ¶
CreateDecoder creates a decoder
func (*Decoder) BatchPhaseInitialize ¶
func (d *Decoder) BatchPhaseInitialize(r []io.Reader, maxCputhreads int, frmt nvjpeg.OutputFormat, allocator gocu.Allocator) (data [][]byte, dests []*Image, err error)
BatchPhaseInitialize initialezes a batch of phases. It also initializes the bytes(BatchedPhase1) and dests (BatchedPhase3) used for the phases.
func (*Decoder) BatchedPhase1 ¶
BatchedPhase1 does phase one of batch decoding
func (*Decoder) BatchedPhase3 ¶
BatchedPhase3 does phase three of batched decoding
func (*Decoder) BatchedPhse2 ¶
BatchedPhse2 does phase two of batched decoding
func (*Decoder) DecodeAIO ¶
func (d *Decoder) DecodeAIO(r io.Reader, frmt nvjpeg.OutputFormat, allocator gocu.Allocator) (*Image, error)
DecodeAIO decodes one jpeg through all the phases in on function
func (*Decoder) DecodeBatchedAIO ¶
func (d *Decoder) DecodeBatchedAIO(r []io.Reader, maxCPUthreads int, frmt nvjpeg.OutputFormat, allocator gocu.Allocator) ([]*Image, error)
DecodeBatchedAIO returns a batch of images
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder streamlines nvjpegs encoderparams, encoderstate, handle, and gocu.Streamer.
func CreateEncoder ¶
CreateEncoder creates an encoder
func (*Encoder) EncodeImage ¶
func (e *Encoder) EncodeImage(src *nvjpeg.Image, fmt nvjpeg.InputFormat, swidth, sheight int32) error
EncodeImage - Compresses the image in the provided format to the JPEG stream using the paramters set by encoder, and stores it in the Encoder.
func (*Encoder) EncodeYUV ¶
func (e *Encoder) EncodeYUV(src *nvjpeg.Image, srcChroma nvjpeg.ChromaSubsampling, swidth, sheight int32) error
EncodeYUV -Compresses the image in YUV colorspace to JPEG stream using the paramters set by encoder, and stores it in the Encoder.
func (*Encoder) GetBufferSize ¶
GetBufferSize - Returns the maximum possible buffer size that is needed to store the compressed JPEG stream, for the given input parameters.
func (*Encoder) GetByteSize ¶
GetByteSize returns the number of bytes in compressed buffer. Can be used to make p for Read()
func (*Encoder) Read ¶
Read reads up to len(p). n is the number of bytes read. if len(p) < buffer stream function will not read any bytes. error sould return number of that should be made for p, or it will contain bigger error issues from nvjpeg. Use GetByteSize() to get the size of p.
func (*Encoder) SetOptimizedHuffman ¶
SetOptimizedHuffman - Sets whether or not to use optimized Huffman. Using optimized Huffman produces smaller JPEG bitstream sizes with the same quality, but with slower performance. Default is false
func (*Encoder) SetQuality ¶
SetQuality sets the quality of the paramters of the endcoder Quality should be a number between 1 and 100. The default is set to 70
func (*Encoder) SetSamplingFactors ¶
func (e *Encoder) SetSamplingFactors(factor nvjpeg.ChromaSubsampling) error
SetSamplingFactors -Sets which chroma subsampling will be used for JPEG compression. ssfactor that will be used for JPEG compression. If the input is in YUV color model and ssfactor is different from the subsampling factors of source image, then the NVJPEG library will convert subsampling to the value of chroma_subsampling. Default value is 4:4:4.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image contains the data used for nvjpeg images
func CreateDestImage ¶
func CreateDestImage(h *nvjpeg.Handle, frmt nvjpeg.OutputFormat, r io.Reader, allocator gocu.Allocator) (*Image, error)
CreateDestImage returns an empty Image used to place data from stream into it
func (*Image) GetChannels ¶
GetChannels returns the channels being held by img