mirror of
https://github.com/gen2brain/cam2ip.git
synced 2026-05-01 10:22:36 +00:00
Change libjpeg library, rename tag
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
//go:build turbo
|
||||
// +build turbo
|
||||
//go:build !libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
jpeg "github.com/antonini/golibjpegturbo"
|
||||
)
|
||||
|
||||
// NewDecoder returns a new Decoder.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//go:build !turbo
|
||||
// +build !turbo
|
||||
//go:build libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
"github.com/pixiv/go-libjpeg/jpeg"
|
||||
)
|
||||
|
||||
// NewDecoder returns a new Decoder.
|
||||
@@ -22,5 +22,9 @@ type Decoder struct {
|
||||
|
||||
// Decode decodes image from JPEG.
|
||||
func (d Decoder) Decode() (image.Image, error) {
|
||||
return jpeg.Decode(d.r)
|
||||
return jpeg.Decode(d.r, &jpeg.DecoderOptions{
|
||||
DCTMethod: jpeg.DCTFloat,
|
||||
DisableFancyUpsampling: true,
|
||||
DisableBlockSmoothing: true,
|
||||
})
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
//go:build turbo
|
||||
// +build turbo
|
||||
//go:build !libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
jpeg "github.com/antonini/golibjpegturbo"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//go:build !turbo
|
||||
// +build !turbo
|
||||
//go:build libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
"github.com/pixiv/go-libjpeg/jpeg"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder.
|
||||
@@ -22,10 +22,7 @@ type Encoder struct {
|
||||
|
||||
// Encode encodes image to JPEG.
|
||||
func (e Encoder) Encode(img image.Image) error {
|
||||
err := jpeg.Encode(e.w, img, &jpeg.Options{Quality: 75})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return jpeg.Encode(e.w, img, &jpeg.EncoderOptions{
|
||||
Quality: 75,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user