// NewConverter creates a new Converter object.
349881
func NewConverter(nameFn NameFunc) *Converter {
	c := &Converter{
		conversionFuncs:          NewConversionFuncs(),
		generatedConversionFuncs: NewConversionFuncs(),
		ignoredConversions:       make(map[typePair]struct{}),
		nameFunc:                 nameFn,
		structFieldDests:         make(map[typeNamePair][]typeNamePair),
		structFieldSources:       make(map[typeNamePair][]typeNamePair),

		inputFieldMappingFuncs: make(map[reflect.Type]FieldMappingFunc),
		inputDefaultFlags:      make(map[reflect.Type]FieldMatchingFlags),
	}
	c.RegisterConversionFunc(Convert_Slice_byte_To_Slice_byte)
	return c
}
844949
func NewConsumer(addrs []string, config *Config) (Consumer, error) {
	client, err := NewClient(addrs, config)
	if err != nil {
		return nil, err
	}
	return newConsumer(client)
}
132225
func (cfg *Config) NewDecoder(r io.Reader) *Decoder {
	return &Decoder{r, cfg}
}
18463
func NewDecoder(r io.Reader) *Decoder {
	decoder := &Decoder{
		r: bufio.NewReader(r),
	}

	return decoder
}
56725
func NewConverter(cfg *ConverterConfig, filter Filter) (Converter, error) {
	err := checkConversion(&cfg.Output, &cfg.Input)
	if err != nil {
		return nil, err
	}
	if cfg.Threads == 0 {
		cfg.Threads = runtime.GOMAXPROCS(0)
	}
	ctx := &converterContext{
		ConverterConfig: *cfg,
	}
	size := 0
	group := sync.WaitGroup{}
	for i := 0; i < cfg.Output.Planes; i++ {
		win := cfg.Input.GetWidth(i)
		hin := cfg.Input.GetHeight(i)
		wout := cfg.Output.GetWidth(i)
		hout := cfg.Output.GetHeight(i)
		if win < 2 || hin < 2 {
			return nil, fmt.Errorf("input size too small %vx%v", win, hin)
		}
		if wout < 2 || hout < 2 {
			return nil, fmt.Errorf("output size too small %vx%v", wout, hout)
		}
		idx := i
		if win != wout {
			dispatch(&group, cfg.Threads, func() {
				threads := min(cfg.Threads, hout)
				ctx.wrez[idx] = NewResize(&ResizerConfig{
					Depth:      8,
					Input:      win,
					Output:     wout,
					Vertical:   false,
					Interlaced: false,
					Pack:       cfg.Input.Pack,
					Threads:    threads,
					DisableAsm: cfg.DisableAsm || wout < 16,
				}, filter)
			})
		}
		if hin != hout {
			dispatch(&group, cfg.Threads, func() {
				threads := min(cfg.Threads, hout)
				if cfg.Output.Interlaced {
					threads = min(cfg.Threads, hout>>1)
				}
				ctx.hrez[idx] = NewResize(&ResizerConfig{
					Depth:      8,
					Input:      hin,
					Output:     hout,
					Vertical:   true,
					Interlaced: cfg.Output.Interlaced,
					Pack:       cfg.Output.Pack,
					Threads:    threads,
					DisableAsm: cfg.DisableAsm || wout < 16 || win < 16,
				}, filter)
			})
		}
		if win != wout && hin != hout {
			p := &Plane{
				Width:  win,
				Height: hout,
				Pitch:  align(win*cfg.Input.Pack, 16),
				Pack:   cfg.Input.Pack,
			}
			size += p.Pitch * p.Height
			ctx.buffer[i] = p
		}
	}
	if size != 0 {
		buffer := make([]byte, size)
		idx := 0
		for i := 0; i < cfg.Output.Planes; i++ {
			if p := ctx.buffer[i]; p != nil {
				size := p.Pitch*(p.Height-1) + p.Width*p.Pack
				p.Data = buffer[idx : idx+size]
				idx += p.Pitch * p.Height
			}
		}
	}
	group.Wait()
	return ctx, nil
}
1213421
func NewDecoder(r io.Reader) *Decoder {
	return &Decoder{Decoder: *json.NewDecoder(r)}
}
1262857
func NewDecoder(s encoding.Source) encoding.Decoder {
	r := s()
	var (
		uf  = func(b []byte, m interface{}) error { return proto.Unmarshal(b, m.(proto.Message)) }
		dec = framing.NewDecoder(r, uf)
	)
	return encoding.DecoderFunc(func(u encoding.Unmarshaler) error { return dec.Decode(u) })
}
785071
func NewDecoder(r io.Reader) (*Decoder, error) {
	err := checkMagic(r)
	if err != nil {
		return nil, err
	}

	d := &Decoder{r: r}
	if d.MetaData, err = readMetaData(d.r); err != nil {
		return nil, err
	}
	if d.StreamInfo == nil {
		return nil, errors.New("Missing STREAMINFO header")
	}

	if d.BitsPerSample != 8 && d.BitsPerSample != 16 && d.BitsPerSample != 24 {
		return nil, errors.New("Unsupported bits per sample (" + strconv.Itoa(d.BitsPerSample) + "), supported values are: 8, 16, and 24")
	}

	return d, nil
}
1308805
func NewEncoder(w io.Writer, e runtime.Encoder) Encoder {
	return &encoder{
		writer:  w,
		encoder: e,
		buf:     &bytes.Buffer{},
	}
}
325947
func NewDecoder(opts ...func(*Decoder)) *Decoder {
	d := &Decoder{
		MarshalOptions: MarshalOptions{
			SupportJSONTags: true,
		},
	}
	for _, o := range opts {
		o(d)
	}

	return d
}
773062
func NewDecoder(reader io.Reader) *Decoder {
	return &Decoder{
		reader: bufio.NewReader(reader),
	}
}
354768
func NewDecoder(data []byte) *Decoder {
	return &Decoder{
		data: data,
		end:  len(data),
	}
}
1120180
func NewConsumer(config *ConsumerConfig) *Consumer {
	if err := config.Validate(); err != nil {
		panic(err)
	}

	Infof(config.Consumerid, "Creating new consumer with configuration: %s", config)
	c := &Consumer{
		config:                         config,
		unsubscribe:                    make(chan bool),
		closeFinished:                  make(chan bool),
		topicPartitionsAndBuffers:      make(map[TopicAndPartition]*messageBuffer),
		topicRegistry:                  make(map[string]map[int32]*partitionTopicInfo),
		connectChannels:                make(chan bool),
		disconnectChannelsForPartition: make(chan TopicAndPartition),
		workerManagers:                 make(map[TopicAndPartition]*WorkerManager),
		stopStreams:                    make(chan bool),
		close:                          make(chan bool),
	}

	if err := c.config.Coordinator.Connect(); err != nil {
		panic(err)
	}
	if err := c.config.LowLevelClient.Initialize(); err != nil {
		panic(err)
	}
	c.metrics = newConsumerMetrics(c.String(), config.MetricsPrefix)
	c.fetcher = newConsumerFetcherManager(c.config, c.disconnectChannelsForPartition, c.metrics)

	go func() {
		<-c.close
		if !c.isShuttingdown {
			c.Close()
		}
	}()

	return c
}
659920
func NewDecoder(r io.Reader, format Format) Decoder {
	switch format {
	case FmtProtoDelim:
		return &protoDecoder{r: r}
	}
	return &textDecoder{r: r}
}
1307367
func NewDashVertexConverter(dash []float64, dashOffset float64, flattener Flattener) *DashVertexConverter {
	var dasher DashVertexConverter
	dasher.dash = dash
	dasher.currentDash = 0
	dasher.dashOffset = dashOffset
	dasher.next = flattener
	return &dasher
}
162161
func NewDecoder(r io.Reader) goa.Decoder {
	return codec.NewDecoder(r, &Handle)
}
844406
func NewVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
	return &versionConverter{
		typeConverter:   t,
		objectConvertor: o,
		hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
			return schema.GroupVersion{
				Group:   from.Group,
				Version: h.Version,
			}
		},
	}
}