Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7a616f0 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12763142 from cf85dd5d to 25Q1-release

Change-Id: Idd8242d6508255c504f09f44b64cfb687942d1c4
parents 350eb0ff cf85dd5d
Loading
Loading
Loading
Loading
+68 −9
Original line number Original line Diff line number Diff line
@@ -1103,12 +1103,19 @@ camera_status_t ACameraCaptureSession_prepareWindow(
/**
/**
 * Request continuous streaming of a sequence of images for the shared capture session
 * Request continuous streaming of a sequence of images for the shared capture session
 * when more than one clients can open the same camera in shared mode by calling
 * when more than one clients can open the same camera in shared mode by calling
 * {@link ACameraManager_openSharedCamera}. In shared session, only primary clients can create
 * {@link ACameraManager_openSharedCamera}. In shared mode, the highest priority client among all
 * a capture request and change capture parameters. Secondary clients can only request streaming of
 * the clients will be the primary client while the others would be secondary clients. In shared
 * images by calling this api {@link ACameraCaptureSessionShared_startStreaming}. Calling this api
 * capture session, only primary clients can create a capture request and change capture parameters.
 * for normal sessions when {@link ACameraManager_openCamera} is used to open the camera will throw
 * Secondary clients can only request streaming of images by calling this api
 * {@link ACameraCaptureSessionShared_startStreaming}. Calling this api for normal sessions when
 * {@link ACameraManager_openCamera} is used to open the camera will throw
 * {@link ACAMERA_ERROR_INVALID_OPERATION}.
 * {@link ACAMERA_ERROR_INVALID_OPERATION}.
 *
 *
 * <p>The priority of client access is determined by considering two factors: its current process
 * state and its "out of memory" score. Clients operating in the background are assigned a lower
 * priority. In contrast, clients running in the foreground, along with system-level clients, are
 * given a higher priority.</p>
 *
 * <p>With this method, the camera device will continually capture images, cycling through the
 * <p>With this method, the camera device will continually capture images, cycling through the
 * settings in the list of {@link ACaptureRequest} specified by the primary client. If primary
 * settings in the list of {@link ACaptureRequest} specified by the primary client. If primary
 * client does not have ongoing repeating request, camera service will use a capture request with
 * client does not have ongoing repeating request, camera service will use a capture request with
@@ -1145,20 +1152,72 @@ camera_status_t ACameraCaptureSession_prepareWindow(
 *         </ul>
 *         </ul>
 */
 */
camera_status_t ACameraCaptureSessionShared_startStreaming(
camera_status_t ACameraCaptureSessionShared_startStreaming(
    ACameraCaptureSession* sharedSession, ACameraCaptureSession_captureCallbacksV2 *callbacks,
    ACameraCaptureSession* sharedSession,
    /*optional*/ACameraCaptureSession_captureCallbacksV2 *callbacks,
    int numOutputWindows, ANativeWindow **window,
    int numOutputWindows, ANativeWindow **window,
    int *captureSequenceId) __INTRODUCED_IN(36);
    /*optional*/int *captureSequenceId) __INTRODUCED_IN(36);


/**
/**
 * This has the same functionality as ACameraCaptureSessionShared_startStreaming, with added
 * This has the same functionality as ACameraCaptureSessionShared_startStreaming, with added
 * support for logical multi-camera where the capture callbacks supports result metadata for
 * support for logical multi-camera where the capture callbacks supports result metadata for
 * physical cameras.
 * physical cameras.
 *
 * Request continuous streaming of a sequence of images for the shared capture session
 * when more than one clients can open the same camera in shared mode by calling
 * {@link ACameraManager_openSharedCamera}. In shared mode, the highest priority client among all
 * the clients will be the primary client while the others would be secondary clients. In shared
 * capture session, only primary clients can create a capture request and change capture parameters.
 * Secondary clients can only request streaming of images by calling this api
 * {@link ACameraCaptureSessionShared_logicalCamera_startStreaming}. Calling this api for normal
 * sessions when {@link ACameraManager_openCamera} is used to open the camera will throw
 * {@link ACAMERA_ERROR_INVALID_OPERATION}.
 *
 * <p>The priority of client access is determined by considering two factors: its current process
 * state and its "out of memory" score. Clients operating in the background are assigned a lower
 * priority. In contrast, clients running in the foreground, along with system-level clients, are
 * given a higher priority.</p>
 *
 * <p>With this method, the camera device will continually capture images, cycling through the
 * settings in the list of {@link ACaptureRequest} specified by the primary client. If primary
 * client does not have ongoing repeating request, camera service will use a capture request with
 * default capture parameters for preview template.</p>
 *
 * <p>To stop the continuous streaming, call {@link ACameraCaptureSessionShared_stopStreaming}.</p>
 *
 * <p>Calling this method will replace an existing continuous streaming request.</p>
 *
 * @param sharedSession the shared capture session when camera is opened in
 *        shared mode.
 * @param callbacks the {@link ACameraCaptureSession_logicalCamera_captureCallbacksV2} to be
 *        associated with this capture sequence. No capture callback will be fired if callbacks
 *        is set to NULL.
 * @param numOutputWindows number of native windows to be used for streaming. Must be at least 1.
 * @param windows an array of {@link ANativeWindow} to be used for streaming. Length must be at
 *        least numOutputWindows.
 * @param captureSequenceId the capture sequence ID associated with this capture method invocation
 *        will be stored here if this argument is not NULL and the method call succeeds.
 *        When this argument is set to NULL, the capture sequence ID will not be returned.
 *
 * @return <ul>
 *         <li>{@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
 *             if it is not NULL.</li>
 *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or
 *             if numRequests < 1</li>
 *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
 *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
 *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
 *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
 *         </li>
 *         <li>{@link ACAMERA_ERROR_INVALID_OPERATION} if the session passed is not a shared
 *              session</li>
 *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for  some other reasons</li>
 *         </ul>
 */
 */
camera_status_t ACameraCaptureSessionShared_logicalCamera_startStreaming(
camera_status_t ACameraCaptureSessionShared_logicalCamera_startStreaming(
    ACameraCaptureSession* sharedSession,
    ACameraCaptureSession* sharedSession,
    ACameraCaptureSession_logicalCamera_captureCallbacksV2 *callbacks,
    /*optional*/ACameraCaptureSession_logicalCamera_captureCallbacksV2 *callbacks,
    int numOutputWindows, ANativeWindow **windows,
    int numOutputWindows, ANativeWindow **windows,
    int *captureSequenceId) __INTRODUCED_IN(36);
    /*optional*/int *captureSequenceId) __INTRODUCED_IN(36);


/**
/**
 * Cancel any ongoing streaming started by {@link ACameraCaptureSessionShared_startStreaming}.
 * Cancel any ongoing streaming started by {@link ACameraCaptureSessionShared_startStreaming}.
+18 −3
Original line number Original line Diff line number Diff line
@@ -299,6 +299,21 @@ camera_status_t ACameraManager_openCamera(
 * ACameraDevice**)} except that it opens the camera in shared mode so that more
 * ACameraDevice**)} except that it opens the camera in shared mode so that more
 * than one client can access the camera at the same time.
 * than one client can access the camera at the same time.
 *
 *
 * <p>When camera is opened in shared mode, the highest priority client among all the clients will
 * be the primary client while the others would be secondary clients. Primary clients can create
 * capture requests, modify any capture parameters and send them to the capture session for a
 * one-shot capture or as a repeating request.</p>
 *
 * <p>Secondary clients cannot create a capture request and modify any capture parameters. However,
 * they can start the camera streaming to desired surface targets using
 * {@link ACameraCaptureSessionShared_startStreaming}. Once the streaming has successfully started,
 * then they can stop the streaming using {@link ACameraCaptureSessionShared_stopStreaming}.</p>
 *
 * <p>The priority of client access is determined by considering two factors: its current process
 * state and its "out of memory" score. Clients operating in the background are assigned a lower
 * priority. In contrast, clients running in the foreground, along with system-level clients, are
 * given a higher priority.</p>
 *
 * <p>Processes need to have android.permission.SYSTEM_CAMERA in addition to
 * <p>Processes need to have android.permission.SYSTEM_CAMERA in addition to
 * android.permission.CAMERA in order to connect to this camera device in shared
 * android.permission.CAMERA in order to connect to this camera device in shared
 * mode.</p>
 * mode.</p>
@@ -308,7 +323,7 @@ camera_status_t ACameraManager_openCamera(
 * @param callback the {@link ACameraDevice_StateCallbacks} associated with the opened camera
 * @param callback the {@link ACameraDevice_StateCallbacks} associated with the opened camera
 *                 device.
 *                 device.
 * @param device the opened {@link ACameraDevice} will be filled here if the method call succeeds.
 * @param device the opened {@link ACameraDevice} will be filled here if the method call succeeds.
 * @param primaryClient will return as true if the client is primaryClient.
 * @param isPrimaryClient will return as true if the client is a primary client.
 *
 *
 * @return <ul>
 * @return <ul>
 *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
 *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
@@ -449,8 +464,8 @@ camera_status_t ACameraManager_unregisterExtendedAvailabilityCallback(
 *
 *
 * @return <ul>
 * @return <ul>
 *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
 *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
 *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any parameter is not
 *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if manager, cameraId, or isSharingSupported
 *         valid.</li>
 *                  is NULL, or cameraId does not match any camera devices connected.</li>
 *         </ul>
 *         </ul>
 */
 */
camera_status_t ACameraManager_isCameraDeviceSharingSupported(
camera_status_t ACameraManager_isCameraDeviceSharingSupported(
+27 −7
Original line number Original line Diff line number Diff line
@@ -1056,10 +1056,20 @@ c2_status_t C2SoftApvEnc::setEncodeArgs(oapv_frms_t* inputFrames, const C2Graphi
                                         input->width(), input->width(), input->width(),
                                         input->width(), input->width(), input->width(),
                                         input->width(), input->width(), input->height(),
                                         input->width(), input->width(), input->height(),
                                         CONV_FORMAT_I420);
                                         CONV_FORMAT_I420);
            } else if (IsYUV420(*input)) {
                return C2_BAD_VALUE;
            } else if (IsI420(*input)) {
            } else if (IsI420(*input)) {
                return C2_BAD_VALUE;
                uint8_t  *srcY  = (uint8_t*)input->data()[0];
                uint8_t  *srcU  = (uint8_t*)input->data()[1];
                uint8_t  *srcV  = (uint8_t*)input->data()[2];
                uint16_t *dstY  = (uint16_t*)inputFrames->frm[0].imgb->a[0];
                uint16_t *dstUV = (uint16_t*)inputFrames->frm[0].imgb->a[1];
                convertPlanar8ToP210(dstY, dstUV, srcY, srcU, srcV,
                                        layout.planes[C2PlanarLayout::PLANE_Y].rowInc,
                                        layout.planes[C2PlanarLayout::PLANE_U].rowInc,
                                        layout.planes[C2PlanarLayout::PLANE_V].rowInc,
                                        input->width(), input->width(),
                                        input->width(), input->height(),
                                        CONV_FORMAT_I420);

            } else {
            } else {
                ALOGE("Not supported color format. %d", mColorFormat);
                ALOGE("Not supported color format. %d", mColorFormat);
                return C2_BAD_VALUE;
                return C2_BAD_VALUE;
@@ -1317,10 +1327,6 @@ void C2SoftApvEnc::process(const std::unique_ptr<C2Work>& work,
        return;
        return;
    }
    }


    if (work->input.buffers.empty()) {
        return;
    }

    std::shared_ptr<C2GraphicView> view;
    std::shared_ptr<C2GraphicView> view;
    std::shared_ptr<C2Buffer> inputBuffer = nullptr;
    std::shared_ptr<C2Buffer> inputBuffer = nullptr;
    if (!work->input.buffers.empty()) {
    if (!work->input.buffers.empty()) {
@@ -1332,7 +1338,19 @@ void C2SoftApvEnc::process(const std::unique_ptr<C2Work>& work,
            work->workletsProcessed = 1u;
            work->workletsProcessed = 1u;
            return;
            return;
        }
        }
    } else {
        ALOGV("Empty input Buffer");
        uint32_t flags = 0;
        if (work->input.flags & C2FrameData::FLAG_END_OF_STREAM) {
            flags |= C2FrameData::FLAG_END_OF_STREAM;
        }
        work->worklets.front()->output.flags = (C2FrameData::flags_t)flags;
        work->worklets.front()->output.buffers.clear();
        work->worklets.front()->output.ordinal = work->input.ordinal;
        work->workletsProcessed = 1u;
        return;
    }
    }

    if (!inputBuffer) {
    if (!inputBuffer) {
        fillEmptyWork(work);
        fillEmptyWork(work);
        return;
        return;
@@ -1361,6 +1379,7 @@ void C2SoftApvEnc::process(const std::unique_ptr<C2Work>& work,


    error = setEncodeArgs(&mInputFrames, view.get(), workIndex);
    error = setEncodeArgs(&mInputFrames, view.get(), workIndex);
    if (error != C2_OK) {
    if (error != C2_OK) {
        ALOGE("setEncodeArgs has failed. err = %d", error);
        mSignalledError = true;
        mSignalledError = true;
        work->result = error;
        work->result = error;
        work->workletsProcessed = 1u;
        work->workletsProcessed = 1u;
@@ -1382,6 +1401,7 @@ void C2SoftApvEnc::process(const std::unique_ptr<C2Work>& work,
        int32_t status =
        int32_t status =
                oapve_encode(mEncoderId, &mInputFrames, mMetaId, bits.get(), &stat, &mReconFrames);
                oapve_encode(mEncoderId, &mInputFrames, mMetaId, bits.get(), &stat, &mReconFrames);
        if (status != C2_OK) {
        if (status != C2_OK) {
            ALOGE("oapve_encode has failed. err = %d", status);
            mSignalledError = true;
            mSignalledError = true;
            work->result = C2_CORRUPTED;
            work->result = C2_CORRUPTED;
            work->workletsProcessed = 1u;
            work->workletsProcessed = 1u;
+33 −0
Original line number Original line Diff line number Diff line
@@ -713,6 +713,39 @@ void convertSemiPlanar8ToP210(uint16_t *dstY, uint16_t *dstUV,
  }
  }
}
}


void convertPlanar8ToP210(uint16_t *dstY, uint16_t *dstUV,
                              const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
                              size_t srcYStride, size_t srcUStride, size_t srcVStride,
                              size_t dstYStride, size_t dstUVStride,
                              uint32_t width, uint32_t height,
                              CONV_FORMAT_T format) {
  if (format != CONV_FORMAT_I420) {
    ALOGE("No support for planar8 to P210. format is %d", format);
    return;
  }

  for (int32_t y = 0; y < height; ++y) {
    for (int32_t x = 0; x < width; ++x) {
      dstY[x] = ((uint16_t)((double)srcY[x] * 1023 / 255 + 0.5) << 6) & 0xFFC0;
    }
    dstY += dstYStride;
    srcY += srcYStride;
  }

  for (int32_t y = 0; y < height / 2; ++y) {
    for (int32_t x = 0; x < width / 2; ++x) {
      dstUV[x<<1] = dstUV[(x<<1) + dstUVStride] =
                ((uint16_t)((double)srcU[x] * 1023 / 255 + 0.5) << 6) & 0xFFC0;
      dstUV[(x<<1) + 1] = dstUV[(x<<1) + dstUVStride + 1] =
                ((uint16_t)((double)srcV[x] * 1023 / 255 + 0.5) << 6) & 0xFFC0;
    }
    dstUV += dstUVStride << 1;
    srcU += srcUStride;
    srcV += srcVStride;
  }
}


std::unique_ptr<C2Work> SimpleC2Component::WorkQueue::pop_front() {
std::unique_ptr<C2Work> SimpleC2Component::WorkQueue::pop_front() {
    std::unique_ptr<C2Work> work = std::move(mQueue.front().work);
    std::unique_ptr<C2Work> work = std::move(mQueue.front().work);
    mQueue.pop_front();
    mQueue.pop_front();
+6 −0
Original line number Original line Diff line number Diff line
@@ -111,6 +111,12 @@ void convertSemiPlanar8ToP210(uint16_t *dstY, uint16_t *dstUV,
                              size_t dstYStride, size_t dstUVStride,
                              size_t dstYStride, size_t dstUVStride,
                              uint32_t width, uint32_t height,
                              uint32_t width, uint32_t height,
                              CONV_FORMAT_T format);
                              CONV_FORMAT_T format);
void convertPlanar8ToP210(uint16_t *dstY, uint16_t *dstUV,
                              const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
                              size_t srcYStride, size_t srcUStride, size_t srcVStride,
                              size_t dstYStride, size_t dstUVStride,
                              uint32_t width, uint32_t height,
                              CONV_FORMAT_T format);


class SimpleC2Component
class SimpleC2Component
        : public C2Component, public std::enable_shared_from_this<SimpleC2Component> {
        : public C2Component, public std::enable_shared_from_this<SimpleC2Component> {
Loading