热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.bytedeco.javacpp.BytePointer.position()方法的使用及代码示例

本文整理了Java中org.bytedeco.javacpp.BytePointer.position()方法的一些代码示例,展示了BytePointer.

本文整理了Java中org.bytedeco.javacpp.BytePointer.position()方法的一些代码示例,展示了BytePointer.position()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BytePointer.position()方法的具体详情如下:
包路径:org.bytedeco.javacpp.BytePointer
类名称:BytePointer
方法名:position

BytePointer.position介绍

暂无

代码示例

代码示例来源:origin: bytedeco/javacpp

/** Constructor to set the {@link #pointer}, {@link #sizes} and {@link #strides}. */
public ByteRawIndexer(BytePointer pointer, long[] sizes, long[] strides) {
super(sizes, strides);
this.pointer = pointer;
base = pointer.address() + pointer.position();
size = pointer.limit() - pointer.position();
}

代码示例来源:origin: bytedeco/javacpp

/** Constructor to set the {@link #pointer}, {@link #sizes} and {@link #strides}. */
public UByteRawIndexer(BytePointer pointer, long[] sizes, long[] strides) {
super(sizes, strides);
this.pointer = pointer;
base = pointer.address() + pointer.position();
size = pointer.limit() - pointer.position();
}

代码示例来源:origin: bytedeco/javacpp

/** Calls {@code ByteRawIndexer(pointer, { pointer.limit() - pointer.position() }, { 1 })}. */
public ByteRawIndexer(BytePointer pointer) {
this(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE);
}

代码示例来源:origin: bytedeco/javacpp

/** Calls {@code UByteRawIndexer(pointer, { pointer.limit() - pointer.position() }, { 1 })}. */
public UByteRawIndexer(BytePointer pointer) {
this(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE);
}

代码示例来源:origin: bytedeco/javacpp

/**
* For direct buffers, calls {@link Pointer#Pointer(Buffer)}, while for buffers
* backed with an array, allocates enough memory for the array and copies it.
*
* @param buffer the Buffer to reference or copy
* @see #put(byte[])
*/
public BytePointer(ByteBuffer buffer) {
super(buffer);
if (buffer != null && !buffer.isDirect() && buffer.hasArray()) {
byte[] array = buffer.array();
allocateArray(array.length - buffer.arrayOffset());
put(array, buffer.arrayOffset(), array.length - buffer.arrayOffset());
position(buffer.position());
limit(buffer.limit());
}
}
/**

代码示例来源:origin: bytedeco/javacpp

@Override public void release() {
pointer.position(position).put(array);
super.release();
}
};

代码示例来源:origin: bytedeco/javacpp

/** Returns {@code create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true)} */
public static UByteIndexer create(BytePointer pointer) {
return create(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE);
}

代码示例来源:origin: bytedeco/javacpp

@Override public void release() {
pointer.position(position).put(array);
super.release();
}
};

代码示例来源:origin: bytedeco/javacpp

/** Returns {@code create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true)} */
public static ByteIndexer create(BytePointer pointer) {
return create(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE);
}

代码示例来源:origin: bytedeco/javacpp

/**
* Creates a byte indexer to access efficiently the data of a pointer.
*
* @param pointer data to access via a buffer or to copy to an array
* @param direct {@code true} to use a direct buffer, see {@link Indexer} for details
* @return the new byte indexer backed by the raw memory interface, a buffer, or an array
*/
public static UByteIndexer create(final BytePointer pointer, long[] sizes, long[] strides, boolean direct) {
if (direct) {
return Raw.getInstance() != null ? new UByteRawIndexer(pointer, sizes, strides)
: new UByteBufferIndexer(pointer.asBuffer(), sizes, strides);
} else {
final long position = pointer.position();
byte[] array = new byte[(int)Math.min(pointer.limit() - position, Integer.MAX_VALUE)];
pointer.get(array);
return new UByteArrayIndexer(array, sizes, strides) {
@Override public void release() {
pointer.position(position).put(array);
super.release();
}
};
}
}

代码示例来源:origin: bytedeco/javacpp

/**
* Creates a byte indexer to access efficiently the data of a pointer.
*
* @param pointer data to access via a buffer or to copy to an array
* @param direct {@code true} to use a direct buffer, see {@link Indexer} for details
* @return the new byte indexer backed by the raw memory interface, a buffer, or an array
*/
public static ByteIndexer create(final BytePointer pointer, long[] sizes, long[] strides, boolean direct) {
if (direct) {
return Raw.getInstance() != null ? new ByteRawIndexer(pointer, sizes, strides)
: new ByteBufferIndexer(pointer.asBuffer(), sizes, strides);
} else {
final long position = pointer.position();
byte[] array = new byte[(int)Math.min(pointer.limit() - position, Integer.MAX_VALUE)];
pointer.get(array);
return new ByteArrayIndexer(array, sizes, strides) {
@Override public void release() {
pointer.position(position).put(array);
super.release();
}
};
}
}

代码示例来源:origin: org.janelia/H5J_Loader_Plugin

private void linewisePageCapture(final int width, int height, final int linesize, final BytePointer data, byte[] page) {
byte[] bytes = new byte[width * pixelBytes];
for (int y = 0; y final int lineInPagePos = y * linesize;
BytePointer ptr = data.position(lineInPagePos);
ptr.get(bytes);
System.arraycopy(bytes, 0, page, y * linesize, bytes.length);
}
}

代码示例来源:origin: org.janelia/H5J_Loader_Plugin

private void pagewisePageCapture(final int width, int height, final int linesize, final BytePointer data, byte[] page) {
BytePointer ptr = data.position(0);
ptr.get(page);
}

代码示例来源:origin: org.janelia/H5J_Loader_Plugin

@Override
public void accept(BytePointer data, int linesize, int width, int height) {
final String FILENAME_FORMAT = "image%05d.ppm";
// NOTE: This code must remain at Java version 1.6, for use in export
// in a separate library.

// Open file
OutputStream stream = null;
try {
stream = new FileOutputStream(String.format(FILENAME_FORMAT,frameNum));

// Write header
stream.write(("P6\n" + width + " " + height + "\n255\n").getBytes());
// Write pixel data
byte[] bytes = new byte[width * pixelBytes];
for (int y = 0; y data.position(y * linesize).get(bytes);
stream.write(bytes);
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
closeStream(stream);
}
}

代码示例来源:origin: hoary/JavaAV

/**
* Free the memory of sample buffers.
*/
public void clear() {
if (planePointers != null) {
for (int i = 0; i av_free(planePointers[i].position(0));
}
planePointers = null;
}
}

代码示例来源:origin: org.bytedeco/javacv

private void writeSamples(int nb_samples) throws Exception {
if (samples_out == null || samples_out.length == 0) {
return;
}
frame.nb_samples(nb_samples);
avcodec_fill_audio_frame(frame, audio_c.channels(), audio_c.sample_fmt(), samples_out[0], (int)samples_out[0].position(), 0);
for (int i = 0; i int linesize = 0;
if (samples_out[0].position() > 0 && samples_out[0].position() linesize = (int)samples_out[i].position();
} else {
linesize = (int)Math.min(samples_out[i].limit(), Integer.MAX_VALUE);
}
frame.data(i, samples_out[i].position(0));
frame.linesize(i, linesize);
}
frame.quality(audio_c.global_quality());
record(frame);
}

代码示例来源:origin: io.antmedia/ant-media-server-common

private void writeSamples(int nb_samples) throws Exception {
if (samples_out == null || samples_out.length == 0) {
return;
}
frame.nb_samples(nb_samples);
avcodec_fill_audio_frame(frame, audio_c.channels(), audio_c.sample_fmt(), samples_out[0], (int)samples_out[0].position(), 0);
for (int i = 0; i int linesize = 0;
if (samples_out[0].position() > 0 && samples_out[0].position() linesize = (int)samples_out[i].position();
} else {
linesize = (int)Math.min(samples_out[i].limit(), Integer.MAX_VALUE);
}
frame.data(i, samples_out[i].position(0));
frame.linesize(i, linesize);
}
frame.quality(audio_c.global_quality());
record(frame);
}

代码示例来源:origin: org.bytedeco.javacpp-presets/leptonica

/** @return {@link PIX#data()} wrapped in a {@link ByteBuffer} starting at given byte index. */
public ByteBuffer createBuffer(int index) {
int h = pixGetHeight((PIX)this);
int wpl = pixGetWpl((PIX)this);
BytePointer data = new BytePointer(pixGetData((PIX)this)).position(index).capacity(h * wpl * 4);
return data.asByteBuffer();
}

代码示例来源:origin: hoary/JavaAV

public MediaPacket[] encodeAudio(AudioFrame audioFrame) throws JavaAVException {
if (audioFormat == null)
throw new JavaAVException("Could not encode audio. No audio format specified.");
List packets = new ArrayList();
AudioFormat srcFormat = audioFrame.getAudioFormat();
AudioFrame[] frames;
// create re-sampler if sample formats does not match
if (!srcFormat.equals(audioFormat)) {
if (audioResampler == null) {
audioResampler = new AudioResampler();
audioResampler.open(srcFormat, audioFormat, avContext.frame_size());
}
frames = audioResampler.resample(audioFrame);
}
else {
frames = new AudioFrame[]{audioFrame};
}
for (AudioFrame frame : frames) {
avcodec_get_frame_defaults(avFrame);
for (int i = 0; i avFrame.data(i, frame.getPlane(i).position(0));
avFrame.linesize(i, frame.getPlane(i).limit());
}
avFrame.nb_samples(frame.getSampleCount());
avFrame.quality(avContext.global_quality());
MediaPacket mediaPacket = encodeAudioFrame(avFrame);
packets.add(mediaPacket);
}
return packets.toArray(new MediaPacket[0]);
}

代码示例来源:origin: org.bytedeco.javacpp-presets/tensorflow

/** Returns {@link #tensor_data()} wrapped in a {@link Buffer} of appropriate type starting at given index. */
public B createBuffer(long index) {
BytePointer ptr = tensor_data();
long size = TotalBytes();
switch (dtype()) {
case DT_COMPLEX64:
case DT_FLOAT: return (B)new FloatPointer(ptr).position(index).capacity(size/4).asBuffer();
case DT_DOUBLE: return (B)new DoublePointer(ptr).position(index).capacity(size/8).asBuffer();
case DT_QINT32:
case DT_INT32: return (B)new IntPointer(ptr).position(index).capacity(size/4).asBuffer();
case DT_BOOL:
case DT_QUINT8:
case DT_UINT8:
case DT_QINT8:
case DT_INT8: return (B)ptr.position(index).capacity(size).asBuffer();
case DT_BFLOAT16:
case DT_INT16: return (B)new ShortPointer(ptr).position(index).capacity(size/2).asBuffer();
case DT_INT64: return (B)new LongPointer(ptr).position(index).capacity(size/8).asBuffer();
case DT_STRING:
default: assert false;
}
return null;
}

推荐阅读
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • 标题: ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • 本文讨论了在VMWARE5.1的虚拟服务器Windows Server 2008R2上安装oracle 10g客户端时出现的问题,并提供了解决方法。错误日志显示了异常访问违例,通过分析日志中的问题帧,找到了解决问题的线索。文章详细介绍了解决方法,帮助读者顺利安装oracle 10g客户端。 ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • 流数据流和IO流的使用及应用
    本文介绍了流数据流和IO流的基本概念和用法,包括输入流、输出流、字节流、字符流、缓冲区等。同时还介绍了异常处理和常用的流类,如FileReader、FileWriter、FileInputStream、FileOutputStream、OutputStreamWriter、InputStreamReader、BufferedReader、BufferedWriter等。此外,还介绍了系统流和标准流的使用。 ... [详细]
  • 本文介绍了使用C++Builder实现获取USB优盘序列号的方法,包括相关的代码和说明。通过该方法,可以获取指定盘符的USB优盘序列号,并将其存放在缓冲中。该方法可以在Windows系统中有效地获取USB优盘序列号,并且适用于C++Builder开发环境。 ... [详细]
  • 本文整理了Java中org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc.getTypeInfo()方法的一些代码示例,展 ... [详细]
  • STM32 IO口模拟串口通讯
    转自:http:ziye334.blog.163.comblogstatic224306191201452833850647前阵子,调项目时需要用到低波 ... [详细]
author-avatar
被爱的李义9_556
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有